summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/dbus/GetForwarders31
-rw-r--r--contrib/dbus/INSTALL9
-rw-r--r--contrib/dbus/Makefile.9.3.2b120
-rw-r--r--contrib/dbus/Makefile.9.3.3rc220
-rw-r--r--contrib/dbus/README.DBUS259
-rwxr-xr-xcontrib/dbus/SetForwarders52
-rw-r--r--contrib/dbus/bind-9.3.2b1-dbus.patch713
-rw-r--r--contrib/dbus/bind-9.3.3rc2-dbus.patch778
-rw-r--r--contrib/dbus/dbus_mgr.c2458
-rw-r--r--contrib/dbus/dbus_mgr.h37
-rw-r--r--contrib/dbus/dbus_service.c1161
-rw-r--r--contrib/dbus/dbus_service.h287
-rw-r--r--contrib/dbus/named-dbus-system.conf20
-rw-r--r--contrib/dbus/named-dbus.service3
-rw-r--r--contrib/dlz/bin/dlzbdb/Makefile.in73
-rw-r--r--contrib/dlz/bin/dlzbdb/dlzbdb.c1273
-rw-r--r--contrib/dlz/config.dlz.in478
-rw-r--r--contrib/dlz/drivers/dlz_bdb_driver.c797
-rw-r--r--contrib/dlz/drivers/dlz_bdbhpt_driver.c860
-rw-r--r--contrib/dlz/drivers/dlz_drivers.c157
-rw-r--r--contrib/dlz/drivers/dlz_filesystem_driver.c1048
-rw-r--r--contrib/dlz/drivers/dlz_ldap_driver.c1339
-rw-r--r--contrib/dlz/drivers/dlz_mysql_driver.c1060
-rw-r--r--contrib/dlz/drivers/dlz_odbc_driver.c1568
-rw-r--r--contrib/dlz/drivers/dlz_postgres_driver.c1372
-rw-r--r--contrib/dlz/drivers/dlz_stub_driver.c331
-rw-r--r--contrib/dlz/drivers/include/dlz/dlz_bdb_driver.h45
-rw-r--r--contrib/dlz/drivers/include/dlz/dlz_bdbhpt_driver.h45
-rw-r--r--contrib/dlz/drivers/include/dlz/dlz_drivers.h30
-rw-r--r--contrib/dlz/drivers/include/dlz/dlz_filesystem_driver.h45
-rw-r--r--contrib/dlz/drivers/include/dlz/dlz_ldap_driver.h45
-rw-r--r--contrib/dlz/drivers/include/dlz/dlz_mysql_driver.h45
-rw-r--r--contrib/dlz/drivers/include/dlz/dlz_odbc_driver.h45
-rw-r--r--contrib/dlz/drivers/include/dlz/dlz_postgres_driver.h45
-rw-r--r--contrib/dlz/drivers/include/dlz/dlz_stub_driver.h45
-rw-r--r--contrib/dlz/drivers/include/dlz/sdlz_helper.h117
-rw-r--r--contrib/dlz/drivers/rules.in47
-rw-r--r--contrib/dlz/drivers/sdlz_helper.c531
-rw-r--r--contrib/dnssec-tools/README9
-rw-r--r--contrib/idn/idnkit-1.0-src/ChangeLog856
-rw-r--r--contrib/idn/idnkit-1.0-src/DISTFILES191
-rw-r--r--contrib/idn/idnkit-1.0-src/INSTALL309
-rw-r--r--contrib/idn/idnkit-1.0-src/INSTALL.ja310
-rw-r--r--contrib/idn/idnkit-1.0-src/LICENSE.txt39
-rw-r--r--contrib/idn/idnkit-1.0-src/Makefile.in79
-rw-r--r--contrib/idn/idnkit-1.0-src/NEWS186
-rw-r--r--contrib/idn/idnkit-1.0-src/README159
-rw-r--r--contrib/idn/idnkit-1.0-src/README.ja151
-rw-r--r--contrib/idn/idnkit-1.0-src/acconfig.h53
-rw-r--r--contrib/idn/idnkit-1.0-src/aclocal.m4472
-rwxr-xr-xcontrib/idn/idnkit-1.0-src/config.guess1317
-rwxr-xr-xcontrib/idn/idnkit-1.0-src/config.sub1411
-rwxr-xr-xcontrib/idn/idnkit-1.0-src/configure3517
-rw-r--r--contrib/idn/idnkit-1.0-src/configure.in711
-rw-r--r--contrib/idn/idnkit-1.0-src/include/Makefile.in65
-rw-r--r--contrib/idn/idnkit-1.0-src/include/config.h.in181
-rw-r--r--contrib/idn/idnkit-1.0-src/include/config.h.win45
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/Makefile.in103
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/aliaslist.h114
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/api.h298
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/assert.h61
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/checker.h171
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/converter.h258
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/debug.h69
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/delimitermap.h123
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/export.h58
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/filechecker.h136
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/filemapper.h137
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/localencoding.h79
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/log.h107
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/logmacro.h72
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/mapper.h159
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/mapselector.h165
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/nameprep.h185
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/normalizer.h155
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/punycode.h70
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/race.h72
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/res.h309
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/resconf.h323
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/result.h86
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/strhash.h123
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/ucs4.h103
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/ucsmap.h131
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/ucsset.h145
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/unicode.h164
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/unormalize.h86
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/utf8.h137
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/util.h98
-rw-r--r--contrib/idn/idnkit-1.0-src/include/idn/version.h70
-rw-r--r--contrib/idn/idnkit-1.0-src/include/mdn/Makefile.in83
-rw-r--r--contrib/idn/idnkit-1.0-src/include/mdn/api.h91
-rw-r--r--contrib/idn/idnkit-1.0-src/include/mdn/localencoding.h49
-rw-r--r--contrib/idn/idnkit-1.0-src/include/mdn/log.h92
-rw-r--r--contrib/idn/idnkit-1.0-src/include/mdn/res.h121
-rw-r--r--contrib/idn/idnkit-1.0-src/include/mdn/resconf.h150
-rw-r--r--contrib/idn/idnkit-1.0-src/include/mdn/result.h97
-rw-r--r--contrib/idn/idnkit-1.0-src/include/mdn/utf8.h70
-rw-r--r--contrib/idn/idnkit-1.0-src/include/mdn/version.h66
-rwxr-xr-xcontrib/idn/idnkit-1.0-src/install-sh250
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/Makefile.in309
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/aliaslist.c355
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/aliaslist.sh35
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/api.c257
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/checker.c446
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/converter.c1244
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/debug.c267
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/delimitermap.c268
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/filechecker.c261
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/filemapper.c347
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/idn.conf.sample.in61
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/localencoding.c123
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/log.c215
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/make.wnt279
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/mapper.c482
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/mapselector.c375
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/nameprep.c357
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/nameprep_template.c137
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/nameprepdata.c2546
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/normalizer.c439
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/punycode.c434
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/race.c427
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/res.c1726
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/resconf.c1477
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/result.c76
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/strhash.c283
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/Makefile.in304
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/api-init1.tsy113
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/api-init2.tsy113
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/api-init3.tsy117
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/api-init4-1.tsy96
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/api-init4-2.tsy96
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/api-init4-3.tsy102
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/api-init5-1.tsy102
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/api-init5-2.tsy102
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/api-init5-3.tsy109
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/api.tsy1009
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/checker.tsy610
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/codeset.h71
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/converter.tsy822
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/delimitermap.tsy257
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/iconvchk.c132
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/mapper.tsy497
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/mapselector.tsy592
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/nameprep.tsy340
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/normalizer.tsy346
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/res.tsy1026
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/resconf.tsy1026
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/setenv.c134
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/setenv.h61
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/testsuite.c578
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/testsuite.h276
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/testutil.c83
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/testutil.h71
-rwxr-xr-xcontrib/idn/idnkit-1.0-src/lib/tests/testygen557
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/tests/ucs4.tsy257
-rwxr-xr-xcontrib/idn/idnkit-1.0-src/lib/tests/utffilter82
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/ucs4.c461
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/ucsmap.c380
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/ucsset.c368
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/unicode.c309
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/unicode_template.c101
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/unicodedata_320.c7916
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/unormalize.c413
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/utf8.c276
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/util.c162
-rw-r--r--contrib/idn/idnkit-1.0-src/lib/version.c54
-rwxr-xr-xcontrib/idn/idnkit-1.0-src/ltconfig3114
-rw-r--r--contrib/idn/idnkit-1.0-src/ltmain.sh4024
-rw-r--r--contrib/idn/idnkit-1.0-src/make.wnt76
-rw-r--r--contrib/idn/idnkit-1.0-src/man/Makefile.in116
-rw-r--r--contrib/idn/idnkit-1.0-src/man/idn.conf.5.in312
-rw-r--r--contrib/idn/idnkit-1.0-src/man/libidnkit.3.in480
-rw-r--r--contrib/idn/idnkit-1.0-src/map/Makefile.in75
-rw-r--r--contrib/idn/idnkit-1.0-src/map/jp.map50
-rwxr-xr-xcontrib/idn/idnkit-1.0-src/mkinstalldirs40
-rw-r--r--contrib/idn/idnkit-1.0-src/patch/bind9/bind-9.2.1-patch5900
-rw-r--r--contrib/idn/idnkit-1.0-src/patch/bind9/bind-9.2.2-patch1169
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/Makefile.in65
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/idnconv/Makefile.in116
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/idnconv/idnconv.1373
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/idnconv/idnconv.c803
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/idnconv/idnslookup.in116
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/idnconv/make.wnt72
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/idnconv/selectiveencode.c127
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/idnconv/selectiveencode.h70
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/idnconv/util.c554
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/idnconv/util.h96
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/make.wnt57
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/rpm/idnkit.spec142
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/runidn/Makefile.in167
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/runidn/resolver.c1056
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/runidn/resolver.h70
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/runidn/runidn.1151
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/runidn/runidn.in109
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/runidn/stub.c387
-rw-r--r--contrib/idn/idnkit-1.0-src/tools/runidn/stub.h94
-rw-r--r--contrib/idn/idnkit-1.0-src/util/Makefile43
-rw-r--r--contrib/idn/idnkit-1.0-src/util/SparseMap.pm575
-rw-r--r--contrib/idn/idnkit-1.0-src/util/UCD.pm194
-rwxr-xr-xcontrib/idn/idnkit-1.0-src/util/generate_nameprep_data.pl405
-rwxr-xr-xcontrib/idn/idnkit-1.0-src/util/generate_normalize_data.pl586
-rw-r--r--contrib/idn/idnkit-1.0-src/win/README.WIN17
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/README.txt665
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/README_j.txt717
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/common/checkdll.c242
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/common/convert.c180
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/common/dump.c118
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/common/encoding.c271
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/common/hook.c224
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/common/make.wnt102
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/common/printf.c138
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/common/wrapcommon.h109
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/config/idnconf.tcl1123
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/config/make.wnt58
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/make.wnt97
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock11/dlldef.h86
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock11/dllfunc.c212
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock11/dllload.c63
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock11/dllmain.c96
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock11/dllstub.c1541
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock11/make.wnt98
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock11/wsock32.def87
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock20/dlldef.h123
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock20/dllfunc.c592
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock20/dllload.c62
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock20/dllmain.c94
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock20/dllstub.c2168
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock20/make.wnt97
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock20/ws2_32.def120
-rw-r--r--contrib/linux/coredump-patch12
-rw-r--r--contrib/named-bootconf/named-bootconf.sh314
-rw-r--r--contrib/nanny/nanny.pl55
-rw-r--r--contrib/nslint-2.1a3/CHANGES191
-rw-r--r--contrib/nslint-2.1a3/FILES24
-rw-r--r--contrib/nslint-2.1a3/INSTALL42
-rw-r--r--contrib/nslint-2.1a3/Makefile.in122
-rw-r--r--contrib/nslint-2.1a3/README14
-rw-r--r--contrib/nslint-2.1a3/VERSION1
-rw-r--r--contrib/nslint-2.1a3/aclocal.m4765
-rw-r--r--contrib/nslint-2.1a3/config.guess693
-rw-r--r--contrib/nslint-2.1a3/config.sub927
-rw-r--r--contrib/nslint-2.1a3/configure1905
-rw-r--r--contrib/nslint-2.1a3/configure.in47
-rw-r--r--contrib/nslint-2.1a3/install-sh250
-rw-r--r--contrib/nslint-2.1a3/lbl/gnuc.h43
-rw-r--r--contrib/nslint-2.1a3/lbl/os-irix5.h38
-rw-r--r--contrib/nslint-2.1a3/lbl/os-osf3.h32
-rw-r--r--contrib/nslint-2.1a3/lbl/os-solaris2.h50
-rw-r--r--contrib/nslint-2.1a3/lbl/os-sunos4.h215
-rw-r--r--contrib/nslint-2.1a3/lbl/os-ultrix4.h39
-rw-r--r--contrib/nslint-2.1a3/mkdep109
-rw-r--r--contrib/nslint-2.1a3/nslint.8451
-rw-r--r--contrib/nslint-2.1a3/nslint.c2382
-rw-r--r--contrib/nslint-2.1a3/savestr.c67
-rw-r--r--contrib/nslint-2.1a3/savestr.h24
-rw-r--r--contrib/nslint-2.1a3/strerror.c75
-rw-r--r--contrib/pkcs11-keygen/PEM_write_pubkey.c124
-rw-r--r--contrib/pkcs11-keygen/README18
-rw-r--r--contrib/pkcs11-keygen/destroyobj.c183
-rw-r--r--contrib/pkcs11-keygen/genkey.c206
-rwxr-xr-xcontrib/pkcs11-keygen/genkey.sh55
-rwxr-xr-xcontrib/pkcs11-keygen/keyconv.pl61
-rwxr-xr-xcontrib/pkcs11-keygen/keydump.pl26
-rw-r--r--contrib/pkcs11-keygen/listobjs.c197
-rw-r--r--contrib/pkcs11-keygen/openssl-0.9.8g-patch8715
-rw-r--r--contrib/pkcs11-keygen/readkey.c230
-rw-r--r--contrib/pkcs11-keygen/set_key_id.c159
-rw-r--r--contrib/pkcs11-keygen/writekey.c360
-rwxr-xr-xcontrib/pkcs11-keygen/writekey.sh73
-rw-r--r--contrib/query-loc-0.4.0/ADDRESSES16
-rw-r--r--contrib/query-loc-0.4.0/ALGO48
-rw-r--r--contrib/query-loc-0.4.0/INSTALL9
-rw-r--r--contrib/query-loc-0.4.0/Makefile.in42
-rw-r--r--contrib/query-loc-0.4.0/README21
-rw-r--r--contrib/query-loc-0.4.0/USAGE7
-rw-r--r--contrib/query-loc-0.4.0/config.h.in69
-rwxr-xr-xcontrib/query-loc-0.4.0/configure6436
-rw-r--r--contrib/query-loc-0.4.0/configure.in65
-rwxr-xr-xcontrib/query-loc-0.4.0/install-sh323
-rw-r--r--contrib/query-loc-0.4.0/loc.c590
-rw-r--r--contrib/query-loc-0.4.0/loc.h78
-rw-r--r--contrib/query-loc-0.4.0/loc_ntoa.c248
-rw-r--r--contrib/query-loc-0.4.0/query-loc.155
-rw-r--r--contrib/query-loc-0.4.0/query-loc.c98
-rwxr-xr-xcontrib/query-loc-0.4.0/reconf8
-rw-r--r--contrib/queryperf/Makefile.in28
-rw-r--r--contrib/queryperf/README82
-rw-r--r--contrib/queryperf/config.h.in37
-rwxr-xr-xcontrib/queryperf/configure4365
-rw-r--r--contrib/queryperf/configure.in70
-rw-r--r--contrib/queryperf/input/sample.06
-rw-r--r--contrib/queryperf/input/sample.113
-rw-r--r--contrib/queryperf/missing/addrinfo.h100
-rw-r--r--contrib/queryperf/missing/getaddrinfo.c632
-rw-r--r--contrib/queryperf/missing/getnameinfo.c226
-rw-r--r--contrib/queryperf/queryperf.c2113
-rw-r--r--contrib/queryperf/utils/gen-data-queryperf.py113
-rw-r--r--contrib/sdb/bdb/README37
-rw-r--r--contrib/sdb/bdb/bdb.c235
-rw-r--r--contrib/sdb/bdb/bdb.h31
-rw-r--r--contrib/sdb/bdb/zone2bdb.c187
-rw-r--r--contrib/sdb/dir/dirdb.c195
-rw-r--r--contrib/sdb/dir/dirdb.h25
-rw-r--r--contrib/sdb/ldap/INSTALL.ldap83
-rw-r--r--contrib/sdb/ldap/README.ldap48
-rw-r--r--contrib/sdb/ldap/README.zone2ldap17
-rw-r--r--contrib/sdb/ldap/ldapdb.c667
-rw-r--r--contrib/sdb/ldap/ldapdb.h6
-rw-r--r--contrib/sdb/ldap/zone2ldap.164
-rw-r--r--contrib/sdb/ldap/zone2ldap.c734
-rw-r--r--contrib/sdb/pgsql/pgsqldb.c348
-rw-r--r--contrib/sdb/pgsql/pgsqldb.h25
-rw-r--r--contrib/sdb/pgsql/zonetodb.c292
-rw-r--r--contrib/sdb/sqlite/README.sdb_sqlite67
-rw-r--r--contrib/sdb/sqlite/sqlitedb.c324
-rw-r--r--contrib/sdb/sqlite/sqlitedb.h25
-rw-r--r--contrib/sdb/sqlite/zone2sqlite.c301
-rw-r--r--contrib/sdb/tcl/lookup.tcl51
-rw-r--r--contrib/sdb/tcl/tcldb.c232
-rw-r--r--contrib/sdb/tcl/tcldb.h25
-rw-r--r--contrib/sdb/time/timedb.c143
-rw-r--r--contrib/sdb/time/timedb.h25
-rw-r--r--contrib/zkt/CHANGELOG446
-rw-r--r--contrib/zkt/LICENSE30
-rw-r--r--contrib/zkt/Makefile.in151
-rw-r--r--contrib/zkt/README44
-rw-r--r--contrib/zkt/README.logging99
-rw-r--r--contrib/zkt/TODO37
-rw-r--r--contrib/zkt/config.h.in217
-rw-r--r--contrib/zkt/config_zkt.h121
-rwxr-xr-xcontrib/zkt/configure6838
-rw-r--r--contrib/zkt/debug.h66
-rw-r--r--contrib/zkt/dki.c1185
-rw-r--r--contrib/zkt/dki.h185
-rw-r--r--contrib/zkt/dnssec-signer.8436
-rw-r--r--contrib/zkt/dnssec-signer.c1002
-rw-r--r--contrib/zkt/dnssec-zkt.8481
-rw-r--r--contrib/zkt/dnssec-zkt.c823
-rw-r--r--contrib/zkt/domaincmp.c190
-rw-r--r--contrib/zkt/domaincmp.h40
-rw-r--r--contrib/zkt/examples/dnskey.db24
-rwxr-xr-xcontrib/zkt/examples/dnssec-signer.sh12
-rwxr-xr-xcontrib/zkt/examples/dnssec-zkt.sh12
-rwxr-xr-xcontrib/zkt/examples/flat/dist.sh70
-rw-r--r--contrib/zkt/examples/flat/dnssec.conf41
-rw-r--r--contrib/zkt/examples/flat/dyn.example.net./Kdyn.example.net.+003+42138.key3
-rw-r--r--contrib/zkt/examples/flat/dyn.example.net./Kdyn.example.net.+003+42138.private7
-rw-r--r--contrib/zkt/examples/flat/dyn.example.net./Kdyn.example.net.+005+01355.key3
-rw-r--r--contrib/zkt/examples/flat/dyn.example.net./Kdyn.example.net.+005+01355.private10
-rw-r--r--contrib/zkt/examples/flat/dyn.example.net./dnskey.db29
-rw-r--r--contrib/zkt/examples/flat/dyn.example.net./dnssec.conf5
-rw-r--r--contrib/zkt/examples/flat/dyn.example.net./dsset-dyn.example.net.2
-rw-r--r--contrib/zkt/examples/flat/dyn.example.net./keyset-dyn.example.net.18
-rw-r--r--contrib/zkt/examples/flat/dyn.example.net./zone.db136
-rw-r--r--contrib/zkt/examples/flat/dyn.example.net./zone.db.dsigned136
-rw-r--r--contrib/zkt/examples/flat/dyn.example.net./zone.org30
-rw-r--r--contrib/zkt/examples/flat/example.net./Kexample.net.+005+01764.key3
-rw-r--r--contrib/zkt/examples/flat/example.net./Kexample.net.+005+01764.published10
-rw-r--r--contrib/zkt/examples/flat/example.net./Kexample.net.+005+41151.key3
-rw-r--r--contrib/zkt/examples/flat/example.net./Kexample.net.+005+41151.private10
-rw-r--r--contrib/zkt/examples/flat/example.net./Kexample.net.+005+41300.key3
-rw-r--r--contrib/zkt/examples/flat/example.net./Kexample.net.+005+41300.private10
-rw-r--r--contrib/zkt/examples/flat/example.net./dnskey.db33
-rw-r--r--contrib/zkt/examples/flat/example.net./dsset-example.net.4
-rw-r--r--contrib/zkt/examples/flat/example.net./kexample.net.+005+14829.key4
-rw-r--r--contrib/zkt/examples/flat/example.net./kexample.net.+005+14829.private10
-rw-r--r--contrib/zkt/examples/flat/example.net./keyset-example.net.19
-rw-r--r--contrib/zkt/examples/flat/example.net./zone.db43
-rw-r--r--contrib/zkt/examples/flat/example.net./zone.db.signed166
-rw-r--r--contrib/zkt/examples/flat/keysets/dlvset-sub.example.net.2
-rw-r--r--contrib/zkt/examples/flat/keysets/dsset-dyn.example.net.2
-rw-r--r--contrib/zkt/examples/flat/keysets/dsset-example.net.4
-rw-r--r--contrib/zkt/examples/flat/keysets/dsset-sub.example.net.2
-rw-r--r--contrib/zkt/examples/flat/keysets/keyset-dyn.example.net.18
-rw-r--r--contrib/zkt/examples/flat/keysets/keyset-example.net.19
-rw-r--r--contrib/zkt/examples/flat/keysets/keyset-sub.example.net.8
-rw-r--r--contrib/zkt/examples/flat/named.conf99
-rw-r--r--contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+001+04254.key3
-rw-r--r--contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+001+04254.private10
-rw-r--r--contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+001+56744.key3
-rw-r--r--contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+001+56744.published10
-rw-r--r--contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+005+54876.key1
-rw-r--r--contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+005+54876.private10
-rw-r--r--contrib/zkt/examples/flat/sub.example.net./dlvset-sub.example.net.2
-rw-r--r--contrib/zkt/examples/flat/sub.example.net./dnskey.db29
-rw-r--r--contrib/zkt/examples/flat/sub.example.net./dnssec.conf14
-rw-r--r--contrib/zkt/examples/flat/sub.example.net./zone.db25
-rw-r--r--contrib/zkt/examples/flat/sub.example.net./zone.db.signed103
-rw-r--r--contrib/zkt/examples/flat/zkt.log2501
-rw-r--r--contrib/zkt/examples/flat/zone.conf10
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+11867.key3
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+11867.published10
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+17439.key4
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+17439.private10
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+35672.key3
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+35672.private10
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+41145.key3
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+41145.private10
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+59244.key3
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+59244.published10
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./dnskey.db48
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./dsset-example.de.6
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./keyset-example.de.28
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./keyset-sub.example.de.8
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+19793.key3
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+19793.private10
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+51977.depreciated10
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+51977.key3
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+55699.key3
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+55699.published10
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+005+40998.key3
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+005+40998.private10
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./dlvset-sub.example.de.2
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./dnskey.db35
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./dnssec.conf17
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./dsset-sub.example.de.2
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./keyset-sub.example.de.8
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./zone.db25
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./zone.db.signed108
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./zone.db37
-rw-r--r--contrib/zkt/examples/hierarchical/de./example.de./zone.db.signed147
-rw-r--r--contrib/zkt/examples/hierarchical/de./keyset-example.de.28
-rw-r--r--contrib/zkt/examples/hierarchical/dnssec.conf40
-rw-r--r--contrib/zkt/examples/hierarchical/named.conf102
-rw-r--r--contrib/zkt/examples/hierarchical/zone.conf10
-rw-r--r--contrib/zkt/examples/views/dnssec-extern.conf39
-rw-r--r--contrib/zkt/examples/views/dnssec-intern.conf39
-rwxr-xr-xcontrib/zkt/examples/views/dnssec-signer-extern7
-rwxr-xr-xcontrib/zkt/examples/views/dnssec-signer-intern7
-rwxr-xr-xcontrib/zkt/examples/views/dnssec-zkt-extern7
-rwxr-xr-xcontrib/zkt/examples/views/dnssec-zkt-intern7
-rw-r--r--contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+10367.key3
-rw-r--r--contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+10367.published10
-rw-r--r--contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+23553.key1
-rw-r--r--contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+23553.private10
-rw-r--r--contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+35744.key4
-rw-r--r--contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+35744.private10
-rw-r--r--contrib/zkt/examples/views/extern/example.net./dnskey.db30
-rw-r--r--contrib/zkt/examples/views/extern/example.net./dsset-example.net.2
-rw-r--r--contrib/zkt/examples/views/extern/example.net./keyset-example.net.10
-rw-r--r--contrib/zkt/examples/views/extern/example.net./zone.db33
-rw-r--r--contrib/zkt/examples/views/extern/example.net./zone.db.signed109
-rw-r--r--contrib/zkt/examples/views/extern/zkt-ext.log28
-rw-r--r--contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+00126.key1
-rw-r--r--contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+00126.private10
-rw-r--r--contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+05972.key1
-rw-r--r--contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+05972.private10
-rw-r--r--contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+23375.key3
-rw-r--r--contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+23375.published10
-rw-r--r--contrib/zkt/examples/views/intern/example.net./dnskey.db30
-rw-r--r--contrib/zkt/examples/views/intern/example.net./dsset-example.net.2
-rw-r--r--contrib/zkt/examples/views/intern/example.net./keyset-example.net.10
-rw-r--r--contrib/zkt/examples/views/intern/example.net./zone.db33
-rw-r--r--contrib/zkt/examples/views/intern/example.net./zone.db.signed109
-rw-r--r--contrib/zkt/examples/views/intern/zkt-int.log169
-rw-r--r--contrib/zkt/examples/views/named.conf97
-rw-r--r--contrib/zkt/examples/views/named.log17
-rw-r--r--contrib/zkt/examples/views/root.hint45
-rwxr-xr-xcontrib/zkt/examples/views/viewtest.sh20
-rw-r--r--contrib/zkt/examples/zone.db45
-rw-r--r--contrib/zkt/examples/zone.db.signed146
-rw-r--r--contrib/zkt/log.c443
-rw-r--r--contrib/zkt/log.h66
-rw-r--r--contrib/zkt/misc.c1157
-rw-r--r--contrib/zkt/misc.h84
-rw-r--r--contrib/zkt/ncparse.c317
-rw-r--r--contrib/zkt/ncparse.h41
-rw-r--r--contrib/zkt/rollover.c615
-rw-r--r--contrib/zkt/rollover.h52
-rw-r--r--contrib/zkt/strlist.c166
-rw-r--r--contrib/zkt/strlist.h46
-rw-r--r--contrib/zkt/tags324
-rw-r--r--contrib/zkt/zconf.c775
-rw-r--r--contrib/zkt/zconf.h173
-rw-r--r--contrib/zkt/zkt-soaserial.c222
-rw-r--r--contrib/zkt/zkt.c354
-rw-r--r--contrib/zkt/zkt.h46
-rw-r--r--contrib/zkt/zone.c336
-rw-r--r--contrib/zkt/zone.h66
479 files changed, 160484 insertions, 0 deletions
diff --git a/contrib/dbus/GetForwarders b/contrib/dbus/GetForwarders
new file mode 100755
index 0000000..838706d
--- /dev/null
+++ b/contrib/dbus/GetForwarders
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# This script uses the named D-BUS support, which must be enabled in
+# the running named with the named '-D' option, to get and print the
+# list of forwarding zones in the running server.
+#
+# It accepts an optional <zone> first argument which is the DNS name
+# of the zone whose forwarders (if any) will be retrieved.
+#
+# If no zone argument is specified, all forwarding zones will be listed.
+#
+# Usage: GetForwarders [ <zone> ]
+#
+# Copyright(C) Jason Vas Dias<jvdias@redhat.com> Red Hat Inc. 2005
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation at
+# http://www.fsf.org/licensing/licenses/gpl.txt
+# and included in this software distribution as the "LICENSE" file.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+zone=''
+if [ $# -gt 0 ]; then
+ zone="string:$1";
+fi
+dbus-send --system --type=method_call --print-reply --reply-timeout=20000 --dest=com.redhat.named /com/redhat/named com.redhat.named.text.GetForwarders $zone;
diff --git a/contrib/dbus/INSTALL b/contrib/dbus/INSTALL
new file mode 100644
index 0000000..2ad526e
--- /dev/null
+++ b/contrib/dbus/INSTALL
@@ -0,0 +1,9 @@
+To build named with D-BUS support, run
+# make
+in this directory.
+Then cd to the top-level BIND source directory,
+(../..), and
+# ./configure ...; make
+After building, cd back to contrib/dbus and run:
+# make install
+as root to install the D-BUS configuration files.
diff --git a/contrib/dbus/Makefile.9.3.2b1 b/contrib/dbus/Makefile.9.3.2b1
new file mode 100644
index 0000000..6285034
--- /dev/null
+++ b/contrib/dbus/Makefile.9.3.2b1
@@ -0,0 +1,20 @@
+# contrib/dbus/Makefile
+#
+# This Makefile will install D-BUS support into the ISC BIND 9.3.2b1+ source,
+# necessary to support dynamic forwarding table management with D-BUS, for
+# Red Hat NetworkManager support.
+#
+# After running "make" in this directory, simply run make in the top level
+# BIND source directory, and D-BUS support will be enabled.
+#
+
+all:
+ echo 'Enabling D-BUS support...'
+ @ cp -fp dbus_mgr.c dbus_service.c ../../bin/named;
+ @ cp -fp dbus_mgr.h dbus_service.h ../../bin/named/include/named;
+ @ cp -fp README.DBUS ../../doc/misc
+ @ cd ../..; patch -s -p1 -b --suffix=.dbus < contrib/dbus/bind-9.3.2b1-dbus.patch
+
+install:
+ install -o root -g root -m 640 named-dbus-system.conf /etc/dbus-1/system.d/named.conf
+ install -o root -g root -m 640 named-dbus.service /usr/share/dbus-1/services/named.service
diff --git a/contrib/dbus/Makefile.9.3.3rc2 b/contrib/dbus/Makefile.9.3.3rc2
new file mode 100644
index 0000000..91a0ffe
--- /dev/null
+++ b/contrib/dbus/Makefile.9.3.3rc2
@@ -0,0 +1,20 @@
+# contrib/dbus/Makefile
+#
+# This Makefile will install D-BUS support into the ISC BIND 9.3.2b1+ source,
+# necessary to support dynamic forwarding table management with D-BUS, for
+# Red Hat NetworkManager support.
+#
+# After running "make" in this directory, simply run make in the top level
+# BIND source directory, and D-BUS support will be enabled.
+#
+
+all:
+ echo 'Enabling D-BUS support...'
+ @ cp -fp dbus_mgr.c dbus_service.c ../../bin/named;
+ @ cp -fp dbus_mgr.h dbus_service.h ../../bin/named/include/named;
+ @ cp -fp README.DBUS ../../doc/misc
+ @ cd ../..; patch -s -p1 -b --suffix=.dbus < contrib/dbus/bind-9.3.3rc2-dbus.patch
+
+install:
+ install -o root -g root -m 640 named-dbus-system.conf /etc/dbus-1/system.d/named.conf
+ install -o root -g root -m 640 named-dbus.service /usr/share/dbus-1/services/named.service
diff --git a/contrib/dbus/README.DBUS b/contrib/dbus/README.DBUS
new file mode 100644
index 0000000..8c5c73f
--- /dev/null
+++ b/contrib/dbus/README.DBUS
@@ -0,0 +1,259 @@
+Dynamic Management of the ISC BIND named Forwarding Table with D-BUS
+
+ Jason Vas Dias<jvdias@redhat.com>, Red Hat Inc., May 2005
+
+
+Overview:
+
+ Red Hat has developed an extension to named that is enabled during
+ rpmbuild of the bind SRPM with the option --define 'WITH_DBUS=1',
+ and at named runtime with the -D named option.
+
+ You can obtain the latest version of the source code for the BIND
+ D-BUS extensions from:
+
+ http://people.redhat.com/~jvdias/bind-dbus/
+
+ The Red Hat BIND D-BUS extensions allow services such as Red Hat's
+ NetworkManager and dhcdbd (the DHCP Client controller D-Bus daemon)
+ to tell named which name servers to forward requests to dynamically,
+ instead of only with the "forward" and "forwarders" named.conf options.
+
+ Dynamic forwarding table management allows named to be an effective
+ and efficient caching nameserver for configurations with multiple
+ wireless or VPN IP interfaces that are not always active, and whose
+ name service parameters are typically configured with DHCP.
+
+ Problems with trying to configure such systems automatically using
+ only the libc resolver, causing conflicts over the contents of the
+ /etc/resolv.conf file, are avoided; the resolv.conf file can contain
+ only the users chosen search path and the single "nameserver 127.0.0.1"
+ entry.
+
+ named also provides a much more efficient, both in terms of caching
+ performance and resolving time, and much more feature rich DNS resolver
+ than does the libc resolver library and nscd, and has the benefit of
+ existing improved IPv6 and DNSSEC support over glibc and nscd.
+
+Operation Guide for Developers:
+
+ Programs can access named's dynamic forward table management services
+ using D-BUS, the "service messagebus" sysv-init service that is started
+ by default at boot (see the D-BUS documentation for details).
+
+ When named is started with the -D option (by adding -D to the $OPTIONS
+ variable in /etc/sysconfig/named), named provides two D-BUS methods:
+
+ These D-BUS names are common to all named D-BUS methods:
+ D-BUS Destination D-BUS Path D-BUS interface
+ ~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~~~~~~
+ com.redhat.named /com/redhat/named com.redhat.named
+
+ D-BUS Members:
+ ~~~~~~~~~~~~~~
+
+ SetForwarders ( { [ string:<domain name>,
+ ~~~~~~~~~~~~~ [ ( uint32:<nameserver IPv4 address>
+ | array of 4 bytes : <nameserver IPv4 address>
+ | array of 16 bytes : <nameserver IPv6 address>
+ | string: <nameserver dotted-quad IPv4 or RFC2374 IPv6 address>
+ )
+ [ uint16: <nameserver port>, ]
+ [ uint8: <forward policy> ]
+ ]
+ ]
+ } , ...
+ )
+
+ SetForwarders will create or delete members of the forwarding table.
+
+ It accepts a list of tuples of up to 4 members: only the <domain name>
+ is required.
+
+ If ONLY the <domain name> is specified, the forwarding entry for
+ EXACTLY that domain name is deleted if it exists.
+
+ Only a specification of at least one <nameserver IP address> is required to
+ create a forwarding entry.
+
+ The IP address can be IPv4:
+ ( 32-bit integer OR array of 4 bytes OR dotted-quad string )
+ Or IPv6:
+ ( array of 16 bytes
+ OR RFC 2373/4 ascii string of 8 ':' separate hex quads as supported by inet_pton(3)
+ )
+
+ 32 and 16-bit integer parameters MUST be given in network byte order; ie the IPv4 address
+ 192.168.2.1 would be specified as uint32:16951488 on an i386 and port 53 would be uint16:13568.
+
+ There are an optional <port> 16-bit integer parameter, to specify the name server socket
+ address port associated with the preceding IP address, and a <forward policy>
+ parameter, which sets the forward policy as follows:
+ 0: "none" : never forward to this nameserver for this domain.
+ 1: "first": forward first to this server, and then search its authoritative data.
+ 2: "only" : always forward to this nameserver for this domain.
+
+ If not specified, <port> will have the value 53, and <forward policy> will be "2": "only".
+ named's default forward policy is "first" .
+
+ Creation of forwarding domains is not "exact", as is deletion, but is "inclusive":
+ creating forwarding entry for the '.' domain sets the default set of nameservers named
+ will query for ALL domains, and creating an entry for "redhat.com" creates a set of
+ nameservers to be queried for all names suffixed by "redhat.com." . If both are specified,
+ the "redhat.com" servers will be tried first, followed by the "." servers.
+
+ Forwarding entries are ONLY created in the first DNS View that matches the "localhost" client
+ (127.0.0.1) and destination. The default view, which exists if no views have been specified
+ in named.conf, matches ALL clients and destinations. If the user has configured views, none
+ of which match the localhost client, then no forwarding will be dynamically configurable.
+ Users are also free to configure a view that matches the localhost, for which forwarding
+ will be dynamically configurable, and other views which do not match the localhost, so that
+ other, remote clients can be served that will not be subject to dynamic forwarding. So it
+ is a fully supported configuration that users can serve authoritative data to external
+ clients and still use named's forwarding features for their localhost resolver.
+
+ SetForwarders returns uint32:0 on success or a DBUS_ERROR message on failure .
+
+
+ GetForwarders ( [ string:<domain name> ] )
+ ~~~~~~~~~~~~~
+ Using the default "com.redhat.named" interface, returns the EXACT forwarding entry for
+ <domain name> as binary D-BUS types; there is also a com.redhat.named.text interface
+ supported by GetForwarders which returns all values as string: text .
+
+ If a <domain name> is not specified, all forwarding table entries are dumped.
+
+
+ Examples:
+ ~~~~~~~~
+
+ Suppose we start out with the named.conf configuration:
+
+
+ options { ...
+ forwarders { 172.16.80.118; };
+ ...
+ };
+
+ zone "redhat.com" {
+ forward only;
+ forwarders { 172.16.76.10; 172.16.52.28; };
+ };
+
+ Using a "dbus-send" trivially modified to support uint16 parameters (!) :
+
+ $ dbus-send --system --type=method_call --print-reply --reply-timeout=20000 \
+ --dest=com.redhat.named /com/redhat/named com.redhat.named.GetForwarders
+ method return sender=:1.367 -> dest=:1.368
+ 0 string "redhat.com"
+ 1 byte 2
+ 2 uint32 172757164
+ 3 uint16 13568
+ 4 uint32 473174188
+ 5 uint16 13568
+ 6 string "."
+ 7 byte 1
+ 8 uint32 1984958636
+ 9 uint16 13568
+
+ ie. GetForwarders always returns a list of tuples of
+ ( <domain name>, <forward policy>, <ip address>, <port> )
+
+ If the "text" interface was specified:
+
+ $ dbus-send --system --type=method_call --print-reply --reply-timeout=20000 \
+ --dest=com.redhat.named /com/redhat/named com.redhat.named.text.GetForwarders
+ method return sender=:1.367 -> dest=:1.370
+ 0 string "redhat.com"
+ 1 string "only"
+ 2 string "172.16.76.10"
+ 3 string "53"
+ 4 string "172.16.52.28"
+ 5 string "53"
+ 6 string "."
+ 7 string "first"
+ 8 string "172.16.80.118"
+ 9 string "53"
+
+ So we could set the default nameserver for the root zone as follows:
+
+ $ dbus-send --system --type=method_call --print-reply --reply-timeout=20000 \
+ --dest=com.redhat.named /com/redhat/named com.redhat.named.SetForwarders \
+ string:'.' string:'192.33.14.30' string:'2001:503:231d::2:30'
+ method return sender=:1.367 -> dest=:1.371
+ 0 uint32 0
+ $ dbus-send --system --type=method_call --print-reply --reply-timeout=20000 \
+ --dest=com.redhat.named /com/redhat/named com.redhat.named.text.GetForwarders
+ method return sender=:1.367 -> dest=:1.372
+ 0 string "redhat.com"
+ 1 string "only"
+ 2 string "172.16.76.10"
+ 3 string "53"
+ 4 string "172.16.52.28"
+ 5 string "53"
+ 6 string "."
+ 7 string "only"
+ 8 string "192.33.14.30"
+ 9 string "53"
+ 10 string "2001:503:231d::2:30"
+ 11 string "53"
+
+ Using tcpdump one can verify that named will attempt to contact 192.33.14.30, then
+ 2001:503:231d::2:30, for all zones not in redhat.com; for redhat.com zones, 172.16.76.10
+ and 192.33.14.30 will be tried in that order.
+
+ If the D-BUS driver dbus-daemon should shut down, named will emit the syslog message:
+ "D-BUS service disabled."
+ And will retry connecting to D-BUS every 10 seconds - once it has connected, the message:
+ "D-BUS service enabled."
+ will be logged.
+
+ NOTE: there are the "SetForwarders" and "GetForwarders" scripts in the contrib/dbus directory
+ of the BIND source code distribution which are wrappers around the dbus-send commands above.
+ Usage: SetForwarders [ -t first | only ] <zone> [ <server> [...<server>] ]
+ GetForwarders [ <zone> ]
+
+
+ DHCP Integration
+ ~~~~~~~~~~~~~~~~
+
+ With the -D option, named will try to subscribe to dhcdbd, the DHCP Client D-BUS Daemon, to
+ be notified of DHCP "reason", "domain-name", "domain-name-server", "ip-address", and "subnet-mask"
+ DHCP options when the dhclient program has received them from a DHCP server .
+
+ If it cannot subscribe to dhcdbd, named will emit the message :
+ "D-BUS dhcdbd subscription disabled."
+ and will monitor D-BUS "NameOwnerChanged" messages for the appearance of a new owner
+ for "com.redhat.dhcp". When the name is owned, named will send a "com.redhat.dhcp.subscribe.binary"
+ message to dhcdbd to subscribe to the above options for all interfaces (provided by dhcdbd-1.5+),
+ and emit the log message:
+ "D-BUS dhcdbd subscription enabled."
+
+ named will match on signals from the com.redhat.dhcp.subscribe.binary interface for those option
+ settings, and , when the last option is received (indicated by a "reason" of 15: END_OPTIONS), it
+ will configure the forwarding table .
+
+ For each whitespace separated member of "domain-name-servers", AND for the reverse IPv4 in-addr.arpa
+ class C or less domain of the ip-address masked by the subnet-mask, it will create a forwarding entry
+ to query each "domain-server" .
+
+ To support CIDR-based reverse subnet forwarding, Views would have to be configured dynamically, a
+ possible future direction which is not yet implemented. (It would perhaps be easier to add a
+ "match-queries" ACL to the forwarders table).
+
+ When dhclient acquires a lease, named will configure forwarding, and emit the message:
+ "D-BUS: dhclient for interface eth0 acquired new lease - creating forwarders."
+
+ When a lease expires or the interface is brought down (dhclient is stopped with dhcdbd), it
+ will revert any forwarding entries from the initial, static configuration that were modified
+ by the DHCP subscription to their initial values; ie. if redhat.com had a forwarder configured
+ in named.conf, and then an DHCP session specified forwarders for redhat.com, when the DHCP
+ session ends the forwarders for redhat.com are reverted to their named.conf values; thus
+ when all DHCP interfaces have released their leases, and if no SetForwarders commands were issued,
+ the forwarding configuration will be identical to that at named startup.
+
+
+ To Do:
+ - Sending signals when any Forwarding entry is changed (easy to implement if it would be desirable).
+ - CIDR based reverse Forwarding
+
diff --git a/contrib/dbus/SetForwarders b/contrib/dbus/SetForwarders
new file mode 100755
index 0000000..8ee4ce1
--- /dev/null
+++ b/contrib/dbus/SetForwarders
@@ -0,0 +1,52 @@
+#!/bin/bash
+#
+# This script uses the named D-BUS support, which must be enabled in
+# the running named with the named '-D' option, to set the forwarding zones
+# in the running server.
+#
+# One zone argument is required, followed by any number of server IP (v4 or v6)
+# addresses. If the server IP address list is empty, any forwarders for the zone
+# will be removed.
+#
+# Usage:
+# SetForwarders [ -t <'first' | 'only'> ] <zone> [ <server IP> [...<server IP>] ]
+#
+# Copyright(C) Jason Vas Dias<jvdias@redhat.com> Red Hat Inc. 2005
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation at
+# http://www.fsf.org/licensing/licenses/gpl.txt
+# and included in this software distribution as the "LICENSE" file.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+usage() { echo "Usage: SetForwarders [ -t <'first' | 'only'> ] <zone> [ <server> [...<server>] ]"; }
+type=''
+if [ $# -eq 0 ]; then
+ usage;
+ exit 1;
+elif [ "$1" = "-t" ]; then
+ if [ $# -lt 2 ]; then
+ echo '-t option requires an argument.'
+ exit 1;
+ fi;
+ type=$2;
+ shift 2;
+fi;
+if [ $# -lt 1 ]; then
+ echo '<zone> first argument required.'
+ exit 1;
+fi;
+zone='string:'"$1";
+shift;
+servers='';
+if [ $# -gt 0 ]; then
+ for svr in $*; do
+ servers="$servers string:$svr";
+ done
+fi;
+dbus-send --system --type=method_call --print-reply --reply-timeout=20000 --dest=com.redhat.named /com/redhat/named com.redhat.named.text.SetForwarders $zone $type $servers;
diff --git a/contrib/dbus/bind-9.3.2b1-dbus.patch b/contrib/dbus/bind-9.3.2b1-dbus.patch
new file mode 100644
index 0000000..cdf50d6
--- /dev/null
+++ b/contrib/dbus/bind-9.3.2b1-dbus.patch
@@ -0,0 +1,713 @@
+--- bind-9.3.2b1/lib/dns/rbt.c.dbus 2005-06-17 21:03:24.000000000 -0400
++++ bind-9.3.2b1/lib/dns/rbt.c 2005-10-07 12:43:26.000000000 -0400
+@@ -2172,6 +2172,47 @@
+ dns_rbt_printtree(rbt->root, NULL, 0);
+ }
+
++static void
++dns_rbt_traverse_tree(dns_rbtnode_t *root, dns_rbt_traverse_callback_t cb, void *cb_arg1, void *cb_arg2 ) {
++/*
++ * This is used ONLY to traverse the forward table by dbus_mgr at the moment.
++ * Since the forward table is not likely to be large, this can be recursive.
++ */
++ dns_name_t name;
++ dns_offsets_t offsets;
++ char buf[DNS_NAME_MAXWIRE];
++ isc_buffer_t buffer;
++
++ if (root != NULL) {
++
++ if (DOWN(root))
++ dns_rbt_traverse_tree(DOWN(root), cb, cb_arg1, cb_arg2);
++
++ if( LEFT(root) != NULL )
++ dns_rbt_traverse_tree(LEFT(root), cb, cb_arg1, cb_arg2);
++
++ if( RIGHT(root) != NULL )
++ dns_rbt_traverse_tree(RIGHT(root), cb, cb_arg1, cb_arg2);
++
++ if( DATA(root) == 0L )
++ return;
++
++ dns_name_init(&name, offsets);
++ isc_buffer_init(&buffer, buf, DNS_NAME_MAXWIRE);
++ dns_name_setbuffer( &name, &buffer);
++ dns_rbt_fullnamefromnode(root, &name);
++
++ (*cb)(&name, DATA(root), cb_arg1, cb_arg2);
++ }
++}
++
++void dns_rbt_traverse( dns_rbt_t *rbt, dns_rbt_traverse_callback_t cb, void *cb_arg1, void *cb_arg2 )
++{
++ REQUIRE(VALID_RBT(rbt));
++
++ dns_rbt_traverse_tree( rbt->root, cb, cb_arg1, cb_arg2 );
++}
++
+ /*
+ * Chain Functions
+ */
+--- bind-9.3.2b1/lib/dns/forward.c.dbus 2005-03-16 22:58:30.000000000 -0500
++++ bind-9.3.2b1/lib/dns/forward.c 2005-10-07 12:43:26.000000000 -0400
+@@ -200,3 +200,89 @@
+ }
+ isc_mem_put(fwdtable->mctx, forwarders, sizeof(dns_forwarders_t));
+ }
++
++/***
++ *** new D-BUS Dynamic Forwarding Zones functions:
++ ***/
++isc_result_t
++dns_fwdtable_delete(dns_fwdtable_t *fwdtable, dns_name_t *name )
++{
++ isc_result_t result;
++
++ REQUIRE(VALID_FWDTABLE(fwdtable));
++
++ RWLOCK(&fwdtable->rwlock, isc_rwlocktype_write);
++
++ result = dns_rbt_deletename(fwdtable->table, name, ISC_FALSE);
++
++ RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_write);
++
++ return (result);
++}
++
++isc_result_t
++dns_fwdtable_find_closest(dns_fwdtable_t *fwdtable,
++ dns_name_t *name,
++ dns_name_t *foundname,
++ dns_forwarders_t **forwardersp)
++{
++ isc_result_t result;
++
++ REQUIRE(VALID_FWDTABLE(fwdtable));
++
++ RWLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
++
++ result = dns_rbt_findname(fwdtable->table, name, 0, foundname,
++ (void **)forwardersp);
++
++ if(result == DNS_R_PARTIALMATCH)
++ result = ISC_R_SUCCESS;
++
++ RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
++
++ return (result);
++}
++
++isc_result_t
++dns_fwdtable_find_exact(dns_fwdtable_t *fwdtable, dns_name_t *name,
++ dns_forwarders_t **forwardersp)
++{
++ isc_result_t result;
++
++ REQUIRE(VALID_FWDTABLE(fwdtable));
++
++ REQUIRE(forwardersp != 0L);
++
++ RWLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
++
++ result = dns_rbt_findname(fwdtable->table, name, 0, NULL,
++ (void **)forwardersp);
++
++ if( result != ISC_R_SUCCESS )
++ *forwardersp = 0L;
++
++ RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
++
++ return (result);
++}
++
++static
++void dns_fwdtable_traverse
++(
++ dns_name_t *name,
++ void *node_data,
++ void *cbp,
++ void *cb_arg
++)
++{
++ dns_fwdtable_callback_t cb = (dns_fwdtable_callback_t) cbp;
++
++ (*cb)( name, node_data, cb_arg);
++}
++
++void dns_fwdtable_foreach(dns_fwdtable_t *fwdtable, dns_fwdtable_callback_t cb, void *cb_arg )
++{
++ REQUIRE(VALID_FWDTABLE(fwdtable));
++
++ dns_rbt_traverse( fwdtable->table, dns_fwdtable_traverse, cb, cb_arg );
++}
+--- bind-9.3.2b1/lib/dns/include/dns/forward.h.dbus 2005-03-16 22:58:31.000000000 -0500
++++ bind-9.3.2b1/lib/dns/include/dns/forward.h 2005-10-07 12:43:26.000000000 -0400
+@@ -98,6 +98,37 @@
+ * all memory associated with the forwarding table is freed.
+ */
+
++
++/* These are ONLY used by dbus_mgr :
++ */
++
++isc_result_t
++dns_fwdtable_delete( dns_fwdtable_t *fwdtable, dns_name_t *name );
++/*
++ * Removes an entry from the forwarding table.
++ */
++
++isc_result_t
++dns_fwdtable_find_exact(dns_fwdtable_t *fwdtable, dns_name_t *name,
++ dns_forwarders_t **forwardersp);
++/*
++ * Finds an exact match for "name" in the forwarding table.
++ */
++
++isc_result_t
++dns_fwdtable_find_closest(dns_fwdtable_t *fwdtable, dns_name_t *name, dns_name_t *foundname,
++ dns_forwarders_t **forwardersp);
++/*
++ * Finds the closest match for "*name" in the forwarding table, returning
++ * the actual name matching in *name if different to *name passed in.
++ */
++
++typedef void (*dns_fwdtable_callback_t)( dns_name_t *, dns_forwarders_t *, void *);
++void dns_fwdtable_foreach(dns_fwdtable_t *fwdtable, dns_fwdtable_callback_t cb, void * );
++/* Invoke cb for each member of fwdtable
++ */
++
++
+ ISC_LANG_ENDDECLS
+
+ #endif /* DNS_FORWARD_H */
+--- bind-9.3.2b1/lib/dns/include/dns/rbt.h.dbus 2004-10-11 01:55:51.000000000 -0400
++++ bind-9.3.2b1/lib/dns/include/dns/rbt.h 2005-10-07 12:43:26.000000000 -0400
+@@ -833,6 +833,17 @@
+ * <something_else> Any error result from dns_name_concatenate.
+ */
+
++
++typedef void (*dns_rbt_traverse_callback_t)( dns_name_t *name,
++ void *node_data,
++ void *cb_arg1,
++ void *cb_arg2);
++
++void dns_rbt_traverse( dns_rbt_t *rbt, dns_rbt_traverse_callback_t cb, void *cb_arg1, void *cb_arg2 );
++/* tree traversal function (only used by D-BUS dynamic forwarding dbus_mgr at
++ * the moment)
++ */
++
+ ISC_LANG_ENDDECLS
+
+ #endif /* DNS_RBT_H */
+--- bind-9.3.2b1/lib/isc/unix/socket.c.dbus 2005-08-25 00:32:55.000000000 -0400
++++ bind-9.3.2b1/lib/isc/unix/socket.c 2005-10-07 13:40:03.000000000 -0400
+@@ -148,6 +148,11 @@
+ ISC_LIST(isc_socketevent_t) recv_list;
+ ISC_LIST(isc_socket_newconnev_t) accept_list;
+ isc_socket_connev_t *connect_ev;
++
++ /* these are used only by isc_sockettype_fd sockets:*/
++ isc_socketevent_t *read_ready_event;
++ isc_socketevent_t *write_ready_event;
++ isc_socketevent_t *selected_event;
+
+ /*
+ * Internal events. Posted when a descriptor is readable or
+@@ -304,7 +309,7 @@
+
+ static void
+ wakeup_socket(isc_socketmgr_t *manager, int fd, int msg) {
+- isc_socket_t *sock;
++ isc_socket_t *sock=0L;
+
+ /*
+ * This is a wakeup on a socket. If the socket is not in the
+@@ -1266,6 +1271,9 @@
+ sock->connected = 0;
+ sock->connecting = 0;
+ sock->bound = 0;
++ sock->read_ready_event = 0L;
++ sock->write_ready_event = 0L;
++ sock->selected_event = 0L;
+
+ /*
+ * initialize the lock
+@@ -1378,13 +1386,16 @@
+ case isc_sockettype_tcp:
+ sock->fd = socket(pf, SOCK_STREAM, IPPROTO_TCP);
+ break;
++
++ case isc_sockettype_fd:
++ sock->fd = pf;
+ }
+
+ #ifdef F_DUPFD
+ /*
+ * Leave a space for stdio to work in.
+ */
+- if (sock->fd >= 0 && sock->fd < 20) {
++ if ( (type != isc_sockettype_fd) && (sock->fd >= 0) && (sock->fd < 20) ) {
+ int new, tmp;
+ new = fcntl(sock->fd, F_DUPFD, 20);
+ tmp = errno;
+@@ -1438,7 +1449,7 @@
+ }
+ }
+
+- if (make_nonblock(sock->fd) != ISC_R_SUCCESS) {
++ if ((type != isc_sockettype_fd) && (make_nonblock(sock->fd) != ISC_R_SUCCESS)) {
+ (void)close(sock->fd);
+ free_socket(&sock);
+ return (ISC_R_UNEXPECTED);
+@@ -1706,6 +1717,38 @@
+ isc_task_send(ev->ev_sender, (isc_event_t **)&iev);
+ }
+
++static
++isc_event_t *dispatch_read_ready(isc_socketmgr_t *manager, isc_socket_t *sock)
++{
++ isc_event_t *dev = (isc_event_t*)sock->read_ready_event, *ev;
++
++ ev = isc_mem_get(manager->mctx, dev->ev_size);
++ memcpy(ev,dev,dev->ev_size);
++ ISC_LINK_INIT(ev,ev_link);
++ isc_task_send(dev->ev_sender, &ev );
++ return (isc_event_t *)sock->selected_event;
++}
++
++static
++isc_event_t *dispatch_write_ready(isc_socketmgr_t *manager,isc_socket_t *sock)
++{
++ isc_event_t *dev = (isc_event_t*)sock->write_ready_event, *ev;
++ ev = isc_mem_get(manager->mctx, dev->ev_size);
++ memcpy(ev,dev,dev->ev_size);
++ ISC_LINK_INIT(ev,ev_link);
++ isc_task_send(dev->ev_sender, &ev );
++ return (isc_event_t *)sock->selected_event;
++}
++
++static
++void dispatch_selected(isc_socketmgr_t *manager, isc_event_t *dev)
++{ isc_event_t *ev;
++ ev = isc_mem_get(manager->mctx, dev->ev_size);
++ memcpy(ev,dev,dev->ev_size);
++ ISC_LINK_INIT(ev,ev_link);
++ isc_task_send(dev->ev_sender, &ev );
++}
++
+ /*
+ * Dequeue an item off the given socket's read queue, set the result code
+ * in the done event to the one provided, and send it to the task it was
+@@ -2113,6 +2156,7 @@
+ int i;
+ isc_socket_t *sock;
+ isc_boolean_t unlock_sock;
++ isc_event_t *sock_selected = 0L;
+
+ REQUIRE(maxfd <= (int)FD_SETSIZE);
+
+@@ -2146,11 +2190,15 @@
+ unlock_sock = ISC_TRUE;
+ LOCK(&sock->lock);
+ if (!SOCK_DEAD(sock)) {
++ if( sock->type != isc_sockettype_fd )
++ {
+ if (sock->listener)
+ dispatch_accept(sock);
+ else
+ dispatch_recv(sock);
+- }
++ }else
++ sock_selected = dispatch_read_ready(manager,sock);
++ }
+ FD_CLR(i, &manager->read_fds);
+ }
+ check_write:
+@@ -2164,16 +2212,24 @@
+ LOCK(&sock->lock);
+ }
+ if (!SOCK_DEAD(sock)) {
++ if( sock->type != isc_sockettype_fd )
++ {
+ if (sock->connecting)
+ dispatch_connect(sock);
+ else
+ dispatch_send(sock);
++ }else
++ sock_selected = dispatch_write_ready(manager,sock);
+ }
+ FD_CLR(i, &manager->write_fds);
+ }
+ if (unlock_sock)
+ UNLOCK(&sock->lock);
+ }
++ if( sock_selected != 0L )
++ {
++ dispatch_selected(manager, sock_selected);
++ }
+ }
+
+ #ifdef ISC_PLATFORM_USETHREADS
+@@ -2192,7 +2248,7 @@
+ int cc;
+ fd_set readfds;
+ fd_set writefds;
+- int msg, fd;
++ int msg, fd = -1;
+ int maxfd;
+ char strbuf[ISC_STRERRORSIZE];
+
+@@ -3523,3 +3579,55 @@
+ return (ISC_R_SUCCESS);
+ }
+ #endif /* ISC_PLATFORM_USETHREADS */
++
++isc_socketevent_t*
++isc_socket_fd_handle_reads( isc_socket_t *sock, isc_socketevent_t *dev )
++{
++ REQUIRE(VALID_SOCKET(sock));
++ if(dev != 0L)
++ {
++ sock->references=1;
++ sock->read_ready_event = dev;
++ select_poke(sock->manager, sock->fd, SELECT_POKE_READ);
++ }else
++ {
++ dev = sock->read_ready_event ;
++ sock->read_ready_event = 0L ;
++ }
++ return dev;
++}
++
++isc_socketevent_t*
++isc_socket_fd_handle_writes( isc_socket_t *sock, isc_socketevent_t *dev )
++{
++ REQUIRE(VALID_SOCKET(sock));
++ if(dev != 0L)
++ {
++ sock->references=1;
++ sock->write_ready_event = dev;
++ select_poke(sock->manager, sock->fd, SELECT_POKE_WRITE);
++ }else
++ {
++ dev = sock->write_ready_event;
++ sock->write_ready_event = 0L;
++ }
++ return dev;
++}
++
++isc_socketevent_t*
++isc_socket_fd_handle_selected( isc_socket_t *sock, isc_socketevent_t *dev )
++{
++ REQUIRE(VALID_SOCKET(sock));
++ if(dev != 0L)
++ {
++ sock->references=1;
++ sock->selected_event = dev;
++ }else
++ {
++ dev = sock->selected_event;
++ sock->selected_event = 0L;
++ sock->references=0;
++ destroy(&sock);
++ }
++ return dev;
++}
+--- bind-9.3.2b1/lib/isc/include/isc/socket.h.dbus 2004-03-08 04:04:53.000000000 -0500
++++ bind-9.3.2b1/lib/isc/include/isc/socket.h 2005-10-07 12:43:26.000000000 -0400
+@@ -136,6 +136,10 @@
+ #define ISC_SOCKEVENT_NEWCONN (ISC_EVENTCLASS_SOCKET + 3)
+ #define ISC_SOCKEVENT_CONNECT (ISC_EVENTCLASS_SOCKET + 4)
+
++#define ISC_SOCKEVENT_READ_READY (ISC_EVENTCLASS_SOCKET + 5)
++#define ISC_SOCKEVENT_WRITE_READY (ISC_EVENTCLASS_SOCKET + 6)
++#define ISC_SOCKEVENT_SELECTED (ISC_EVENTCLASS_SOCKET + 7)
++
+ /*
+ * Internal events.
+ */
+@@ -144,7 +148,8 @@
+
+ typedef enum {
+ isc_sockettype_udp = 1,
+- isc_sockettype_tcp = 2
++ isc_sockettype_tcp = 2,
++ isc_sockettype_fd = 8
+ } isc_sockettype_t;
+
+ /*
+@@ -699,6 +704,30 @@
+ * 'sock' is a valid socket.
+ */
+
++isc_socketevent_t*
++isc_socket_fd_handle_reads( isc_socket_t *sock, isc_socketevent_t *dev );
++/* register the "dev" event to be sent when the isc_sockettype_fd sock
++ * was select()-ed for read. If there is already an event registered, it
++ * is returned, otherwise 0 is returned. If dev is 0, removes any existing
++ * registered event.
++ */
++
++isc_socketevent_t*
++isc_socket_fd_handle_writes( isc_socket_t *sock, isc_socketevent_t *dev );
++/* register the "dev" event to be sent when the isc_sockettype_fd sock
++ * was select()-ed for write. If there is already an event registered, it
++ * is returned, otherwise 0 is returned. If dev is 0, removes any existing
++ * registered event.
++ */
++
++isc_socketevent_t*
++isc_socket_fd_handle_selected( isc_socket_t *sock, isc_socketevent_t *dev );
++/* register the "dev" event to be sent when ALL isc_sockettype_fd sockets
++ * have been select()-ed . If there is already an event registered, it
++ * is returned, otherwise 0 is returned. If dev is 0, removes any existing
++ * registered event.
++ */
++
+ ISC_LANG_ENDDECLS
+
+ #endif /* ISC_SOCKET_H */
+--- bind-9.3.2b1/bin/named/log.c.dbus 2005-05-24 19:58:17.000000000 -0400
++++ bind-9.3.2b1/bin/named/log.c 2005-10-07 12:43:26.000000000 -0400
+@@ -41,6 +41,7 @@
+ { "queries", 0 },
+ { "unmatched", 0 },
+ { "update-security", 0 },
++ { "dbus", 0 },
+ { NULL, 0 }
+ };
+
+@@ -60,6 +61,7 @@
+ { "notify", 0 },
+ { "control", 0 },
+ { "lwresd", 0 },
++ { "dbus", 0 },
+ { NULL, 0 }
+ };
+
+--- bind-9.3.2b1/bin/named/Makefile.in.dbus 2004-09-06 17:47:25.000000000 -0400
++++ bind-9.3.2b1/bin/named/Makefile.in 2005-10-07 13:44:22.000000000 -0400
+@@ -35,7 +35,9 @@
+ ${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
+ ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
+ ${DBDRIVER_INCLUDES}
+-
++DBUS_ARCHDEP_LIBDIR ?= lib
++DBUS_INCLUDES = \
++ -I/usr/${DBUS_ARCHDEP_LIBDIR}/dbus-1.0/include -I/usr/include/dbus-1.0
+ CDEFINES =
+ CWARNINGS =
+
+@@ -52,6 +54,7 @@
+ ISCDEPLIBS = ../../lib/isc/libisc.@A@
+ LWRESDEPLIBS = ../../lib/lwres/liblwres.@A@
+ BIND9DEPLIBS = ../../lib/bind9/libbind9.@A@
++DBUSLIBS= -ldbus-1
+
+ DEPLIBS = ${LWRESDEPLIBS} ${DNSDEPLIBS} ${BIND9DEPLIBS} \
+ ${ISCCFGDEPLIBS} ${ISCCCDEPLIBS} ${ISCDEPLIBS}
+@@ -71,6 +74,7 @@
+ zoneconf.@O@ \
+ lwaddr.@O@ lwresd.@O@ lwdclient.@O@ lwderror.@O@ lwdgabn.@O@ \
+ lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ \
++ dbus_service.@O@ dbus_mgr.@O@ \
+ $(DBDRIVER_OBJS)
+
+ UOBJS = unix/os.@O@
+@@ -83,6 +87,7 @@
+ zoneconf.c \
+ lwaddr.c lwresd.c lwdclient.c lwderror.c lwdgabn.c \
+ lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c \
++ dbus_service.c dbus_mgr.c \
+ $(DBDRIVER_SRCS)
+
+ MANPAGES = named.8 lwresd.8 named.conf.5
+@@ -105,9 +110,14 @@
+ -DNS_LOCALSTATEDIR=\"${localstatedir}\" \
+ -c ${srcdir}/config.c
+
++dbus_service.@O@: dbus_service.c
++ ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \
++ ${DBUS_INCLUDES} \
++ -c ${srcdir}/dbus_service.c
++
+ named@EXEEXT@: ${OBJS} ${UOBJS} ${DEPLIBS}
+ ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
+- ${OBJS} ${UOBJS} ${LIBS}
++ ${OBJS} ${UOBJS} ${LIBS} ${DBUSLIBS}
+
+ lwresd@EXEEXT@: named@EXEEXT@
+ rm -f lwresd@EXEEXT@
+--- bind-9.3.2b1/bin/named/named.8.dbus 2005-05-12 22:43:20.000000000 -0400
++++ bind-9.3.2b1/bin/named/named.8 2005-10-07 13:50:12.000000000 -0400
+@@ -41,7 +41,7 @@
+ named \- Internet domain name server
+ .SH "SYNOPSIS"
+ .HP 6
+-\fBnamed\fR [\fB\-4\fR] [\fB\-6\fR] [\fB\-c\ \fIconfig\-file\fR\fR] [\fB\-d\ \fIdebug\-level\fR\fR] [\fB\-f\fR] [\fB\-g\fR] [\fB\-n\ \fI#cpus\fR\fR] [\fB\-p\ \fIport\fR\fR] [\fB\-s\fR] [\fB\-t\ \fIdirectory\fR\fR] [\fB\-u\ \fIuser\fR\fR] [\fB\-v\fR] [\fB\-x\ \fIcache\-file\fR\fR]
++\fBnamed\fR [\fB\-4\fR] [\fB\-6\fR] [\fB\-c\ \fIconfig\-file\fR\fR] [\fB\-d\ \fIdebug\-level\fR\fR] [\fB\-f\fR] [\fB\-g\fR] [\fB\-n\ \fI#cpus\fR\fR] [\fB\-p\ \fIport\fR\fR] [\fB\-s\fR] [\fB\-t\ \fIdirectory\fR\fR] [\fB\-u\ \fIuser\fR\fR] [\fB\-v\fR] [\fB\-x\ \fIcache\-file\fR\fR] [\fB\-D\fR]
+ .SH "DESCRIPTION"
+ .PP
+ \fBnamed\fR is a Domain Name System (DNS) server, part of the BIND 9 distribution from ISC\&. For more information on the DNS, see RFCs 1033, 1034, and 1035\&.
+@@ -103,6 +103,13 @@
+ .B "Warning:"
+ This option must not be used\&. It is only of interest to BIND 9 developers and may be removed or changed in a future release\&.
+ .RE
++.sp
++.TP
++\fB\-D\fR
++Enable dynamic management of the forwarding table with D-BUS
++messages. This option is required for Red Hat NetworkManager
++support. See doc/README.DBUS .
++.sp
+ .SH "SIGNALS"
+ .PP
+ In routine operation, signals should not be used to control the nameserver; \fBrndc\fR should be used instead\&.
+@@ -117,6 +124,7 @@
+ .SH "CONFIGURATION"
+ .PP
+ The \fBnamed\fR configuration file is too complex to describe in detail here\&. A complete description is provided in the BIND 9 Administrator Reference Manual\&.
++.PP
+ .SH "FILES"
+ .TP
+ \fI/etc/named\&.conf\fR
+--- bind-9.3.2b1/bin/named/main.c.dbus 2005-04-28 21:04:47.000000000 -0400
++++ bind-9.3.2b1/bin/named/main.c 2005-10-07 12:43:26.000000000 -0400
+@@ -239,7 +239,8 @@
+ "usage: named [-4|-6] [-c conffile] [-d debuglevel] "
+ "[-f|-g] [-n number_of_cpus]\n"
+ " [-p port] [-s] [-t chrootdir] [-u username]\n"
+- " [-m {usage|trace|record}]\n");
++ " [-m {usage|trace|record}]\n"
++ " [-D ]\n");
+ }
+
+ static void
+@@ -345,7 +346,7 @@
+
+ isc_commandline_errprint = ISC_FALSE;
+ while ((ch = isc_commandline_parse(argc, argv,
+- "46c:C:d:fgi:lm:n:N:p:P:st:u:vx:")) != -1) {
++ "46c:C:d:fgi:lm:n:N:p:P:st:u:vx:D")) != -1) {
+ switch (ch) {
+ case '4':
+ if (disable4)
+@@ -434,6 +435,9 @@
+ case 'v':
+ printf("BIND %s\n", ns_g_version);
+ exit(0);
++ case 'D':
++ ns_g_dbus = 1;
++ break;
+ case '?':
+ usage();
+ ns_main_earlyfatal("unknown option '-%c'",
+--- bind-9.3.2b1/bin/named/server.c.dbus 2005-07-26 22:53:15.000000000 -0400
++++ bind-9.3.2b1/bin/named/server.c 2005-10-07 12:43:26.000000000 -0400
+@@ -86,6 +86,8 @@
+ #include <stdlib.h>
+ #endif
+
++#include <named/dbus_mgr.h>
++
+ /*
+ * Check an operation for failure. Assumes that the function
+ * using it has a 'result' variable and a 'cleanup' label.
+@@ -1496,12 +1498,12 @@
+ if (result != ISC_R_SUCCESS) {
+ char namebuf[DNS_NAME_FORMATSIZE];
+ dns_name_format(origin, namebuf, sizeof(namebuf));
+- cfg_obj_log(forwarders, ns_g_lctx, ISC_LOG_WARNING,
+- "could not set up forwarding for domain '%s': %s",
++ cfg_obj_log(forwarders, ns_g_lctx, ISC_LOG_NOTICE,
++ "setting up forwarding failed for domain '%s': %s",
+ namebuf, isc_result_totext(result));
+ goto cleanup;
+ }
+-
++
+ result = ISC_R_SUCCESS;
+
+ cleanup:
+@@ -2873,6 +2875,20 @@
+
+ CHECKFATAL(load_zones(server, ISC_FALSE), "loading zones");
+
++ server->dbus_mgr = 0L;
++ if( ns_g_dbus )
++ if( dbus_mgr_create
++ ( ns_g_mctx, ns_g_taskmgr, ns_g_socketmgr, ns_g_timermgr,
++ &server->dbus_mgr
++ ) != ISC_R_SUCCESS
++ )
++ {
++ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
++ NS_LOGMODULE_SERVER, ISC_LOG_WARNING,
++ "dbus_mgr initialization failed. D-BUS service is disabled."
++ );
++ }
++
+ ns_os_started();
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
+ ISC_LOG_NOTICE, "running");
+@@ -2935,6 +2951,9 @@
+
+ dns_db_detach(&server->in_roothints);
+
++ if( server->dbus_mgr != 0L )
++ dbus_mgr_shutdown(server->dbus_mgr);
++
+ isc_task_endexclusive(server->task);
+
+ isc_task_detach(&server->task);
+--- bind-9.3.2b1/bin/named/include/named/globals.h.dbus 2004-03-07 23:04:20.000000000 -0500
++++ bind-9.3.2b1/bin/named/include/named/globals.h 2005-10-07 13:47:36.000000000 -0400
+@@ -112,6 +112,8 @@
+
+ EXTERN int ns_g_listen INIT(3);
+
++EXTERN int ns_g_dbus INIT(0);
++
+ #undef EXTERN
+ #undef INIT
+
+--- bind-9.3.2b1/bin/named/include/named/server.h.dbus 2004-03-07 23:04:21.000000000 -0500
++++ bind-9.3.2b1/bin/named/include/named/server.h 2005-10-07 12:43:26.000000000 -0400
+@@ -91,7 +91,8 @@
+ ns_controls_t * controls; /* Control channels */
+ unsigned int dispatchgen;
+ ns_dispatchlist_t dispatches;
+-
++
++ ns_dbus_mgr_t * dbus_mgr;
+ };
+
+ #define NS_SERVER_MAGIC ISC_MAGIC('S','V','E','R')
+--- bind-9.3.2b1/bin/named/include/named/log.h.dbus 2004-03-07 23:04:21.000000000 -0500
++++ bind-9.3.2b1/bin/named/include/named/log.h 2005-10-07 12:43:26.000000000 -0400
+@@ -34,6 +34,7 @@
+ #define NS_LOGCATEGORY_QUERIES (&ns_g_categories[4])
+ #define NS_LOGCATEGORY_UNMATCHED (&ns_g_categories[5])
+ #define NS_LOGCATEGORY_UPDATE_SECURITY (&ns_g_categories[6])
++#define NS_LOGCATEGORY_DBUS (&ns_g_categories[7])
+
+ /*
+ * Backwards compatibility.
+@@ -51,6 +52,7 @@
+ #define NS_LOGMODULE_NOTIFY (&ns_g_modules[8])
+ #define NS_LOGMODULE_CONTROL (&ns_g_modules[9])
+ #define NS_LOGMODULE_LWRESD (&ns_g_modules[10])
++#define NS_LOGMODULE_DBUS (&ns_g_modules[11])
+
+ isc_result_t
+ ns_log_init(isc_boolean_t safe);
+--- bind-9.3.2b1/bin/named/include/named/types.h.dbus 2004-03-06 05:21:26.000000000 -0500
++++ bind-9.3.2b1/bin/named/include/named/types.h 2005-10-07 12:43:26.000000000 -0400
+@@ -38,4 +38,6 @@
+ typedef struct ns_dispatch ns_dispatch_t;
+ typedef ISC_LIST(ns_dispatch_t) ns_dispatchlist_t;
+
++typedef struct ns_dbus_mgr ns_dbus_mgr_t ;
++
+ #endif /* NAMED_TYPES_H */
diff --git a/contrib/dbus/bind-9.3.3rc2-dbus.patch b/contrib/dbus/bind-9.3.3rc2-dbus.patch
new file mode 100644
index 0000000..9048db7
--- /dev/null
+++ b/contrib/dbus/bind-9.3.3rc2-dbus.patch
@@ -0,0 +1,778 @@
+--- bind-9.3.3rc2/lib/dns/forward.c.dbus 2005-03-17 04:58:30.000000000 +0100
++++ bind-9.3.3rc2/lib/dns/forward.c 2006-09-18 10:08:37.000000000 +0200
+@@ -200,3 +200,89 @@
+ }
+ isc_mem_put(fwdtable->mctx, forwarders, sizeof(dns_forwarders_t));
+ }
++
++/***
++ *** new D-BUS Dynamic Forwarding Zones functions:
++ ***/
++isc_result_t
++dns_fwdtable_delete(dns_fwdtable_t *fwdtable, dns_name_t *name )
++{
++ isc_result_t result;
++
++ REQUIRE(VALID_FWDTABLE(fwdtable));
++
++ RWLOCK(&fwdtable->rwlock, isc_rwlocktype_write);
++
++ result = dns_rbt_deletename(fwdtable->table, name, ISC_FALSE);
++
++ RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_write);
++
++ return (result);
++}
++
++isc_result_t
++dns_fwdtable_find_closest(dns_fwdtable_t *fwdtable,
++ dns_name_t *name,
++ dns_name_t *foundname,
++ dns_forwarders_t **forwardersp)
++{
++ isc_result_t result;
++
++ REQUIRE(VALID_FWDTABLE(fwdtable));
++
++ RWLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
++
++ result = dns_rbt_findname(fwdtable->table, name, 0, foundname,
++ (void **)forwardersp);
++
++ if(result == DNS_R_PARTIALMATCH)
++ result = ISC_R_SUCCESS;
++
++ RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
++
++ return (result);
++}
++
++isc_result_t
++dns_fwdtable_find_exact(dns_fwdtable_t *fwdtable, dns_name_t *name,
++ dns_forwarders_t **forwardersp)
++{
++ isc_result_t result;
++
++ REQUIRE(VALID_FWDTABLE(fwdtable));
++
++ REQUIRE(forwardersp != 0L);
++
++ RWLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
++
++ result = dns_rbt_findname(fwdtable->table, name, 0, NULL,
++ (void **)forwardersp);
++
++ if( result != ISC_R_SUCCESS )
++ *forwardersp = 0L;
++
++ RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
++
++ return (result);
++}
++
++static
++void dns_fwdtable_traverse
++(
++ dns_name_t *name,
++ void *node_data,
++ void *cbp,
++ void *cb_arg
++)
++{
++ dns_fwdtable_callback_t cb = (dns_fwdtable_callback_t) cbp;
++
++ (*cb)( name, node_data, cb_arg);
++}
++
++void dns_fwdtable_foreach(dns_fwdtable_t *fwdtable, dns_fwdtable_callback_t cb, void *cb_arg )
++{
++ REQUIRE(VALID_FWDTABLE(fwdtable));
++
++ dns_rbt_traverse( fwdtable->table, dns_fwdtable_traverse, cb, cb_arg );
++}
+--- bind-9.3.3rc2/lib/dns/include/dns/forward.h.dbus 2005-03-17 04:58:31.000000000 +0100
++++ bind-9.3.3rc2/lib/dns/include/dns/forward.h 2006-09-18 10:08:37.000000000 +0200
+@@ -98,6 +98,37 @@
+ * all memory associated with the forwarding table is freed.
+ */
+
++
++/* These are ONLY used by dbus_mgr :
++ */
++
++isc_result_t
++dns_fwdtable_delete( dns_fwdtable_t *fwdtable, dns_name_t *name );
++/*
++ * Removes an entry from the forwarding table.
++ */
++
++isc_result_t
++dns_fwdtable_find_exact(dns_fwdtable_t *fwdtable, dns_name_t *name,
++ dns_forwarders_t **forwardersp);
++/*
++ * Finds an exact match for "name" in the forwarding table.
++ */
++
++isc_result_t
++dns_fwdtable_find_closest(dns_fwdtable_t *fwdtable, dns_name_t *name, dns_name_t *foundname,
++ dns_forwarders_t **forwardersp);
++/*
++ * Finds the closest match for "*name" in the forwarding table, returning
++ * the actual name matching in *name if different to *name passed in.
++ */
++
++typedef void (*dns_fwdtable_callback_t)( dns_name_t *, dns_forwarders_t *, void *);
++void dns_fwdtable_foreach(dns_fwdtable_t *fwdtable, dns_fwdtable_callback_t cb, void * );
++/* Invoke cb for each member of fwdtable
++ */
++
++
+ ISC_LANG_ENDDECLS
+
+ #endif /* DNS_FORWARD_H */
+--- bind-9.3.3rc2/lib/dns/include/dns/rbt.h.dbus 2004-10-11 07:55:51.000000000 +0200
++++ bind-9.3.3rc2/lib/dns/include/dns/rbt.h 2006-09-18 10:08:37.000000000 +0200
+@@ -833,6 +833,17 @@
+ * <something_else> Any error result from dns_name_concatenate.
+ */
+
++
++typedef void (*dns_rbt_traverse_callback_t)( dns_name_t *name,
++ void *node_data,
++ void *cb_arg1,
++ void *cb_arg2);
++
++void dns_rbt_traverse( dns_rbt_t *rbt, dns_rbt_traverse_callback_t cb, void *cb_arg1, void *cb_arg2 );
++/* tree traversal function (only used by D-BUS dynamic forwarding dbus_mgr at
++ * the moment)
++ */
++
+ ISC_LANG_ENDDECLS
+
+ #endif /* DNS_RBT_H */
+--- bind-9.3.3rc2/lib/dns/rbt.c.dbus 2005-06-18 03:03:24.000000000 +0200
++++ bind-9.3.3rc2/lib/dns/rbt.c 2006-09-18 10:08:37.000000000 +0200
+@@ -2172,6 +2172,47 @@
+ dns_rbt_printtree(rbt->root, NULL, 0);
+ }
+
++static void
++dns_rbt_traverse_tree(dns_rbtnode_t *root, dns_rbt_traverse_callback_t cb, void *cb_arg1, void *cb_arg2 ) {
++/*
++ * This is used ONLY to traverse the forward table by dbus_mgr at the moment.
++ * Since the forward table is not likely to be large, this can be recursive.
++ */
++ dns_name_t name;
++ dns_offsets_t offsets;
++ char buf[DNS_NAME_MAXWIRE];
++ isc_buffer_t buffer;
++
++ if (root != NULL) {
++
++ if (DOWN(root))
++ dns_rbt_traverse_tree(DOWN(root), cb, cb_arg1, cb_arg2);
++
++ if( LEFT(root) != NULL )
++ dns_rbt_traverse_tree(LEFT(root), cb, cb_arg1, cb_arg2);
++
++ if( RIGHT(root) != NULL )
++ dns_rbt_traverse_tree(RIGHT(root), cb, cb_arg1, cb_arg2);
++
++ if( DATA(root) == 0L )
++ return;
++
++ dns_name_init(&name, offsets);
++ isc_buffer_init(&buffer, buf, DNS_NAME_MAXWIRE);
++ dns_name_setbuffer( &name, &buffer);
++ dns_rbt_fullnamefromnode(root, &name);
++
++ (*cb)(&name, DATA(root), cb_arg1, cb_arg2);
++ }
++}
++
++void dns_rbt_traverse( dns_rbt_t *rbt, dns_rbt_traverse_callback_t cb, void *cb_arg1, void *cb_arg2 )
++{
++ REQUIRE(VALID_RBT(rbt));
++
++ dns_rbt_traverse_tree( rbt->root, cb, cb_arg1, cb_arg2 );
++}
++
+ /*
+ * Chain Functions
+ */
+--- bind-9.3.3rc2/lib/isc/include/isc/socket.h.dbus 2004-03-08 10:04:53.000000000 +0100
++++ bind-9.3.3rc2/lib/isc/include/isc/socket.h 2006-09-18 10:08:37.000000000 +0200
+@@ -136,6 +136,10 @@
+ #define ISC_SOCKEVENT_NEWCONN (ISC_EVENTCLASS_SOCKET + 3)
+ #define ISC_SOCKEVENT_CONNECT (ISC_EVENTCLASS_SOCKET + 4)
+
++#define ISC_SOCKEVENT_READ_READY (ISC_EVENTCLASS_SOCKET + 5)
++#define ISC_SOCKEVENT_WRITE_READY (ISC_EVENTCLASS_SOCKET + 6)
++#define ISC_SOCKEVENT_SELECTED (ISC_EVENTCLASS_SOCKET + 7)
++
+ /*
+ * Internal events.
+ */
+@@ -144,7 +148,8 @@
+
+ typedef enum {
+ isc_sockettype_udp = 1,
+- isc_sockettype_tcp = 2
++ isc_sockettype_tcp = 2,
++ isc_sockettype_fd = 8
+ } isc_sockettype_t;
+
+ /*
+@@ -699,6 +704,30 @@
+ * 'sock' is a valid socket.
+ */
+
++isc_socketevent_t*
++isc_socket_fd_handle_reads( isc_socket_t *sock, isc_socketevent_t *dev );
++/* register the "dev" event to be sent when the isc_sockettype_fd sock
++ * was select()-ed for read. If there is already an event registered, it
++ * is returned, otherwise 0 is returned. If dev is 0, removes any existing
++ * registered event.
++ */
++
++isc_socketevent_t*
++isc_socket_fd_handle_writes( isc_socket_t *sock, isc_socketevent_t *dev );
++/* register the "dev" event to be sent when the isc_sockettype_fd sock
++ * was select()-ed for write. If there is already an event registered, it
++ * is returned, otherwise 0 is returned. If dev is 0, removes any existing
++ * registered event.
++ */
++
++isc_socketevent_t*
++isc_socket_fd_handle_selected( isc_socket_t *sock, isc_socketevent_t *dev );
++/* register the "dev" event to be sent when ALL isc_sockettype_fd sockets
++ * have been select()-ed . If there is already an event registered, it
++ * is returned, otherwise 0 is returned. If dev is 0, removes any existing
++ * registered event.
++ */
++
+ ISC_LANG_ENDDECLS
+
+ #endif /* ISC_SOCKET_H */
+--- bind-9.3.3rc2/lib/isc/unix/socket.c.dbus 2006-05-19 04:53:36.000000000 +0200
++++ bind-9.3.3rc2/lib/isc/unix/socket.c 2006-09-18 10:08:37.000000000 +0200
+@@ -148,6 +148,11 @@
+ ISC_LIST(isc_socketevent_t) recv_list;
+ ISC_LIST(isc_socket_newconnev_t) accept_list;
+ isc_socket_connev_t *connect_ev;
++
++ /* these are used only by isc_sockettype_fd sockets:*/
++ isc_socketevent_t *read_ready_event;
++ isc_socketevent_t *write_ready_event;
++ isc_socketevent_t *selected_event;
+
+ /*
+ * Internal events. Posted when a descriptor is readable or
+@@ -304,7 +309,7 @@
+
+ static void
+ wakeup_socket(isc_socketmgr_t *manager, int fd, int msg) {
+- isc_socket_t *sock;
++ isc_socket_t *sock=0L;
+
+ /*
+ * This is a wakeup on a socket. If the socket is not in the
+@@ -1289,6 +1294,9 @@
+ sock->connected = 0;
+ sock->connecting = 0;
+ sock->bound = 0;
++ sock->read_ready_event = 0L;
++ sock->write_ready_event = 0L;
++ sock->selected_event = 0L;
+
+ /*
+ * initialize the lock
+@@ -1401,13 +1409,16 @@
+ case isc_sockettype_tcp:
+ sock->fd = socket(pf, SOCK_STREAM, IPPROTO_TCP);
+ break;
++
++ case isc_sockettype_fd:
++ sock->fd = pf;
+ }
+
+ #ifdef F_DUPFD
+ /*
+ * Leave a space for stdio to work in.
+ */
+- if (sock->fd >= 0 && sock->fd < 20) {
++ if ( (type != isc_sockettype_fd) && (sock->fd >= 0) && (sock->fd < 20) ) {
+ int new, tmp;
+ new = fcntl(sock->fd, F_DUPFD, 20);
+ tmp = errno;
+@@ -1461,7 +1472,7 @@
+ }
+ }
+
+- if (make_nonblock(sock->fd) != ISC_R_SUCCESS) {
++ if ((type != isc_sockettype_fd) && (make_nonblock(sock->fd) != ISC_R_SUCCESS)) {
+ (void)close(sock->fd);
+ free_socket(&sock);
+ return (ISC_R_UNEXPECTED);
+@@ -1729,6 +1740,38 @@
+ isc_task_send(ev->ev_sender, (isc_event_t **)&iev);
+ }
+
++static
++isc_event_t *dispatch_read_ready(isc_socketmgr_t *manager, isc_socket_t *sock)
++{
++ isc_event_t *dev = (isc_event_t*)sock->read_ready_event, *ev;
++
++ ev = isc_mem_get(manager->mctx, dev->ev_size);
++ memcpy(ev,dev,dev->ev_size);
++ ISC_LINK_INIT(ev,ev_link);
++ isc_task_send(dev->ev_sender, &ev );
++ return (isc_event_t *)sock->selected_event;
++}
++
++static
++isc_event_t *dispatch_write_ready(isc_socketmgr_t *manager,isc_socket_t *sock)
++{
++ isc_event_t *dev = (isc_event_t*)sock->write_ready_event, *ev;
++ ev = isc_mem_get(manager->mctx, dev->ev_size);
++ memcpy(ev,dev,dev->ev_size);
++ ISC_LINK_INIT(ev,ev_link);
++ isc_task_send(dev->ev_sender, &ev );
++ return (isc_event_t *)sock->selected_event;
++}
++
++static
++void dispatch_selected(isc_socketmgr_t *manager, isc_event_t *dev)
++{ isc_event_t *ev;
++ ev = isc_mem_get(manager->mctx, dev->ev_size);
++ memcpy(ev,dev,dev->ev_size);
++ ISC_LINK_INIT(ev,ev_link);
++ isc_task_send(dev->ev_sender, &ev );
++}
++
+ /*
+ * Dequeue an item off the given socket's read queue, set the result code
+ * in the done event to the one provided, and send it to the task it was
+@@ -2136,6 +2179,7 @@
+ int i;
+ isc_socket_t *sock;
+ isc_boolean_t unlock_sock;
++ isc_event_t *sock_selected = 0L;
+
+ REQUIRE(maxfd <= (int)FD_SETSIZE);
+
+@@ -2169,11 +2213,15 @@
+ unlock_sock = ISC_TRUE;
+ LOCK(&sock->lock);
+ if (!SOCK_DEAD(sock)) {
++ if( sock->type != isc_sockettype_fd )
++ {
+ if (sock->listener)
+ dispatch_accept(sock);
+ else
+ dispatch_recv(sock);
+- }
++ }else
++ sock_selected = dispatch_read_ready(manager,sock);
++ }
+ FD_CLR(i, &manager->read_fds);
+ }
+ check_write:
+@@ -2187,16 +2235,24 @@
+ LOCK(&sock->lock);
+ }
+ if (!SOCK_DEAD(sock)) {
++ if( sock->type != isc_sockettype_fd )
++ {
+ if (sock->connecting)
+ dispatch_connect(sock);
+ else
+ dispatch_send(sock);
++ }else
++ sock_selected = dispatch_write_ready(manager,sock);
+ }
+ FD_CLR(i, &manager->write_fds);
+ }
+ if (unlock_sock)
+ UNLOCK(&sock->lock);
+ }
++ if( sock_selected != 0L )
++ {
++ dispatch_selected(manager, sock_selected);
++ }
+ }
+
+ #ifdef ISC_PLATFORM_USETHREADS
+@@ -2215,7 +2271,7 @@
+ int cc;
+ fd_set readfds;
+ fd_set writefds;
+- int msg, fd;
++ int msg, fd = -1;
+ int maxfd;
+ char strbuf[ISC_STRERRORSIZE];
+
+@@ -3546,3 +3602,55 @@
+ return (ISC_R_SUCCESS);
+ }
+ #endif /* ISC_PLATFORM_USETHREADS */
++
++isc_socketevent_t*
++isc_socket_fd_handle_reads( isc_socket_t *sock, isc_socketevent_t *dev )
++{
++ REQUIRE(VALID_SOCKET(sock));
++ if(dev != 0L)
++ {
++ sock->references=1;
++ sock->read_ready_event = dev;
++ select_poke(sock->manager, sock->fd, SELECT_POKE_READ);
++ }else
++ {
++ dev = sock->read_ready_event ;
++ sock->read_ready_event = 0L ;
++ }
++ return dev;
++}
++
++isc_socketevent_t*
++isc_socket_fd_handle_writes( isc_socket_t *sock, isc_socketevent_t *dev )
++{
++ REQUIRE(VALID_SOCKET(sock));
++ if(dev != 0L)
++ {
++ sock->references=1;
++ sock->write_ready_event = dev;
++ select_poke(sock->manager, sock->fd, SELECT_POKE_WRITE);
++ }else
++ {
++ dev = sock->write_ready_event;
++ sock->write_ready_event = 0L;
++ }
++ return dev;
++}
++
++isc_socketevent_t*
++isc_socket_fd_handle_selected( isc_socket_t *sock, isc_socketevent_t *dev )
++{
++ REQUIRE(VALID_SOCKET(sock));
++ if(dev != 0L)
++ {
++ sock->references=1;
++ sock->selected_event = dev;
++ }else
++ {
++ dev = sock->selected_event;
++ sock->selected_event = 0L;
++ sock->references=0;
++ destroy(&sock);
++ }
++ return dev;
++}
+--- bind-9.3.3rc2/bin/named/named.8.dbus 2006-06-29 15:02:30.000000000 +0200
++++ bind-9.3.3rc2/bin/named/named.8 2006-09-18 10:08:37.000000000 +0200
+@@ -33,7 +33,7 @@
+ named \- Internet domain name server
+ .SH "SYNOPSIS"
+ .HP 6
+-\fBnamed\fR [\fB\-4\fR] [\fB\-6\fR] [\fB\-c\ \fR\fB\fIconfig\-file\fR\fR] [\fB\-d\ \fR\fB\fIdebug\-level\fR\fR] [\fB\-f\fR] [\fB\-g\fR] [\fB\-n\ \fR\fB\fI#cpus\fR\fR] [\fB\-p\ \fR\fB\fIport\fR\fR] [\fB\-s\fR] [\fB\-t\ \fR\fB\fIdirectory\fR\fR] [\fB\-u\ \fR\fB\fIuser\fR\fR] [\fB\-v\fR] [\fB\-x\ \fR\fB\fIcache\-file\fR\fR]
++\fBnamed\fR [\fB\-4\fR] [\fB\-6\fR] [\fB\-c\ \fR\fB\fIconfig\-file\fR\fR] [\fB\-d\ \fR\fB\fIdebug\-level\fR\fR] [\fB\-f\fR] [\fB\-g\fR] [\fB\-n\ \fR\fB\fI#cpus\fR\fR] [\fB\-p\ \fR\fB\fIport\fR\fR] [\fB\-s\fR] [\fB\-t\ \fR\fB\fIdirectory\fR\fR] [\fB\-u\ \fR\fB\fIuser\fR\fR] [\fB\-v\fR] [\fB\-x\ \fR\fB\fIcache\-file\fR\fR] [\fB\-D\fR]
+ .SH "DESCRIPTION"
+ .PP
+ \fBnamed\fR
+@@ -146,6 +146,13 @@
+ .B "Warning:"
+ This option must not be used. It is only of interest to BIND 9 developers and may be removed or changed in a future release.
+ .RE
++.sp
++.TP
++\fB\-D\fR
++Enable dynamic management of the forwarding table with D-BUS
++messages. This option is required for Red Hat NetworkManager
++support. See doc/README.DBUS .
++.sp
+ .SH "SIGNALS"
+ .PP
+ In routine operation, signals should not be used to control the nameserver;
+@@ -165,6 +172,73 @@
+ \fBnamed\fR
+ configuration file is too complex to describe in detail here. A complete description is provided in the
+ BIND 9 Administrator Reference Manual.
++.PP
++.SH "NOTES"
++.PP
++.TP
++\fBRed Hat SELinux BIND Security Profile:\fR
++.PP
++By default, Red Hat ships BIND with the most secure SELinux policy
++that will not prevent normal BIND operation and will prevent exploitation
++of all known BIND security vulnerabilities . See the selinux(8) man page
++for information about SElinux.
++.PP
++It is not necessary to run named in a chroot environment if the Red Hat
++SELinux policy for named is enabled. When enabled, this policy is far
++more secure than a chroot environment.
++.PP
++With this extra security comes some restrictions:
++.br
++By default, the SELinux policy does not allow named to write any master
++zone database files. Only the root user may create files in the $ROOTDIR/var/named
++zone database file directory (the options { "directory" } option), where
++$ROOTDIR is set in /etc/sysconfig/named.
++.br
++The "named" group must be granted read privelege to
++these files in order for named to be enabled to read them.
++.br
++Any file created in the zone database file directory is automatically assigned
++the SELinux file context named_zone_t .
++.br
++By default, SELinux prevents any role from modifying named_zone_t files; this
++means that files in the zone database directory cannot be modified by dynamic
++DNS (DDNS) updates or zone transfers.
++.br
++The Red Hat BIND distribution and SELinux policy creates two directories where
++named is allowed to create and modify files: $ROOTDIR/var/named/slaves and
++$ROOTDIR/var/named/data. By placing files you want named to modify, such as
++slave or DDNS updateable zone files and database / statistics dump files in
++these directories, named will work normally and no further operator action is
++required. Files in these directories are automatically assigned the 'named_cache_t'
++file context, which SELinux allows named to write.
++.br
++You can enable the named_t domain to write and create named_zone_t files by use
++of the SELinux tunable boolean variable "named_write_master_zones", using the
++setsebool(8) command or the system-config-security GUI . If you do this, you
++must also set the ENABLE_ZONE_WRITE variable in /etc/sysconfig/named to
++1 / yes to set the ownership of files in the $ROOTDIR/var/named directory
++to named:named in order for named to be allowed to write them.
++.PP
++\fBRed Hat BIND named_sdb SDB support:\fR
++.PP
++Red Hat ships the bind-sdb RPM that provides the /usr/sbin/named_sdb program,
++which is named compiled with the Simplified Database Backend modules that ISC
++provides in the "contrib/sdb" directory.
++.br
++The SDB modules for LDAP, PostGreSQL and DirDB are compiled into named_sdb.
++.br
++To run named_sdb, set the ENABLE_SDB variable in /etc/sysconfig/named to 1 or "yes",
++and then the "service named start" named initscript will run named_sdb instead
++of named .
++.br
++See the documentation for the various SDB modules in /usr/share/doc/bind-sdb-*/ .
++.PP
++\fBRed Hat system-config-bind:\fR
++.PP
++Red Hat provides the system-config-bind GUI to configure named.conf and zone
++database files. Run the "system-config-bind" command and access the manual
++by selecting the Help menu.
++.PP
+ .SH "FILES"
+ .TP 3n
+ \fI/etc/named.conf\fR
+--- bind-9.3.3rc2/bin/named/include/named/globals.h.dbus 2006-03-02 01:37:20.000000000 +0100
++++ bind-9.3.3rc2/bin/named/include/named/globals.h 2006-09-18 10:08:37.000000000 +0200
+@@ -112,6 +112,8 @@
+
+ EXTERN int ns_g_listen INIT(3);
+
++EXTERN int ns_g_dbus INIT(0);
++
+ #undef EXTERN
+ #undef INIT
+
+--- bind-9.3.3rc2/bin/named/include/named/log.h.dbus 2004-03-08 05:04:21.000000000 +0100
++++ bind-9.3.3rc2/bin/named/include/named/log.h 2006-09-18 10:08:37.000000000 +0200
+@@ -34,6 +34,7 @@
+ #define NS_LOGCATEGORY_QUERIES (&ns_g_categories[4])
+ #define NS_LOGCATEGORY_UNMATCHED (&ns_g_categories[5])
+ #define NS_LOGCATEGORY_UPDATE_SECURITY (&ns_g_categories[6])
++#define NS_LOGCATEGORY_DBUS (&ns_g_categories[7])
+
+ /*
+ * Backwards compatibility.
+@@ -51,6 +52,7 @@
+ #define NS_LOGMODULE_NOTIFY (&ns_g_modules[8])
+ #define NS_LOGMODULE_CONTROL (&ns_g_modules[9])
+ #define NS_LOGMODULE_LWRESD (&ns_g_modules[10])
++#define NS_LOGMODULE_DBUS (&ns_g_modules[11])
+
+ isc_result_t
+ ns_log_init(isc_boolean_t safe);
+--- bind-9.3.3rc2/bin/named/include/named/server.h.dbus 2006-03-02 01:37:20.000000000 +0100
++++ bind-9.3.3rc2/bin/named/include/named/server.h 2006-09-18 10:08:37.000000000 +0200
+@@ -91,7 +91,8 @@
+ ns_controls_t * controls; /* Control channels */
+ unsigned int dispatchgen;
+ ns_dispatchlist_t dispatches;
+-
++
++ ns_dbus_mgr_t * dbus_mgr;
+ };
+
+ #define NS_SERVER_MAGIC ISC_MAGIC('S','V','E','R')
+--- bind-9.3.3rc2/bin/named/include/named/types.h.dbus 2004-03-06 11:21:26.000000000 +0100
++++ bind-9.3.3rc2/bin/named/include/named/types.h 2006-09-18 10:08:37.000000000 +0200
+@@ -38,4 +38,6 @@
+ typedef struct ns_dispatch ns_dispatch_t;
+ typedef ISC_LIST(ns_dispatch_t) ns_dispatchlist_t;
+
++typedef struct ns_dbus_mgr ns_dbus_mgr_t ;
++
+ #endif /* NAMED_TYPES_H */
+--- bind-9.3.3rc2/bin/named/log.c.dbus 2005-05-25 01:58:17.000000000 +0200
++++ bind-9.3.3rc2/bin/named/log.c 2006-09-18 10:08:37.000000000 +0200
+@@ -41,6 +41,7 @@
+ { "queries", 0 },
+ { "unmatched", 0 },
+ { "update-security", 0 },
++ { "dbus", 0 },
+ { NULL, 0 }
+ };
+
+@@ -60,6 +61,7 @@
+ { "notify", 0 },
+ { "control", 0 },
+ { "lwresd", 0 },
++ { "dbus", 0 },
+ { NULL, 0 }
+ };
+
+--- bind-9.3.3rc2/bin/named/main.c.dbus 2006-01-06 01:01:42.000000000 +0100
++++ bind-9.3.3rc2/bin/named/main.c 2006-09-18 10:08:37.000000000 +0200
+@@ -239,7 +239,8 @@
+ "usage: named [-4|-6] [-c conffile] [-d debuglevel] "
+ "[-f|-g] [-n number_of_cpus]\n"
+ " [-p port] [-s] [-t chrootdir] [-u username]\n"
+- " [-m {usage|trace|record}]\n");
++ " [-m {usage|trace|record}]\n"
++ " [-D ]\n");
+ }
+
+ static void
+@@ -345,7 +346,7 @@
+
+ isc_commandline_errprint = ISC_FALSE;
+ while ((ch = isc_commandline_parse(argc, argv,
+- "46c:C:d:fgi:lm:n:N:p:P:st:u:vx:")) != -1) {
++ "46c:C:d:fgi:lm:n:N:p:P:st:u:vx:D")) != -1) {
+ switch (ch) {
+ case '4':
+ if (disable4)
+@@ -434,6 +435,9 @@
+ case 'v':
+ printf("BIND %s\n", ns_g_version);
+ exit(0);
++ case 'D':
++ ns_g_dbus = 1;
++ break;
+ case '?':
+ usage();
+ ns_main_earlyfatal("unknown option '-%c'",
+--- bind-9.3.3rc2/bin/named/server.c.dbus 2006-05-24 06:30:24.000000000 +0200
++++ bind-9.3.3rc2/bin/named/server.c 2006-09-18 10:08:37.000000000 +0200
+@@ -86,6 +86,8 @@
+ #include <stdlib.h>
+ #endif
+
++#include <named/dbus_mgr.h>
++
+ /*
+ * Check an operation for failure. Assumes that the function
+ * using it has a 'result' variable and a 'cleanup' label.
+@@ -1495,12 +1497,12 @@
+ if (result != ISC_R_SUCCESS) {
+ char namebuf[DNS_NAME_FORMATSIZE];
+ dns_name_format(origin, namebuf, sizeof(namebuf));
+- cfg_obj_log(forwarders, ns_g_lctx, ISC_LOG_WARNING,
+- "could not set up forwarding for domain '%s': %s",
++ cfg_obj_log(forwarders, ns_g_lctx, ISC_LOG_NOTICE,
++ "setting up forwarding failed for domain '%s': %s",
+ namebuf, isc_result_totext(result));
+ goto cleanup;
+ }
+-
++
+ result = ISC_R_SUCCESS;
+
+ cleanup:
+@@ -2875,6 +2877,20 @@
+
+ CHECKFATAL(load_zones(server, ISC_FALSE), "loading zones");
+
++ server->dbus_mgr = 0L;
++ if( ns_g_dbus )
++ if( dbus_mgr_create
++ ( ns_g_mctx, ns_g_taskmgr, ns_g_socketmgr, ns_g_timermgr,
++ &server->dbus_mgr
++ ) != ISC_R_SUCCESS
++ )
++ {
++ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
++ NS_LOGMODULE_SERVER, ISC_LOG_WARNING,
++ "dbus_mgr initialization failed. D-BUS service is disabled."
++ );
++ }
++
+ ns_os_started();
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
+ ISC_LOG_NOTICE, "running");
+@@ -2937,6 +2953,9 @@
+
+ dns_db_detach(&server->in_roothints);
+
++ if( server->dbus_mgr != 0L )
++ dbus_mgr_shutdown(server->dbus_mgr);
++
+ isc_task_endexclusive(server->task);
+
+ isc_task_detach(&server->task);
+--- bind-9.3.3rc2/bin/named/Makefile.in.dbus 2004-09-06 23:47:25.000000000 +0200
++++ bind-9.3.3rc2/bin/named/Makefile.in 2006-09-18 10:10:58.000000000 +0200
+@@ -35,7 +35,8 @@
+ ${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
+ ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
+ ${DBDRIVER_INCLUDES}
+-
++DBUS_INCLUDES = \
++ -I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0
+ CDEFINES =
+ CWARNINGS =
+
+@@ -52,6 +53,7 @@
+ ISCDEPLIBS = ../../lib/isc/libisc.@A@
+ LWRESDEPLIBS = ../../lib/lwres/liblwres.@A@
+ BIND9DEPLIBS = ../../lib/bind9/libbind9.@A@
++DBUSLIBS= -ldbus-1
+
+ DEPLIBS = ${LWRESDEPLIBS} ${DNSDEPLIBS} ${BIND9DEPLIBS} \
+ ${ISCCFGDEPLIBS} ${ISCCCDEPLIBS} ${ISCDEPLIBS}
+@@ -71,6 +73,7 @@
+ zoneconf.@O@ \
+ lwaddr.@O@ lwresd.@O@ lwdclient.@O@ lwderror.@O@ lwdgabn.@O@ \
+ lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ \
++ dbus_service.@O@ dbus_mgr.@O@ \
+ $(DBDRIVER_OBJS)
+
+ UOBJS = unix/os.@O@
+@@ -83,6 +86,7 @@
+ zoneconf.c \
+ lwaddr.c lwresd.c lwdclient.c lwderror.c lwdgabn.c \
+ lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c \
++ dbus_service.c dbus_mgr.c \
+ $(DBDRIVER_SRCS)
+
+ MANPAGES = named.8 lwresd.8 named.conf.5
+@@ -105,9 +109,14 @@
+ -DNS_LOCALSTATEDIR=\"${localstatedir}\" \
+ -c ${srcdir}/config.c
+
++dbus_service.o: dbus_service.c
++ ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \
++ ${DBUS_INCLUDES} \
++ -c ${srcdir}/dbus_service.c
++
+ named@EXEEXT@: ${OBJS} ${UOBJS} ${DEPLIBS}
+ ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
+- ${OBJS} ${UOBJS} ${LIBS}
++ ${OBJS} ${UOBJS} ${LIBS} ${DBUSLIBS}
+
+ lwresd@EXEEXT@: named@EXEEXT@
+ rm -f lwresd@EXEEXT@
diff --git a/contrib/dbus/dbus_mgr.c b/contrib/dbus/dbus_mgr.c
new file mode 100644
index 0000000..b744790
--- /dev/null
+++ b/contrib/dbus/dbus_mgr.c
@@ -0,0 +1,2458 @@
+/* dbus_mgr.c
+ *
+ * named module to provide dynamic forwarding zones in
+ * response to D-BUS dhcp events or commands.
+ *
+ * Copyright(C) Jason Vas Dias, Red Hat Inc., 2005
+ * Modified by Adam Tkac, Red Hat Inc., 2007
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation at
+ * http://www.fsf.org/licensing/licenses/gpl.txt
+ * and included in this software distribution as the "LICENSE" file.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+#include <config.h>
+#include <isc/types.h>
+#include <isc/net.h>
+#include <isc/mem.h>
+#include <isc/magic.h>
+#include <isc/list.h>
+#include <isc/task.h>
+#include <isc/event.h>
+#include <isc/socket.h>
+#include <isc/timer.h>
+#include <isc/netaddr.h>
+#include <isc/sockaddr.h>
+#include <isc/buffer.h>
+#include <isc/log.h>
+
+#include <dns/name.h>
+#include <dns/acl.h>
+#include <dns/fixedname.h>
+#include <dns/view.h>
+#include <dns/forward.h>
+
+#include <named/types.h>
+#include <named/config.h>
+#include <named/server.h>
+#include <named/globals.h>
+#include <named/log.h>
+
+#include <named/dbus_service.h>
+#include <named/dbus_mgr.h>
+
+#include <string.h>
+#include <search.h>
+
+typedef void (*__free_fn_t) (void *__nodep);
+extern void tdestroy (void *__root, __free_fn_t __freefct);
+extern void free(void*);
+
+#ifdef ISC_USE_INTERNAL_MALLOC
+# if ISC_USE_INTERNAL_MALLOC
+# error dbus_mgr cannot be used if ISC_USE_INTERNAL_MALLOC==1
+# endif
+#endif
+
+#define DBUSMGR_DESTINATION "com.redhat.named"
+#define DBUSMGR_OBJECT_PATH "/com/redhat/named"
+#define DBUSMGR_INTERFACE "com.redhat.named"
+
+#define DBUSMGR_MAGIC ISC_MAGIC('D', 'B', 'U', 'S')
+
+struct ns_dbus_mgr
+{
+ unsigned int magic;
+ isc_mem_t * mctx; /* Memory context. */
+ isc_taskmgr_t * taskmgr; /* Task manager. */
+ isc_socketmgr_t * socketmgr; /* Socket manager. */
+ isc_timermgr_t * timermgr; /* Timer manager. */
+ isc_task_t * task; /* task */
+ isc_timer_t * timer; /* dbus_init retry */
+ void * sockets; /* dbus fd tree */
+ void * dhc_if; /* dhcp interface tree */
+ void * ifwdt; /* initial forwarder tree */
+ char * dhcdbd_name; /* dhcdbd destination */
+ DBUS_SVC dbus; /* dbus handle */
+};
+
+typedef
+struct dbus_mgr_sock_s
+{
+ int fd;
+ struct ns_dbus_mgr *mgr;
+ isc_socket_t *sock;
+ isc_socketevent_t *ser;
+ isc_socketevent_t *sew;
+ isc_socketevent_t *sel;
+} DBusMgrSocket;
+
+typedef
+enum dhc_state_e
+{
+ DHC_NBI, /* no broadcast interfaces found */
+ DHC_PREINIT, /* configuration started */
+ DHC_BOUND, /* lease obtained */
+ DHC_RENEW, /* lease renewed */
+ DHC_REBOOT, /* have valid lease, but now obtained a different one */
+ DHC_REBIND, /* new, different lease */
+ DHC_STOP, /* remove old lease */
+ DHC_MEDIUM, /* media selection begun */
+ DHC_TIMEOUT, /* timed out contacting DHCP server */
+ DHC_FAIL, /* all attempts to contact server timed out, sleeping */
+ DHC_EXPIRE, /* lease has expired, renewing */
+ DHC_RELEASE, /* releasing lease */
+ DHC_START, /* sent when dhclient started OK */
+ DHC_ABEND, /* dhclient exited abnormally */
+ DHC_END, /* dhclient exited normally */
+ DHC_END_OPTIONS, /* last option in subscription sent */
+ DHC_INVALID=255
+} DHC_State;
+
+typedef ISC_LIST(dns_name_t) DNSNameList;
+
+typedef ISC_LIST(isc_sockaddr_t) SockAddrList;
+
+typedef struct dbm_fwdr_s
+{
+ dns_fwdpolicy_t fwdpolicy;
+ dns_name_t dn;
+ SockAddrList sa;
+ ISC_LINK( struct dbm_fwdr_s ) link;
+} DBusMgrInitialFwdr;
+
+typedef
+struct dhc_if_s
+{
+ char *if_name;
+ DHC_State dhc_state;
+ DHC_State previous_state;
+ struct in_addr ip;
+ struct in_addr subnet_mask;
+ DNSNameList dn;
+ SockAddrList dns;
+} DHC_IF;
+
+static void
+dbus_mgr_watch_handler( int fd, dbus_svc_WatchFlags flags, void *mgrp );
+
+static
+dbus_svc_HandlerResult
+dbus_mgr_message_handler
+(
+ DBusMsgHandlerArgs
+);
+
+static
+void dbus_mgr_close_socket( const void *p, const VISIT which, const int level);
+
+static
+void dbus_mgr_destroy_socket( void *p );
+
+static
+void dbus_mgr_free_dhc( void *p );
+
+static void
+dbus_mgr_watches_selected(isc_task_t *t, isc_event_t *ev);
+
+static isc_result_t
+dbus_mgr_init_dbus(ns_dbus_mgr_t *);
+
+static isc_result_t
+dbus_mgr_record_initial_fwdtable(ns_dbus_mgr_t *);
+
+static
+dns_fwdtable_t *dbus_mgr_get_fwdtable(void);
+
+static void
+dbus_mgr_free_initial_fwdtable(ns_dbus_mgr_t *);
+
+static
+uint8_t dbus_mgr_subscribe_to_dhcdbd( ns_dbus_mgr_t * );
+
+static
+void dbus_mgr_dbus_shutdown_handler ( ns_dbus_mgr_t * );
+
+static
+int dbus_mgr_log_err( const char *fmt, ...)
+{
+ va_list va;
+ va_start(va, fmt);
+ isc_log_vwrite(ns_g_lctx,
+ NS_LOGCATEGORY_DBUS,
+ NS_LOGMODULE_DBUS,
+ ISC_LOG_NOTICE,
+ fmt, va
+ );
+ va_end(va);
+ return 0;
+}
+
+static
+int dbus_mgr_log_dbg( const char *fmt, ...)
+{
+ va_list va;
+ va_start(va, fmt);
+ isc_log_vwrite(ns_g_lctx,
+ NS_LOGCATEGORY_DBUS,
+ NS_LOGMODULE_DBUS,
+ ISC_LOG_DEBUG(80),
+ fmt, va
+ );
+ va_end(va);
+ return 0;
+}
+
+static
+int dbus_mgr_log_info( const char *fmt, ...)
+{
+ va_list va;
+ va_start(va, fmt);
+ isc_log_vwrite(ns_g_lctx,
+ NS_LOGCATEGORY_DBUS,
+ NS_LOGMODULE_DBUS,
+ ISC_LOG_DEBUG(1),
+ fmt, va
+ );
+ va_end(va);
+ return 0;
+}
+
+isc_result_t
+dbus_mgr_create
+( isc_mem_t *mctx,
+ isc_taskmgr_t *taskmgr,
+ isc_socketmgr_t *socketmgr,
+ isc_timermgr_t *timermgr,
+ ns_dbus_mgr_t **dbus_mgr
+)
+{
+ isc_result_t result;
+ ns_dbus_mgr_t *mgr;
+
+ *dbus_mgr = 0L;
+
+ mgr = isc_mem_get(mctx, sizeof(*mgr));
+ if (mgr == NULL)
+ return (ISC_R_NOMEMORY);
+
+ mgr->magic = DBUSMGR_MAGIC;
+ mgr->mctx = mctx;
+ mgr->taskmgr = taskmgr;
+ mgr->socketmgr = socketmgr;
+ mgr->timermgr = timermgr;
+ mgr->task = 0L;
+ mgr->sockets = 0L;
+ mgr->timer = 0L;
+ mgr->dhc_if = 0L;
+ mgr->ifwdt = 0L;
+ mgr->dhcdbd_name = 0L;
+
+ if( (result = isc_task_create( taskmgr, 100, &(mgr->task)))
+ != ISC_R_SUCCESS
+ ) goto cleanup_mgr;
+
+ isc_task_setname( mgr->task, "dbusmgr", mgr );
+
+ mgr->dbus = 0L;
+
+ if( (result = dbus_mgr_record_initial_fwdtable( mgr ))
+ != ISC_R_SUCCESS
+ ) goto cleanup_mgr;
+
+ if( (result = dbus_mgr_init_dbus( mgr ))
+ != ISC_R_SUCCESS
+ ) goto cleanup_mgr;
+
+ *dbus_mgr = mgr;
+
+ return ISC_R_SUCCESS;
+
+ cleanup_mgr:
+ if ( dbus_mgr_get_fwdtable() != NULL)
+ dbus_mgr_free_initial_fwdtable (mgr);
+ if( mgr->task != 0L )
+ isc_task_detach(&(mgr->task));
+ isc_mem_put(mctx, mgr, sizeof(*mgr));
+ return (result);
+}
+
+static isc_result_t
+dbus_mgr_init_dbus(ns_dbus_mgr_t * mgr)
+{
+ char destination[]=DBUSMGR_DESTINATION;
+ isc_result_t result;
+
+ if( mgr->sockets != 0L )
+ {
+ isc_task_purgerange(mgr->task, 0L, ISC_SOCKEVENT_READ_READY, ISC_SOCKEVENT_SELECTED, 0L);
+ twalk(mgr->sockets, dbus_mgr_close_socket);
+ tdestroy(mgr->sockets, dbus_mgr_destroy_socket);
+ mgr->sockets = 0L;
+ }
+
+ if( mgr->dbus != 0L )
+ {
+ dbus_svc_shutdown(mgr->dbus);
+ mgr->dbus = 0L;
+ }
+
+ result = dbus_svc_init(DBUS_PRIVATE_SYSTEM, destination, &mgr->dbus,
+ dbus_mgr_watch_handler, 0L, 0L, mgr);
+
+ if(result != ISC_R_SUCCESS)
+ goto cleanup;
+
+ if( mgr->dbus == 0L )
+ {
+ if( mgr->timer == 0L)
+ {
+ isc_task_purgerange(mgr->task, 0L, ISC_SOCKEVENT_READ_READY, ISC_SOCKEVENT_SELECTED, 0L);
+ if( mgr->sockets != 0L )
+ {
+ twalk(mgr->sockets, dbus_mgr_close_socket);
+ tdestroy(mgr->sockets, dbus_mgr_destroy_socket);
+ mgr->sockets = 0L;
+ }
+ dbus_mgr_dbus_shutdown_handler ( mgr );
+ return ISC_R_SUCCESS;
+ }
+ goto cleanup;
+ }
+
+ if( !dbus_svc_add_filter
+ ( mgr->dbus, dbus_mgr_message_handler, mgr, 4,
+ "type=signal,path=/org/freedesktop/DBus,member=NameOwnerChanged",
+ "type=signal,path=/org/freedesktop/DBus/Local,member=Disconnected",
+ "type=signal,interface=com.redhat.dhcp.subscribe.binary",
+ "type=method_call,destination=com.redhat.named,path=/com/redhat/named"
+ )
+ )
+ {
+ dbus_mgr_log_err( "dbus_svc_add_filter failed" );
+ goto cleanup;
+ }
+
+ if( mgr->timer != 0L )
+ {
+ isc_timer_reset(mgr->timer,
+ isc_timertype_inactive,
+ NULL, NULL, ISC_TRUE
+ );
+ }
+
+ if( !dbus_mgr_subscribe_to_dhcdbd( mgr ) )
+ dbus_mgr_log_err("D-BUS dhcdbd subscription disabled.");
+
+ dbus_mgr_log_err("D-BUS service enabled.");
+ return ISC_R_SUCCESS;
+
+ cleanup:
+ isc_task_purgerange(mgr->task, 0L, ISC_SOCKEVENT_READ_READY, ISC_SOCKEVENT_SELECTED, 0L);
+ twalk(mgr->sockets, dbus_mgr_close_socket);
+ tdestroy(mgr->sockets, dbus_mgr_destroy_socket);
+ mgr->sockets = 0L;
+ if( mgr->dbus )
+ {
+ dbus_svc_shutdown(mgr->dbus);
+ mgr->dbus = 0L;
+ }
+ return ISC_R_FAILURE;
+}
+
+static
+uint8_t dbus_mgr_subscribe_to_dhcdbd( ns_dbus_mgr_t *mgr )
+{
+ DBUS_SVC dbus = mgr->dbus;
+ char subs[1024], path[1024],
+ dhcdbd_destination[]="com.redhat.dhcp", *ddp[1]={ &(dhcdbd_destination[0]) },
+ *dhcdbd_name=0L;
+ const char *options[] = { "reason", "ip-address", "subnet-mask",
+ "domain-name", "domain-name-servers"
+ };
+ dbus_svc_MessageHandle msg;
+ int i, n_opts = 5;
+
+ if( mgr->dhcdbd_name == 0L )
+ {
+ msg = dbus_svc_call
+ ( dbus,
+ "org.freedesktop.DBus",
+ "/org/freedesktop/DBus",
+ "GetNameOwner",
+ "org.freedesktop.DBus",
+ TYPE_STRING, &ddp,
+ TYPE_INVALID
+ );
+ if( msg == 0L )
+ return 0;
+
+ if( !dbus_svc_get_args(dbus, msg,
+ TYPE_STRING, &(dhcdbd_name),
+ TYPE_INVALID
+ )
+ ) return 0;
+
+ mgr->dhcdbd_name = isc_mem_get(mgr->mctx, strlen(dhcdbd_name) + 1);
+ if( mgr->dhcdbd_name == 0L )
+ return 0;
+
+ strcpy(mgr->dhcdbd_name, dhcdbd_name);
+
+ }
+
+ sprintf(path,"/com/redhat/dhcp/subscribe");
+ sprintf(subs,"com.redhat.dhcp.binary");
+
+ for(i = 0; i < n_opts; i++)
+ {
+ msg = dbus_svc_call
+ ( dbus,
+ "com.redhat.dhcp",
+ path,
+ "binary",
+ subs,
+ TYPE_STRING, &(options[i]),
+ TYPE_INVALID
+ );
+ if(msg == 0L)
+ return 0;
+ if ( dbus_svc_message_type( msg ) == ERROR )
+ return 0;
+ }
+ dbus_mgr_log_err("D-BUS dhcdbd subscription enabled.");
+ return 1;
+}
+
+void
+dbus_mgr_shutdown
+( ns_dbus_mgr_t *mgr
+)
+{
+ if( mgr->timer != 0L )
+ isc_timer_detach(&(mgr->timer));
+ if( mgr->dbus != 0L )
+ {
+ isc_task_purgerange(mgr->task, 0L, ISC_SOCKEVENT_READ_READY, ISC_SOCKEVENT_SELECTED, 0L);
+ if( mgr->sockets != 0L )
+ {
+ twalk(mgr->sockets, dbus_mgr_close_socket);
+ tdestroy(mgr->sockets, dbus_mgr_destroy_socket);
+ mgr->sockets = 0L;
+ }
+ dbus_svc_shutdown(mgr->dbus);
+ }
+ if( mgr->dhc_if != 0L )
+ tdestroy(mgr->dhc_if, dbus_mgr_free_dhc);
+ if( mgr->dhcdbd_name != 0L )
+ isc_mem_put(mgr->mctx, mgr->dhcdbd_name, strlen(mgr->dhcdbd_name) + 1);
+ isc_task_detach(&(mgr->task));
+ dbus_mgr_free_initial_fwdtable(mgr);
+ isc_mem_put(mgr->mctx, mgr, sizeof(ns_dbus_mgr_t));
+}
+
+static
+void dbus_mgr_restart_dbus(isc_task_t *t, isc_event_t *ev)
+{
+ ns_dbus_mgr_t *mgr = (ns_dbus_mgr_t*)(ev->ev_arg) ;
+ t=t;
+ isc_event_free(&ev);
+ dbus_mgr_log_dbg("attempting to connect to D-BUS");
+ dbus_mgr_init_dbus( mgr );
+}
+
+static
+void dbus_mgr_handle_dbus_shutdown_event(isc_task_t *t, isc_event_t *ev)
+{
+ ns_dbus_mgr_t *mgr = ev->ev_arg;
+ isc_time_t tick={10,0};
+ isc_interval_t tock={10,0};
+ DBUS_SVC dbus = mgr->dbus;
+ t = t;
+
+ mgr->dbus = 0L;
+
+ isc_event_free(&ev);
+
+ if ( dbus != 0L )
+ {
+ isc_task_purgerange(mgr->task, 0L, ISC_SOCKEVENT_READ_READY, ISC_SOCKEVENT_SELECTED, 0L);
+ if( mgr->sockets != 0L )
+ {
+ twalk(mgr->sockets, dbus_mgr_close_socket);
+ tdestroy(mgr->sockets, dbus_mgr_destroy_socket);
+ mgr->sockets = 0L;
+ }
+ dbus_svc_shutdown(dbus);
+ }
+
+ dbus_mgr_log_err( "D-BUS service disabled." );
+
+ if( mgr->timer != 0L )
+ {
+ isc_timer_reset(mgr->timer,
+ isc_timertype_ticker,
+ &tick, &tock, ISC_TRUE
+ );
+ }else
+ if( isc_timer_create
+ ( mgr->timermgr,
+ isc_timertype_ticker,
+ &tick, &tock,
+ mgr->task,
+ dbus_mgr_restart_dbus,
+ mgr,
+ &(mgr->timer)
+ ) != ISC_R_SUCCESS
+ )
+ {
+ dbus_mgr_log_err( "D-BUS service cannot be restored." );
+ }
+}
+
+static
+void dbus_mgr_dbus_shutdown_handler ( ns_dbus_mgr_t *mgr )
+{
+ isc_event_t *dbus_shutdown_event =
+ isc_event_allocate
+ ( mgr->mctx,
+ mgr->task,
+ 1,
+ dbus_mgr_handle_dbus_shutdown_event,
+ mgr,
+ sizeof(isc_event_t)
+ );
+ if( dbus_shutdown_event != 0L )
+ {
+ isc_task_purgerange(mgr->task, 0L, ISC_SOCKEVENT_READ_READY, ISC_SOCKEVENT_SELECTED, 0L);
+ isc_task_send( mgr->task, &dbus_shutdown_event );
+ }else
+ dbus_mgr_log_err("unable to allocate dbus shutdown event");
+}
+
+static
+dns_view_t *dbus_mgr_get_localhost_view(void)
+{
+ dns_view_t *view;
+ isc_netaddr_t localhost = { AF_INET, { { htonl( ( 127 << 24 ) | 1 ) } }, 0 };
+ int match;
+
+ for (view = ISC_LIST_HEAD(ns_g_server->viewlist);
+ view != NULL;
+ view = ISC_LIST_NEXT(view, link)
+ )
+ {
+ /* return first view matching "localhost" source and dest */
+
+ if(( (view->matchclients != 0L ) /* 0L: accept "any" */
+ &&(( dns_acl_match( &localhost,
+ NULL, /* unsigned queries */
+ view->matchclients,
+ &(ns_g_server->aclenv),
+ &match,
+ NULL /* no match list */
+ ) != ISC_R_SUCCESS
+ ) || (match <= 0)
+ )
+ )
+ ||( (view->matchdestinations != 0L ) /* 0L: accept "any" */
+ &&(( dns_acl_match( &localhost,
+ NULL, /* unsigned queries */
+ view->matchdestinations,
+ &(ns_g_server->aclenv),
+ &match,
+ NULL /* no match list */
+ ) != ISC_R_SUCCESS
+ ) || (match <= 0)
+ )
+ )
+ ) continue;
+
+ break;
+ }
+ return view;
+}
+
+static
+dns_fwdtable_t *dbus_mgr_get_fwdtable(void)
+{
+ dns_view_t *view = dbus_mgr_get_localhost_view();
+ if( view != 0L )
+ return view->fwdtable;
+ return 0L;
+}
+
+static
+dns_fwdtable_t *dbus_mgr_get_view_and_fwdtable( dns_view_t **viewp )
+{
+ *viewp = dbus_mgr_get_localhost_view();
+ if( *viewp != 0L )
+ return (*viewp)->fwdtable;
+ return 0L;
+}
+
+static int dbus_mgr_ifwdr_comparator( const void *p1, const void *p2 )
+{
+ char n1buf[ DNS_NAME_FORMATSIZE ]="", *n1p=&(n1buf[0]),
+ n2buf[ DNS_NAME_FORMATSIZE ]="", *n2p=&(n2buf[0]);
+ dns_name_t *dn1;
+ dns_name_t *dn2;
+ DE_CONST(&(((const DBusMgrInitialFwdr*)p1)->dn), dn1);
+ DE_CONST(&(((const DBusMgrInitialFwdr*)p2)->dn), dn2);
+ dns_name_format(dn1, n1p, DNS_NAME_FORMATSIZE );
+ dns_name_format(dn2, n2p, DNS_NAME_FORMATSIZE );
+ return strcmp(n1buf, n2buf);
+}
+
+static int dbus_mgr_dhc_if_comparator( const void *p1, const void *p2 );
+
+static void dbus_mgr_record_initial_forwarder( dns_name_t *name, dns_forwarders_t *fwdr, void *mp )
+{
+ ns_dbus_mgr_t *mgr = mp;
+ isc_sockaddr_t *sa, *nsa;
+ DBusMgrInitialFwdr *ifwdr;
+
+ if( ISC_LIST_HEAD(fwdr->addrs) == 0L)
+ return;
+
+ if( (ifwdr = isc_mem_get(mgr->mctx, sizeof(DBusMgrInitialFwdr))) == 0L)
+ return;
+
+ ifwdr->fwdpolicy = fwdr->fwdpolicy;
+
+ dns_name_init(&(ifwdr->dn), NULL);
+ if( dns_name_dupwithoffsets(name, mgr->mctx, &(ifwdr->dn)) != ISC_R_SUCCESS )
+ goto namedup_err;
+
+ ISC_LIST_INIT(ifwdr->sa);
+
+ for( sa = ISC_LIST_HEAD(fwdr->addrs);
+ sa != 0L;
+ sa = ISC_LIST_NEXT(sa,link)
+ )
+ {
+ nsa = isc_mem_get(mgr->mctx, sizeof(isc_sockaddr_t));
+ if( nsa == 0L )
+ goto nsa_err;
+ *nsa = *sa;
+ ISC_LINK_INIT(nsa, link);
+ ISC_LIST_APPEND(ifwdr->sa, nsa, link);
+ }
+ ISC_LINK_INIT(ifwdr, link);
+ tsearch( ifwdr, &(mgr->ifwdt), dbus_mgr_ifwdr_comparator);
+
+ return;
+
+nsa_err:
+ while ( (sa = ISC_LIST_HEAD (ifwdr->sa)) != NULL) {
+ ISC_LIST_UNLINK (ifwdr->sa, sa, link);
+ isc_mem_put (mgr->mctx, sa, sizeof (*sa));
+ }
+
+namedup_err:
+ isc_mem_put (mgr->mctx, ifwdr, sizeof (*ifwdr));
+
+ return;
+}
+
+static isc_result_t
+dbus_mgr_record_initial_fwdtable( ns_dbus_mgr_t *mgr )
+{
+ dns_fwdtable_t *fwdtable = dbus_mgr_get_fwdtable();
+
+ if( fwdtable == 0L )
+ return ISC_R_SUCCESS; /* no initial fwdtable */
+ dns_fwdtable_foreach( fwdtable, dbus_mgr_record_initial_forwarder, mgr);
+ return ISC_R_SUCCESS;
+}
+
+static void
+dbus_mgr_free_initial_forwarder( void *p )
+{
+ DBusMgrInitialFwdr *ifwdr = p;
+ isc_sockaddr_t *sa;
+
+ dns_name_free(&(ifwdr->dn), ns_g_mctx);
+ for( sa = ISC_LIST_HEAD( ifwdr->sa );
+ sa != 0L;
+ sa = ISC_LIST_HEAD( ifwdr->sa )
+ )
+ {
+ if( ISC_LINK_LINKED(sa, link) )
+ ISC_LIST_UNLINK(ifwdr->sa, sa, link);
+ isc_mem_put(ns_g_mctx, sa, sizeof(isc_sockaddr_t));
+ }
+ isc_mem_put(ns_g_mctx, ifwdr, sizeof(DBusMgrInitialFwdr));
+}
+
+static void
+dbus_mgr_free_initial_fwdtable( ns_dbus_mgr_t *mgr )
+{
+ tdestroy(mgr->ifwdt, dbus_mgr_free_initial_forwarder);
+ mgr->ifwdt = 0L;
+}
+
+static void
+dbus_mgr_log_forwarders( const char *pfx, dns_name_t *name, SockAddrList *saList)
+{
+ isc_sockaddr_t *sa;
+ char nameP[DNS_NAME_FORMATSIZE], addrP[128];
+ int s=0;
+ dns_name_format(name, nameP, DNS_NAME_FORMATSIZE );
+ for( sa = ISC_LIST_HEAD(*saList);
+ sa != 0L;
+ sa = ISC_LIST_NEXT(sa,link)
+ )
+ {
+ isc_sockaddr_format(sa, addrP, 128);
+ dbus_mgr_log_info("%s zone %s server %d: %s", pfx, nameP, s++, addrP);
+ }
+}
+
+static
+isc_result_t dbus_mgr_set_forwarders
+(
+ ns_dbus_mgr_t *mgr,
+ DNSNameList *nameList,
+ SockAddrList *saList,
+ dns_fwdpolicy_t fwdpolicy
+)
+{
+ isc_result_t result = ISC_R_SUCCESS;
+ dns_fwdtable_t *fwdtable;
+ dns_view_t *view=0L;
+ dns_name_t *dnsName;
+ isc_sockaddr_t *sa, *nsa;
+ dns_forwarders_t *fwdr=0L;
+
+ fwdtable = dbus_mgr_get_view_and_fwdtable(&view);
+
+ if( fwdtable == 0L )
+ {
+ if( ISC_LIST_HEAD(*saList) == 0L )
+ return ISC_R_SUCCESS;/* deletion not required */
+
+ view = dbus_mgr_get_localhost_view();
+ if( view == 0L )
+ return ISC_R_NOPERM; /* if configuration does not allow localhost clients,
+ * then we really shouldn't be creating a forwarding table.
+ */
+ result = isc_task_beginexclusive(mgr->task);
+
+ if( result == ISC_R_SUCCESS )
+ {
+ result = dns_fwdtable_create( mgr->mctx, &(view->fwdtable) );
+
+ isc_task_endexclusive(mgr->task);
+
+ if( result != ISC_R_SUCCESS )
+ return result;
+
+ if( view->fwdtable == 0L )
+ return ISC_R_NOMEMORY;
+
+ if( isc_log_getdebuglevel(ns_g_lctx) >= 1 )
+ dbus_mgr_log_info("Created forwarder table.");
+ }
+ }
+
+ for( dnsName = ISC_LIST_HEAD(*nameList);
+ dnsName != NULL;
+ dnsName = ISC_LIST_NEXT(dnsName,link)
+ )
+ {
+ fwdr = 0L;
+ if( ( dns_fwdtable_find_exact( fwdtable, dnsName, &fwdr ) != ISC_R_SUCCESS )
+ ||( fwdr == 0L )
+ )
+ {
+ if( ISC_LIST_HEAD( *saList ) == 0L )
+ continue;
+ /* no forwarders for name - add forwarders */
+
+ result = isc_task_beginexclusive(mgr->task);
+
+ if( result == ISC_R_SUCCESS )
+ {
+ result = dns_fwdtable_add( fwdtable, dnsName,
+ (isc_sockaddrlist_t*)saList,
+ fwdpolicy
+ ) ;
+
+ if( view != 0L )
+ dns_view_flushcache( view );
+
+ isc_task_endexclusive(mgr->task);
+
+ if( result != ISC_R_SUCCESS )
+ return result;
+
+ if( isc_log_getdebuglevel(ns_g_lctx) >= 1 )
+ dbus_mgr_log_forwarders("Created forwarder",dnsName, saList);
+ }
+ continue;
+ }
+
+ if( ISC_LIST_HEAD( *saList ) == 0L )
+ { /* empty forwarders list - delete forwarder entry */
+
+ if( isc_log_getdebuglevel(ns_g_lctx) >= 1 )
+ dbus_mgr_log_forwarders("Deleting forwarder", dnsName, (SockAddrList*)&(fwdr->addrs));
+
+ result = isc_task_beginexclusive(mgr->task);
+ if( result == ISC_R_SUCCESS )
+ {
+ result = dns_fwdtable_delete( fwdtable, dnsName );
+
+ if( view != 0L )
+ dns_view_flushcache( view );
+
+ isc_task_endexclusive(mgr->task);
+
+ if( result != ISC_R_SUCCESS )
+ return result;
+ }
+ continue;
+ }
+
+ result = isc_task_beginexclusive(mgr->task);
+
+ if( result == ISC_R_SUCCESS )
+ {
+ fwdr->fwdpolicy = fwdpolicy;
+
+ if( isc_log_getdebuglevel(ns_g_lctx) >= 1 )
+ dbus_mgr_log_forwarders("Removing forwarder", dnsName, (SockAddrList*)&(fwdr->addrs));
+
+ for( sa = ISC_LIST_HEAD(fwdr->addrs);
+ sa != 0L ;
+ sa = ISC_LIST_HEAD(fwdr->addrs)
+ )
+ {
+ if( ISC_LINK_LINKED(sa, link) )
+ ISC_LIST_UNLINK(fwdr->addrs, sa, link);
+ isc_mem_put(mgr->mctx, sa, sizeof(isc_sockaddr_t));
+ }
+
+ ISC_LIST_INIT( fwdr->addrs );
+
+ for( sa = ISC_LIST_HEAD(*saList);
+ sa != 0L;
+ sa = ISC_LIST_NEXT(sa,link)
+ )
+ {
+ nsa = isc_mem_get(mgr->mctx, sizeof(isc_sockaddr_t));
+ if( nsa == 0L )
+ {
+ result = ISC_R_NOMEMORY;
+ break;
+ }
+ *nsa = *sa;
+ ISC_LINK_INIT( nsa, link );
+ ISC_LIST_APPEND( fwdr->addrs, nsa, link );
+ }
+
+ if( view != 0L )
+ dns_view_flushcache( view );
+
+ isc_task_endexclusive(mgr->task);
+
+ if( isc_log_getdebuglevel(ns_g_lctx) >= 1 )
+ dbus_mgr_log_forwarders("Added forwarder", dnsName, (SockAddrList*)&(fwdr->addrs));
+
+ }else
+ return result;
+
+ }
+ return (result);
+}
+
+static void
+dbus_mgr_get_name_list
+(
+ ns_dbus_mgr_t *mgr,
+ char *domains,
+ DNSNameList *nameList,
+ char *error_name,
+ char *error_message
+)
+{
+ char *name, *endName, *endp;
+ dns_fixedname_t *fixedname;
+ dns_name_t *dnsName;
+ isc_buffer_t buffer;
+ isc_result_t result;
+ uint32_t total_length;
+
+ total_length = strlen(domains);
+ endp = domains + total_length;
+
+ ISC_LIST_INIT( *nameList );
+
+ for( name = domains + strspn(domains," \t\n"),
+ endName = name + strcspn(name," \t\n");
+ (name < endp) && (endName <= endp);
+ name = endName + 1 + strspn(endName+1," \t\n"),
+ endName = name + strcspn(name," \t\n")
+ )
+ { /* name loop */
+ *endName = '\0';
+
+ isc_buffer_init( &buffer, name, endName - name );
+ isc_buffer_add(&buffer, endName - name);
+
+ fixedname = isc_mem_get( mgr->mctx, sizeof( dns_fixedname_t ));
+
+ dns_fixedname_init(fixedname);
+
+ dnsName = dns_fixedname_name(fixedname);
+
+ result= dns_name_fromtext
+ ( dnsName, &buffer, ( *(endp-1) != '.') ? dns_rootname : NULL, ISC_FALSE, NULL
+ );
+
+ if( result != ISC_R_SUCCESS )
+ {
+ sprintf(error_name, "com.redhat.named.InvalidArgument");
+ sprintf(error_message,"Invalid DNS name initial argument: %s", name);
+
+ isc_mem_put( mgr->mctx, fixedname, sizeof( dns_fixedname_t ) );
+
+ for( dnsName = ISC_LIST_HEAD( *nameList );
+ (dnsName != 0L);
+ dnsName = ISC_LIST_HEAD( *nameList )
+ )
+ {
+ if( ISC_LINK_LINKED(dnsName,link) )
+ ISC_LIST_DEQUEUE( *nameList, dnsName, link );
+ isc_mem_put( mgr->mctx, dnsName, sizeof( dns_fixedname_t ) );
+ }
+ ISC_LIST_INIT(*nameList);
+ return;
+ }
+ ISC_LINK_INIT(dnsName, link);
+ ISC_LIST_ENQUEUE( *nameList, dnsName, link );
+ }
+}
+
+static isc_result_t
+dbus_mgr_get_sa_list
+(
+ ns_dbus_mgr_t *mgr,
+ dbus_svc_MessageIterator iter,
+ SockAddrList *saList ,
+ uint8_t *fwdpolicy,
+ char *error_name,
+ char *error_message
+)
+{
+ DBUS_SVC dbus = mgr->dbus;
+ isc_sockaddr_t *nsSA=0L, *nsSA_Q=0L;
+ uint32_t argType = dbus_svc_message_next_arg_type( dbus, iter ),
+ length;
+ isc_result_t result;
+ in_port_t port;
+ char *ip;
+ uint8_t *iparray=0L;
+
+ ISC_LIST_INIT(*saList);
+
+ if( argType == TYPE_INVALID )
+ return ISC_R_SUCCESS; /* address list "removal" */
+
+ do
+ {
+ switch( argType )
+ {
+ case TYPE_UINT32:
+
+ nsSA = isc_mem_get(mgr->mctx, sizeof(isc_sockaddr_t));
+ if( nsSA != 0L )
+ {
+ memset(nsSA,'\0', sizeof(isc_sockaddr_t));
+ nsSA_Q = nsSA;
+ dbus_svc_message_next_arg(dbus, iter, &(nsSA->type.sin.sin_addr.s_addr));
+ nsSA->type.sa.sa_family = AF_INET;
+ nsSA->length = sizeof( nsSA->type.sin );
+ }
+ break;
+
+ case TYPE_ARRAY:
+
+ argType = dbus_svc_message_element_type( dbus, iter );
+ if( argType == TYPE_BYTE )
+ {
+ iparray = 0L;
+ length = 0;
+
+ dbus_svc_message_get_elements(dbus, iter, &length, &iparray);
+
+ if( iparray != 0L )
+ {
+ if (length == sizeof( struct in_addr ))
+ {
+ nsSA = isc_mem_get(mgr->mctx, sizeof(isc_sockaddr_t));
+ if( nsSA != 0L )
+ {
+ memset(nsSA,'\0', sizeof(isc_sockaddr_t));
+ nsSA_Q = nsSA;
+
+ memcpy(&(nsSA->type.sin.sin_addr), iparray, sizeof( struct in_addr ));
+ nsSA->type.sa.sa_family = AF_INET;
+ nsSA->length = sizeof( nsSA->type.sin );
+ }
+ }else
+ if (length == sizeof( struct in6_addr ))
+ {
+ nsSA = isc_mem_get(mgr->mctx, sizeof(isc_sockaddr_t));
+ if( nsSA != 0L )
+ {
+ memset(nsSA,'\0', sizeof(isc_sockaddr_t));
+ nsSA_Q = nsSA;
+
+ memcpy(&(nsSA->type.sin6.sin6_addr), iparray, sizeof( struct in6_addr ));
+ nsSA->type.sa.sa_family = AF_INET6;
+ nsSA->length = sizeof( nsSA->type.sin6 );
+ }
+ }
+ }
+ }
+ break;
+
+ case TYPE_STRING:
+
+ ip = 0L;
+ dbus_svc_message_next_arg(dbus, iter, &(ip));
+ if( ip != 0L )
+ {
+ length = strlen(ip);
+ if( strspn(ip, "0123456789.") == length )
+ {
+ nsSA = isc_mem_get(mgr->mctx, sizeof(isc_sockaddr_t));
+ if( nsSA != 0L)
+ {
+ memset(nsSA,'\0', sizeof(isc_sockaddr_t));
+ if( inet_pton( AF_INET, ip, &(nsSA->type.sin.sin_addr)) )
+ {
+ nsSA->type.sa.sa_family = AF_INET;
+ nsSA->length = sizeof(nsSA->type.sin);
+ nsSA_Q = nsSA;
+ }
+ }
+ }else
+ if( strspn(ip, "0123456789AaBbCcDdEeFf:.") == length)
+ {
+ nsSA = isc_mem_get(mgr->mctx, sizeof(isc_sockaddr_t));
+ if( nsSA != 0L )
+ {
+ memset(nsSA,'\0', sizeof(isc_sockaddr_t));
+ if( inet_pton( AF_INET6, ip, &(nsSA->type.sin6.sin6_addr)) )
+ {
+ nsSA->type.sa.sa_family = AF_INET6;
+ nsSA->length = sizeof(nsSA->type.sin6);
+ nsSA_Q = nsSA;
+ }
+ }
+ }
+ }
+ break;
+
+ case TYPE_UINT16:
+
+ if( (nsSA == 0L) || (nsSA->type.sa.sa_family == AF_UNSPEC) )
+ break;
+ else
+ if( nsSA->type.sa.sa_family == AF_INET )
+ dbus_svc_message_next_arg(dbus, iter, &(nsSA->type.sin.sin_port));
+ else
+ if( nsSA->type.sa.sa_family == AF_INET6 )
+ dbus_svc_message_next_arg(dbus, iter, &(nsSA->type.sin6.sin6_port));
+ break;
+
+ case TYPE_BYTE:
+
+ dbus_svc_message_next_arg(dbus, iter, fwdpolicy);
+ if(*fwdpolicy > dns_fwdpolicy_only)
+ *fwdpolicy = dns_fwdpolicy_only;
+ break;
+
+ default:
+
+ if(nsSA != 0L)
+ nsSA->type.sa.sa_family = AF_UNSPEC;
+ sprintf(error_message,"Unhandled argument type: %c", argType);
+ break;
+ }
+
+ if( (nsSA != 0L)
+ &&(nsSA->type.sa.sa_family == AF_UNSPEC)
+ )
+ {
+ sprintf(error_name, "com.redhat.named.InvalidArgument");
+ if( error_message[0]=='\0')
+ {
+ if( nsSA == 0L )
+ sprintf(error_message,"Missing IP Address Name Server argument");
+ else
+ sprintf(error_message,"Bad IP Address Name Server argument");
+ }
+ if( nsSA != 0L )
+ isc_mem_put(mgr->mctx, nsSA, sizeof(isc_sockaddr_t));
+ nsSA = 0L;
+ for( nsSA = ISC_LIST_HEAD( *saList );
+ (nsSA != 0L);
+ nsSA = ISC_LIST_HEAD( *saList )
+ )
+ {
+ if(ISC_LINK_LINKED(nsSA, link))
+ ISC_LIST_DEQUEUE( *saList, nsSA, link );
+ isc_mem_put( mgr->mctx, nsSA, sizeof( isc_sockaddr_t ) );
+ }
+ ISC_LIST_INIT(*saList);
+ return ISC_R_FAILURE;
+ }
+
+ if( nsSA != 0L )
+ {
+ if( nsSA->type.sin.sin_port == 0 )
+ {
+ if( ns_g_port != 0L )
+ nsSA->type.sin.sin_port = htons(ns_g_port);
+ else
+ {
+ result = ns_config_getport(ns_g_config, &(port) );
+ if( result != ISC_R_SUCCESS )
+ port = 53;
+ nsSA->type.sin.sin_port = htons( port );
+ }
+ }
+
+ if( nsSA_Q != 0L )
+ {
+ ISC_LINK_INIT(nsSA,link);
+ ISC_LIST_ENQUEUE(*saList, nsSA, link);
+ nsSA_Q = 0L;
+ }
+ }
+
+ argType = dbus_svc_message_next_arg_type( dbus, iter );
+
+ } while ( argType != TYPE_INVALID );
+
+ return ISC_R_SUCCESS;
+}
+
+static void
+dbus_mgr_handle_set_forwarders
+(
+ ns_dbus_mgr_t *mgr,
+ DBUS_SVC dbus,
+ uint8_t reply_expected,
+ uint32_t serial,
+ const char *path,
+ const char *member,
+ const char *interface,
+ const char *sender,
+ dbus_svc_MessageHandle msg
+)
+{
+ dbus_svc_MessageIterator iter;
+ char error_name[1024]="", error_message[1024]="", *domains=0L;
+ uint32_t argType, new_serial;
+ DNSNameList nameList;
+ dns_name_t *dnsName;
+ SockAddrList saList;
+ isc_sockaddr_t *nsSA;
+ isc_result_t result;
+ uint8_t fwdpolicy = dns_fwdpolicy_only;
+
+ iter = dbus_svc_message_iterator_new( dbus, msg );
+
+ if( iter == 0L )
+ {
+ if( reply_expected )
+ {
+ sprintf(error_name, "com.redhat.named.InvalidArguments");
+ sprintf(error_message,"SetForwarders requires DNS name and nameservers arguments.");
+ dbus_svc_send( dbus, ERROR, serial, &new_serial, sender, path, interface, member,
+ TYPE_STRING, error_name, TYPE_STRING, error_message, TYPE_INVALID
+ );
+ }
+ return;
+ }
+
+ argType = dbus_svc_message_next_arg_type( dbus, iter );
+
+ if( argType != TYPE_STRING )
+ {
+ if( reply_expected )
+ {
+ sprintf(error_name, "com.redhat.named.InvalidArguments");
+ sprintf(error_message,"SetForwarders requires DNS name string initial argument.");
+ dbus_svc_send( dbus, ERROR, serial, &new_serial, sender, path, interface, member,
+ TYPE_STRING, error_name, TYPE_STRING, error_message, TYPE_INVALID
+ );
+ }
+ return;
+ }
+
+ dbus_svc_message_next_arg( dbus, iter, &domains );
+
+ if( ( domains == 0L ) || (*domains == '\0') )
+ {
+ if( reply_expected )
+ {
+ sprintf(error_name, "com.redhat.named.InvalidArguments");
+ sprintf(error_message,"SetForwarders requires DNS name string initial argument.");
+ dbus_svc_send( dbus, ERROR, serial, &new_serial, sender, path, interface, member,
+ TYPE_STRING, error_name, TYPE_STRING, error_message, TYPE_INVALID
+ );
+ }
+ return;
+ }
+
+ dbus_mgr_get_name_list( mgr, domains, &nameList, error_name, error_message );
+
+ if( error_name[0] != '\0' )
+ {
+ if( reply_expected )
+ {
+ dbus_svc_send( dbus, ERROR, serial, &new_serial, sender, path, interface, member,
+ TYPE_STRING, error_name, TYPE_STRING, error_message, TYPE_INVALID
+ );
+ }
+ return;
+ }
+
+ if( ISC_LIST_HEAD( nameList ) == 0L )
+ return;
+
+ result = dbus_mgr_get_sa_list( mgr, iter, &saList , &fwdpolicy, error_name, error_message );
+
+ if( result == ISC_R_SUCCESS )
+ {
+ result = dbus_mgr_set_forwarders( mgr, &nameList, &saList, fwdpolicy );
+
+ if( result != ISC_R_SUCCESS )
+ {
+ if( reply_expected )
+ {
+ sprintf(error_name, "com.redhat.named.Failure");
+ sprintf(error_message, isc_result_totext(result));
+ dbus_svc_send( dbus, ERROR, serial, &new_serial, sender, path, interface, member,
+ TYPE_STRING, error_name, TYPE_STRING, error_message, TYPE_INVALID
+ );
+ }
+ }else
+ if( reply_expected )
+ dbus_svc_send( dbus, RETURN, serial, &new_serial, sender, path, interface, member,
+ TYPE_UINT32, &result, TYPE_INVALID
+ );
+ }else
+ {
+ if( reply_expected )
+ {
+ dbus_svc_send( dbus, ERROR, serial, &new_serial, sender, path, interface, member,
+ TYPE_STRING, error_name, TYPE_STRING, error_message, TYPE_INVALID
+ );
+ }
+ }
+
+ for( dnsName = ISC_LIST_HEAD( nameList );
+ (dnsName != 0L) ;
+ dnsName = ISC_LIST_HEAD( nameList )
+ )
+ {
+ if( ISC_LINK_LINKED(dnsName,link) )
+ ISC_LIST_DEQUEUE( nameList, dnsName, link );
+ isc_mem_put( mgr->mctx, dnsName, sizeof( dns_fixedname_t ) );
+ }
+
+ for( nsSA = ISC_LIST_HEAD(saList);
+ (nsSA != 0L) ;
+ nsSA = ISC_LIST_HEAD(saList)
+ )
+ {
+ if( ISC_LINK_LINKED(nsSA,link) )
+ ISC_LIST_DEQUEUE( saList, nsSA, link );
+ isc_mem_put(mgr->mctx, nsSA, sizeof(isc_sockaddr_t));
+ }
+}
+
+static
+int dbus_mgr_msg_append_dns_name
+( DBUS_SVC dbus,
+ dbus_svc_MessageHandle msg,
+ dns_name_t *name
+)
+{
+ char nameBuf[ DNS_NAME_FORMATSIZE ]="", *nameP=&(nameBuf[0]);
+
+ dns_name_format(name, nameP, DNS_NAME_FORMATSIZE );
+
+ if( *nameP == '\0' )
+ return 0;
+
+ return dbus_svc_message_append_args( dbus, msg, TYPE_STRING, &nameP, TYPE_INVALID ) > 0;
+}
+
+typedef enum dbmoi_e
+{
+ OUTPUT_BINARY,
+ OUTPUT_TEXT
+} DBusMgrOutputInterface;
+
+static
+int dbus_mgr_msg_append_forwarders
+( DBUS_SVC dbus,
+ dbus_svc_MessageHandle msg,
+ dns_forwarders_t *fwdr,
+ DBusMgrOutputInterface outputType
+)
+{
+ isc_sockaddr_t *sa;
+ char policyBuf[16]="", *pbp[1]={&(policyBuf[0])}, addressBuf[64]="", *abp[1]={&(addressBuf[0])};
+ uint8_t *byteArray[1];
+
+ if( outputType == OUTPUT_BINARY )
+ {
+ if(!dbus_svc_message_append_args
+ ( dbus, msg,
+ TYPE_BYTE, &(fwdr->fwdpolicy),
+ TYPE_INVALID
+ )
+ ) return 0;
+ }else
+ if( outputType == OUTPUT_TEXT )
+ {
+ sprintf(policyBuf,"%s",
+ (fwdr->fwdpolicy == dns_fwdpolicy_none)
+ ? "none"
+ : (fwdr->fwdpolicy == dns_fwdpolicy_first)
+ ? "first"
+ : "only"
+ );
+ if(!dbus_svc_message_append_args
+ ( dbus, msg,
+ TYPE_STRING, pbp,
+ TYPE_INVALID
+ )
+ ) return 0;
+ }else
+ return 0;
+
+ for( sa = ISC_LIST_HEAD(fwdr->addrs);
+ sa != 0L;
+ sa = ISC_LIST_NEXT(sa, link)
+ )
+ {
+ if( outputType == OUTPUT_BINARY )
+ {
+ if( sa->type.sa.sa_family == AF_INET )
+ {
+ if(!dbus_svc_message_append_args
+ ( dbus, msg,
+ TYPE_UINT32, &(sa->type.sin.sin_addr.s_addr),
+ TYPE_INVALID
+ )
+ ) return 0;
+
+ if(!dbus_svc_message_append_args
+ ( dbus, msg,
+ TYPE_UINT16, &(sa->type.sin.sin_port),
+ TYPE_INVALID
+ )
+ ) return 0;
+ }else
+ if( sa->type.sa.sa_family == AF_INET6 )
+ {
+ byteArray[0] = (uint8_t*)&(sa->type.sin6.sin6_addr);
+ if(!dbus_svc_message_append_args
+ ( dbus, msg,
+ TYPE_ARRAY, TYPE_BYTE, &byteArray, sizeof(struct in6_addr),
+ TYPE_INVALID
+ )
+ ) return 0;
+
+ if(!dbus_svc_message_append_args
+ ( dbus, msg,
+ TYPE_UINT16, &(sa->type.sin6.sin6_port),
+ TYPE_INVALID
+ )
+ ) return 0;
+ }else
+ continue;
+ }else
+ if( outputType == OUTPUT_TEXT )
+ {
+ if( sa->type.sa.sa_family == AF_INET )
+ {
+ if( inet_ntop( AF_INET, &(sa->type.sin.sin_addr), addressBuf, sizeof(addressBuf)) == 0L )
+ continue;
+ if(!dbus_svc_message_append_args
+ ( dbus, msg,
+ TYPE_STRING, abp,
+ TYPE_INVALID
+ )
+ ) return 0;
+ sprintf(addressBuf, "%hu", ntohs( sa->type.sin.sin_port ));
+ if(!dbus_svc_message_append_args
+ ( dbus, msg,
+ TYPE_STRING, abp,
+ TYPE_INVALID
+ )
+ ) return 0;
+ }else
+ if( sa->type.sa.sa_family == AF_INET6 )
+ {
+ if( inet_ntop( AF_INET6, &(sa->type.sin6.sin6_addr), addressBuf, sizeof(addressBuf)) == 0L )
+ continue;
+ if(!dbus_svc_message_append_args
+ ( dbus, msg,
+ TYPE_STRING, abp,
+ TYPE_INVALID
+ )
+ ) return 0;
+ sprintf(addressBuf, "%hu", ntohs( sa->type.sin6.sin6_port ));
+ if(!dbus_svc_message_append_args
+ ( dbus, msg,
+ TYPE_STRING, abp,
+ TYPE_INVALID
+ )
+ ) return 0;
+ }else
+ continue;
+ }else
+ return 0;
+ }
+ return 1;
+}
+
+typedef struct dbm_m_s
+{
+ DBUS_SVC dbus;
+ dbus_svc_MessageHandle msg;
+ DBusMgrOutputInterface outputType;
+} DBusMgrMsg;
+
+static
+void forwarders_to_msg( dns_name_t *name, dns_forwarders_t *fwdr, void *mp )
+{
+ DBusMgrMsg *m = mp;
+
+ if( (fwdr == 0L) || (name == 0L) || (mp == 0L))
+ return;
+ dbus_mgr_msg_append_dns_name ( m->dbus, m->msg, name );
+ dbus_mgr_msg_append_forwarders( m->dbus, m->msg, fwdr, m->outputType );
+}
+
+static void
+dbus_mgr_handle_list_forwarders
+(
+ DBUS_SVC dbus,
+ uint8_t reply_expected,
+ uint32_t serial,
+ const char *path,
+ const char *member,
+ const char *interface,
+ const char *sender,
+ dbus_svc_MessageHandle msg
+)
+{
+ char error_name[1024], error_message[1024];
+ DBusMgrMsg m;
+ uint32_t new_serial;
+ dns_fwdtable_t *fwdtable = dbus_mgr_get_fwdtable();
+ DBusMgrOutputInterface outputType = OUTPUT_BINARY;
+ uint32_t length = strlen(interface);
+
+ if( !reply_expected )
+ return;
+
+ if( (length > 4) && (strcmp(interface + (length - 4), "text")==0))
+ outputType = OUTPUT_TEXT;
+
+ if( fwdtable == 0L )
+ {
+ sprintf(error_name,"com.redhat.dbus.Failure");
+ sprintf(error_message, "%s", isc_result_totext(ISC_R_NOPERM));
+ dbus_svc_send( dbus, ERROR, serial, &new_serial, sender, path, interface, member,
+ TYPE_STRING, error_name, TYPE_STRING, error_message, TYPE_INVALID
+ );
+ return;
+ }
+
+ msg = dbus_svc_new_message( dbus, RETURN, serial, sender, path, interface, member);
+
+ m.dbus = dbus;
+ m.msg = msg;
+ m.outputType = outputType;
+
+ if( msg == 0L )
+ {
+ sprintf(error_name,"com.redhat.dbus.OutOfMemory");
+ sprintf(error_message,"out of memory");
+ dbus_svc_send( dbus, ERROR, serial, &new_serial, sender, path, interface, member,
+ TYPE_STRING, error_name, TYPE_STRING, error_message, TYPE_INVALID
+ );
+ }
+
+ dns_fwdtable_foreach( fwdtable, forwarders_to_msg, &m );
+
+ dbus_svc_send_message( dbus, msg, &new_serial );
+}
+
+static void
+dbus_mgr_handle_get_forwarders
+(
+ DBUS_SVC dbus,
+ uint8_t reply_expected,
+ uint32_t serial,
+ const char *path,
+ const char *member,
+ const char *interface,
+ const char *sender,
+ dbus_svc_MessageHandle msg
+)
+{
+ char error_name[1024], error_message[1024], *domain=0L;
+ isc_result_t result;
+ dns_fixedname_t fixedname;
+ dns_name_t *dnsName;
+ isc_buffer_t buffer;
+ uint32_t length, new_serial;
+ dns_fwdtable_t *fwdtable;
+ dns_forwarders_t *fwdr=0L;
+ dns_name_t *foundname;
+ dns_fixedname_t fixedFoundName;
+ DBusMgrOutputInterface outputType = OUTPUT_BINARY;
+
+ if( !reply_expected )
+ return;
+
+ length = strlen(interface);
+
+ if( (length > 4) && (strcmp(interface + (length - 4), "text")==0))
+ outputType = OUTPUT_TEXT;
+
+ if( (!dbus_svc_get_args( dbus, msg, TYPE_STRING, &domain, TYPE_INVALID))
+ ||(domain == 0L)
+ ||(*domain == '\0')
+ )
+ {
+
+ sprintf(error_name,"com.redhat.dbus.InvalidArguments");
+ sprintf(error_message,"domain name argument expected");
+ dbus_svc_send( dbus, ERROR, serial, &new_serial, sender, path, interface, member,
+ TYPE_STRING, error_name, TYPE_STRING, error_message, TYPE_INVALID
+ );
+ return;
+ }
+
+ length = strlen( domain );
+
+ isc_buffer_init( &buffer, domain, length);
+
+ isc_buffer_add(&buffer, length);
+
+ dns_fixedname_init(&fixedname);
+
+ dnsName = dns_fixedname_name(&fixedname);
+
+ result = dns_name_fromtext
+ ( dnsName, &buffer, dns_rootname, ISC_FALSE, NULL
+ );
+
+ if( result != ISC_R_SUCCESS )
+ {
+ sprintf(error_name,"com.redhat.dbus.InvalidArguments");
+ sprintf(error_message,"invalid domain name argument: %s", domain);
+ dbus_svc_send( dbus, ERROR, serial, &new_serial, sender, path, interface, member,
+ TYPE_STRING, error_name, TYPE_STRING, error_message, TYPE_INVALID
+ );
+ return;
+ }
+
+ msg = dbus_svc_new_message( dbus, RETURN, serial, sender, path, interface, member);
+
+ if( msg == 0L )
+ {
+ sprintf(error_name,"com.redhat.dbus.OutOfMemory");
+ sprintf(error_message,"out of memory");
+ dbus_svc_send( dbus, ERROR, serial, &new_serial, sender, path, interface, member,
+ TYPE_STRING, error_name, TYPE_STRING, error_message, TYPE_INVALID
+ );
+ return;
+ }
+
+ fwdtable = dbus_mgr_get_fwdtable();
+
+ if( fwdtable == 0L )
+ {
+ sprintf(error_name,"com.redhat.dbus.Failure");
+ sprintf(error_message, "%s", isc_result_totext(ISC_R_NOPERM));
+ dbus_svc_send( dbus, ERROR, serial, &new_serial, sender, path, interface, member,
+ TYPE_STRING, error_name, TYPE_STRING, error_message, TYPE_INVALID
+ );
+ return;
+ }
+
+ dns_fixedname_init(&fixedFoundName);
+ foundname = dns_fixedname_name(&fixedFoundName);
+
+ if( ( dns_fwdtable_find_closest( fwdtable, dnsName, foundname, &fwdr ) == ISC_R_SUCCESS )
+ &&( fwdr != 0L )
+ )
+ {
+ if( (!dbus_mgr_msg_append_dns_name( dbus, msg, foundname ))
+ ||(!dbus_mgr_msg_append_forwarders( dbus, msg, fwdr, outputType ))
+ )
+ {
+ sprintf(error_name,"com.redhat.dbus.OutOfMemory");
+ sprintf(error_message,"out of memory");
+ dbus_svc_send( dbus, ERROR, serial, &new_serial, sender, path, interface, member,
+ TYPE_STRING, error_name, TYPE_STRING, error_message, TYPE_INVALID
+ );
+ return;
+ }
+
+ }else
+ {
+ result = ISC_R_NOTFOUND;
+ if( outputType == OUTPUT_BINARY )
+ {
+ dbus_svc_message_append_args( dbus, msg,
+ TYPE_UINT32, &(result),
+ TYPE_INVALID
+ ) ;
+ }else
+ {
+ sprintf(error_name,"com.redhat.dbus.NotFound");
+ sprintf(error_message,"Not Found");
+ dbus_svc_send( dbus, ERROR, serial, &new_serial, sender, path, interface, member,
+ TYPE_STRING, error_name, TYPE_STRING, error_message, TYPE_INVALID
+ );
+ return;
+ }
+ }
+ dbus_svc_send_message( dbus, msg, &new_serial );
+}
+
+static void
+dbus_mgr_check_dhcdbd_state( ns_dbus_mgr_t *mgr, dbus_svc_MessageHandle msg )
+{
+ DBUS_SVC dbus = mgr->dbus;
+ char *name_owned = 0L,
+ *old_owner = 0L,
+ *new_owner = 0L;
+
+ if( !dbus_svc_get_args( dbus, msg,
+ TYPE_STRING, &name_owned,
+ TYPE_STRING, &old_owner,
+ TYPE_STRING, &new_owner,
+ TYPE_INVALID
+ )
+ ) return;
+
+ dbus_mgr_log_dbg("NameOwnerChanged: %s %s %s ( %s )", name_owned, old_owner, new_owner, mgr->dhcdbd_name);
+
+ if( (name_owned == 0L) || (new_owner == 0L) || (old_owner == 0L) )
+ return;
+
+ if( strcmp( name_owned, "com.redhat.dhcp" ) == 0 )
+ {
+ if( *new_owner == '\0' )
+ {
+ isc_mem_put(mgr->mctx, mgr->dhcdbd_name, strlen(mgr->dhcdbd_name) + 1);
+ mgr->dhcdbd_name = 0L;
+ dbus_mgr_log_err("D-BUS dhcdbd subscription disabled.");
+ return;
+ }
+ if( (mgr->dhcdbd_name == 0L)
+ ||( strcmp( mgr->dhcdbd_name, new_owner) != 0 )
+ )
+ {
+ if( mgr->dhcdbd_name != 0L )
+ {
+ isc_mem_put(mgr->mctx, mgr->dhcdbd_name, strlen(mgr->dhcdbd_name)+1);
+ mgr->dhcdbd_name = 0L;
+ }
+ mgr->dhcdbd_name = isc_mem_get(mgr->mctx, strlen(new_owner) + 1);
+ if( mgr->dhcdbd_name == 0L )
+ return;
+ strcpy( mgr->dhcdbd_name, new_owner );
+ dbus_mgr_subscribe_to_dhcdbd( mgr );
+ }
+ }else
+ if( ( mgr->dhcdbd_name != 0L )
+ && ( strcmp(mgr->dhcdbd_name, name_owned) == 0L )
+ && ( *new_owner == '\0' )
+ )
+ {
+ isc_mem_put(mgr->mctx, mgr->dhcdbd_name, strlen(mgr->dhcdbd_name));
+ mgr->dhcdbd_name = 0L;
+ dbus_mgr_log_err("D-BUS dhcdbd subscription disabled.");
+ }
+}
+
+static int dbus_mgr_dhc_if_comparator( const void *p1, const void *p2 )
+{
+ return( strcmp( ((const DHC_IF*)p1)->if_name, ((const DHC_IF*)p2)->if_name) );
+}
+
+static
+dns_name_t *dbus_mgr_if_reverse_ip_name
+( ns_dbus_mgr_t *mgr,
+ struct in_addr ip_address,
+ struct in_addr subnet_mask
+)
+{
+ dns_name_t *dns_name =0L;
+ dns_fixedname_t *fixedname=0L;
+ char name [ DNS_NAME_FORMATSIZE ], *p;
+ uint32_t ip = (ntohl(ip_address.s_addr) & ntohl(subnet_mask.s_addr)), i;
+ isc_buffer_t buffer;
+ isc_result_t result;
+
+ if( (ip == 0) || (ip == 0xffffffff) )
+ return 0L;
+
+ for(i = 8, p = name; (i < 32); i += 8)
+ if( ip & ( 0xff << i ) )
+ p += sprintf(p, "%u.", (((ip & ( 0xff << i )) >> i ) & 0xff) );
+
+ if( p > name )
+ {
+ p += sprintf(p, "in-addr.arpa");
+ isc_buffer_init( &buffer, name, p - name );
+ isc_buffer_add(&buffer, p - name);
+
+ fixedname = isc_mem_get( mgr->mctx, sizeof( dns_fixedname_t ));
+
+ dns_fixedname_init(fixedname);
+
+ dns_name = dns_fixedname_name(fixedname);
+
+ result= dns_name_fromtext
+ ( dns_name, &buffer, dns_rootname, ISC_FALSE, NULL
+ );
+
+ ISC_LINK_INIT(dns_name, link);
+ if( result == ISC_R_SUCCESS )
+ return dns_name;
+ }
+ return 0L;
+}
+
+static void
+dbus_mgr_free_dhc( void *p )
+{
+ DHC_IF *d_if = p;
+ dns_name_t *dn;
+ isc_sockaddr_t *sa;
+
+ isc_mem_put( ns_g_mctx, d_if->if_name, strlen(d_if->if_name) + 1);
+ for( sa = ISC_LIST_HEAD( d_if->dns );
+ sa != NULL;
+ sa = ISC_LIST_HEAD( d_if->dns )
+ )
+ {
+ if( ISC_LINK_LINKED( sa, link ) )
+ ISC_LIST_UNLINK( d_if->dns, sa, link );
+ isc_mem_put(ns_g_mctx, sa, sizeof(isc_sockaddr_t));
+ }
+ for( dn = ISC_LIST_HEAD( d_if->dn );
+ dn != NULL;
+ dn = ISC_LIST_HEAD( d_if->dn )
+ )
+ {
+ if( ISC_LINK_LINKED( dn, link ) )
+ ISC_LIST_UNLINK( d_if->dn, dn, link );
+ isc_mem_put( ns_g_mctx, dn, sizeof( dns_fixedname_t ) );
+ }
+ isc_mem_put( ns_g_mctx, d_if, sizeof(DHC_IF));
+}
+
+static void
+dbus_mgr_handle_dhcdbd_message
+(
+ ns_dbus_mgr_t *mgr,
+ const char *path,
+ const char *member,
+ dbus_svc_MessageHandle msg
+)
+{
+ DBUS_SVC dbus = mgr->dbus;
+ DHC_IF *d_if, *const*d_ifpp, dif;
+ DHC_State dhc_state;
+ char *if_name, *opt_name, error_name[1024]="", error_message[1024]="";
+ uint8_t *value=0L;
+ uint32_t length;
+ isc_result_t result;
+ isc_sockaddr_t *sa = 0L;
+ dns_name_t *dn = 0L;
+ struct in_addr *ip;
+ in_port_t port;
+ char dnBuf[ DNS_NAME_FORMATSIZE ];
+ isc_buffer_t buffer;
+ DBusMgrInitialFwdr *ifwdr, *const*ifwdpp, ifwd;
+ ISC_LIST(DBusMgrInitialFwdr) ifwdrList;
+ DNSNameList nameList;
+ dbus_mgr_log_dbg("Got dhcdbd message: %s %s %p", path, member, msg );
+
+ if( ( if_name = strrchr(path,'/') ) == 0L )
+ {
+ dbus_mgr_log_err("bad path in dhcdbd message:", path);
+ return;
+ }
+
+ ++if_name;
+ dif.if_name = if_name;
+
+ if( ((d_ifpp=tfind( &dif, &(mgr->dhc_if), dbus_mgr_dhc_if_comparator)) == 0L)
+ ||((d_if = *d_ifpp) == 0L)
+ )
+ {
+ d_if = isc_mem_get( mgr->mctx, sizeof(DHC_IF));
+ if( d_if == 0L )
+ {
+ dbus_mgr_log_err("out of memory");
+ return;
+ }
+ memset(d_if, '\0', sizeof(DHC_IF));
+ if((d_if->if_name = isc_mem_get( mgr->mctx, strlen(if_name) + 1)) == 0L)
+ {
+ dbus_mgr_log_err("out of memory");
+ return;
+ }
+ strcpy(d_if->if_name, if_name);
+ d_if->dhc_state = DHC_INVALID;
+ d_if->previous_state = DHC_INVALID;
+ ISC_LIST_INIT( d_if->dn );
+ ISC_LIST_INIT( d_if->dns );
+ if( tsearch( d_if, &(mgr->dhc_if), dbus_mgr_dhc_if_comparator) == 0L )
+ {
+ dbus_mgr_log_err("out of memory");
+ return;
+ }
+ }
+
+ if( strcmp(member, "reason") == 0 )
+ {
+ if( (!dbus_svc_get_args( dbus, msg,
+ TYPE_STRING, &opt_name,
+ TYPE_ARRAY, TYPE_BYTE, &value, &length,
+ TYPE_INVALID
+ )
+ )
+ ||( value == 0L)
+ ||( length != sizeof(uint32_t))
+ ||( *((uint32_t*)value) > DHC_END_OPTIONS)
+ )
+ {
+ dbus_mgr_log_err("Invalid DHC reason value received from dhcdbd");
+ return;
+ }
+ dhc_state = (DHC_State) *((uint32_t*)value);
+ dbus_mgr_log_dbg("reason: %d %d %d", dhc_state, d_if->dhc_state, d_if->previous_state);
+ switch( dhc_state )
+ {
+
+ case DHC_END_OPTIONS:
+ switch( d_if->dhc_state )
+ {
+ case DHC_END_OPTIONS:
+ break;
+
+ case DHC_RENEW:
+ case DHC_REBIND:
+ if( ( d_if->previous_state != DHC_INVALID )
+ &&( d_if->previous_state != DHC_RELEASE )
+ ) break;
+ /* DHC_RENEW means the same lease parameters were obtained.
+ * Only do configuration if we started up with existing dhclient
+ * which has now renewed - else we are already configured correctly.
+ */
+ dbus_mgr_log_err("D-BUS: existing dhclient for interface %s RENEWed lease", if_name);
+
+ case DHC_REBOOT:
+ case DHC_BOUND:
+ d_if->previous_state = d_if->dhc_state;
+ d_if->dhc_state = DHC_BOUND;
+ if( (dn = dbus_mgr_if_reverse_ip_name(mgr, d_if->ip, d_if->subnet_mask )) != 0L )
+ {
+ ISC_LIST_APPEND(d_if->dn, dn, link );
+ }
+ if( ( ISC_LIST_HEAD( d_if->dn ) != NULL )
+ &&( ISC_LIST_HEAD( d_if->dns ) != NULL )
+ )
+ {
+ dbus_mgr_log_err("D-BUS: dhclient for interface %s acquired new lease - creating forwarders.",
+ if_name
+ );
+ result = dbus_mgr_set_forwarders( mgr, &(d_if->dn), &(d_if->dns), dns_fwdpolicy_only );
+ if( result != ISC_R_SUCCESS )
+ {
+ dbus_mgr_log_err("D-BUS: forwarder configuration failed: %s", isc_result_totext(result));
+ }
+ }
+ break;
+
+ case DHC_STOP:
+ case DHC_TIMEOUT:
+ case DHC_FAIL:
+ case DHC_EXPIRE:
+ case DHC_RELEASE:
+ d_if->previous_state = d_if->dhc_state;
+ d_if->dhc_state = DHC_RELEASE;
+ if( ISC_LIST_HEAD( d_if->dn ) != NULL )
+ {
+ dbus_mgr_log_err("D-BUS: dhclient for interface %s released lease - removing forwarders.",
+ if_name);
+ for( sa = ISC_LIST_HEAD( d_if->dns );
+ sa != 0L;
+ sa = ISC_LIST_HEAD( d_if->dns )
+ )
+ {
+ if( ISC_LINK_LINKED( sa, link ) )
+ ISC_LIST_UNLINK( d_if->dns, sa, link );
+ isc_mem_put( mgr->mctx, sa, sizeof(isc_sockaddr_t));
+ }
+ ISC_LIST_INIT( d_if->dns );
+ ISC_LIST_INIT( ifwdrList );
+
+ for( dn = ISC_LIST_HEAD( d_if->dn );
+ dn != 0L;
+ dn = ISC_LIST_NEXT( dn, link )
+ )
+ {
+ dns_name_init( &(ifwd.dn), NULL );
+ isc_buffer_init( &buffer, dnBuf, DNS_NAME_FORMATSIZE);
+ dns_name_setbuffer( &(ifwd.dn), &buffer);
+ dns_name_copy(dn, &(ifwd.dn), NULL);
+ if( ((ifwdpp = tfind(&ifwd, &(mgr->ifwdt), dbus_mgr_ifwdr_comparator)) != 0L )
+ &&((ifwdr = *ifwdpp) != 0L)
+ )
+ {
+ ISC_LIST_APPEND( ifwdrList, ifwdr, link );
+ }
+ }
+
+ result = dbus_mgr_set_forwarders( mgr, &(d_if->dn), &(d_if->dns), dns_fwdpolicy_none );
+ if( result != ISC_R_SUCCESS )
+ {
+ dbus_mgr_log_err("D-BUS: removal of forwarders failed: %s", isc_result_totext(result));
+ }
+
+ for( dn = ISC_LIST_HEAD( d_if->dn );
+ dn != 0L;
+ dn = ISC_LIST_HEAD( d_if->dn )
+ )
+ {
+ if( ISC_LINK_LINKED( dn, link ) )
+ ISC_LIST_UNLINK( d_if->dn, dn, link );
+ isc_mem_put( mgr->mctx, dn, sizeof( dns_fixedname_t ) );
+ }
+ ISC_LIST_INIT( d_if->dn );
+
+ for( ifwdr = ISC_LIST_HEAD( ifwdrList );
+ ifwdr != 0L;
+ ifwdr = ISC_LIST_HEAD( ifwdrList )
+ )
+ {
+ if( ISC_LINK_LINKED( ifwdr, link ) )
+ ISC_LIST_UNLINK( ifwdrList, ifwdr, link );
+ ISC_LINK_INIT(ifwdr, link);
+ ISC_LIST_INIT(nameList);
+ ISC_LINK_INIT(&(ifwdr->dn), link);
+ ISC_LIST_APPEND( nameList, &(ifwdr->dn), link );
+ result = dbus_mgr_set_forwarders( mgr, &nameList,
+ &(ifwdr->sa),
+ ifwdr->fwdpolicy
+ );
+ if( result != ISC_R_SUCCESS )
+ {
+ dbus_mgr_log_err("D-BUS: restore of forwarders failed: %s", isc_result_totext(result));
+ }
+ }
+ }
+
+ case DHC_ABEND:
+ case DHC_END:
+ case DHC_NBI:
+ case DHC_PREINIT:
+ case DHC_MEDIUM:
+ case DHC_START:
+ case DHC_INVALID:
+ default:
+ break;
+ }
+ break;
+
+ case DHC_BOUND:
+ case DHC_REBOOT:
+ case DHC_REBIND:
+ case DHC_RENEW:
+ case DHC_STOP:
+ case DHC_TIMEOUT:
+ case DHC_FAIL:
+ case DHC_EXPIRE:
+ case DHC_RELEASE:
+ d_if->previous_state = d_if->dhc_state;
+ d_if->dhc_state = dhc_state;
+
+ case DHC_ABEND:
+ case DHC_END:
+ case DHC_NBI:
+ case DHC_PREINIT:
+ case DHC_MEDIUM:
+ case DHC_START:
+ case DHC_INVALID:
+ default:
+ break;
+ }
+ }else
+ if( strcmp( member, "domain_name" ) == 0 )
+ {
+ if( (!dbus_svc_get_args( dbus, msg,
+ TYPE_STRING, &opt_name,
+ TYPE_ARRAY, TYPE_BYTE, &value, &length,
+ TYPE_INVALID
+ )
+ )
+ ||( value == 0L)
+ ||( length == 0)
+ )
+ {
+ dbus_mgr_log_err("Invalid domain_name value received from dhcdbd");
+ return;
+ }
+ dbus_mgr_log_dbg("domain-name %s", (char*)value);
+ dbus_mgr_get_name_list( mgr, (char*)value, &(d_if->dn), error_name, error_message );
+ if( ( error_message[0] != '\0' ) || (ISC_LIST_HEAD(d_if->dn) == 0L ))
+ {
+ dbus_mgr_log_err("Bad domain_name value: %s", error_message );
+ }
+ }else
+ if( strcmp( member, "domain_name_servers") == 0 )
+ {
+ if( (!dbus_svc_get_args( dbus, msg,
+ TYPE_STRING, &opt_name,
+ TYPE_ARRAY, TYPE_BYTE, &value, &length,
+ TYPE_INVALID
+ )
+ )
+ ||( value == 0L)
+ ||( length == 0)
+ )
+ {
+ dbus_mgr_log_err("Invalid domain_name_servers value received from dhcdbd");
+ return;
+ }
+ for(ip = (struct in_addr*) value; ip < ((struct in_addr*)(value + length)); ip++)
+ {
+ dbus_mgr_log_dbg("domain-name-servers: %s", inet_ntop(AF_INET, value, error_name, 16));
+ sa = isc_mem_get(mgr->mctx, sizeof(isc_sockaddr_t));
+ memset(sa, '\0', sizeof(isc_sockaddr_t));
+ sa->type.sin.sin_addr = *ip;
+ sa->type.sa.sa_family = AF_INET;
+ sa->length = sizeof(sa->type.sin);
+ result = ns_config_getport(ns_g_config, &(port) );
+ if( result != ISC_R_SUCCESS )
+ port = 53;
+ sa->type.sin.sin_port = htons( port );
+ ISC_LIST_APPEND(d_if->dns, sa, link);
+ }
+ }else
+ if( strcmp(member, "ip_address") == 0)
+ {
+ if( (!dbus_svc_get_args( dbus, msg,
+ TYPE_STRING, &opt_name,
+ TYPE_ARRAY, TYPE_BYTE, &value, &length,
+ TYPE_INVALID
+ )
+ )
+ ||( value == 0L)
+ ||( length != sizeof(struct in_addr) )
+ )
+ {
+ dbus_mgr_log_err("Invalid ip_address value received from dhcdbd");
+ return;
+ }
+ dbus_mgr_log_dbg("ip-address: %s", inet_ntop(AF_INET, value, error_name, 16));
+ d_if->ip = *((struct in_addr*)value);
+
+ }else
+ if( strcmp(member, "subnet_mask") == 0 )
+ {
+ if( (!dbus_svc_get_args( dbus, msg,
+ TYPE_STRING, &opt_name,
+ TYPE_ARRAY, TYPE_BYTE, &value, &length,
+ TYPE_INVALID
+ )
+ )
+ ||( value == 0L)
+ ||( length != sizeof(struct in_addr) )
+ )
+ {
+ dbus_mgr_log_err("Invalid subnet_mask value received from dhcdbd");
+ return;
+ }
+ dbus_mgr_log_dbg("subnet-mask: %s", inet_ntop(AF_INET, value, error_name, 16));
+ d_if->subnet_mask = *((struct in_addr*)value);
+ }
+}
+
+static
+dbus_svc_HandlerResult
+dbus_mgr_message_handler
+(
+ DBusMsgHandlerArgs
+)
+{
+ char error_name[1024], error_message[1024];
+ ns_dbus_mgr_t *mgr = object;
+ uint32_t new_serial;
+
+ if_suffix = prefix = suffix = prefixObject = 0L;
+
+ dbus_mgr_log_dbg("D-BUS message: %u %u %u %s %s %s %s %s %s",
+ type, reply_expected, serial, destination, path, member, interface, sender, signature
+ );
+
+ if ( ( type == SIGNAL )
+ &&( strcmp(path,"/org/freedesktop/DBus/Local") == 0 )
+ )
+ {
+ if( strcmp(member,"Disconnected") == 0 )
+ dbus_mgr_dbus_shutdown_handler( mgr );
+ }else
+ if( ( type == SIGNAL )
+ &&( strcmp(path,"/org/freedesktop/DBus") == 0 )
+ &&(strcmp(member,"NameOwnerChanged") == 0)
+ &&(strcmp(signature, "sss") == 0)
+ )
+ {
+ dbus_mgr_check_dhcdbd_state( mgr, msg );
+ }else
+ if( ( type == SIGNAL )
+ &&( (sender != 0L) && (mgr->dhcdbd_name != 0L) && (strcmp(sender,mgr->dhcdbd_name) == 0))
+ &&( strcmp(interface,"com.redhat.dhcp.subscribe.binary") == 0 )
+ )
+ {
+ dbus_mgr_handle_dhcdbd_message( mgr, path, member, msg );
+ }else
+ if( (type == CALL)
+ &&( strcmp(destination, DBUSMGR_DESTINATION)==0)
+ &&( strcmp(path, DBUSMGR_OBJECT_PATH)==0)
+ )
+ {
+ if( strcmp(member, "SetForwarders") == 0 )
+ dbus_mgr_handle_set_forwarders
+ ( mgr, dbus, reply_expected, serial, path, member, interface, sender, msg );
+ else
+ if( strcmp(member, "GetForwarders") == 0 )
+ {
+ if( *signature != '\0' )
+ dbus_mgr_handle_get_forwarders
+ ( dbus, reply_expected, serial, path, member, interface, sender, msg );
+ else
+ dbus_mgr_handle_list_forwarders
+ ( dbus, reply_expected, serial, path, member, interface, sender, msg );
+ }else
+ if( reply_expected )
+ {
+ sprintf(error_name, "InvalidOperation");
+ sprintf(error_message, "Unrecognized path / interface / member");
+ dbus_svc_send( dbus, ERROR, serial, &new_serial, sender, path, interface, member,
+ TYPE_STRING, error_name, TYPE_STRING, error_message, TYPE_INVALID
+ );
+ }
+ }
+ return HANDLED;
+}
+
+static void
+dbus_mgr_read_watch_activated(isc_task_t *t, isc_event_t *ev)
+{
+ DBusMgrSocket *sfd = (DBusMgrSocket*)(ev->ev_arg);
+ t = t;
+ isc_mem_put(sfd->mgr->mctx, ev, ev->ev_size);
+ dbus_mgr_log_dbg("watch %d READ",sfd->fd);
+ isc_socket_fd_handle_reads( sfd->sock, sfd->ser );
+ dbus_svc_handle_watch( sfd->mgr->dbus, sfd->fd, WATCH_ENABLE | WATCH_READ );
+}
+
+static void
+dbus_mgr_write_watch_activated(isc_task_t *t, isc_event_t *ev)
+{
+ DBusMgrSocket *sfd = (DBusMgrSocket*)(ev->ev_arg);
+ t = t;
+ isc_mem_put(sfd->mgr->mctx, ev, ev->ev_size);
+ dbus_mgr_log_dbg("watch %d WRITE",sfd->fd);
+ isc_socket_fd_handle_writes( sfd->sock, sfd->ser );
+ dbus_svc_handle_watch( sfd->mgr->dbus, sfd->fd, WATCH_ENABLE | WATCH_WRITE );
+}
+
+static void
+dbus_mgr_watches_selected(isc_task_t *t, isc_event_t *ev)
+{
+ ns_dbus_mgr_t *mgr = (ns_dbus_mgr_t*)(ev->ev_arg);
+ t = t;
+ isc_mem_put(mgr->mctx, ev, ev->ev_size);
+ if( ( mgr->dbus == 0L ) || (mgr->sockets == 0L))
+ {
+ return;
+ }
+ dbus_mgr_log_dbg("watches selected");
+ dbus_svc_dispatch( mgr->dbus );
+ dbus_mgr_log_dbg("dispatch complete");
+}
+
+static int dbus_mgr_socket_comparator( const void *p1, const void *p2 )
+{
+ return( ( ((const DBusMgrSocket*)p1)->fd
+ == ((const DBusMgrSocket*)p2)->fd
+ ) ? 0
+ : ( ((const DBusMgrSocket*)p1)->fd
+ > ((const DBusMgrSocket*)p2)->fd
+ ) ? 1
+ : -1
+ );
+}
+
+static void
+dbus_mgr_watch_handler( int fd, dbus_svc_WatchFlags flags, void *mgrp )
+{
+ ns_dbus_mgr_t *mgr = mgrp;
+ DBusMgrSocket sockFd, *sfd=0L, *const*spp=0L;
+ isc_result_t result=ISC_R_SUCCESS;
+ isc_socketevent_t *sev;
+ isc_event_t *pev[1];
+
+ if(mgr == 0L)
+ return;
+
+ if( (flags & 7) == WATCH_ERROR )
+ return;
+
+ sockFd.fd = fd;
+
+ dbus_mgr_log_dbg("watch handler: fd %d %d", fd, flags);
+
+ if( ((spp = tfind( &sockFd, &(mgr->sockets), dbus_mgr_socket_comparator) ) == 0L )
+ ||((sfd = *spp) == 0L )
+ )
+ {
+ if( ( flags & WATCH_ENABLE ) == 0 )
+ return;
+
+ sfd = isc_mem_get(mgr->mctx, sizeof(DBusMgrSocket));
+ if( sfd == 0L )
+ {
+ dbus_mgr_log_err("dbus_mgr: out of memory" );
+ return;
+ }
+ sfd->fd = fd;
+ sfd->mgr = mgr;
+ sfd->ser = sfd->sew = sfd->sel = 0L;
+
+ if( tsearch(sfd, &(mgr->sockets), dbus_mgr_socket_comparator) == 0L )
+ {
+ dbus_mgr_log_err("dbus_mgr: out of memory" );
+ isc_mem_put(mgr->mctx, sfd, sizeof(DBusMgrSocket));
+ return;
+ }
+ sfd->sock = 0L;
+ result = isc_socket_create( mgr->socketmgr, fd, isc_sockettype_fd, &(sfd->sock) );
+ if( result != ISC_R_SUCCESS )
+ {
+ dbus_mgr_log_err("dbus_mgr: isc_socket_create failed: %s",
+ isc_result_totext(result)
+ );
+ tdelete(sfd, &(mgr->sockets), dbus_mgr_socket_comparator);
+ isc_mem_put(mgr->mctx, sfd, sizeof(DBusMgrSocket));
+ return;
+ }
+ }
+
+ if( (flags & WATCH_ENABLE) == WATCH_ENABLE )
+ {
+ if( (flags & WATCH_READ) == WATCH_READ )
+ {
+ if( sfd->ser == 0L )
+ {
+ sfd->ser = (isc_socketevent_t *)
+ isc_event_allocate
+ (
+ mgr->mctx, mgr->task,
+ ISC_SOCKEVENT_READ_READY,
+ dbus_mgr_read_watch_activated,
+ sfd,
+ sizeof(isc_socketevent_t)
+ );
+
+ if( sfd->ser == 0L )
+ {
+ dbus_mgr_log_err("dbus_mgr: out of memory" );
+ tdelete(sfd, &(mgr->sockets), dbus_mgr_socket_comparator);
+ isc_mem_put(mgr->mctx, sfd, sizeof(DBusMgrSocket));
+ return;
+ }
+
+ sev = isc_socket_fd_handle_reads(sfd->sock, sfd->ser );
+
+ }else
+ {
+ sev = isc_socket_fd_handle_reads(sfd->sock, sfd->ser );
+ }
+ }
+ if( (flags & WATCH_WRITE) == WATCH_WRITE )
+ {
+ if( sfd->sew == 0L )
+ {
+ sfd->sew = (isc_socketevent_t *)
+ isc_event_allocate
+ (
+ mgr->mctx, mgr->task,
+ ISC_SOCKEVENT_WRITE_READY,
+ dbus_mgr_write_watch_activated,
+ sfd,
+ sizeof(isc_socketevent_t)
+ );
+ if( sfd->sew == 0L )
+ {
+ dbus_mgr_log_err("dbus_mgr: out of memory" );
+ tdelete(sfd, &(mgr->sockets), dbus_mgr_socket_comparator);
+ isc_mem_put(mgr->mctx, sfd, sizeof(DBusMgrSocket));
+ return;
+ }
+
+ sev = isc_socket_fd_handle_writes(sfd->sock, sfd->sew );
+
+ }else
+ {
+ sev = isc_socket_fd_handle_writes(sfd->sock, sfd->sew );
+ }
+ }
+ if( (sfd->ser != 0L) || (sfd->sew != 0L) )
+ {
+ if( sfd->sel == 0L )
+ {
+ sfd->sel = (isc_socketevent_t *)
+ isc_event_allocate
+ (
+ mgr->mctx, mgr->task,
+ ISC_SOCKEVENT_SELECTED,
+ dbus_mgr_watches_selected,
+ mgr,
+ sizeof(isc_socketevent_t)
+ );
+ if( sfd->sel == 0L )
+ {
+ dbus_mgr_log_err("dbus_mgr: out of memory" );
+ tdelete(sfd, &(mgr->sockets), dbus_mgr_socket_comparator);
+ isc_mem_put(mgr->mctx, sfd, sizeof(DBusMgrSocket));
+ return;
+ }
+
+ sev = isc_socket_fd_handle_selected(sfd->sock, sfd->sel );
+
+ }else
+ {
+ sev = isc_socket_fd_handle_selected(sfd->sock, sfd->sel);
+ }
+ }
+ }else
+ {
+ dbus_mgr_log_dbg("watch %d disabled",fd);
+ if(flags & WATCH_READ)
+ {
+ sev = isc_socket_fd_handle_reads( sfd->sock, 0L );
+ if( sev != 0L )
+ {
+ pev[0]=(isc_event_t*)sev;
+ isc_event_free(pev);
+ }
+ sfd->ser = 0L;
+ }
+
+ if( flags & WATCH_WRITE )
+ {
+ sev = isc_socket_fd_handle_writes( sfd->sock, 0L );
+ if( sev != 0L )
+ {
+ pev[0]=(isc_event_t*)sev;
+ isc_event_free(pev);
+ }
+ sfd->sew = 0L;
+ }
+
+ if( (sfd->ser == 0L) && (sfd->sew == 0L) )
+ {
+ sev = isc_socket_fd_handle_selected( sfd->sock, 0L );
+ if( sev != 0L )
+ {
+ pev[0]=(isc_event_t*)sev;
+ isc_event_free(pev);
+ }
+ sfd->sel = 0L;
+
+ tdelete(sfd, &(mgr->sockets), dbus_mgr_socket_comparator);
+
+ isc_mem_put(mgr->mctx, sfd, sizeof(DBusMgrSocket));
+ }
+ }
+}
+
+static
+void dbus_mgr_close_socket( const void *p, const VISIT which, const int level)
+{
+ DBusMgrSocket *const*spp=p, *sfd;
+ isc_event_t *ev ;
+ int i = level ? 0 :1;
+ i &= i;
+
+ if( (spp==0L) || ((sfd = *spp)==0L)
+ ||((which != leaf) && (which != postorder))
+ ) return;
+
+ if( sfd->ser != 0L )
+ {
+ ev = (isc_event_t *)isc_socket_fd_handle_reads(sfd->sock, 0);
+ if( ev != 0L )
+ isc_event_free((isc_event_t **)&ev);
+ sfd->ser = 0L;
+ }
+
+ if( sfd->sew != 0L )
+ {
+ ev = (isc_event_t *)isc_socket_fd_handle_writes(sfd->sock, 0);
+ if( ev != 0L )
+ isc_event_free((isc_event_t **)&ev);
+ sfd->sew = 0L;
+ }
+
+ if( sfd->sel != 0L )
+ {
+ ev = (isc_event_t *)isc_socket_fd_handle_selected(sfd->sock, 0);
+ if( ev != 0L )
+ isc_event_free((isc_event_t **)&ev);
+ sfd->sel = 0L;
+ dbus_mgr_log_dbg("CLOSED socket %d", sfd->fd);
+ }
+}
+
+static
+void dbus_mgr_destroy_socket( void *p )
+{
+ DBusMgrSocket *sfd = p;
+
+ isc_mem_put( sfd->mgr->mctx, sfd, sizeof(DBusMgrSocket) );
+}
diff --git a/contrib/dbus/dbus_mgr.h b/contrib/dbus/dbus_mgr.h
new file mode 100644
index 0000000..78be0d0
--- /dev/null
+++ b/contrib/dbus/dbus_mgr.h
@@ -0,0 +1,37 @@
+/* dbus_mgr.h
+ *
+ * named module to provide dynamic forwarding zones in
+ * response to D-BUS dhcp events
+ *
+ * Copyright(C) Jason Vas Dias, Red Hat Inc., 2005
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation at
+ * http://www.fsf.org/licensing/licenses/gpl.txt
+ * and included in this software distribution as the "LICENSE" file.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+extern isc_result_t
+dbus_mgr_create
+( isc_mem_t *mctx,
+ isc_taskmgr_t *taskmgr,
+ isc_socketmgr_t *socketmgr,
+ isc_timermgr_t *timermgr,
+ ns_dbus_mgr_t **dbus_mgr
+);
+
+extern void
+dbus_mgr_shutdown
+( ns_dbus_mgr_t *dus_mgr_t
+);
+
+
+
+
+
diff --git a/contrib/dbus/dbus_service.c b/contrib/dbus/dbus_service.c
new file mode 100644
index 0000000..47d55d5
--- /dev/null
+++ b/contrib/dbus/dbus_service.c
@@ -0,0 +1,1161 @@
+/* dbus_service.c
+ *
+ * D-BUS Service Utilities
+ *
+ * Provides MINIMAL utilities for construction of D-BUS "Services".
+ *
+ * Copyright(C) Jason Vas Dias, Red Hat Inc., 2005
+ * Modified by Adam Tkac, Red Hat Inc., 2007
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation at
+ * http://www.fsf.org/licensing/licenses/gpl.txt
+ * and included in this software distribution as the "LICENSE" file.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <linux/limits.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/select.h>
+#include <sys/wait.h>
+#include <sys/ioctl.h>
+#include <time.h>
+#include <signal.h>
+#include <syslog.h>
+#include <fcntl.h>
+#include <string.h>
+extern size_t strnlen(const char *s, size_t maxlen);
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <ifaddrs.h>
+#include <search.h>
+#include <getopt.h>
+typedef void (*__free_fn_t) (void *__nodep);
+extern void tdestroy (void *__root, __free_fn_t __freefct);
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <errno.h>
+#define DBUS_API_SUBJECT_TO_CHANGE "Very Annoying and Silly!"
+#include <dbus/dbus.h>
+
+#include <named/dbus_service.h>
+#include <isc/result.h>
+
+typedef struct dbcs_s
+{
+ DBusConnection *connection;
+ DBusDispatchStatus dispatchStatus;
+ uint32_t status;
+ dbus_svc_WatchHandler wh;
+ void * wh_arg;
+ const char * unique_name;
+ dbus_svc_MessageHandler mh;
+ void * def_mh_obj;
+ dbus_svc_MessageHandler mf;
+ void * def_mf_obj;
+ dbus_svc_ShutdownHandler sh;
+ void * sh_obj;
+ dbus_svc_ErrorHandler eh;
+ dbus_svc_ErrorHandler dh;
+ /*{ glibc b-trees: */
+ void * roots;
+ void * timeouts;
+ void * watches;
+ void * filters;
+ /*}*/
+ int n;
+ fd_set r_fds;
+ fd_set s_r_fds;
+ fd_set w_fds;
+ fd_set s_w_fds;
+ fd_set e_fds;
+ fd_set s_e_fds;
+ DBusMessage *currentMessage;
+ int rejectMessage;
+} DBusConnectionState;
+
+typedef struct root_s
+{
+ char *path;
+ char *if_prefix;
+ DBUS_SVC cs;
+ dbus_svc_MessageHandler mh;
+ void *object;
+ void *tree;
+} Root;
+
+typedef struct mhn_s
+{
+ char *path;
+ dbus_svc_MessageHandler mh;
+ void *object;
+} MessageHandlerNode;
+
+typedef struct mfn_s
+{
+ DBusConnectionState *cs;
+ dbus_svc_MessageHandler mf;
+ void *obj;
+ int n_matches;
+ char **matches;
+} MessageFilterNode;
+
+typedef struct dbto_s
+{
+ DBusTimeout *to;
+ DBusConnectionState *cs;
+ struct timeval tv;
+} DBusConnectionTimeout;
+
+static void no_free( void *p){ p=0; }
+
+static int ptr_key_comparator( const void *p1, const void *p2 )
+{
+ return
+ ( (p1 == p2)
+ ? 0
+ :( (p1 > p2)
+ ? 1
+ : -1
+ )
+ );
+}
+
+static DBusHandlerResult
+default_message_filter
+( DBusConnection *connection,
+ DBusMessage *message,
+ void *p
+)
+{
+ DBusConnectionState *cs = p;
+ uint32_t type =dbus_message_get_type( message ),
+ serial =dbus_message_get_serial( message );
+ uint8_t reply =dbus_message_get_no_reply( message )==0;
+ const char
+ *path = dbus_message_get_path( message ),
+ *dest = dbus_message_get_destination( message ),
+ *member = dbus_message_get_member( message ),
+ *interface=dbus_message_get_interface( message ),
+ *sender =dbus_message_get_sender( message ),
+ *signature=dbus_message_get_signature( message );
+ connection = connection;
+ if(cs->mf)
+ return
+ (*(cs->mf))( cs, type, reply, serial, dest, path, member, interface, 0L,
+ sender, signature, message, 0L, 0L, 0L, cs->def_mf_obj
+ ) ;
+ return HANDLED;
+}
+
+uint8_t
+dbus_svc_add_filter
+( DBusConnectionState *cs, dbus_svc_MessageHandler mh, void *obj, int n_matches, ... )
+{
+ DBusError error;
+ va_list va;
+ char *m;
+
+ va_start(va, n_matches );
+
+ cs->mf = mh;
+ cs->def_mf_obj = obj;
+
+ if ( ! dbus_connection_add_filter (cs->connection, default_message_filter, cs, NULL))
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_add_filter: dbus_connection_add_filter failed");
+ va_end(va);
+ return( 0 );
+ }
+
+ if( n_matches )
+ {
+ memset(&error,'\0',sizeof(DBusError));
+ dbus_error_init(&error);
+ while( n_matches-- )
+ {
+ m = va_arg(va, char* ) ;
+
+ dbus_bus_add_match(cs->connection, m, &error);
+
+ if( dbus_error_is_set(&error))
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_add_filter: dbus_bus_add_match failed for %s: %s %s",
+ m, error.name, error.message
+ );
+ va_end(va);
+ return(0);
+ }
+ }
+ }
+ va_end(va);
+ return( 1 );
+}
+
+
+uint8_t
+dbus_svc_get_args_va(DBusConnectionState *cs, DBusMessage* msg, dbus_svc_DataType firstType, va_list va)
+{
+ DBusError error;
+ memset(&error,'\0',sizeof(DBusError));
+ dbus_error_init(&error);
+ if( (!dbus_message_get_args_valist(msg, &error, firstType, va)) || dbus_error_is_set(&error) )
+ {
+ if( dbus_error_is_set(&error) )
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_get_args failed: %s %s",error.name, error.message);
+ dbus_error_free(&error);
+ }else
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_get_args failed: dbus_message_get_args_valist failed");
+ return( 0 );
+ }
+ return( 1 );
+}
+
+uint8_t
+dbus_svc_get_args(DBusConnectionState *cs, DBusMessage* msg, dbus_svc_DataType firstType, ...)
+{
+ va_list va;
+ uint8_t r;
+ va_start(va, firstType);
+ r = dbus_svc_get_args_va( cs, msg, firstType, va);
+ va_end(va);
+ return r;
+}
+
+uint8_t
+dbus_svc_send_va
+( DBusConnectionState *cs,
+ dbus_svc_MessageType type,
+ int32_t reply_serial,
+ uint32_t *new_serial,
+ const char *destination,
+ const char *path,
+ const char *interface,
+ const char *member,
+ dbus_svc_DataType firstType,
+ va_list va
+)
+{
+ DBusMessageIter iter;
+ char *e;
+ DBusMessage *msg =
+ dbus_svc_new_message
+ ( cs,
+ type,
+ reply_serial,
+ destination,
+ path,
+ interface,
+ member
+ );
+
+ if(msg == 0L)
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_send: dbus_svc_new_message failed");
+ return 0;
+ }
+
+ if( type != DBUS_MESSAGE_TYPE_ERROR )
+ {
+ if( !dbus_message_append_args_valist( msg, firstType, va ) )
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_send: dbus_message_append_args_valist failed");
+ return 0;
+ }
+ }else
+ {
+ if( firstType == DBUS_TYPE_STRING )
+ {
+ e = 0L;
+ e = va_arg( va, char* );
+ if( (e == 0L) || !dbus_message_set_error_name( msg, e ) )
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_send: dbus_message_set_error_name failed");
+ return 0;
+ }
+ firstType = va_arg(va, int);
+ if( firstType == DBUS_TYPE_STRING )
+ {
+ e = 0L;
+ e = va_arg( va, char* );
+ if( e == 0L )
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_send: NULL error message");
+ return 0;
+ }
+ dbus_message_iter_init_append (msg, &iter);
+ if( !dbus_message_iter_append_basic
+ (&iter, DBUS_TYPE_STRING, &e)
+ )
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_send: dbus_message_iter_append_basic failed");
+ return 0;
+ }
+ }
+ }else
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_send: unhandled type for error name: %c", firstType);
+ return 0;
+ }
+ }
+
+ if( !dbus_connection_send(cs->connection, msg, new_serial) )
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_send: dbus_message_send failed");
+ return 0;
+ }
+ if( cs->dh != 0L ) (*(cs->dh))("Sending message");
+ dbus_connection_flush(cs->connection);
+ return 1;
+}
+
+uint8_t
+dbus_svc_send
+( DBusConnectionState *cs,
+ dbus_svc_MessageType type,
+ int32_t reply_serial,
+ uint32_t *new_serial,
+ const char *destination,
+ const char *path,
+ const char *interface,
+ const char *member,
+ dbus_svc_DataType firstType,
+ ...
+)
+{
+ uint8_t r;
+ va_list va;
+ va_start(va, firstType);
+ r = dbus_svc_send_va(cs, type, reply_serial, new_serial, destination, path,interface,member,firstType,va);
+ va_end(va);
+ return ( r ) ;
+}
+
+dbus_svc_MessageHandle
+dbus_svc_new_message
+( DBusConnectionState* cs,
+ dbus_svc_MessageType type,
+ int32_t reply_serial,
+ const char *destination,
+ const char *path,
+ const char *interface,
+ const char *member
+)
+{
+ DBusMessage *msg = dbus_message_new(type);
+
+ if( msg == 0L)
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_new_message: dbus_message_set_reply_serial failed");
+ return 0;
+ }
+
+ if( reply_serial != -1 )
+ {
+ if( !dbus_message_set_reply_serial(msg,reply_serial) )
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_new_message: dbus_message_set_reply_serial failed");
+ return 0;
+ }
+ }
+
+ if( (destination !=0L) && !dbus_message_set_destination(msg, destination) )
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_new_message: dbus_message_set_destination failed");
+ return 0;
+ }
+
+ if( !dbus_message_set_path(msg, path) )
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_new_message: dbus_message_set_path failed");
+ return 0;
+ }
+
+ if( ! dbus_message_set_interface(msg,interface) )
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_new_message: dbus_message_set_interface failed - %s", interface);
+ return 0;
+ }
+
+ if( !dbus_message_set_member(msg,member) )
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_new_message: dbus_message_set_member failed");
+ return 0;
+ }
+
+ return msg;
+}
+
+extern uint8_t
+dbus_svc_send_message
+(
+ DBusConnectionState *cs,
+ dbus_svc_MessageHandle msg,
+ uint32_t *new_serial
+)
+{
+ if( !dbus_connection_send(cs->connection, msg, new_serial) )
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_send: dbus_message_send failed");
+ return 0;
+ }
+ if( cs->dh != 0L ) (*(cs->dh))("Sending message");
+ dbus_connection_flush(cs->connection);
+ return 1;
+}
+
+uint8_t
+dbus_svc_message_append_args(DBusConnectionState *cs, dbus_svc_MessageHandle msg, dbus_svc_DataType firstType, ...)
+{
+ va_list va;
+ va_start(va, firstType);
+ if( !dbus_message_append_args_valist( msg, firstType, va ) )
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_send: dbus_message_append_args failed");
+ va_end(va);
+ return 0;
+ }
+ va_end(va);
+ return ( 1 ) ;
+}
+
+dbus_svc_MessageHandle
+dbus_svc_call
+( DBusConnectionState *cs,
+ const char *destination,
+ const char *path,
+ const char *member,
+ const char *interface,
+ dbus_svc_DataType firstType,
+ ...
+)
+{
+ DBusMessage *message=0L, *reply=0L;
+ va_list va;
+ DBusError error;
+ int reply_timeout=20000;
+
+ va_start(va, firstType);
+
+ memset(&error,'\0',sizeof(DBusError));
+ dbus_error_init(&error);
+
+ if(( message =
+ dbus_message_new_method_call
+ ( destination,
+ path,
+ interface,
+ member
+ )
+ ) == 0L
+ )
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_call: dbus_message_new_method_call failed");
+ va_end(va);
+ return(0L);
+ };
+
+ if( !dbus_message_append_args_valist( message, firstType, va ) )
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_call: dbus_message_append_args_valist failed");
+ va_end(va);
+ return(0L);
+ }
+
+ if((reply =
+ dbus_connection_send_with_reply_and_block
+ (cs->connection,
+ message, reply_timeout,
+ &error
+ )
+ ) == 0L
+ )
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_call: dbus_message_send_with_reply_and_block failed: %s %s",
+ error.name, error.message
+ );
+ va_end(va);
+ return(0L);
+ }
+ va_end(va);
+ return reply;
+}
+
+dbus_svc_MessageIterator
+dbus_svc_message_iterator_new( DBusConnectionState *cs, DBusMessage *msg)
+{
+ DBusMessageIter *iter = malloc( sizeof(DBusMessageIter) );
+ void *p =cs;
+ p++;
+ if( iter != 0L )
+ {
+ if( !dbus_message_iter_init( msg, iter ))
+ {
+ free( iter ) ;
+ iter = 0L;
+ }
+ }
+ return iter;
+}
+
+uint32_t
+dbus_svc_message_next_arg_type( DBusConnectionState *cs, dbus_svc_MessageIterator iter )
+{
+ void *p =cs;
+ p++;
+ return dbus_message_iter_get_arg_type( iter );
+}
+
+void
+dbus_svc_message_next_arg( DBusConnectionState *cs, dbus_svc_MessageIterator iter, void *value )
+{
+ void *p =cs;
+ p++;
+ dbus_message_iter_get_basic( iter, value );
+ dbus_message_iter_next( iter );
+}
+
+uint32_t
+dbus_svc_message_element_type(DBusConnectionState *cs , dbus_svc_MessageIterator iter)
+{
+ void *p =cs;
+ p++;
+ return dbus_message_iter_get_element_type(iter);
+}
+
+void
+dbus_svc_message_get_elements( DBusConnectionState *cs , dbus_svc_MessageIterator iter, uint32_t *n, void *array )
+{
+ void *p =cs;
+ p++;
+ dbus_message_iter_get_fixed_array( iter, n, array);
+}
+
+void dbus_svc_message_iterator_free( DBusConnectionState *cs, dbus_svc_MessageIterator iter )
+{
+ void *p =cs;
+ p++;
+ free( iter );
+}
+
+uint8_t dbus_svc_message_type( DBusMessage *msg )
+{
+ return dbus_message_get_type( msg );
+}
+
+static DBusConnectionState *
+dbcs_new( DBusConnection *connection )
+{
+ DBusConnectionState *dbcs = (DBusConnectionState *) malloc( sizeof(DBusConnectionState) );
+ if ( dbcs )
+ {
+ memset( dbcs, '\0', sizeof( DBusConnectionState ));
+ dbcs->connection = connection;
+ }
+ return(dbcs);
+}
+
+static DBusConnectionTimeout *
+timeout_new( DBusTimeout *timeout )
+{
+ DBusConnectionTimeout *to = (DBusConnectionTimeout *) malloc ( sizeof(DBusConnectionTimeout) );
+ if( to != 0L )
+ {
+ to->to = timeout;
+ dbus_timeout_set_data(timeout, to, 0L);
+ if( dbus_timeout_get_enabled(timeout) )
+ gettimeofday(&(to->tv),0L);
+ else
+ {
+ to->tv.tv_sec = 0 ;
+ to->tv.tv_usec = 0 ;
+ }
+ }
+ return( to );
+}
+
+static dbus_bool_t
+add_timeout( DBusTimeout *timeout, void *csp )
+{
+ DBusConnectionState *cs = csp;
+ DBusConnectionTimeout *to = timeout_new(timeout);
+ if( cs->dh != 0L ) (*(cs->dh))("add_timeout: %d", dbus_timeout_get_interval(timeout));
+ to->cs = cs;
+ if ( to )
+ {
+ if( tsearch((void*)to, &(cs->timeouts), ptr_key_comparator) != 0L )
+ return TRUE;
+ }
+ if( cs->eh != 0L ) (*(cs->eh))("add_timeout: out of memory");
+ return FALSE;
+}
+
+static void
+remove_timeout( DBusTimeout *timeout, void *csp )
+{
+ DBusConnectionState *cs = csp;
+ DBusConnectionTimeout *to = dbus_timeout_get_data(timeout);
+ if( (to != 0L) && (to->to == timeout) )
+ {
+ if( cs->dh != 0L ) (*(cs->dh))("remove_timeout: %d", dbus_timeout_get_interval(to->to));
+ if( tdelete((const void*)to, &(cs->timeouts), ptr_key_comparator) != 0L )
+ {
+ free(to);
+ }else
+ if( cs->eh != 0L ) (*(cs->eh))("remove_timeout: can't happen?!?: timeout data %p not found", to);
+ }else
+ if( cs->eh != 0L ) (*(cs->eh))("remove_timeout: can't happen?!?: timeout %p did not record data %p %p",
+ timeout, to, ((to != 0L) ? to->to : 0L)
+ );
+}
+
+static void
+toggle_timeout( DBusTimeout *timeout, void *csp )
+{
+ DBusConnectionState *cs = csp;
+ DBusConnectionTimeout **top = tfind( (const void*) dbus_timeout_get_data(timeout),
+ &(cs->timeouts),
+ ptr_key_comparator
+ ),
+ *to=0L;
+ if( (top != 0L) && ((to=*top) != 0L) && (to->to == timeout) )
+ {
+ if( cs->dh != 0L ) (*(cs->dh))("toggle_timeout: %d", dbus_timeout_get_interval(to->to));
+ if( dbus_timeout_get_enabled(timeout) )
+ gettimeofday(&(to->tv),0L);
+ else
+ {
+ to->tv.tv_sec = 0 ;
+ to->tv.tv_usec = 0 ;
+ }
+ }else
+ if( cs->eh != 0L ) (*(cs->eh))("toggle_timeout: can't happen?!?: timeout %p %s %p %p", timeout,
+ ((to==0L) ? "did not record data" : "not found"),
+ to, ((to != 0L) ? to->to : 0L)
+ );
+}
+
+static void
+process_timeout( const void *p, const VISIT which, const int level)
+{
+ DBusConnectionState *cs;
+ void * const *tpp = p;
+ DBusConnectionTimeout *to;
+ struct timeval tv;
+ float now, then, interval;
+ int l = level ? 1 : 0;
+ l=l;
+
+ gettimeofday(&tv,0L);
+
+ if( (tpp != 0L) && (*tpp != 0L) && ((which == postorder) || (which == leaf)) )
+ {
+ to = (DBusConnectionTimeout*)*tpp;
+ cs = to->cs;
+ if ( !dbus_timeout_get_enabled(to->to) )
+ return;
+ cs = dbus_timeout_get_data(to->to);
+ then = ((float)to->tv.tv_sec) + (((float)to->tv.tv_usec) / 1000000.0);
+ if( then != 0.0 )
+ {
+ interval = ((float)dbus_timeout_get_interval(to->to)) / 1000.0;
+ now = ((float)tv.tv_sec) + (( (float)tv.tv_usec) / 1000000.0);
+ if( (now - then) >= interval )
+ {
+ if( cs->dh != 0L ) (*(cs->dh))("handle_timeout: %d - %f %f %f", dbus_timeout_get_interval(to->to), then, now, interval);
+ dbus_timeout_handle( to->to );
+ to->tv=tv;
+ }
+ }else
+ {
+ to->tv = tv;
+ }
+ }
+}
+
+static void
+process_timeouts ( DBusConnectionState *cs )
+{
+ twalk( cs->timeouts, process_timeout );
+}
+
+static void
+set_watch_fds( DBusWatch *watch, DBusConnectionState *cs )
+{
+ uint8_t flags = dbus_watch_get_flags(watch);
+ int fd = dbus_watch_get_fd(watch);
+
+ if ( cs->n <= fd )
+ cs->n = fd + 1;
+
+ if ( dbus_watch_get_enabled(watch) )
+ {
+ if ( flags & DBUS_WATCH_READABLE )
+ {
+ FD_SET(fd , &(cs->r_fds));
+ if( cs->wh != 0L )
+ (*(cs->wh))( fd, WATCH_ENABLE | WATCH_READ, cs->wh_arg );
+ }else
+ {
+ FD_CLR(fd , &(cs->r_fds));
+ if( cs->wh != 0L )
+ (*(cs->wh))( fd, WATCH_READ, cs->wh_arg );
+ }
+
+ if ( flags & DBUS_WATCH_WRITABLE )
+ {
+ FD_SET(fd , &(cs->w_fds));
+ if( cs->wh != 0L )
+ (*(cs->wh))( fd, WATCH_ENABLE | WATCH_WRITE, cs->wh_arg );
+ }else
+ {
+ FD_CLR(fd , &(cs->w_fds));
+ if( cs->wh != 0L )
+ (*(cs->wh))( fd, WATCH_WRITE, cs->wh_arg );
+ }
+ if ( flags & DBUS_WATCH_ERROR )
+ {
+ FD_SET(fd , &(cs->e_fds));
+ if( cs->wh != 0L )
+ (*(cs->wh))( fd, WATCH_ENABLE | WATCH_ERROR, cs->wh_arg );
+ }else
+ {
+ FD_CLR(fd , &(cs->e_fds));
+ if( cs->wh != 0L )
+ (*(cs->wh))( fd, WATCH_ERROR, cs->wh_arg );
+ }
+ }else
+ {
+ if( FD_ISSET( fd, &(cs->r_fds)) )
+ if( cs->wh != 0L )
+ (*(cs->wh))( fd, WATCH_READ, cs->wh_arg );
+ FD_CLR(fd , &(cs->r_fds));
+
+ if( FD_ISSET( fd, &(cs->w_fds)) )
+ if( cs->wh != 0L )
+ (*(cs->wh))( fd, WATCH_WRITE, cs->wh_arg );
+ FD_CLR(fd , &(cs->w_fds));
+
+ if( FD_ISSET( fd, &(cs->e_fds)) )
+ if( cs->wh != 0L )
+ (*(cs->wh))( fd, WATCH_ERROR, cs->wh_arg );
+ FD_CLR(fd , &(cs->e_fds));
+ }
+}
+
+static dbus_bool_t
+add_watch ( DBusWatch *watch, void *csp )
+{
+ DBusConnectionState *cs = csp;
+
+ dbus_watch_set_data(watch, cs, no_free );
+ if( cs->dh != 0L ) (*(cs->dh))("add_watch: %d", dbus_watch_get_fd(watch));
+ if( tsearch((const void*)watch,&(cs->watches),ptr_key_comparator) == 0L )
+ {
+ if( cs->eh != 0L ) (*(cs->eh))("add_watch: out of memory");
+ return FALSE;
+ }
+ set_watch_fds(watch,cs);
+ return TRUE;
+}
+
+static void
+remove_watch ( DBusWatch *watch, void *csp )
+{
+ DBusConnectionState *cs = csp;
+ int fd = dbus_watch_get_fd(watch);
+ if( tdelete((const void*)watch, &(cs->watches), ptr_key_comparator) == 0L )
+ if( cs->eh != 0L ) (*(cs->eh))("remove_watch: can't happen?!?: watch not found");
+ if( cs->dh != 0L ) (*(cs->dh))("remove_watch: %d", dbus_watch_get_fd(watch));
+ FD_CLR(fd , &(cs->r_fds));
+ FD_CLR(fd , &(cs->w_fds));
+ FD_CLR(fd , &(cs->e_fds));
+ if( cs->wh != 0L )
+ (*(cs->wh))(dbus_watch_get_fd(watch), WATCH_READ | WATCH_WRITE | WATCH_ERROR, cs->wh_arg );
+}
+
+static void
+toggle_watch ( DBusWatch *watch, void *csp )
+{
+ DBusConnectionState *cs = csp;
+ if( cs->dh != 0L ) (*(cs->dh))("toggle_watch: %d", dbus_watch_get_fd(watch));
+ set_watch_fds(watch,cs);
+}
+
+static void
+process_watch( const void *p, const VISIT which, const int level)
+{
+ void * const *wpp=p;
+ DBusWatch *w;
+ int fd;
+ uint8_t flags;
+ DBusConnectionState *cs;
+ int l = level ? 1 : 0;
+ l=l;
+
+ if((wpp != 0L) && (*wpp != 0L) && ( (which == postorder) || (which == leaf) ) )
+ {
+ w = (DBusWatch*)*wpp;
+ cs = dbus_watch_get_data( w );
+ if( cs == 0 )
+ return;
+ if( ! dbus_watch_get_enabled(w) )
+ return;
+ fd = dbus_watch_get_fd( w );
+ flags = dbus_watch_get_flags( w );
+ if( cs->dh != 0L ) (*(cs->dh))("handle_watch: %d", dbus_watch_get_fd( w ));
+ if ( (flags & DBUS_WATCH_READABLE) && (FD_ISSET(fd, &(cs->s_r_fds))) )
+ dbus_watch_handle(w, DBUS_WATCH_READABLE);
+ if ( (flags & DBUS_WATCH_WRITABLE) && (FD_ISSET(fd, &(cs->s_w_fds))) )
+ dbus_watch_handle(w, DBUS_WATCH_READABLE);
+ if ( (flags & DBUS_WATCH_ERROR) && (FD_ISSET(fd, &(cs->s_e_fds))) )
+ dbus_watch_handle(w, DBUS_WATCH_ERROR);
+ }
+}
+
+static void
+process_watches ( DBusConnectionState *cs )
+{
+ twalk( cs->watches, process_watch );
+}
+
+void dbus_svc_handle_watch( DBusConnectionState *cs, int fd, dbus_svc_WatchFlags action )
+{
+ switch( action & 7 )
+ {
+ case WATCH_READ:
+ FD_SET(fd, &(cs->s_r_fds));
+ break;
+
+ case WATCH_WRITE:
+ FD_SET(fd, &(cs->s_w_fds));
+ break;
+
+ case WATCH_ERROR:
+ FD_SET(fd, &(cs->s_e_fds));
+ break;
+ }
+}
+
+static void
+dispatch_status
+( DBusConnection *connection,
+ DBusDispatchStatus new_status,
+ void *csp
+)
+{
+ connection=connection;
+ DBusConnectionState *cs = csp;
+ cs->dispatchStatus = new_status;
+}
+
+void
+dbus_svc_main_loop( DBusConnectionState *cs, void (*idle_handler)(DBusConnectionState *) )
+{
+ struct timeval timeout={0,200000};
+ int n_fds;
+
+ while( cs->status != SHUTDOWN )
+ {
+ cs->s_r_fds = cs->r_fds;
+ cs->s_w_fds = cs->w_fds;
+ cs->s_e_fds = cs->e_fds;
+
+ timeout.tv_sec = 0;
+ timeout.tv_usec= 200000;
+
+ if ( (n_fds = select(cs->n, &(cs->s_r_fds), &(cs->s_w_fds), &(cs->s_e_fds), &timeout)) < 0 )
+ {
+ if (errno != EINTR)
+ {
+ if( cs->eh != 0L ) (*(cs->eh))( "select failed: %d : %s", errno, strerror(errno));
+ return;
+ }
+ }
+
+ if( n_fds > 0 )
+ process_watches(cs);
+
+ process_timeouts(cs);
+
+ if ( cs->dispatchStatus != DBUS_DISPATCH_COMPLETE )
+ dbus_connection_dispatch( cs->connection );
+
+ if( idle_handler != 0L )
+ (*idle_handler)(cs);
+ }
+}
+
+void dbus_svc_dispatch(DBusConnectionState *cs)
+{
+ process_watches(cs);
+
+ FD_ZERO(&(cs->s_r_fds));
+ FD_ZERO(&(cs->s_w_fds));
+ FD_ZERO(&(cs->s_e_fds));
+
+ process_timeouts(cs);
+
+ while ( cs->dispatchStatus != DBUS_DISPATCH_COMPLETE )
+ dbus_connection_dispatch( cs->connection );
+}
+
+void
+dbus_svc_quit( DBusConnectionState *cs )
+{
+ cs->status = SHUTDOWN;
+}
+
+static isc_result_t
+connection_setup
+( DBusConnection *connection,
+ DBUS_SVC *dbus,
+ dbus_svc_WatchHandler wh,
+ dbus_svc_ErrorHandler eh,
+ dbus_svc_ErrorHandler dh,
+ void *wh_arg
+)
+{
+ *dbus = dbcs_new( connection );
+
+ if ( *dbus == 0L )
+ {
+ if(eh)(*(eh))("connection_setup: out of memory");
+ goto fail;
+ }
+ (*dbus)->wh = wh;
+ (*dbus)->wh_arg = wh_arg;
+ (*dbus)->eh = eh;
+ (*dbus)->dh = dh;
+
+ if (!dbus_connection_set_watch_functions
+ ( (*dbus)->connection,
+ add_watch,
+ remove_watch,
+ toggle_watch,
+ *dbus,
+ no_free
+ )
+ )
+ {
+ if( (*dbus)->eh != 0L ) (*((*dbus)->eh))("connection_setup: dbus_connection_set_watch_functions failed");
+ goto fail;
+ }
+
+ if (!dbus_connection_set_timeout_functions
+ ( connection,
+ add_timeout,
+ remove_timeout,
+ toggle_timeout,
+ *dbus,
+ no_free
+ )
+ )
+ {
+ if( (*dbus)->eh != 0L ) (*((*dbus)->eh))("connection_setup: dbus_connection_set_timeout_functions failed");
+ goto fail;
+ }
+
+ dbus_connection_set_dispatch_status_function
+ ( connection,
+ dispatch_status,
+ *dbus,
+ no_free
+ );
+
+ if (dbus_connection_get_dispatch_status (connection) != DBUS_DISPATCH_COMPLETE)
+ dbus_connection_ref(connection);
+
+ return ISC_R_SUCCESS;
+
+ fail:
+ if( *dbus != 0L )
+ free(*dbus);
+
+ dbus_connection_set_dispatch_status_function (connection, NULL, NULL, NULL);
+ dbus_connection_set_watch_functions (connection, NULL, NULL, NULL, NULL, NULL);
+ dbus_connection_set_timeout_functions (connection, NULL, NULL, NULL, NULL, NULL);
+
+ return ISC_R_FAILURE;
+}
+
+isc_result_t
+dbus_svc_init
+(
+ dbus_svc_DBUS_TYPE bus,
+ char *name,
+ DBUS_SVC *dbus,
+ dbus_svc_WatchHandler wh ,
+ dbus_svc_ErrorHandler eh ,
+ dbus_svc_ErrorHandler dh ,
+ void *wh_arg
+)
+{
+ DBusConnection *connection;
+ DBusError error;
+ char *session_bus_address=0L;
+
+ memset(&error,'\0',sizeof(DBusError));
+
+ dbus_error_init(&error);
+
+ switch( bus )
+ {
+ /* DBUS_PRIVATE_* bus types are the only type which allow reconnection if the dbus-daemon is restarted
+ */
+ case DBUS_PRIVATE_SYSTEM:
+
+ if ( (connection = dbus_connection_open_private("unix:path=/var/run/dbus/system_bus_socket", &error)) == 0L )
+ {
+ if(eh)(*eh)("dbus_svc_init failed: %s %s",error.name, error.message);
+ return ISC_R_FAILURE;
+ }
+
+ if ( ! dbus_bus_register(connection,&error) )
+ {
+ if(eh)(*eh)("dbus_bus_register failed: %s %s", error.name, error.message);
+ dbus_connection_close(connection);
+ free(connection);
+ return ISC_R_FAILURE;
+ }
+ break;
+
+ case DBUS_PRIVATE_SESSION:
+
+ session_bus_address = getenv("DBUS_SESSION_BUS_ADDRESS");
+ if ( session_bus_address == 0L )
+ {
+ if(eh)(*eh)("dbus_svc_init failed: DBUS_SESSION_BUS_ADDRESS environment variable not set");
+ return ISC_R_FAILURE;
+ }
+
+ if ( (connection = dbus_connection_open_private(session_bus_address, &error)) == 0L )
+ {
+ if(eh)(*eh)("dbus_svc_init failed: %s %s",error.name, error.message);
+ return ISC_R_FAILURE;
+ }
+
+ if ( ! dbus_bus_register(connection,&error) )
+ {
+ if(eh)(*eh)("dbus_bus_register failed: %s %s", error.name, error.message);
+ dbus_connection_close(connection);
+ free(connection);
+ return ISC_R_FAILURE;
+ }
+ break;
+
+ case DBUS_SYSTEM:
+ case DBUS_SESSION:
+
+ if ( (connection = dbus_bus_get (bus, &error)) == 0L )
+ {
+ if(eh)(*eh)("dbus_svc_init failed: %s %s",error.name, error.message);
+ return ISC_R_FAILURE;
+ }
+ break;
+
+ default:
+ if(eh)(*eh)("dbus_svc_init failed: unknown bus type %d", bus);
+ return ISC_R_FAILURE;
+ }
+
+ dbus_connection_set_exit_on_disconnect(connection, FALSE);
+
+ if ( (connection_setup(connection, dbus, wh, eh, dh, wh_arg)) != ISC_R_SUCCESS)
+ {
+ if(eh)(*eh)("dbus_svc_init failed: connection_setup failed");
+ return ISC_R_FAILURE;
+ }
+
+ if( name == 0L )
+ return ISC_R_SUCCESS;
+
+ (*dbus)->unique_name = dbus_bus_get_unique_name(connection);
+
+ switch
+ ( dbus_bus_request_name
+ ( connection, name,
+#ifdef DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT
+ DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT ,
+#else
+ 0 ,
+#endif
+ &error
+ )
+ )
+ {
+ case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
+ break;
+ case DBUS_REQUEST_NAME_REPLY_EXISTS:
+ case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
+ case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER:
+ if(eh)(*eh)("dbus_svc_init: dbus_bus_request_name failed: Name already registered");
+ goto give_up;
+ default:
+ if(eh)(*eh)("dbus_svc_init: dbus_bus_request_name failed: %s %s", error.name, error.message);
+ goto give_up;
+ }
+ return ISC_R_SUCCESS;
+
+ give_up:
+ dbus_connection_close( connection );
+ dbus_connection_unref( connection );
+ if( *dbus )
+ {
+ dbus_connection_set_dispatch_status_function (connection, NULL, NULL, NULL);
+ dbus_connection_set_watch_functions (connection, NULL, NULL, NULL, NULL, NULL);
+ dbus_connection_set_timeout_functions (connection, NULL, NULL, NULL, NULL, NULL);
+ free(*dbus);
+ }
+ return ISC_R_FAILURE;
+}
+
+const char *dbus_svc_unique_name(DBusConnectionState *cs)
+{
+ return cs->unique_name;
+}
+
+void
+dbus_svc_shutdown ( DBusConnectionState *cs )
+{
+ if (!dbus_connection_set_watch_functions
+ ( cs->connection,
+ NULL, NULL, NULL, NULL, NULL
+ )
+ ) if( cs->eh != 0L ) (*(cs->eh))("connection_shutdown: dbus_connection_set_watch_functions: No Memory."
+ "Setting watch functions to NULL failed."
+ );
+
+ if (!dbus_connection_set_timeout_functions
+ ( cs->connection,
+ NULL, NULL, NULL, NULL, NULL
+ )
+ ) if( cs->eh != 0L ) (*(cs->eh))("connection_shutdown: dbus_connection_set_timeout_functions: No Memory."
+ "Setting timeout functions to NULL failed."
+ );
+
+ dbus_connection_set_dispatch_status_function (cs->connection, NULL, NULL, NULL);
+
+ tdestroy( cs->timeouts, free);
+ cs->timeouts=0L;
+ tdestroy( cs->watches, no_free);
+ cs->watches=0L;
+
+ dbus_connection_close( cs->connection );
+ dbus_connection_unref( cs->connection );
+
+ free( cs );
+}
diff --git a/contrib/dbus/dbus_service.h b/contrib/dbus/dbus_service.h
new file mode 100644
index 0000000..d8a21f1
--- /dev/null
+++ b/contrib/dbus/dbus_service.h
@@ -0,0 +1,287 @@
+/* D-BUS Service Utilities
+ *
+ * Provides utilities for construction of D-BUS "Services"
+ *
+ * Copyright(C) Jason Vas Dias, Red Hat Inc., 2005
+ * Modified by Adam Tkac, Red Hat Inc., 2007
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation at
+ * http://www.fsf.org/licensing/licenses/gpl.txt
+ * and included in this software distribution as the "LICENSE" file.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef D_BUS_SERVER_UTILITIES_H
+#define D_BUS_SERVER_UTILITIES_H
+
+#include <stdint.h>
+#include <stdarg.h>
+#include <isc/types.h>
+
+typedef struct dbcs_s* DBUS_SVC;
+
+typedef enum
+{ HANDLED, NOT_HANDLED, HANDLED_NOW
+} dbus_svc_HandlerResult;
+
+typedef enum
+{ INVALID, CALL, RETURN, ERROR, SIGNAL
+} dbus_svc_MessageType;
+
+typedef enum
+{
+ DBUS_SESSION,
+ DBUS_SYSTEM,
+ DBUS_STARTER,
+ DBUS_PRIVATE_SYSTEM,
+ DBUS_PRIVATE_SESSION
+} dbus_svc_DBUS_TYPE;
+
+typedef enum /* D-BUS Protocol Type Codes / Signature Chars */
+{
+ TYPE_INVALID = (int)'\0',
+ TYPE_BYTE = (int)'y',
+ TYPE_BOOLEAN = (int)'b',
+ TYPE_INT16 = (int)'n',
+ TYPE_UINT16 = (int)'q',
+ TYPE_INT32 = (int)'i',
+ TYPE_UINT32 = (int)'u',
+ TYPE_INT64 = (int)'x',
+ TYPE_UINT64 = (int)'t',
+ TYPE_DOUBLE = (int)'d',
+ TYPE_STRING = (int)'s',
+ TYPE_OBJECT_PATH =(int)'o',
+ TYPE_SIGNATURE= (int)'g',
+ TYPE_ARRAY = (int)'a',
+ TYPE_VARIANT = (int)'v',
+ TYPE_STRUCT = (int)'r',
+ TYPE_DICT_ENTRY = (int)'e',
+ STRUCT_BEGIN = (int)'(',
+ STRUCT_END = (int)')',
+ DICT_ENTRY_BEGIN =(int)'{',
+ DICT_ENTRY_END =(int)'}'
+} dbus_svc_DataType;
+
+typedef struct DBusMessage* dbus_svc_MessageHandle;
+
+typedef int
+(*dbus_svc_ErrorHandler)
+( const char *errorFmt, ...
+); /* Error Handler function prototype - handle FATAL errors from D-BUS calls */
+
+typedef enum
+{
+ WATCH_ENABLE = 8,
+ WATCH_ERROR = 4,
+ WATCH_WRITE = 2,
+ WATCH_READ = 1
+} dbus_svc_WatchFlags;
+
+typedef void (*dbus_svc_WatchHandler)( int, dbus_svc_WatchFlags, void *arg );
+
+typedef dbus_svc_HandlerResult
+(*dbus_svc_MessageHandler)
+( DBUS_SVC dbus,
+ dbus_svc_MessageType type,
+ uint8_t reply_expected, /* 1 / 0 */
+ uint32_t serial, /* serial number of message; needed to reply */
+ const char *destination, /* D-BUS connection name / destination */
+ const char *path, /* D-BUS Object Path */
+ const char *member, /* D-BUS Object Member */
+ const char *interface, /* D-BUS Object interface */
+ const char *if_suffix, /* remainder of interface prefixed by ifPrefix */
+ const char *sender, /* Senders' connection destination */
+ const char *signature, /* Signature String composed of Type Codes */
+ dbus_svc_MessageHandle msg,/* Message pointer: call dbus_svc_get_args(msg,...) to get data */
+ const char *prefix, /* If non-null, this is the root prefix for this sub-path message */
+ const char *suffix, /* If non-null, this is the suffix of this sub-path message */
+ void *prefixObject, /* If non-null, this is the object that was registered for the prefix */
+ void *object /* If non-null, this is the object that was registered for the complete path */
+); /* Message Handler function prototype */
+
+#define DBusMsgHandlerArgs \
+ DBUS_SVC dbus, \
+ dbus_svc_MessageType type, \
+ uint8_t reply_expected, \
+ uint32_t serial, \
+ const char *destination, \
+ const char *path, \
+ const char *member, \
+ const char *interface, \
+ const char *if_suffix, \
+ const char *sender, \
+ const char *signature, \
+ dbus_svc_MessageHandle msg, \
+ const char *prefix, \
+ const char *suffix, \
+ void *prefixObject, \
+ void *object
+
+#define SHUTDOWN 255
+
+extern isc_result_t dbus_svc_init
+( dbus_svc_DBUS_TYPE bus,
+ char *name, /* name to register with D-BUS */
+ DBUS_SVC *dbus, /* dbus handle */
+ dbus_svc_WatchHandler wh, /* optional handler for watch events */
+ dbus_svc_ErrorHandler eh, /* optional error log message handler */
+ dbus_svc_ErrorHandler dh, /* optional debug / info log message handler */
+ void *wh_arg /* optional watch handler arg */
+);
+/*
+ * Obtains connection to DBUS_BUS_STARTER and registers "name".
+ * "eh" will be called for all errors from this server session.
+ */
+
+/* EITHER :
+ * pass a NULL WatchHandler to dbus_svc_init and use dbus_svc_main_loop
+ * OR:
+ * supply a valid WatchHandler, and call dbus_svc_handle_watch when
+ * select() returns the watch fd as ready for the watch action, and
+ * call dbus_svc_dispatch when all watches have been handled.
+ */
+
+
+uint8_t
+dbus_svc_add_filter
+( DBUS_SVC, dbus_svc_MessageHandler mh, void *obj, int n_matches, ... );
+/*
+ * Registers SINGLE message handler to handle ALL messages, adding match rules
+ */
+
+void dbus_svc_main_loop( DBUS_SVC, void (*idle_handler)(DBUS_SVC) );
+
+void dbus_svc_handle_watch( DBUS_SVC, int watch_fd, dbus_svc_WatchFlags action);
+
+void dbus_svc_dispatch( DBUS_SVC );
+
+/*
+ * Enter message processing loop.
+ * If "idle_handler" is non-null, it will be called once per iteration of loop.
+ */
+
+const char *dbus_svc_unique_name( DBUS_SVC );
+/*
+ * Returns connection "unique" (socket) name
+ */
+
+void dbus_svc_quit( DBUS_SVC );
+/*
+ * Exit message processing loop
+ */
+
+void dbus_svc_shutdown( DBUS_SVC );
+/*
+ * Close connections and clean up.
+ * DBUS_SVC pointer is invalid after this.
+ */
+
+uint8_t
+dbus_svc_get_args( DBUS_SVC, dbus_svc_MessageHandle, dbus_svc_DataType, ... );
+/* get arguments from message */
+
+uint8_t
+dbus_svc_get_args_va( DBUS_SVC, dbus_svc_MessageHandle, dbus_svc_DataType, va_list );
+/* get arguments from message */
+
+
+typedef void (*dbus_svc_ShutdownHandler) ( DBUS_SVC, void * );
+uint8_t
+dbus_svc_add_shutdown_filter
+(
+ DBUS_SVC, dbus_svc_ShutdownHandler sh, void *obj
+);
+/* Registers a filter for D-BUS shutdown event.
+ * Cannot be used in conjunction with dbus_svc_add_message_filter.
+ */
+
+uint8_t
+dbus_svc_remove_message_filter
+( DBUS_SVC, dbus_svc_MessageHandler mh);
+/* Unregisters the message filter */
+
+uint8_t
+dbus_svc_send
+( DBUS_SVC,
+ dbus_svc_MessageType type,
+ int32_t reply_serial,
+ uint32_t *new_serial,
+ const char *destination,
+ const char *path,
+ const char *member,
+ const char *interface,
+ dbus_svc_DataType firstType,
+ ... /* pointer, { (dbus_svc_DataType, pointer )...} */
+); /* sends messages / replies to "destination" */
+
+uint8_t
+dbus_svc_send_va
+( DBUS_SVC cs,
+ dbus_svc_MessageType type,
+ int32_t reply_serial,
+ uint32_t *new_serial,
+ const char *destination,
+ const char *path,
+ const char *member,
+ const char *interface,
+ dbus_svc_DataType firstType,
+ va_list va
+); /* sends messages / replies to "destination" */
+
+dbus_svc_MessageHandle
+dbus_svc_call
+( DBUS_SVC cs,
+ const char *destination,
+ const char *path,
+ const char *member,
+ const char *interface,
+ dbus_svc_DataType firstType,
+ ...
+); /* constructs message, sends it, returns reply */
+
+dbus_svc_MessageHandle
+dbus_svc_new_message
+( DBUS_SVC cs,
+ dbus_svc_MessageType type,
+ int32_t reply_serial,
+ const char *destination,
+ const char *path,
+ const char *interface,
+ const char *member
+);
+
+uint8_t
+dbus_svc_send_message(DBUS_SVC , dbus_svc_MessageHandle , uint32_t * );
+
+uint8_t
+dbus_svc_message_append_args( DBUS_SVC , dbus_svc_MessageHandle, dbus_svc_DataType, ...);
+
+typedef struct DBusMessageIter *dbus_svc_MessageIterator;
+
+dbus_svc_MessageIterator
+dbus_svc_message_iterator_new( DBUS_SVC, dbus_svc_MessageHandle );
+
+uint32_t
+dbus_svc_message_next_arg_type( DBUS_SVC, dbus_svc_MessageIterator );
+
+void
+dbus_svc_message_next_arg( DBUS_SVC, dbus_svc_MessageIterator, void * );
+
+uint32_t
+dbus_svc_message_element_type( DBUS_SVC, dbus_svc_MessageIterator );
+
+void
+dbus_svc_message_get_elements( DBUS_SVC, dbus_svc_MessageIterator, uint32_t *n, void *array );
+
+uint8_t dbus_svc_message_type( dbus_svc_MessageHandle );
+
+void dbus_svc_message_iterator_free( DBUS_SVC, dbus_svc_MessageIterator );
+
+#endif
diff --git a/contrib/dbus/named-dbus-system.conf b/contrib/dbus/named-dbus-system.conf
new file mode 100644
index 0000000..2cb99bd
--- /dev/null
+++ b/contrib/dbus/named-dbus-system.conf
@@ -0,0 +1,20 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <servicedir>/usr/share/dbus-1/services</servicedir>
+ <policy user="named">
+ <allow own="com.redhat.named"/>
+ <allow send_interface="com.redhat.named"/>
+ <allow send_destination="com.redhat.named"/>
+ </policy>
+ <policy user="root">
+ <allow send_interface="com.redhat.named"/>
+ <allow send_destination="com.redhat.named"/>
+ </policy>
+ <policy context="default">
+ <deny own="com.redhat.named"/>
+ <deny send_destination="com.redhat.named"/>
+ <deny send_interface="com.redhat.named"/>
+ </policy>
+</busconfig>
+
diff --git a/contrib/dbus/named-dbus.service b/contrib/dbus/named-dbus.service
new file mode 100644
index 0000000..ddf40e7
--- /dev/null
+++ b/contrib/dbus/named-dbus.service
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=com.redhat.named
+Exec=/usr/sbin/named
diff --git a/contrib/dlz/bin/dlzbdb/Makefile.in b/contrib/dlz/bin/dlzbdb/Makefile.in
new file mode 100644
index 0000000..a31c503
--- /dev/null
+++ b/contrib/dlz/bin/dlzbdb/Makefile.in
@@ -0,0 +1,73 @@
+# Copyright (C) 1998-2001 Internet Software Consortium.
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+# $Id: Makefile.in,v 1.3 2007/09/07 06:53:03 marka Exp $
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+top_srcdir = @top_srcdir@
+
+@BIND9_VERSION@
+
+@BIND9_MAKE_INCLUDES@
+
+DLZINCLUDES = @DLZ_DRIVER_INCLUDES@
+
+CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include \
+ ${ISC_INCLUDES} ${DLZINCLUDES}
+
+CDEFINES = @USE_DLZ@
+CWARNINGS =
+
+DLZLIBS = @DLZ_DRIVER_LIBS@
+ISCLIBS = ../../../../lib/isc/libisc.@A@
+
+DEPLIBS = ${ISCDEPLIBS}
+
+LIBS = ${ISCLIBS} ${DLZLIBS} @LIBS@
+
+TARGETS = dlzbdb
+
+SRCS = dlzbdb.c
+
+#MANPAGES =
+
+#HTMLPAGES =
+
+#MANOBJS = ${MANPAGES} ${HTMLPAGES}
+
+@BIND9_MAKE_RULES@
+
+dlzbdb.@O@: dlzbdb.c
+ ${LIBTOOL} ${CC} ${ALL_CFLAGS} -DVERSION=\"${VERSION}\" \
+ -c ${srcdir}/dlzbdb.c
+
+dlzbdb: dlzbdb.@O@ ${DEPLIBS}
+ ${LIBTOOL} ${PURIFY} ${CC} ${CFLAGS} -o $@ dlzbdb.@O@ ${LIBS}
+
+doc man:: ${MANOBJS}
+
+#docclean manclean maintainer-clean::
+# rm -f ${MANOBJS}
+
+clean distclean maintainer-clean::
+ rm -f ${TARGETS}
+
+installdirs:
+ $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir}
+# $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8
+
+install:: dlzbdb installdirs
+ ${LIBTOOL} ${INSTALL_PROGRAM} dlzbdb ${DESTDIR}${sbindir}
diff --git a/contrib/dlz/bin/dlzbdb/dlzbdb.c b/contrib/dlz/bin/dlzbdb/dlzbdb.c
new file mode 100644
index 0000000..aedc953
--- /dev/null
+++ b/contrib/dlz/bin/dlzbdb/dlzbdb.c
@@ -0,0 +1,1273 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (C) 1999-2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef DLZ_BDB
+
+/*
+ * exit codes
+ * 0 everything ok
+ * 1 error parsing command line
+ * 2 Missing, too many or invalid combination of command line parameters
+ * 3 Unable to open BDB database.
+ * 4 Unable to allocate memory for, or create lexer.
+ * 5 unable to perform BDB cursor operation
+ */
+
+#include <config.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <isc/buffer.h>
+#include <isc/commandline.h>
+#include <isc/formatcheck.h>
+#include <isc/lex.h>
+#include <isc/mem.h>
+#include <isc/result.h>
+#include <isc/string.h>
+#include <isc/util.h>
+
+#include <db.h>
+
+/* shut up compiler warnings about no previous prototype */
+
+static void
+show_usage(void);
+
+int
+getzone(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey);
+
+int
+gethost(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey);
+
+void
+bdb_cleanup(void);
+
+isc_result_t
+bdb_opendb(DBTYPE db_type, DB **db_out, const char *db_name, int flags);
+
+void
+put_data(isc_boolean_t dns_data, char *input_key, char *input_data);
+
+void
+insert_data(void);
+
+isc_result_t
+openBDB(void);
+
+isc_result_t
+open_lexer(void);
+
+void
+close_lexer(void);
+
+isc_result_t
+bulk_write(char type, DB *database, DBC *dbcursor, DBT *bdbkey, DBT *bdbdata);
+
+void
+operation_add(void);
+
+void
+operation_bulk(void);
+
+void
+operation_listOrDelete(isc_boolean_t dlt);
+
+
+/*%
+ * Maximum length of a single data line that
+ * may be inserted into database by this program.
+ * If you need to insert a line of data that is more
+ * than 10,000 characters change this definition.
+ */
+
+#define max_data_len 10000
+
+/*%
+ * BDB database names. If you want to use different
+ * database names change them here.
+ */
+
+#define dlz_data "dns_data"
+#define dlz_zone "dns_zone"
+#define dlz_host "dns_host"
+#define dlz_client "dns_client"
+
+
+/*%
+ * Error code returned by BDB secondary index callback functions.
+ * This error is returned if the callback function could not create
+ * the secondary index for any reason.
+ */
+
+#define BDBparseErr 1
+
+/* A struct to hold all the relevant info about the database */
+
+typedef struct bdb_instance {
+ DB_ENV *dbenv; /* BDB environment */
+ DB *data; /* dns_data database handle */
+ DBC *cursor; /* database cursor */
+ DBC *cursor2; /* second cursor used during list operation. */
+ DBC *cursor3; /* third cursor used during list operation */
+ DBC *cursor4; /* fourth cursor used during list operation */
+ DB *zone; /* zone database handle */
+ DB *host; /* host database handle */
+ DB *client; /* client database handle */
+} bdb_instance_t;
+
+/* Possible operations */
+
+#define list 1 /* list data */
+#define dele 2 /* delete data */
+#define add 3 /* add a single piece of data */
+#define bulk 4 /* bulk load data */
+
+
+/*%
+ * quit macro is used instead of exit. quit always trys to close the lexer
+ * and the BDB database before exiting.
+ */
+
+#define quit(i) close_lexer(); bdb_cleanup(); exit(i);
+
+/*%
+ * checkOp is used to verify that only one operation (list, del, add,
+ * bulk from file, bulk from stdin) is specified on the command line.
+ * This prevents a user from specifying two operations on the command
+ * line, which would make no sense anyway.
+ */
+
+#define checkOp(x) if (x != 0) {fprintf(stderr, "\nonly one operation "\
+ "(l e d a f s) may be specified\n"); quit(2);}
+
+/*%
+ * checkParam is used to only allow a parameter to be specified once.
+ * I.E. the parameter key can only be used on the command line once.
+ * any attempt to use it twice causes an error.
+ */
+
+#define checkParam(x, y) if (x != NULL) {fprintf(stderr, "\n%s may only "\
+ "be specified once\n", y); quit(2);}
+
+/*%
+ * checkInvalidParam is used to only allow paramters which make sense for
+ * the operation selected. I.E. passing the key parameter makes no sense
+ * for the add operation, and thus it isn't allowed.
+ */
+
+#define checkInvalidParam(x, y, z) if (x != NULL) {fprintf(stderr, "\n%s "\
+ "may not be specified %s\n", y, z); quit(2);}
+
+/*%
+ * checkInvalidOption is used to only allow paramters which make sense for
+ * the operation selected - but checks boolean options.
+ * I.E. passing the "b" bare_list parameter makes no sense for the add
+ * operation, and thus it isn't allowed.
+ * if w == x then output error message "flag", "message"
+ */
+
+#define checkInvalidOption(w, x, y, z) if (w == x) {fprintf(stderr, "\n%s "\
+ "may not be specified %s\n", y, z); quit(2);}
+
+/* Global Variables */
+
+int operation = 0; /*%< operation to perform. */
+/*% allow new lock files or DB to be created. */
+isc_boolean_t create_allowed = isc_boolean_false;
+char *key = NULL; /*%< key to use in list & del operations */
+
+/*% dump DB in DLZBDB bulk format */
+isc_boolean_t list_everything = isc_boolean_false;
+unsigned int key_val; /*%< key as unsigned int used in list & del operations */
+char *zone = NULL; /*%< zone to use in list operations */
+char *host = NULL; /*%< host to use in list operations */
+char *c_zone = NULL; /*%< client zone to use in list operations */
+char *c_ip = NULL; /*%< client IP to use in list operations */
+char *a_data = NULL; /*%< data in add operation */
+char *bulk_file = NULL; /*%< bulk data file to load */
+char *db_envdir = NULL; /*%< BDB environment location */
+char *db_file = NULL; /*%< BDB database file location. */
+bdb_instance_t db; /* BDB instance we are operating on */
+isc_lex_t *lexer = NULL; /*%< lexer for use to use in parsing input */
+isc_mem_t *lex_mctx = NULL; /*%< memory context for lexer */
+char lex_data_buf[max_data_len]; /*%< data array to use for lex_buffer below */
+isc_buffer_t lex_buffer; /*%< buffer for lexer during add operation */
+
+
+/*%
+ * Displays usage message
+ */
+
+static void
+show_usage(void) {
+ fprintf(stderr, "\n\n\
+---Usage:---------------------------------------------------------------------\
+\n\n\
+ List data:\n\
+ dlzbdb -l [-k key] [-z zone] [-h host] [-c client_zone] [-i client_ip]\n\
+ BDB_environment BDB_database\n\n\
+ Delete data:\n\
+ dlzbdb -d [-k key] [-c client_zone] [-i client_ip]\n\
+ BDB_environment BDB_database\n\n\
+ Bulk load data from file:\n\
+ dlzbdb -f file_to_load BDB_environment BDB_database\n\n\
+ Bulk load data from stdin\n\
+ dlzbdb -s BDB_environment BDB_database\n\n\
+ Add data:\n\
+ dlzbdb -a \"dns data to be added\" BDB_environment BDB_database\n\n\
+ Export data:\n\
+ dlzbdb -e BDB_environment BDB_database\n\n\
+ Normally operations can only be performed on an existing database files.\n\
+ Use the -n flag with any operation to allow files to be created.\n\
+ Existing files will NOT be truncated by using the -n flag.\n\
+ The -n flag will allow a new database to be created, or allow new\n\
+ environment files to be created for an existing database.\n\n\
+---Format for -f & -a options:------------------------------------------------\
+\n\n\
+db_type zone host dns_type ttl ip\n\
+db_type zone host dns_type ttl mx_priority mail_host\n\
+db_type zone host dns_type ttl nm_svr resp_psn serial refresh retry expire min\
+\n\
+db_type zone client_ip\n\n\
+---Examples:------------------------------------------------------------------\
+\n\n\
+d mynm.com www A 10 127.0.0.1\n\
+d mynm.com @ MX 10 5 mail\n\
+d mynm.com @ SOA 10 ns1.mynm.com. root.mynm.com. 2 28800 7200 604800 86400\n\
+c mynm.com 127.0.0.1\n\
+c mynm.com 192.168.0.10\n\
+");
+quit(1);
+}
+
+
+/*% BDB callback to create zone secondary index */
+
+int
+getzone(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey) {
+ char *tmp;
+ char *left;
+ char *right;
+ int result=0;
+
+ UNUSED(dbp);
+ UNUSED(pkey);
+
+ /* Allocate memory to use in parsing the string */
+ tmp = right = malloc(pdata->size + 1);
+
+ /* verify memory was allocated */
+ if (right == NULL) {
+ result = BDBparseErr;
+ goto getzone_cleanup;
+ }
+
+ /* copy data string into newly allocated memory */
+ strncpy(right, pdata->data, pdata->size);
+ right[pdata->size] = '\0';
+
+ /* split string at the first space */
+ left = isc_string_separate(&right, " ");
+
+ /* copy string for "zone" secondary index */
+ skey->data = strdup(left);
+ if (skey->data == NULL) {
+ result = BDBparseErr;
+ goto getzone_cleanup;
+ }
+ /* set required values for BDB */
+ skey->size = strlen(skey->data);
+ skey->flags = DB_DBT_APPMALLOC;
+
+ getzone_cleanup:
+
+ /* cleanup memory */
+ if (tmp != NULL)
+ free(tmp);
+
+ return result;
+}
+
+/*%
+ * BDB callback to create host secondary index
+ */
+
+int
+gethost(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey) {
+ char *tmp;
+ char *left;
+ char *right;
+ int result=0;
+
+ UNUSED(dbp);
+ UNUSED(pkey);
+
+ /* allocate memory to use in parsing the string */
+ tmp = right = malloc(pdata->size + 1);
+
+ /* verify memory was allocated */
+ if (tmp == NULL) {
+ result = BDBparseErr;
+ goto gethost_cleanup;
+ }
+
+ /* copy data string into newly allocated memory */
+ strncpy(right, pdata->data, pdata->size);
+ right[pdata->size] = '\0';
+
+ /* we don't care about left string. */
+ /* memory of left string will be freed when tmp is freed. */
+ isc_string_separate(&right, " ");
+
+ /* verify right still has some characters left */
+ if (right == NULL) {
+ result = BDBparseErr;
+ goto gethost_cleanup;
+ }
+
+ /* get "host" from data string */
+ left = isc_string_separate(&right, " ");
+ /* copy string for "host" secondary index */
+ skey->data = strdup(left);
+ if (skey->data == NULL) {
+ result = BDBparseErr;
+ goto gethost_cleanup;
+ }
+ /* set required values for BDB */
+ skey->size = strlen(skey->data);
+ skey->flags = DB_DBT_APPMALLOC;
+
+ gethost_cleanup:
+
+ /* cleanup memory */
+ if (tmp != NULL)
+ free(tmp);
+
+ return result;
+}
+
+/*%
+ * Performs BDB cleanup. Close each database that we opened.
+ * Close environment. Set each var to NULL so we know they
+ * were closed and don't accidentally try to close them twice.
+ */
+
+void
+bdb_cleanup(void) {
+
+ /* close cursors */
+ if (db.cursor4 != NULL) {
+ db.cursor4->c_close(db.cursor4);
+ db.cursor4 = NULL;
+ }
+
+ if (db.cursor3 != NULL) {
+ db.cursor3->c_close(db.cursor3);
+ db.cursor3 = NULL;
+ }
+
+ if (db.cursor2 != NULL) {
+ db.cursor2->c_close(db.cursor2);
+ db.cursor2 = NULL;
+ }
+
+ if (db.cursor != NULL) {
+ db.cursor->c_close(db.cursor);
+ db.cursor = NULL;
+ }
+
+ /* close databases */
+ if (db.data != NULL) {
+ db.data->close(db.data, 0);
+ db.data = NULL;
+ }
+ if (db.host != NULL) {
+ db.host->close(db.host, 0);
+ db.host = NULL;
+ }
+ if (db.zone != NULL) {
+ db.zone->close(db.zone, 0);
+ db.zone = NULL;
+ }
+ if (db.client != NULL) {
+ db.client->close(db.client, 0);
+ db.client = NULL;
+ }
+
+ /* close environment */
+ if (db.dbenv != NULL) {
+ db.dbenv->close(db.dbenv, 0);
+ db.dbenv = NULL;
+ }
+}
+
+/*% Initializes, sets flags and then opens Berkeley databases. */
+
+isc_result_t
+bdb_opendb(DBTYPE db_type, DB **db_out, const char *db_name, int flags) {
+
+ int result;
+ int createFlag = 0;
+
+ /* Initialize the database. */
+ if ((result = db_create(db_out, db.dbenv, 0)) != 0) {
+ fprintf(stderr, "BDB could not initialize %s database. BDB error: %s",
+ db_name, db_strerror(result));
+ return ISC_R_FAILURE;
+ }
+
+ /* set database flags. */
+ if ((result = (*db_out)->set_flags(*db_out, flags)) != 0) {
+ fprintf(stderr, "BDB could not set flags for %s database. BDB error: %s",
+ db_name, db_strerror(result));
+ return ISC_R_FAILURE;
+ }
+
+ if (create_allowed == isc_boolean_true) {
+ createFlag = DB_CREATE;
+ }
+ /* open the database. */
+ if ((result = (*db_out)->open(*db_out, NULL, db_file, db_name, db_type,
+ createFlag, 0)) != 0) {
+ fprintf(stderr, "BDB could not open %s database in %s. BDB error: %s",
+ db_name, db_file, db_strerror(result));
+ return ISC_R_FAILURE;
+ }
+
+ return ISC_R_SUCCESS;
+}
+
+/*%
+ * parses input and adds it to the BDB database
+ * Lexer should be instantiated, and either a file or buffer opened for it.
+ * The insert_data function is used by both the add, and bulk insert
+ * operations
+ */
+
+void
+put_data(isc_boolean_t dns_data, char *input_key, char *input_data) {
+
+ int bdbres;
+ DBT key, data;
+
+ /* make sure key & data are completely empty */
+ memset(&key, 0, sizeof(key));
+ memset(&data, 0, sizeof(data));
+
+ /* if client data, setup key for insertion */
+ if (!dns_data && input_key != NULL) {
+ key.data = input_key;
+ key.size = strlen(input_key);
+ key.flags = 0;
+ }
+ /* always setup data for insertion */
+ data.data = input_data;
+ data.size = strlen(input_data);
+ data.flags = 0;
+
+ /* execute insert against appropriate database. */
+ if (dns_data) {
+ bdbres = db.data->put(db.data, NULL, &key, &data, DB_APPEND);
+ } else {
+ bdbres = db.client->put(db.client, NULL, &key, &data, 0);
+ }
+
+ /* if something went wrong, log error and quit */
+ if (bdbres != 0) {
+ fprintf(stderr, "BDB could not insert data. Error: %s",
+ db_strerror(bdbres));
+ quit(5);
+ }
+}
+
+void
+insert_data(void) {
+ unsigned int opt =
+ ISC_LEXOPT_EOL | /* Want end-of-line token. */
+ ISC_LEXOPT_EOF | /* Want end-of-file token. */
+ ISC_LEXOPT_QSTRING | /* Recognize qstrings. */
+ ISC_LEXOPT_QSTRINGMULTILINE; /* Allow multiline "" strings */
+
+ isc_result_t result;
+ isc_token_t token; /* token from lexer */
+ isc_boolean_t loop = isc_boolean_true;
+ isc_boolean_t have_czone = isc_boolean_false;
+ char data_arr[max_data_len];
+ isc_buffer_t buf;
+ char data_arr2[max_data_len];
+ isc_buffer_t buf2;
+ char data_type = 'u'; /* u =unknown, b =bad token, d/D =DNS, c/C =client IP */
+
+ /* Initialize buffers */
+ isc_buffer_init(&buf, &data_arr, max_data_len);
+ isc_buffer_init(&buf2, &data_arr2, max_data_len);
+
+ while (loop) {
+ result = isc_lex_gettoken(lexer, opt, &token);
+ if (result != ISC_R_SUCCESS)
+ goto data_cleanup;
+
+ switch(token.type) {
+ case isc_tokentype_string:
+ if (data_type == 'u') {
+ /* store data_type */
+ strncpy(&data_type, token.value.as_pointer, 1);
+ /* verify data_type was specified correctly on input */
+ if (strlen(token.value.as_pointer) > 1 || (
+ data_type != 'd' && data_type != 'D' &&
+ data_type != 'c' && data_type != 'C') ) {
+ /* if not, set to 'b' so this line is ignored. */
+ data_type = 'b';
+ }
+ } else if (data_type == 'c' || data_type == 'C') {
+ if (have_czone == isc_boolean_true) {
+ isc_buffer_putstr(&buf2, token.value.as_pointer);
+ /* add string terminator to buffer */
+ isc_buffer_putmem(&buf2, "\0", 1);
+ } else {
+ isc_buffer_putstr(&buf, token.value.as_pointer);
+ /* add string terminator to buffer */
+ isc_buffer_putmem(&buf, "\0", 1);
+ have_czone = isc_boolean_true;
+ }
+ } else {
+ isc_buffer_putstr(&buf, token.value.as_pointer);
+ isc_buffer_putstr(&buf, " ");
+ }
+ break;
+ case isc_tokentype_qstring:
+ isc_buffer_putstr(&buf, "\"");
+ isc_buffer_putstr(&buf, token.value.as_pointer);
+ isc_buffer_putstr(&buf, "\" ");
+ break;
+ case isc_tokentype_eol:
+ case isc_tokentype_eof:
+
+ if ((data_type != 'u' && isc_buffer_usedlength(&buf) > 0) || data_type == 'b') {
+ /* perform insert operation */
+ if (data_type == 'd' || data_type == 'D') {
+ /* add string terminator to buffer */
+ isc_buffer_putmem(&buf, "\0", 1);
+ put_data(isc_boolean_true, NULL, (char *) &data_arr);
+ } else if (data_type == 'c' || data_type == 'C') {
+ put_data(isc_boolean_false, (char *) &data_arr,
+ (char *) &data_arr2);
+ } else if (data_type == 'b') {
+ fprintf(stderr, "Bad / unknown token encountered on line %lu."\
+ " Skipping line.", isc_lex_getsourceline(lexer) - 1);
+ } else {
+ fprintf(stderr, "Bad / unknown db data type encountered on " \
+ "line %lu. Skipping line\n", isc_lex_getsourceline(lexer) - 1);
+ }
+ }
+
+ if (token.type == isc_tokentype_eof) {
+ loop = isc_boolean_false;
+ }
+
+ /* reset buffer for next insert */
+ isc_buffer_clear(&buf);
+ isc_buffer_clear(&buf2);
+ have_czone = isc_boolean_false;
+ data_type ='u';
+ break;
+ default:
+ data_type = 'b';
+ break;
+ }
+ }
+
+ return;
+
+ data_cleanup:
+ /* let user know we had problems */
+ fprintf(stderr, "Unknown error processing tokens during \"add\" or " \
+ "\"bulk\" operation.\nStoped processing on line %lu.",
+ isc_lex_getsourceline(lexer));
+}
+
+
+isc_result_t
+openBDB(void) {
+
+ int bdbres;
+ isc_result_t result;
+
+ /* create BDB environment */
+ /* Basically BDB allocates and assigns memory to db->dbenv */
+ bdbres = db_env_create(&db.dbenv, 0);
+ if (bdbres != 0) {
+ fprintf(stderr, "BDB environment could not be created. BDB error: %s",
+ db_strerror(bdbres));
+ result = ISC_R_FAILURE;
+ goto openBDB_cleanup;
+ }
+
+ /* open BDB environment */
+ if (create_allowed == isc_boolean_true) {
+ /* allowed to create new files */
+ bdbres = db.dbenv->open(db.dbenv, db_envdir,
+ DB_INIT_CDB | DB_INIT_MPOOL | DB_CREATE, 0);
+ } else { /* not allowed to create new files. */
+ bdbres = db.dbenv->open(db.dbenv, db_envdir,
+ DB_INIT_CDB | DB_INIT_MPOOL, 0);
+ }
+ if (bdbres != 0) {
+ fprintf(stderr, "BDB environment at '%s' could not be opened. BDB " \
+ "error: %s", db_envdir, db_strerror(bdbres));
+ result = ISC_R_FAILURE;
+ goto openBDB_cleanup;
+ }
+
+ /* open dlz_data database. */
+
+ result = bdb_opendb(DB_RECNO, &db.data, dlz_data, 0);
+ if (result != ISC_R_SUCCESS)
+ goto openBDB_cleanup;
+
+ /* open dlz_host database */
+ result = bdb_opendb(DB_BTREE, &db.host, dlz_host, DB_DUP | DB_DUPSORT);
+ if (result != ISC_R_SUCCESS)
+ goto openBDB_cleanup;
+
+ /* open dlz_zone database. */
+ result = bdb_opendb(DB_BTREE, &db.zone, dlz_zone, DB_DUP | DB_DUPSORT);
+ if (result != ISC_R_SUCCESS)
+ goto openBDB_cleanup;
+
+ /* open dlz_client database. */
+ result = bdb_opendb(DB_BTREE, &db.client, dlz_client, DB_DUP | DB_DUPSORT);
+ if (result != ISC_R_SUCCESS)
+ goto openBDB_cleanup;
+
+ /* associate the host secondary database with the primary database */
+ bdbres = db.data->associate(db.data, NULL, db.host, gethost, 0);
+ if (bdbres != 0) {
+ fprintf(stderr, "BDB could not associate %s database with %s. BDB "\
+ "error: %s", dlz_host, dlz_data, db_strerror(bdbres));
+ result = ISC_R_FAILURE;
+ goto openBDB_cleanup;
+ }
+
+ /* associate the zone secondary database with the primary database */
+ bdbres = db.data->associate(db.data, NULL, db.zone, getzone, 0);
+ if (bdbres != 0) {
+ fprintf(stderr, "BDB could not associate %s database with %s. BDB "\
+ "error: %s", dlz_zone, dlz_data, db_strerror(bdbres));
+ result = ISC_R_FAILURE;
+ goto openBDB_cleanup;
+ }
+
+ return result;
+
+ openBDB_cleanup:
+
+ bdb_cleanup();
+ return result;
+}
+
+/*% Create & open lexer to parse input data */
+
+isc_result_t
+open_lexer(void) {
+ isc_result_t result;
+
+ /* check if we already opened the lexer, if we did, return success */
+ if (lexer != NULL)
+ return ISC_R_SUCCESS;
+
+ /* allocate memory for lexer, and verify it was allocated */
+ result = isc_mem_create(0, 0, &lex_mctx);
+ if (result != ISC_R_SUCCESS) {
+ fprintf(stderr, "unexpected error creating lexer\n");
+ return result;
+ }
+
+ /* create lexer */
+ result = isc_lex_create(lex_mctx, 1500, &lexer);
+ if (result != ISC_R_SUCCESS)
+ fprintf(stderr, "unexpected error creating lexer\n");
+
+ /* set allowed commenting style */
+ isc_lex_setcomments(lexer, ISC_LEXCOMMENT_C | /* Allow C comments */
+ ISC_LEXCOMMENT_CPLUSPLUS | /* Allow C++ comments */
+ ISC_LEXCOMMENT_SHELL); /* Allow shellcomments */
+
+ isc_buffer_init(&lex_buffer, &lex_data_buf, max_data_len);
+
+ return result;
+}
+
+/*% Close the lexer, and cleanup memory */
+
+void
+close_lexer(void) {
+
+ /* If lexer is still open, close it & destroy it. */
+ if (lexer != NULL) {
+ isc_lex_close(lexer);
+ isc_lex_destroy(&lexer);
+ }
+
+ /* if lexer memory is still allocated, destroy it. */
+ if (lex_mctx != NULL)
+ isc_mem_destroy(&lex_mctx);
+}
+
+/*% Perform add operation */
+
+void
+operation_add(void) {
+ /* check for any parameters that are not allowed during add */
+ checkInvalidParam(key, "k", "for add operation");
+ checkInvalidParam(zone, "z", "for add operation");
+ checkInvalidParam(host, "h", "for add operation");
+ checkInvalidParam(c_zone, "c", "for add operation");
+ checkInvalidParam(c_ip, "i", "for add operation");
+ checkInvalidOption(list_everything, isc_boolean_true, "e",
+ "for add operation");
+
+ /* if open lexer fails it alread prints error messages. */
+ if (open_lexer() != ISC_R_SUCCESS) {
+ quit(4);
+ }
+
+ /* copy input data to buffer */
+ isc_buffer_putstr(&lex_buffer, a_data);
+
+ /* tell lexer to use buffer as input */
+ if (isc_lex_openbuffer(lexer, &lex_buffer) != ISC_R_SUCCESS) {
+ fprintf(stderr, "unexpected error opening lexer buffer");
+ quit(4);
+ }
+
+ /*common logic for "add" & "bulk" operations are handled by insert_data */
+ insert_data();
+}
+
+/*% Perform bulk insert operation */
+
+void
+operation_bulk(void) {
+ /* check for any parameters that are not allowed during bulk */
+ checkInvalidParam(key, "k", "for bulk load operation");
+ checkInvalidParam(zone, "z", "for bulk load operation");
+ checkInvalidParam(host, "h", "for bulk load operation");
+ checkInvalidParam(c_zone, "c", "for bulk load operation");
+ checkInvalidParam(c_ip, "i", "for bulk load operation");
+ checkInvalidOption(list_everything, isc_boolean_true, "e",
+ "for bulk load operation");
+
+ /* if open lexer fails it already prints error messages. */
+ if (open_lexer() != ISC_R_SUCCESS) {
+ quit(4);
+ }
+
+ if (bulk_file == NULL) {
+ if (isc_lex_openstream(lexer, stdin) != ISC_R_SUCCESS) {
+ fprintf(stderr, "unexpected error opening stdin by lexer.");
+ quit(4);
+ }
+ } else if (isc_lex_openfile(lexer, bulk_file) != ISC_R_SUCCESS) {
+ fprintf(stderr, "unexpected error opening %s by lexer.", bulk_file);
+ quit(4);
+ }
+
+ /* common logic for "add" & "bulk" operations are handled by insert_data */
+ insert_data();
+}
+
+isc_result_t
+bulk_write(char type, DB *database, DBC *dbcursor, DBT *bdbkey, DBT *bdbdata) {
+
+ int bdbres;
+ db_recno_t recNum;
+ char *retkey = NULL, *retdata;
+ size_t retklen = 0, retdlen;
+ void *p;
+
+ /* use a 5MB buffer for the bulk dump */
+ int buffer_size = 5 * 1024 * 1024;
+
+ /* try to allocate a 5 MB buffer, if we fail write err msg, die. */
+ bdbdata->data = malloc(buffer_size);
+ if (bdbdata->data == NULL) {
+ fprintf(stderr,
+ "Unable to allocate 5 MB buffer for bulk database dump\n");
+ return ISC_R_FAILURE;
+ }
+ bdbdata->ulen = buffer_size;
+ bdbdata->flags = DB_DBT_USERMEM;
+
+ /* get a cursor, make sure it worked. */
+ bdbres = database->cursor(database, NULL, &dbcursor, 0);
+ if (bdbres != 0) {
+ fprintf(stderr, "Unexpected error. BDB Error: %s\n",db_strerror(bdbres));
+ free(bdbdata->data);
+ return ISC_R_FAILURE;
+ }
+
+ /* loop and dump all data */
+ for (;;) {
+
+ /* loop through data until DB_NOTFOUND is returned */
+ bdbres = dbcursor->c_get(dbcursor, bdbkey, bdbdata,
+ DB_MULTIPLE_KEY | DB_NEXT);
+ /* if not successful did we encounter DB_NOTFOUND, or */
+ /* have a different problem. */
+ if (bdbres != 0) {
+ if (bdbres != DB_NOTFOUND) {
+ fprintf(stderr, "Unexpected error. BDB Error: %s\n",
+ db_strerror(bdbres));
+ free(bdbdata->data);
+ return ISC_R_FAILURE;
+ }
+ /* Hit DB_NOTFOUND which means end of data. */
+ break;
+ } /* end of if (bdbres !=0) */
+
+ for (DB_MULTIPLE_INIT(p, bdbdata);;) {
+ if (type == 'c')
+ DB_MULTIPLE_KEY_NEXT(p, bdbdata, retkey, retklen, retdata, retdlen);
+ else
+ DB_MULTIPLE_RECNO_NEXT(p, bdbdata, recNum, retdata, retdlen);
+
+ if (p == NULL)
+ break;
+ if (type == 'c')
+ printf("c %.*s %.*s\n",(int)retklen, retkey,(int)retdlen, retdata);
+ else
+ printf("d %.*s\n", (int)retdlen, retdata);
+ } /* end of for (DB_MULTIPLE_INIT....) */
+
+ } /* end of for (;;) */
+
+ /* free the buffer we created earlier */
+ free(bdbdata->data);
+
+ return ISC_R_SUCCESS;
+}
+
+/*%
+ * Perform listOrDelete operation
+ * if dlt == true, delete data
+ * else list data
+ */
+
+void
+operation_listOrDelete(isc_boolean_t dlt) {
+
+ int bdbres = 0;
+ DBC *curList[3];
+ DBT bdbkey, bdbdata;
+ db_recno_t recno;
+ int curIndex = 0;
+
+
+ /* verify that only allowed parameters were passed. */
+ if (dlt == isc_boolean_true) {
+ checkInvalidParam(zone, "z", "for delete operation");
+ checkInvalidParam(host, "h", "for delete operation");
+ checkInvalidOption(list_everything, isc_boolean_true, "e",
+ "for delete operation");
+ checkInvalidOption(create_allowed, isc_boolean_true, "n",
+ "for delete operation");
+ } else if (key != NULL || zone != NULL || host != NULL) {
+ checkInvalidParam(c_zone, "c", "for list when k, z or h are specified");
+ checkInvalidParam(c_ip, "i", "for list when k, z, or h are specified");
+ checkInvalidOption(list_everything, isc_boolean_true, "e",
+ "for list when k, z, or h are specified");
+ checkInvalidOption(create_allowed, isc_boolean_true, "n",
+ "for list operation");
+ } else if (c_ip != NULL || c_zone != NULL) {
+ checkInvalidOption(list_everything, isc_boolean_true, "e",
+ "for list when c or i are specified");
+ checkInvalidOption(create_allowed, isc_boolean_true, "n",
+ "for list operation");
+ }
+
+ memset(&bdbkey, 0, sizeof(bdbkey));
+ memset(&bdbdata, 0, sizeof(bdbdata));
+
+ /* Dump database in "dlzbdb" bulk format */
+ if (list_everything == isc_boolean_true) {
+ if (bulk_write('c', db.client, db.cursor, &bdbkey, &bdbdata)
+ != ISC_R_SUCCESS)
+ return;
+ memset(&bdbkey, 0, sizeof(bdbkey));
+ memset(&bdbdata, 0, sizeof(bdbdata));
+ bulk_write('d', db.data, db.cursor2, &bdbkey, &bdbdata);
+ return;
+ } /* end if (list_everything) */
+
+ /* set NULL the 2nd and 3rd positions in curList. */
+ /* that way later when add cursors to the join list */
+ /* it is already null terminated. */
+ curList[1] = curList[2] = NULL;
+
+ if (key != NULL) {
+ /* make sure other parameters weren't */
+ checkInvalidParam(zone, "z", "when k is specified");
+ checkInvalidParam(host, "h", "when k is specified");
+
+ recno = key_val;
+ bdbkey.data = &recno;
+ bdbkey.size = sizeof(recno);
+
+ if (dlt == isc_boolean_true) {
+ bdbres = db.data->del(db.data, NULL, &bdbkey, 0);
+ } else {
+ bdbdata.flags = DB_DBT_REALLOC;
+ bdbres = db.data->get(db.data, NULL, &bdbkey, &bdbdata, 0);
+
+ if (bdbres == 0) {
+ printf("KEY | DATA\n");
+ printf("%lu | %.*s\n", *(u_long *) bdbkey.data,
+ (int)bdbdata.size, (char *)bdbdata.data);
+ }
+ } /* closes else of if (dlt == isc_boolean_true) */
+ if (bdbres == DB_NOTFOUND) {
+ printf("Key not found in database");
+ }
+ } /* closes if (key != NULL) */
+
+ /* if zone is passed */
+ if (zone != NULL) {
+ /* create a cursor and make sure it worked */
+ bdbres = db.zone->cursor(db.zone, NULL, &db.cursor2, 0);
+ if (bdbres != 0) {
+ fprintf(stderr, "Unexpected error. BDB Error: %s\n",
+ db_strerror(bdbres));
+ return;
+ }
+
+ bdbkey.data = zone;
+ bdbkey.size = strlen(zone);
+ bdbres = db.cursor2->c_get(db.cursor2, &bdbkey, &bdbdata, DB_SET);
+ if (bdbres != 0) {
+ if (bdbres != DB_NOTFOUND) {
+ fprintf(stderr, "Unexpected error. BDB Error: %s\n",
+ db_strerror(bdbres));
+ } else {
+ printf("Zone not found in database");
+ }
+ return;
+ }
+
+ /* add cursor to cursor list for later use in join */
+ curList[curIndex++] = db.cursor2;
+ }
+
+ /* if host is passed */
+ if (host != NULL) {
+
+ /* create a cursor and make sure it worked. */
+ bdbres = db.host->cursor(db.host, NULL, &db.cursor3, 0);
+ if (bdbres != 0) {
+ fprintf(stderr, "Unexpected error. BDB Error: %s\n",
+ db_strerror(bdbres));
+ return;
+ }
+ bdbkey.data = host;
+ bdbkey.size = strlen(host);
+ bdbres = db.cursor3->c_get(db.cursor3, &bdbkey, &bdbdata, DB_SET);
+ if (bdbres != 0) {
+ if (bdbres != DB_NOTFOUND) {
+ fprintf(stderr, "Unexpected error. BDB Error: %s\n",
+ db_strerror(bdbres));
+ } else {
+ printf("Host not found in database");
+ }
+ return;
+ }
+
+ /* add cursor to cursor list for later use in join */
+ curList[curIndex++] = db.cursor3;
+ }
+
+
+ if (zone != NULL || host != NULL) {
+
+ /* join any cursors */
+ bdbres = db.data->join(db.data, curList, &db.cursor4, 0);
+ if (bdbres != 0) {
+ fprintf(stderr, "Unexpected error. BDB Error: %s\n",
+ db_strerror(bdbres));
+ return;
+ }
+
+ memset(&bdbkey, 0, sizeof(bdbkey));
+ bdbkey.flags = DB_DBT_REALLOC;
+ memset(&bdbdata, 0, sizeof(bdbdata));
+ bdbdata.flags = DB_DBT_REALLOC;
+
+ /* print a header to explain the output */
+ printf("KEY | DATA\n");
+ /* loop and list all results. */
+ while (bdbres == 0) {
+ /* get data */
+ bdbres = db.cursor4->c_get(db.cursor4, &bdbkey, &bdbdata, 0);
+ /* verify call had no errors */
+ if (bdbres != 0) {
+ break;
+ }
+ printf("%lu | %.*s\n", *(u_long *) bdbkey.data,
+ (int)bdbdata.size, (char *)bdbdata.data);
+ } /* closes while loop */
+ }
+
+ if (c_ip != NULL && c_zone == NULL) {
+ fprintf(stderr, "i may only be specified when c is also specified\n");
+ quit(2);
+ }
+ /* if client_zone was passed */
+ if (c_zone != NULL) {
+
+ /* create a cursor and make sure it worked. */
+ if (dlt == isc_boolean_true) {
+ /* open read-write cursor */
+ bdbres = db.client->cursor(db.client, NULL, &db.cursor,
+ DB_WRITECURSOR);
+ } else {
+ /* open read only cursor */
+ bdbres = db.client->cursor(db.client, NULL, &db.cursor, 0);
+ /* print a header to explain the output */
+ printf("CLIENT_ZONE | CLIENT_IP\n");
+ }
+
+ bdbkey.data = c_zone;
+ bdbkey.size = strlen(c_zone);
+
+ if (c_ip != NULL) {
+ bdbdata.data = c_ip;
+ bdbdata.size = strlen(c_ip);
+ bdbres = db.cursor->c_get(db.cursor, &bdbkey, &bdbdata, DB_GET_BOTH);
+ if (bdbres == DB_NOTFOUND) {
+ printf("Client zone & IP not found in database");
+ }
+ } else {
+ bdbdata.flags = DB_DBT_REALLOC;
+ bdbres = db.cursor->c_get(db.cursor, &bdbkey, &bdbdata, DB_SET);
+ if (bdbres == DB_NOTFOUND) {
+ printf("Client zone not found in database");
+ }
+ }
+
+ while (bdbres == 0) {
+ if (dlt == isc_boolean_false) {
+ printf("%.*s | %.*s\n", (int)bdbkey.size, (char *) bdbkey.data,
+ (int)bdbdata.size, (char *) bdbdata.data);
+ } else {
+ /* delete record. */
+ bdbres = db.cursor->c_del(db.cursor, 0);
+ if (bdbres != 0) {
+ fprintf(stderr, "Unexpected error. BDB Error: %s\n",
+ db_strerror(bdbres));
+ break;
+ }
+ }
+ if (c_ip != NULL) {
+ break;
+ }
+ bdbres = db.cursor->c_get(db.cursor, &bdbkey, &bdbdata, DB_NEXT_DUP);
+ if (bdbres != 0) {
+ break;
+ }
+ } /* end while loop */
+ }
+
+
+ if (bdbres != 0 && bdbres != DB_NOTFOUND) {
+ fprintf(stderr, "Unexpected error during list operation " \
+ "BDB error: %s", db_strerror(bdbres));
+ }
+
+ if (bdbkey.flags == DB_DBT_REALLOC && bdbkey.data != NULL) {
+ free(bdbkey.data);
+ }
+ if (bdbdata.flags == DB_DBT_REALLOC && bdbdata.data != NULL) {
+ free(bdbdata.data);
+ }
+}
+
+
+int
+main(int argc, char **argv) {
+
+ int ch;
+ char *endp;
+
+ /* there has to be at least 2 args, some operations require more */
+ if (argc < 2)
+ show_usage();
+
+ /* use the ISC commandline parser to get all the program arguments */
+ while ((ch= isc_commandline_parse(argc, argv, "ldesna:f:k:z:h:c:i:")) != -1) {
+ switch (ch) {
+ case 'n':
+ create_allowed = isc_boolean_true;
+ break;
+ case 'l':
+ checkOp(operation);
+ operation = list;
+ break;
+ case 'd':
+ checkOp(operation);
+ operation = dele;
+ break;
+ case 'a':
+ checkOp(operation);
+ operation = add;
+ a_data = isc_commandline_argument;
+ break;
+ case 'f':
+ checkOp(operation);
+ operation = bulk;
+ bulk_file = isc_commandline_argument;
+ break;
+ case 's':
+ checkOp(operation);
+ operation = bulk;
+ break;
+ case 'k':
+ checkParam(key, "k");
+ key = isc_commandline_argument;
+ key_val = strtoul(key, &endp, 10);
+ if (*endp != '\0' || key_val < 1) {
+ fprintf(stderr, "Error converting key to integer");
+ }
+ break;
+ case 'z':
+ checkParam(zone, "z");
+ zone = isc_commandline_argument;
+ break;
+ case 'h':
+ checkParam(host, "h");
+ host = isc_commandline_argument;
+ break;
+ case 'c':
+ checkParam(c_zone, "c");
+ c_zone = isc_commandline_argument;
+ break;
+ case 'i':
+ checkParam(c_ip, "i");
+ c_ip = isc_commandline_argument;
+ break;
+ case 'e':
+ checkOp(operation);
+ operation = list;
+ list_everything = isc_boolean_true;
+ break;
+ case '?':
+ show_usage();
+ break;
+ default:
+ /* should never reach this point */
+ fprintf(stderr, "unexpected error parsing command arguments\n");
+ quit(1);
+ break;
+ }
+ }
+
+ argc -= isc_commandline_index;
+ argv += isc_commandline_index;
+
+ /* argc & argv have been modified, so now only "extra" parameters are */
+ /* left in argc & argv. "Extra" parameters are any parameters that were */
+ /* not passed using a command line flag. Exactly 2 args should be left. */
+ /* The first should be the BDB environment path, the second should be the */
+ /* BDB database. The BDB database path can be either relative to the */
+ /* BDB environment path, or absolute. */
+ if (argc < 2) {
+ fprintf(stderr, "Both a Berkeley DB environment and file "\
+ "must be specified");
+ quit(2);
+ } else if (argc > 2) {
+ fprintf(stderr, "Too many parameters. Check command line for errors.");
+ quit(2);
+ }
+
+ /* get db_file to operate on */
+ db_envdir = argv[0];
+ db_file = argv[1];
+
+ if (openBDB() != ISC_R_SUCCESS) {
+ /* openBDB already prints error messages, don't do it here. */
+ bdb_cleanup();
+ quit(3);
+ }
+
+ switch(operation) {
+ case list:
+ operation_listOrDelete(isc_boolean_false);
+ break;
+ case dele:
+ operation_listOrDelete(isc_boolean_true);
+ break;
+ case add:
+ operation_add();
+ break;
+ case bulk:
+ operation_bulk();
+ break;
+ default:
+ fprintf(stderr, "\nNo operation was selected. "\
+ "Select an operation (l d a f)");
+ quit(2);
+ break;
+ }
+
+ quit(0);
+}
+#endif
+
diff --git a/contrib/dlz/config.dlz.in b/contrib/dlz/config.dlz.in
new file mode 100644
index 0000000..f78e907
--- /dev/null
+++ b/contrib/dlz/config.dlz.in
@@ -0,0 +1,478 @@
+# Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+#
+# Shorthand. Note quoting: DLZ_DRIVER_DIR expanded in Makefile, not here.
+#
+dlzdir='${DLZ_DRIVER_DIR}'
+
+#
+# Private autoconf macro to simplify configuring drivers:
+#
+# DLZ_ADD_DRIVER(DEFINE, DRIVER, INCLUDES, LIBS)
+#
+# where:
+# DEFINE is FOO (to define -DDLZ_FOO)
+# DRIVER is dlz_foo_driver (sources without the .c)
+# INCLUDES is any necessary include definitions
+# LIBS is any necessary library definitions
+#
+AC_DEFUN(DLZ_ADD_DRIVER, [
+ USE_DLZ="$USE_DLZ -DDLZ_$1"
+ for i in $2
+ do
+ DLZ_DRIVER_SRCS="$DLZ_DRIVER_SRCS $dlzdir/$i.c"
+ DLZ_DRIVER_OBJS="$DLZ_DRIVER_OBJS $i.$O"
+ done
+ if test -n "$3"
+ then
+ DLZ_DRIVER_INCLUDES="$DLZ_DRIVER_INCLUDES $3"
+ fi
+ if test -n "$4"
+ then
+ DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS $4"
+ fi
+])
+
+#
+# Check for the various DLZ drivers
+#
+
+#
+# Was --with-dlz-postgres specified?
+#
+
+AC_MSG_CHECKING(for Postgres DLZ driver)
+AC_ARG_WITH(dlz_postgres,
+[ --with-dlz-postgres[=PATH] Build with Postgres DLZ driver [yes|no|path].
+ (Required to use Postgres with DLZ)],
+ use_dlz_postgres="$withval", use_dlz_postgres="no")
+
+if test "$use_dlz_postgres" = "yes"
+then
+ # User did not specify a path - guess it
+ # Ask Postgres to tell us where it is
+
+ AC_PATH_PROGS(PG_CONFIG, pg_config, [not found])
+
+ if test "$PG_CONFIG" != "not found"
+ then
+ use_dlz_postgres=`$PG_CONFIG --includedir`
+ use_dlz_postgres_lib=`$PG_CONFIG --libdir`
+ fi
+fi
+
+if test "$use_dlz_postgres" = "yes"
+then
+ # User did not specify path and Postgres didn't say - guess it
+
+ pgdirs="/usr /usr/local /usr/local/pgsql /usr/pkg"
+ for d in $pgdirs
+ do
+ if test -f $d/include/libpq-fe.h
+ then
+ use_dlz_postgres=$d/include
+ use_dlz_postgres_lib=$d/lib
+ break
+ fi
+ done
+fi
+
+if test "$use_dlz_postgres" = "yes"
+then
+ # Still no joy, give up
+
+ AC_MSG_RESULT(not found)
+ AC_MSG_ERROR(
+[No pg_config and PostgreSQL was not found in any of $pgdirs; use --with-dlz-postgres=/path or put pg_config in your path])
+fi
+
+case "$use_dlz_postgres" in
+ no)
+ AC_MSG_RESULT(no)
+ ;;
+ *)
+ DLZ_ADD_DRIVER(POSTGRES, dlz_postgres_driver,
+ [-I$use_dlz_postgres],
+ [-L$use_dlz_postgres_lib -lpq])
+
+ AC_MSG_RESULT(
+[using PostgreSQL from $use_dlz_postgres_lib and $use_dlz_postgres])
+ ;;
+esac
+
+
+#
+# Was --with-dlz-mysql specified?
+#
+
+AC_MSG_CHECKING(for MySQL DLZ driver)
+AC_ARG_WITH(dlz_mysql,
+[ --with-dlz-mysql[=PATH] Build with MySQL DLZ driver [yes|no|path].
+ (Required to use MySQL with DLZ)],
+ use_dlz_mysql="$withval", use_dlz_mysql="no")
+
+mysql_include=""
+mysql_lib=""
+if test "$use_dlz_mysql" = "yes"
+then
+ # User did not specify a path - guess it
+ mysqldirs="/usr /usr/local /usr/local/mysql /usr/pkg"
+ for d in $mysqldirs
+ do
+ if test -f $d/include/mysql/mysql.h
+ then
+ use_dlz_mysql=$d
+ mysql_include=$d/include/mysql
+ if test -d $d/lib/mysql
+ then
+ mysql_lib=$d/lib/mysql
+ else
+ mysql_lib=$d/lib
+ fi
+ break
+ elif test -f $d/include/mysql.h
+ then
+ use_dlz_mysql=$d
+ mysql_include=$d/include
+ if test -d $d/lib/mysql
+ then
+ mysql_lib=$d/lib/mysql
+ else
+ mysql_lib=$d/lib
+ fi
+ break
+ fi
+ done
+elif test "$use_dlz_mysql" != "no"
+then
+ d=$use_dlz_mysql
+ if test -f $d/include/mysql/mysql.h
+ then
+ mysql_include=$d/include/mysql
+ if test -d $d/lib/mysql
+ then
+ mysql_lib=$d/lib/mysql
+ else
+ mysql_lib=$d/lib
+ fi
+ elif test -f $d/include/mysql.h
+ then
+ mysql_include=$d/include
+ if test -d $d/lib/mysql
+ then
+ mysql_lib=$d/lib/mysql
+ else
+ mysql_lib=$d/lib
+ fi
+ fi
+fi
+
+if test "$use_dlz_mysql" = "yes"
+then
+ AC_MSG_RESULT(not found)
+ AC_MSG_ERROR(
+[MySQL was not found in any of $mysqldirs; use --with-dlz-mysql=/path])
+fi
+
+case "$use_dlz_mysql" in
+ no)
+ AC_MSG_RESULT(no)
+ ;;
+ *)
+ DLZ_ADD_DRIVER(MYSQL, dlz_mysql_driver,
+ [-I${mysql_include}],
+ [-L${mysql_lib} -lmysqlclient -lz -lcrypt -lm])
+
+ AC_MSG_RESULT(
+[using mysql from ${mysql_lib} and ${mysql_include}])
+ ;;
+esac
+
+
+#
+# Was --with-dlz-bdb specified?
+#
+
+AC_MSG_CHECKING(for Berkeley DB DLZ driver)
+AC_ARG_WITH(dlz_bdb,
+[ --with-dlz-bdb[=PATH] Build with Berkeley DB DLZ driver [yes|no|path].
+ (Required to use Berkeley DB with DLZ)],
+ use_dlz_bdb="$withval", use_dlz_bdb="no")
+
+case "$use_dlz_bdb" in
+ no)
+ AC_MSG_RESULT(no)
+ ;;
+ *)
+ if test "$use_dlz_bdb" = "yes"
+ then
+ # User did not specify a path - guess directories
+ bdbdirs="/usr/local /usr/pkg /usr"
+ elif test -d "$use_dlz_bdb"
+ then
+ # User specified directory and it exists
+ bdbdirs="$use_dlz_bdb"
+ else
+ AC_MSG_RESULT(not found)
+ AC_MSG_ERROR([path $use_dlz_bdb does not exist])
+ bdbdirs=""
+ fi
+
+ # Use path we were given or guessed. This is insanely
+ # complicated because we have to search for a bunch of
+ # platform-specific variations and have to check
+ # separately for include and library directories.
+
+ # Set both to yes, so we can check them later
+ dlz_bdb_inc="yes"
+ dlz_bdb_libs="yes"
+
+ for dd in $bdbdirs
+ do
+ # Skip nonexistant directories
+ if test ! -d "$dd"
+ then
+ continue
+ fi
+
+ # Check other locations for includes.
+ # Order is important (sigh).
+
+ bdb_incdirs="/ /db42/ /db41/ /db4/ /db/"
+ for d in $bdb_incdirs
+ do
+ if test -f "$dd/include${d}db.h"
+ then
+ dlz_bdb_inc="-I$dd/include${d}"
+ break
+ fi
+ done
+
+ # Give up on this directory if we couldn't
+ # find the include subdir
+
+ if test "$dlz_bdb_inc" = "yes"
+ then
+ continue
+ fi
+
+ # Look for libname other than libdb.so.
+ # Order is important (sigh).
+
+ bdb_libnames="db42 db-4.2 db41 db-4.1 db"
+ for d in $bdb_libnames
+ do
+ if test -f "$dd/lib/lib${d}.so"
+ then
+ if test "$dd" != "/usr"
+ then
+ dlz_bdb_libs="-L${dd}/lib "
+ else
+ dlz_bdb_libs=""
+ fi
+ dlz_bdb_libs="${dlz_bdb_libs}-l${d}"
+ break
+ fi
+ done
+
+ # If we found both incdir and lib, we're done
+ if test "$dlz_bdb_libs" != "yes"
+ then
+ break
+ fi
+
+ # Otherwise, we're starting over
+
+ dlz_bdb_inc="yes"
+ dlz_bdb_libs="yes"
+ done
+
+ # Done searching, now make sure we got everything.
+
+ if test "$dlz_bdb_inc" = "yes"
+ then
+ AC_MSG_RESULT(not found)
+ AC_MSG_ERROR([could not find Berkeley DB include directory])
+ fi
+
+ if test "$dlz_bdb_libs" = "yes"
+ then
+ AC_MSG_RESULT(not found)
+ AC_MSG_ERROR([could not find Berkeley DB library])
+ fi
+
+ DLZ_ADD_DRIVER(BDB, dlz_bdb_driver dlz_bdbhpt_driver,
+ [$dlz_bdb_inc], [$dlz_bdb_libs])
+
+ AC_MSG_RESULT([using Berkeley DB: $dlz_bdb_inc $dlz_bdb_libs])
+
+ AC_CONFIG_FILES([contrib/dlz/bin/dlzbdb/Makefile])
+ ;;
+esac
+
+
+#
+# Was --with-dlz-filesystem specified?
+#
+
+AC_MSG_CHECKING(for file system DLZ driver)
+AC_ARG_WITH(dlz_filesystem,
+[ --with-dlz-filesystem[=PATH] Build with filesystem DLZ driver [yes|no].
+ (Required to use file system driver with DLZ)],
+ use_dlz_filesystem="$withval", use_dlz_filesystem="no")
+
+case "$use_dlz_filesystem" in
+ no)
+ AC_MSG_RESULT(no)
+ ;;
+ *)
+ DLZ_ADD_DRIVER(FILESYSTEM, dlz_filesystem_driver)
+
+ AC_MSG_RESULT(yes)
+ ;;
+esac
+
+
+#
+# Was --with-dlz-ldap specified?
+#
+
+AC_MSG_CHECKING(for LDAP DLZ driver)
+AC_ARG_WITH(dlz_ldap,
+[ --with-dlz-ldap[=PATH] Build with LDAP DLZ driver [yes|no|path].
+ (Required to use LDAP with DLZ)],
+ use_dlz_ldap="$withval", use_dlz_ldap="no")
+
+if test "$use_dlz_ldap" = "yes"
+then
+ # User did not specify a path - guess it
+ ldapdirs="/usr /usr/local /usr/pkg"
+ for d in $ldapdirs
+ do
+ if test -f $d/include/ldap.h
+ then
+ use_dlz_ldap=$d
+ break
+ fi
+ done
+fi
+
+if test "$use_dlz_ldap" = "yes"
+then
+ AC_MSG_RESULT(not found)
+ AC_MSG_ERROR(
+[LDAP headers were not found in any of $ldapdirs; use --with-dlz-ldap=/path])
+fi
+
+case "$use_dlz_ldap" in
+ no)
+ AC_MSG_RESULT(no)
+ ;;
+ *)
+ DLZ_ADD_DRIVER(LDAP, dlz_ldap_driver,
+ [-I$use_dlz_ldap/include],
+ [-L$use_dlz_ldap/lib -lldap -llber])
+
+ AC_MSG_RESULT(
+[using LDAP from $use_dlz_ldap/lib and $use_dlz_ldap/include])
+ ;;
+esac
+
+
+#
+# Was --with-dlz-odbc specified?
+#
+
+AC_MSG_CHECKING(for ODBC DLZ driver)
+AC_ARG_WITH(dlz_odbc,
+[ --with-dlz-odbc[=PATH] Build with ODBC DLZ driver [yes|no|path].
+ (Required to use ODBC with DLZ)],
+ use_dlz_odbc="$withval", use_dlz_odbc="no")
+
+if test "$use_dlz_odbc" = "yes"
+then
+ # User did not specify a path - guess it
+ odbcdirs="/usr /usr/local /usr/pkg"
+ for d in $odbcdirs
+ do
+ if test -f $d/include/sql.h -a -f $d/lib/libodbc.a
+ then
+ use_dlz_odbc=$d
+ break
+ fi
+ done
+fi
+
+case "$use_dlz_odbc" in
+ no)
+ AC_MSG_RESULT(no)
+ ;;
+ yes)
+ AC_MSG_RESULT(not found)
+ AC_MSG_ERROR(
+[ODBC headers were not found in any of $odbcdirs; use --with-dlz-odbc=/path])
+ ;;
+ *)
+ DLZ_ADD_DRIVER(ODBC, dlz_odbc_driver,
+ [-I$use_dlz_odbc/include],
+ [-L$use_dlz_odbc/lib -lodbc])
+
+ AC_MSG_RESULT([using ODBC from $use_dlz_odbc])
+ ;;
+esac
+
+
+#
+# Was --with-dlz-stub specified?
+#
+
+AC_MSG_CHECKING(for stub DLZ driver)
+AC_ARG_WITH(dlz_stub,
+[ --with-dlz-stub[=PATH] Build with stub DLZ driver [yes|no].
+ (Required to use stub driver with DLZ)],
+ use_dlz_stub="$withval", use_dlz_stub="no")
+
+case "$use_dlz_stub" in
+ no)
+ AC_MSG_RESULT(no)
+ ;;
+ *)
+
+ DLZ_ADD_DRIVER(STUB, dlz_stub_driver)
+
+ AC_MSG_RESULT(yes)
+ ;;
+esac
+
+
+# Add any additional DLZ drivers here.
+
+#
+# Finally, some generic stuff that applies to all drivers, assuming
+# we're compiling DLZ at all.
+#
+if test -n "$USE_DLZ"
+then
+ #
+ # Where to find DLZ driver header files.
+ #
+ DLZ_DRIVER_INCLUDES="-I$dlzdir/include $DLZ_DRIVER_INCLUDES"
+
+ #
+ # Initialization and shutdown wrappers, helper functions.
+ #
+ DLZ_DRIVER_SRCS="$dlzdir/dlz_drivers.c $dlzdir/sdlz_helper.c $DLZ_DRIVER_SRCS"
+ DLZ_DRIVER_OBJS="dlz_drivers.$O sdlz_helper.$O $DLZ_DRIVER_OBJS"
+fi
diff --git a/contrib/dlz/drivers/dlz_bdb_driver.c b/contrib/dlz/drivers/dlz_bdb_driver.c
new file mode 100644
index 0000000..5aa96a5
--- /dev/null
+++ b/contrib/dlz/drivers/dlz_bdb_driver.c
@@ -0,0 +1,797 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (C) 1999-2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef DLZ_BDB
+
+#include <config.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <dns/log.h>
+#include <dns/sdlz.h>
+#include <dns/result.h>
+
+#include <isc/mem.h>
+#include <isc/print.h>
+#include <isc/result.h>
+#include <isc/util.h>
+
+#include <named/globals.h>
+
+#include <dlz/dlz_bdb_driver.h>
+
+#include <db.h>
+
+static dns_sdlzimplementation_t *dlz_bdb = NULL;
+
+/* should the bdb driver use threads. */
+#ifdef ISC_PLATFORM_USETHREADS
+#define bdb_threads DB_THREAD
+#else
+#define bdb_threads 0
+#endif
+
+/* BDB database names */
+#define dlz_data "dns_data"
+#define dlz_zone "dns_zone"
+#define dlz_host "dns_host"
+#define dlz_client "dns_client"
+
+/*%
+ * This structure contains all the Berkeley DB handles
+ * for this instance of the BDB driver.
+ */
+
+typedef struct bdb_instance {
+ DB_ENV *dbenv; /*%< BDB environment */
+ DB *data; /*%< dns_data database handle */
+ DB *zone; /*%< zone database handle */
+ DB *host; /*%< host database handle */
+ DB *client; /*%< client database handle */
+ isc_mem_t *mctx; /*%< memory context */
+
+} bdb_instance_t;
+
+typedef struct parsed_data {
+ char *zone;
+ char *host;
+ char *type;
+ int ttl;
+ char *data;
+} parsed_data_t;
+
+
+/* forward reference */
+
+static isc_result_t
+bdb_findzone(void *driverarg, void *dbdata, const char *name);
+
+/*%
+ * Parses the DBT from the Berkeley DB into a parsed_data record
+ * The parsed_data record should be allocated before and passed into the
+ * bdb_parse_data function. The char (type & data) fields should not
+ * be "free"d as that memory is part of the DBT data field. It will be
+ * "free"d when the DBT is freed.
+ */
+
+static isc_result_t
+bdb_parse_data(char *in, parsed_data_t *pd) {
+
+ char *endp, *ttlStr;
+ char *tmp = in;
+ char *lastchar = (char *) &tmp[strlen(tmp) + 1];
+
+ /*%
+ * String should be formated as:
+ * zone(a space)host(a space)ttl(a space)type(a space)remaining data
+ * examples:
+ * example.com www 10 A 127.0.0.1
+ * example.com mail 10 A 127.0.0.2
+ * example.com @ 10 MX 20 mail.example.com
+ */
+
+ /* save pointer to zone */
+ pd->zone = tmp;
+
+ /* find space after zone and change it to a '\0' */
+ tmp = strchr(tmp, ' ');
+ /* verify we found a space */
+ if (tmp == NULL)
+ return ISC_R_FAILURE;
+ /* change the space to a null (string terminator) */
+ tmp[0] = '\0';
+ /* make sure it is safe to increment pointer */
+ if (++tmp > lastchar)
+ return ISC_R_FAILURE;
+
+ /* save pointer to host */
+ pd->host = tmp;
+
+ /* find space after type and change it to a '\0' */
+ tmp = strchr(tmp, ' ');
+ /* verify we found a space */
+ if (tmp == NULL)
+ return ISC_R_FAILURE;
+ /* change the space to a null (string terminator) */
+ tmp[0] = '\0';
+ /* make sure it is safe to increment pointer */
+ if (++tmp > lastchar)
+ return ISC_R_FAILURE;
+
+ /* save pointer to dns type */
+ pd->type = tmp;
+
+ /* find space after type and change it to a '\0' */
+ tmp = strchr(tmp, ' ');
+ /* verify we found a space */
+ if (tmp == NULL)
+ return ISC_R_FAILURE;
+ /* change the space to a null (string terminator) */
+ tmp[0] = '\0';
+ /* make sure it is safe to increment pointer */
+ if (++tmp > lastchar)
+ return ISC_R_FAILURE;
+
+ /* save pointer to dns ttl */
+ ttlStr = tmp;
+
+ /* find space after ttl and change it to a '\0' */
+ tmp = strchr(tmp, ' ');
+ /* verify we found a space */
+ if (tmp == NULL)
+ return ISC_R_FAILURE;
+ /* change the space to a null (string terminator) */
+ tmp[0] = '\0';
+ /* make sure it is safe to increment pointer */
+ if (++tmp > lastchar)
+ return ISC_R_FAILURE;
+
+ /* save pointer to remainder of DNS data */
+ pd->data = tmp;
+
+ /* convert ttl string to integer */
+ pd->ttl = strtol(ttlStr, &endp, 10);
+ if (*endp != '\0' || pd->ttl < 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "BDB driver ttl must be a postive number");
+ return ISC_R_FAILURE;
+ }
+
+ /* if we get this far everything should have worked. */
+ return ISC_R_SUCCESS;
+}
+
+/*
+ * DLZ methods
+ */
+
+static isc_result_t
+bdb_allowzonexfr(void *driverarg, void *dbdata, const char *name,
+ const char *client)
+{
+ isc_result_t result;
+ bdb_instance_t *db = (bdb_instance_t *) dbdata;
+ DBC *client_cursor = NULL;
+ DBT key, data;
+
+ /* check to see if we are authoritative for the zone first. */
+ result = bdb_findzone(driverarg, dbdata, name);
+ if (result != ISC_R_SUCCESS)
+ return (ISC_R_NOTFOUND);
+
+ memset(&key, 0, sizeof(DBT));
+ key.flags = DB_DBT_MALLOC;
+ key.data = strdup(name);
+ if (key.data == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto xfr_cleanup;
+ }
+ key.size = strlen(key.data);
+
+ memset(&data, 0, sizeof(DBT));
+ data.flags = DB_DBT_MALLOC;
+ data.data = strdup(client);
+ if (data.data == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto xfr_cleanup;
+ }
+ data.size = strlen(data.data);
+
+ /* get a cursor to loop through zone data */
+ if (db->client->cursor(db->client, NULL, &client_cursor, 0) != 0) {
+ result = ISC_R_FAILURE;
+ goto xfr_cleanup;
+ }
+
+ switch(client_cursor->c_get(client_cursor, &key, &data, DB_GET_BOTH)) {
+ case DB_NOTFOUND:
+ case DB_SECONDARY_BAD:
+ result = ISC_R_NOTFOUND;
+ break;
+ case 0:
+ result = ISC_R_SUCCESS;
+ break;
+ default:
+ result = ISC_R_FAILURE;
+ }
+
+ xfr_cleanup:
+
+ /* free any memory duplicate string in the key field */
+ if (key.data != NULL)
+ free(key.data);
+
+ /* free any memory allocated to the data field. */
+ if (data.data != NULL)
+ free(data.data);
+
+ /* get rid of zone_cursor */
+ if (client_cursor != NULL)
+ client_cursor->c_close(client_cursor);
+
+ return result;
+
+}
+
+static isc_result_t
+bdb_allnodes(const char *zone, void *driverarg, void *dbdata,
+ dns_sdlzallnodes_t *allnodes)
+{
+
+ isc_result_t result = ISC_R_NOTFOUND;
+ bdb_instance_t *db = (bdb_instance_t *) dbdata;
+ DBC *zone_cursor = NULL;
+ DBT key, data;
+ int flags;
+ int bdbres;
+ parsed_data_t pd;
+ char *tmp = NULL, *tmp_zone;
+
+ UNUSED(driverarg);
+
+ memset(&key, 0, sizeof(DBT));
+ memset(&data, 0, sizeof(DBT));
+
+ key.data = tmp_zone = strdup(zone);
+
+ if (key.data == NULL)
+ return (ISC_R_NOMEMORY);
+
+ key.size = strlen(key.data);
+
+ /* get a cursor to loop through zone data */
+ if (db->zone->cursor(db->zone, NULL, &zone_cursor, 0) != 0) {
+ result = ISC_R_FAILURE;
+ goto allnodes_cleanup;
+ }
+
+ flags = DB_SET;
+
+ while ((bdbres = zone_cursor->c_get(zone_cursor, &key, &data,
+ flags)) == 0) {
+
+ flags = DB_NEXT_DUP;
+
+ tmp = realloc(tmp, data.size + 1);
+ if (tmp == NULL)
+ goto allnodes_cleanup;
+
+ strncpy(tmp, data.data, data.size);
+ tmp[data.size] = '\0';
+
+ if (bdb_parse_data(tmp, &pd) != ISC_R_SUCCESS)
+ goto allnodes_cleanup;
+
+ result = dns_sdlz_putnamedrr(allnodes, pd.host, pd.type,
+ pd.ttl, pd.data);
+ if (result != ISC_R_SUCCESS)
+ goto allnodes_cleanup;
+
+ } /* end while loop */
+
+ allnodes_cleanup:
+
+ if (tmp != NULL)
+ free(tmp);
+
+ /* free any memory duplicate string in the key field */
+ if (tmp_zone != NULL)
+ free(tmp_zone);
+
+ /* get rid of zone_cursor */
+ if (zone_cursor != NULL)
+ zone_cursor->c_close(zone_cursor);
+
+ return result;
+
+}
+
+/*%
+ * Performs BDB cleanup.
+ * Used by bdb_create if there is an error starting up.
+ * Used by bdb_destroy when the driver is shutting down.
+ */
+
+static void
+bdb_cleanup(bdb_instance_t *db) {
+
+ isc_mem_t *mctx;
+
+ /* close databases */
+ if (db->data != NULL)
+ db->data->close(db->data, 0);
+ if (db->host != NULL)
+ db->host->close(db->host, 0);
+ if (db->zone != NULL)
+ db->zone->close(db->zone, 0);
+ if (db->client != NULL)
+ db->client->close(db->client, 0);
+
+ /* close environment */
+ if (db->dbenv != NULL)
+ db->dbenv->close(db->dbenv, 0);
+
+ /* cleanup memory */
+ if (db->mctx != NULL) {
+ /* save mctx for later */
+ mctx = db->mctx;
+ /* return, and detach the memory */
+ isc_mem_put(mctx, db, sizeof(bdb_instance_t));
+ isc_mem_detach(&mctx);
+ }
+}
+
+static isc_result_t
+bdb_findzone(void *driverarg, void *dbdata, const char *name)
+{
+
+ isc_result_t result;
+ bdb_instance_t *db = (bdb_instance_t *) dbdata;
+ DBC *zone_cursor = NULL;
+ DBT key, data;
+
+ UNUSED(driverarg);
+
+ memset(&key, 0, sizeof(DBT));
+ memset(&data, 0, sizeof(DBT));
+ data.flags = DB_DBT_MALLOC;
+
+ key.data = strdup(name);
+
+ if (key.data == NULL)
+ return (ISC_R_NOMEMORY);
+
+ key.size = strlen(key.data);
+
+ /* get a cursor to loop through zone data */
+ if (db->zone->cursor(db->zone, NULL, &zone_cursor, 0) != 0) {
+ result = ISC_R_NOTFOUND;
+ goto findzone_cleanup;
+ }
+
+ switch(zone_cursor->c_get(zone_cursor, &key, &data, DB_SET)) {
+ case DB_NOTFOUND:
+ case DB_SECONDARY_BAD:
+ result = ISC_R_NOTFOUND;
+ break;
+ case 0:
+ result = ISC_R_SUCCESS;
+ break;
+ default:
+ result = ISC_R_FAILURE;
+ }
+
+ findzone_cleanup:
+
+ /* free any memory duplicate string in the key field */
+ if (key.data != NULL)
+ free(key.data);
+
+ /* free any memory allocated to the data field. */
+ if (data.data != NULL)
+ free(data.data);
+
+ /* get rid of zone_cursor */
+ if (zone_cursor != NULL)
+ zone_cursor->c_close(zone_cursor);
+
+ return result;
+}
+
+static isc_result_t
+bdb_lookup(const char *zone, const char *name, void *driverarg,
+ void *dbdata, dns_sdlzlookup_t *lookup)
+{
+
+ isc_result_t result = ISC_R_NOTFOUND;
+ bdb_instance_t *db = (bdb_instance_t *) dbdata;
+ DBC *zone_cursor = NULL;
+ DBC *host_cursor = NULL;
+ DBC *join_cursor = NULL;
+ DBT key, data;
+ DBC *cur_arr[3];
+ int bdbres;
+ parsed_data_t pd;
+ char *tmp_zone, *tmp_host = NULL;
+ char *tmp = NULL;
+
+ UNUSED(driverarg);
+
+ memset(&key, 0, sizeof(DBT));
+ memset(&data, 0, sizeof(DBT));
+
+ /* set zone key */
+ key.data = tmp_zone = strdup(zone);
+ if (key.data == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto lookup_cleanup;
+ }
+ key.size = strlen(key.data);
+
+ /* get a cursor to loop through zone data */
+ if (db->zone->cursor(db->zone, NULL, &zone_cursor, 0) != 0) {
+ result = ISC_R_FAILURE;
+ goto lookup_cleanup;
+ }
+
+ /* initialize zone_cursor with zone_key */
+ if (zone_cursor->c_get(zone_cursor, &key, &data, DB_SET) != 0) {
+ result = ISC_R_NOTFOUND;
+ goto lookup_cleanup;
+ }
+
+ /* set host key */
+ key.data = tmp_host = strdup(name);
+ if (key.data == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto lookup_cleanup;
+ }
+ key.size = strlen(key.data);
+
+ /* get a cursor to loop through host data */
+ if (db->host->cursor(db->host, NULL, &host_cursor, 0) != 0) {
+ result = ISC_R_FAILURE;
+ goto lookup_cleanup;
+ }
+
+ /* initialize host_cursor with host_key */
+ if (host_cursor->c_get(host_cursor, &key, &data, DB_SET) != 0) {
+ result = ISC_R_NOTFOUND;
+ goto lookup_cleanup;
+ }
+
+ cur_arr[0] = zone_cursor;
+ cur_arr[1] = host_cursor;
+ cur_arr[2] = NULL;
+
+ db->data->join(db->data, cur_arr, &join_cursor, 0);
+
+ while ((bdbres = join_cursor->c_get(join_cursor, &key,
+ &data, 0)) == 0) {
+
+ tmp = realloc(tmp, data.size + 1);
+ if (tmp == NULL)
+ goto lookup_cleanup;
+
+ strncpy(tmp, data.data, data.size);
+ tmp[data.size] = '\0';
+
+ if (bdb_parse_data(tmp, &pd) != ISC_R_SUCCESS)
+ goto lookup_cleanup;
+
+ result = dns_sdlz_putrr(lookup, pd.type, pd.ttl, pd.data);
+
+ if (result != ISC_R_SUCCESS)
+ goto lookup_cleanup;
+ } /* end while loop */
+
+ lookup_cleanup:
+
+ if (tmp != NULL)
+ free(tmp);
+ if (tmp_zone != NULL)
+ free(tmp_zone);
+ if (tmp_host != NULL)
+ free(tmp_host);
+
+ /* get rid of the joined cusor */
+ if (join_cursor != NULL)
+ join_cursor->c_close(join_cursor);
+
+ /* get rid of zone_cursor */
+ if (zone_cursor != NULL)
+ zone_cursor->c_close(zone_cursor);
+
+ /* get rid of host_cursor */
+ if (host_cursor != NULL)
+ host_cursor->c_close(host_cursor);
+
+ return result;
+
+ return ISC_R_NOTFOUND;
+}
+
+
+/*% Initializes, sets flags and then opens Berkeley databases. */
+
+static isc_result_t
+bdb_opendb(DB_ENV *db_env, DBTYPE db_type, DB **db, const char *db_name,
+ char *db_file, int flags) {
+
+ int result;
+
+ /* Initialize the database. */
+ if ((result = db_create(db, db_env, 0)) != 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "BDB could not initialize %s database. "
+ "BDB error: %s",
+ db_name, db_strerror(result));
+ return ISC_R_FAILURE;
+ }
+
+ /* set database flags. */
+ if ((result = (*db)->set_flags(*db, flags)) != 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "BDB could not set flags for %s database. "
+ "BDB error: %s",
+ db_name, db_strerror(result));
+ return ISC_R_FAILURE;
+ }
+
+ /* open the database. */
+ if ((result = (*db)->open(*db, NULL, db_file, db_name, db_type,
+ DB_RDONLY | bdb_threads, 0)) != 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "BDB could not open %s database in %s. "
+ "BDB error: %s",
+ db_name, db_file, db_strerror(result));
+ return ISC_R_FAILURE;
+ }
+
+ return ISC_R_SUCCESS;
+}
+
+static isc_result_t
+bdb_create(const char *dlzname, unsigned int argc, char *argv[],
+ void *driverarg, void **dbdata)
+{
+ isc_result_t result;
+ int bdbres;
+ bdb_instance_t *db = NULL;
+
+ UNUSED(dlzname);
+ UNUSED(driverarg);
+
+ /* verify we have 3 arg's passed to the driver */
+ if (argc != 3) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Berkeley DB driver requires at least "
+ "2 command line args.");
+ return (ISC_R_FAILURE);
+ }
+
+ /* allocate and zero memory for driver structure */
+ db = isc_mem_get(ns_g_mctx, sizeof(bdb_instance_t));
+ if (db == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Could not allocate memory for "
+ "database instance object.");
+ return (ISC_R_NOMEMORY);
+ }
+ memset(db, 0, sizeof(bdb_instance_t));
+
+ /* attach to the memory context */
+ isc_mem_attach(ns_g_mctx, &db->mctx);
+
+ /* create BDB environment
+ * Basically BDB allocates and assigns memory to db->dbenv
+ */
+ bdbres = db_env_create(&db->dbenv, 0);
+ if (bdbres != 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "BDB environment could not be created. "
+ "BDB error: %s",
+ db_strerror(bdbres));
+ result = ISC_R_FAILURE;
+ goto init_cleanup;
+ }
+
+ /* open BDB environment */
+ bdbres = db->dbenv->open(db->dbenv, argv[1],
+ DB_INIT_CDB | DB_INIT_MPOOL |
+ bdb_threads | DB_CREATE,
+ 0);
+ if (bdbres != 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "BDB environment at '%s' could not be opened. "
+ "BDB error: %s",
+ argv[1], db_strerror(bdbres));
+ result = ISC_R_FAILURE;
+ goto init_cleanup;
+ }
+
+ /* open dlz_data database. */
+ result = bdb_opendb(db->dbenv, DB_UNKNOWN, &db->data,
+ dlz_data, argv[2], 0);
+ if (result != ISC_R_SUCCESS)
+ goto init_cleanup;
+
+ /* open dlz_host database. */
+ result = bdb_opendb(db->dbenv, DB_UNKNOWN, &db->host,
+ dlz_host, argv[2],
+ DB_DUP | DB_DUPSORT);
+ if (result != ISC_R_SUCCESS)
+ goto init_cleanup;
+
+ /* open dlz_zone database. */
+ result = bdb_opendb(db->dbenv, DB_UNKNOWN, &db->zone,
+ dlz_zone, argv[2],
+ DB_DUP | DB_DUPSORT);
+ if (result != ISC_R_SUCCESS)
+ goto init_cleanup;
+
+ /* open dlz_client database. */
+ result = bdb_opendb(db->dbenv, DB_UNKNOWN, &db->client,
+ dlz_client, argv[2], DB_DUP | DB_DUPSORT);
+ if (result != ISC_R_SUCCESS)
+ goto init_cleanup;
+
+ /* associate the host secondary database with the primary database */
+ bdbres = db->data->associate(db->data, NULL, db->host, NULL, 0);
+ if (bdbres != 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "BDB could not associate %s database with %s. "
+ "BDB error: %s",
+ dlz_host, dlz_data, db_strerror(bdbres));
+ result = ISC_R_FAILURE;
+ goto init_cleanup;
+ }
+
+ /* associate the zone secondary database with the primary database */
+ bdbres = db->data->associate(db->data, NULL, db->zone, NULL, 0);
+ if (bdbres != 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "BDB could not associate %s database with %s. "
+ "BDB error: %s",
+ dlz_zone, dlz_data, db_strerror(bdbres));
+ result = ISC_R_FAILURE;
+ goto init_cleanup;
+ }
+
+ *dbdata = db;
+
+ return(ISC_R_SUCCESS);
+
+ init_cleanup:
+
+ bdb_cleanup(db);
+ return result;
+}
+
+static void
+bdb_destroy(void *driverarg, void *dbdata)
+{
+ UNUSED(driverarg);
+
+ bdb_cleanup((bdb_instance_t *) dbdata);
+}
+
+/* bdb_authority not needed as authority data is returned by lookup */
+static dns_sdlzmethods_t dlz_bdb_methods = {
+ bdb_create,
+ bdb_destroy,
+ bdb_findzone,
+ bdb_lookup,
+ NULL,
+ bdb_allnodes,
+ bdb_allowzonexfr
+};
+
+/*%
+ * Wrapper around dns_sdlzregister().
+ */
+isc_result_t
+dlz_bdb_init(void) {
+ isc_result_t result;
+
+ /*
+ * Write debugging message to log
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "Registering DLZ bdb driver.");
+
+ result = dns_sdlzregister("bdb", &dlz_bdb_methods, NULL,
+ DNS_SDLZFLAG_RELATIVEOWNER |
+ DNS_SDLZFLAG_RELATIVERDATA |
+ DNS_SDLZFLAG_THREADSAFE,
+ ns_g_mctx, &dlz_bdb);
+ if (result != ISC_R_SUCCESS) {
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "dns_sdlzregister() failed: %s",
+ isc_result_totext(result));
+ result = ISC_R_UNEXPECTED;
+ }
+
+
+ return result;
+}
+
+/*%
+ * Wrapper around dns_sdlzunregister().
+ */
+void
+dlz_bdb_clear(void) {
+
+ /*
+ * Write debugging message to log
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "Unregistering DLZ bdb driver.");
+
+ if (dlz_bdb != NULL)
+ dns_sdlzunregister(&dlz_bdb);
+}
+
+#endif
diff --git a/contrib/dlz/drivers/dlz_bdbhpt_driver.c b/contrib/dlz/drivers/dlz_bdbhpt_driver.c
new file mode 100644
index 0000000..da5b235
--- /dev/null
+++ b/contrib/dlz/drivers/dlz_bdbhpt_driver.c
@@ -0,0 +1,860 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (C) 1999-2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef DLZ_BDB
+
+#include <config.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <dns/log.h>
+#include <dns/sdlz.h>
+#include <dns/result.h>
+
+#include <isc/mem.h>
+#include <isc/print.h>
+#include <isc/result.h>
+#include <isc/util.h>
+
+#include <named/globals.h>
+
+#include <dlz/dlz_bdbhpt_driver.h>
+
+#include <db.h>
+
+static dns_sdlzimplementation_t *dlz_bdbhpt = NULL;
+
+/* should the bdb driver use threads. */
+#ifdef ISC_PLATFORM_USETHREADS
+#define bdbhpt_threads DB_THREAD
+#else
+#define bdbhpt_threads 0
+#endif
+
+/* bdbhpt database names */
+#define dlz_data "dns_data"
+#define dlz_zone "dns_zone"
+#define dlz_xfr "dns_xfr"
+#define dlz_client "dns_client"
+
+ /* This structure contains all the Berkeley DB handles
+ * for this instance of the bdbhpt driver.
+ */
+
+typedef struct bdbhpt_instance {
+ DB_ENV *dbenv; /*%< bdbhpt environment */
+ DB *data; /*%< dns_data database handle */
+ DB *zone; /*%< zone database handle */
+ DB *xfr; /*%< zone xfr database handle */
+ DB *client; /*%< client database handle */
+ isc_mem_t *mctx; /*%< memory context */
+
+} bdbhpt_instance_t;
+
+typedef struct bdbhpt_parsed_data {
+ char *host;
+ char *type;
+ int ttl;
+ char *data;
+} bdbhpt_parsed_data_t;
+
+
+/* forward reference */
+
+static isc_result_t
+bdbhpt_findzone(void *driverarg, void *dbdata, const char *name);
+
+/*%
+ * Reverses a string in place.
+ */
+
+static char *bdbhpt_strrev(char *str)
+{
+ char *p1, *p2;
+
+ if (! str || ! *str)
+ return str;
+ for (p1 = str, p2 = str + strlen(str) - 1; p2 > p1; ++p1, --p2)
+ {
+ *p1 ^= *p2;
+ *p2 ^= *p1;
+ *p1 ^= *p2;
+ }
+ return str;
+}
+
+/*%
+ * Parses the DBT from the Berkeley DB into a parsed_data record
+ * The parsed_data record should be allocated before and passed into the
+ * bdbhpt_parse_data function. The char (type & data) fields should not
+ * be "free"d as that memory is part of the DBT data field. It will be
+ * "free"d when the DBT is freed.
+ */
+
+static isc_result_t
+bdbhpt_parse_data(char *in, bdbhpt_parsed_data_t *pd) {
+
+ char *endp, *ttlStr;
+ char *tmp = in;
+ char *lastchar = (char *) &tmp[strlen(tmp)];
+
+ /*%
+ * String should be formated as:
+ * replication_id
+ * (a space)
+ * host_name
+ * (a space)
+ * ttl
+ * (a space)
+ * type
+ * (a space)
+ * remaining data
+ *
+ * examples:
+ *
+ * 9191 host 10 A 127.0.0.1
+ * server1_212 host 10 A 127.0.0.2
+ * {xxxx-xxxx-xxxx-xxxx-xxxx} host 10 MX 20 mail.example.com
+ */
+
+ /*
+ * we don't need the replication id, so don't
+ * bother saving a pointer to it.
+ */
+
+ /* find space after replication id */
+ tmp = strchr(tmp, ' ');
+ /* verify we found a space */
+ if (tmp == NULL)
+ return ISC_R_FAILURE;
+ /* make sure it is safe to increment pointer */
+ if (++tmp > lastchar)
+ return ISC_R_FAILURE;
+
+ /* save pointer to host */
+ pd->host = tmp;
+
+ /* find space after host and change it to a '\0' */
+ tmp = strchr(tmp, ' ');
+ /* verify we found a space */
+ if (tmp == NULL)
+ return ISC_R_FAILURE;
+ /* change the space to a null (string terminator) */
+ tmp[0] = '\0';
+ /* make sure it is safe to increment pointer */
+ if (++tmp > lastchar)
+ return ISC_R_FAILURE;
+
+ /* save pointer to ttl string */
+ ttlStr = tmp;
+
+ /* find space after ttl and change it to a '\0' */
+ tmp = strchr(tmp, ' ');
+ /* verify we found a space */
+ if (tmp == NULL)
+ return ISC_R_FAILURE;
+ /* change the space to a null (string terminator) */
+ tmp[0] = '\0';
+ /* make sure it is safe to increment pointer */
+ if (++tmp > lastchar)
+ return ISC_R_FAILURE;
+
+ /* save pointer to dns type */
+ pd->type = tmp;
+
+ /* find space after type and change it to a '\0' */
+ tmp = strchr(tmp, ' ');
+ /* verify we found a space */
+ if (tmp == NULL)
+ return ISC_R_FAILURE;
+ /* change the space to a null (string terminator) */
+ tmp[0] = '\0';
+ /* make sure it is safe to increment pointer */
+ if (++tmp > lastchar)
+ return ISC_R_FAILURE;
+
+ /* save pointer to remainder of DNS data */
+ pd->data = tmp;
+
+ /* convert ttl string to integer */
+ pd->ttl = strtol(ttlStr, &endp, 10);
+ if (*endp != '\0' || pd->ttl < 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "bdbhpt driver ttl must be a postive number");
+ return ISC_R_FAILURE;
+ }
+
+ /* if we get this far everything should have worked. */
+ return ISC_R_SUCCESS;
+}
+
+/*
+ * DLZ methods
+ */
+
+static isc_result_t
+bdbhpt_allowzonexfr(void *driverarg, void *dbdata, const char *name,
+ const char *client)
+{
+ isc_result_t result;
+ bdbhpt_instance_t *db = (bdbhpt_instance_t *) dbdata;
+ DBT key, data;
+
+ /* check to see if we are authoritative for the zone first. */
+ result = bdbhpt_findzone(driverarg, dbdata, name);
+ if (result != ISC_R_SUCCESS)
+ return (ISC_R_NOTFOUND);
+
+ memset(&key, 0, sizeof(DBT));
+ key.flags = DB_DBT_MALLOC;
+ key.data = strdup(name);
+ if (key.data == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto xfr_cleanup;
+ }
+ key.size = strlen(key.data);
+
+ memset(&data, 0, sizeof(DBT));
+ data.flags = DB_DBT_MALLOC;
+ data.data = strdup(client);
+ if (data.data == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto xfr_cleanup;
+ }
+ data.size = strlen(data.data);
+
+ switch(db->client->get(db->client, NULL, &key, &data, DB_GET_BOTH)) {
+ case DB_NOTFOUND:
+ result = ISC_R_NOTFOUND;
+ break;
+ case 0:
+ result = ISC_R_SUCCESS;
+ break;
+ default:
+ result = ISC_R_FAILURE;
+ }
+
+ xfr_cleanup:
+
+ /* free any memory duplicate string in the key field */
+ if (key.data != NULL)
+ free(key.data);
+
+ /* free any memory allocated to the data field. */
+ if (data.data != NULL)
+ free(data.data);
+
+ return result;
+
+}
+
+/*%
+ * BDB does not allow a secondary index on a database that allows
+ * duplicates. We have a few options:
+ *
+ * 1) kill speed by having lookup method use a secondary db which
+ * is associated to the primary DB with the DNS data. Then have
+ * another secondary db for zone transfer which also points to
+ * the dns_data primary. NO - The point of this driver is
+ * lookup performance.
+ *
+ * 2) Blow up database size by storing DNS data twice. Once for
+ * the lookup (dns_data) database, and a second time for the zone
+ * transfer (dns_xfr) database. NO - That would probably require
+ * a larger cache to provide good performance. Also, that would
+ * make the DB larger on disk potentially slowing it as well.
+ *
+ * 3) Loop through the dns_xfr database with a cursor to get
+ * all the different hosts in a zone. Then use the zone & host
+ * together to lookup the data in the dns_data database. YES -
+ * This may slow down zone xfr's a little, but that's ok they
+ * don't happen as often and don't need to be as fast. We can
+ * also use this table when deleting a zone (The BDB driver
+ * is read only - the delete would be used during replication
+ * updates by a separate process).
+ */
+
+static isc_result_t
+bdbhpt_allnodes(const char *zone, void *driverarg, void *dbdata,
+ dns_sdlzallnodes_t *allnodes)
+{
+
+ isc_result_t result = ISC_R_NOTFOUND;
+ bdbhpt_instance_t *db = (bdbhpt_instance_t *) dbdata;
+ DBC *xfr_cursor = NULL;
+ DBC *dns_cursor = NULL;
+ DBT xfr_key, xfr_data, dns_key, dns_data;
+ int xfr_flags;
+ int dns_flags;
+ int bdbhptres;
+ bdbhpt_parsed_data_t pd;
+ char *tmp = NULL, *tmp_zone, *tmp_zone_host = NULL;
+
+ UNUSED(driverarg);
+
+ memset(&xfr_key, 0, sizeof(DBT));
+ memset(&xfr_data, 0, sizeof(DBT));
+ memset(&dns_key, 0, sizeof(DBT));
+ memset(&dns_data, 0, sizeof(DBT));
+
+ xfr_key.data = tmp_zone = strdup(zone);
+ if (xfr_key.data == NULL)
+ return (ISC_R_NOMEMORY);
+
+ xfr_key.size = strlen(xfr_key.data);
+
+ /* get a cursor to loop through dns_xfr table */
+ if (db->xfr->cursor(db->xfr, NULL, &xfr_cursor, 0) != 0) {
+ result = ISC_R_FAILURE;
+ goto allnodes_cleanup;
+ }
+
+ /* get a cursor to loop through dns_data table */
+ if (db->data->cursor(db->data, NULL, &dns_cursor, 0) != 0) {
+ result = ISC_R_FAILURE;
+ goto allnodes_cleanup;
+ }
+
+ xfr_flags = DB_SET;
+
+ /* loop through xfr table for specified zone. */
+ while ((bdbhptres = xfr_cursor->c_get(xfr_cursor, &xfr_key, &xfr_data,
+ xfr_flags)) == 0) {
+
+ xfr_flags = DB_NEXT_DUP;
+
+ /* +1 to allow for space between zone and host names */
+ dns_key.size = xfr_data.size + xfr_key.size + 1;
+
+ /* +1 to allow for null term at end of string. */
+ dns_key.data = tmp_zone_host = malloc(dns_key.size + 1);
+ if (dns_key.data == NULL)
+ goto allnodes_cleanup;
+
+ /*
+ * construct search key for dns_data.
+ * zone_name(a space)host_name
+ */
+ strcpy(dns_key.data, zone);
+ strcat(dns_key.data, " ");
+ strncat(dns_key.data, xfr_data.data, xfr_data.size);
+
+ dns_flags = DB_SET;
+
+ while ((bdbhptres = dns_cursor->c_get(dns_cursor, &dns_key,
+ &dns_data,
+ dns_flags)) == 0) {
+
+ dns_flags = DB_NEXT_DUP;
+
+ /* +1 to allow for null term at end of string. */
+ tmp = realloc(tmp, dns_data.size + 1);
+ if (tmp == NULL)
+ goto allnodes_cleanup;
+
+ /* copy data to tmp string, and append null term. */
+ strncpy(tmp, dns_data.data, dns_data.size);
+ tmp[dns_data.size] = '\0';
+
+ /* split string into dns data parts. */
+ if (bdbhpt_parse_data(tmp, &pd) != ISC_R_SUCCESS)
+ goto allnodes_cleanup;
+
+ result = dns_sdlz_putnamedrr(allnodes, pd.host,
+ pd.type, pd.ttl, pd.data);
+ if (result != ISC_R_SUCCESS)
+ goto allnodes_cleanup;
+
+ } /* end inner while loop */
+
+ /* clean up memory */
+ if (tmp_zone_host != NULL) {
+ free(tmp_zone_host);
+ tmp_zone_host = NULL;
+ }
+ } /* end outer while loop */
+
+ allnodes_cleanup:
+
+ /* free any memory */
+ if (tmp != NULL)
+ free(tmp);
+
+ if (tmp_zone_host != NULL)
+ free(tmp_zone_host);
+
+ if (tmp_zone != NULL)
+ free(tmp_zone);
+
+ /* get rid of cursors */
+ if (xfr_cursor != NULL)
+ xfr_cursor->c_close(xfr_cursor);
+
+ if (dns_cursor != NULL)
+ dns_cursor->c_close(xfr_cursor);
+
+ return result;
+}
+
+/*%
+ * Performs bdbhpt cleanup.
+ * Used by bdbhpt_create if there is an error starting up.
+ * Used by bdbhpt_destroy when the driver is shutting down.
+ */
+
+static void
+bdbhpt_cleanup(bdbhpt_instance_t *db) {
+
+ isc_mem_t *mctx;
+
+ /* close databases */
+ if (db->data != NULL)
+ db->data->close(db->data, 0);
+ if (db->xfr != NULL)
+ db->xfr->close(db->xfr, 0);
+ if (db->zone != NULL)
+ db->zone->close(db->zone, 0);
+ if (db->client != NULL)
+ db->client->close(db->client, 0);
+
+ /* close environment */
+ if (db->dbenv != NULL)
+ db->dbenv->close(db->dbenv, 0);
+
+ /* cleanup memory */
+ if (db->mctx != NULL) {
+ /* save mctx for later */
+ mctx = db->mctx;
+ /* return, and detach the memory */
+ isc_mem_put(mctx, db, sizeof(bdbhpt_instance_t));
+ isc_mem_detach(&mctx);
+ }
+}
+
+static isc_result_t
+bdbhpt_findzone(void *driverarg, void *dbdata, const char *name)
+{
+
+ isc_result_t result;
+ bdbhpt_instance_t *db = (bdbhpt_instance_t *) dbdata;
+ DBT key, data;
+
+ UNUSED(driverarg);
+
+ memset(&key, 0, sizeof(DBT));
+ memset(&data, 0, sizeof(DBT));
+ data.flags = DB_DBT_MALLOC;
+
+ key.data = strdup(name);
+
+ if (key.data == NULL)
+ return (ISC_R_NOMEMORY);
+
+ /*
+ * reverse string to take advantage of BDB locality of reference
+ * if we need futher lookups because the zone doesn't match the
+ * first time.
+ */
+ key.data = bdbhpt_strrev(key.data);
+ key.size = strlen(key.data);
+
+ switch(db->zone->get(db->zone, NULL, &key, &data, 0)) {
+ case DB_NOTFOUND:
+ result = ISC_R_NOTFOUND;
+ break;
+ case 0:
+ result = ISC_R_SUCCESS;
+ break;
+ default:
+ result = ISC_R_FAILURE;
+ }
+
+ /* free any memory duplicate string in the key field */
+ if (key.data != NULL)
+ free(key.data);
+
+ /* free any memory allocated to the data field. */
+ if (data.data != NULL)
+ free(data.data);
+
+ return result;
+}
+
+static isc_result_t
+bdbhpt_lookup(const char *zone, const char *name, void *driverarg,
+ void *dbdata, dns_sdlzlookup_t *lookup)
+{
+
+ isc_result_t result = ISC_R_NOTFOUND;
+ bdbhpt_instance_t *db = (bdbhpt_instance_t *) dbdata;
+ DBC *data_cursor = NULL;
+ DBT key, data;
+ int bdbhptres;
+ int flags;
+
+ bdbhpt_parsed_data_t pd;
+ char *tmp = NULL;
+ char *keyStr = NULL;
+
+ UNUSED(driverarg);
+
+ memset(&key, 0, sizeof(DBT));
+ memset(&data, 0, sizeof(DBT));
+
+ key.size = strlen(zone) + strlen(name) + 1;
+
+ /* allocate mem for key */
+ key.data = keyStr = malloc((key.size + 1) * sizeof(char));
+
+ if (keyStr == NULL)
+ return ISC_R_NOMEMORY;
+
+ strcpy(keyStr, zone);
+ strcat(keyStr, " ");
+ strcat(keyStr, name);
+
+ /* get a cursor to loop through data */
+ if (db->data->cursor(db->data, NULL, &data_cursor, 0) != 0) {
+ result = ISC_R_FAILURE;
+ goto lookup_cleanup;
+ }
+
+ result = ISC_R_NOTFOUND;
+
+ flags = DB_SET;
+ while ((bdbhptres = data_cursor->c_get(data_cursor, &key, &data,
+ flags)) == 0) {
+
+ flags = DB_NEXT_DUP;
+ tmp = realloc(tmp, data.size + 1);
+ if (tmp == NULL)
+ goto lookup_cleanup;
+
+ strncpy(tmp, data.data, data.size);
+ tmp[data.size] = '\0';
+
+ if (bdbhpt_parse_data(tmp, &pd) != ISC_R_SUCCESS)
+ goto lookup_cleanup;
+
+ result = dns_sdlz_putrr(lookup, pd.type, pd.ttl, pd.data);
+
+ if (result != ISC_R_SUCCESS)
+ goto lookup_cleanup;
+ } /* end while loop */
+
+ lookup_cleanup:
+
+ /* get rid of cursor */
+ if (data_cursor != NULL)
+ data_cursor->c_close(data_cursor);
+
+ if (keyStr != NULL)
+ free(keyStr);
+ if (tmp != NULL)
+ free(tmp);
+
+ return result;
+}
+
+/*% Initializes, sets flags and then opens Berkeley databases. */
+
+static isc_result_t
+bdbhpt_opendb(DB_ENV *db_env, DBTYPE db_type, DB **db, const char *db_name,
+ char *db_file, int flags) {
+
+ int result;
+
+ /* Initialize the database. */
+ if ((result = db_create(db, db_env, 0)) != 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "bdbhpt could not initialize %s database. "
+ "bdbhpt error: %s",
+ db_name, db_strerror(result));
+ return ISC_R_FAILURE;
+ }
+
+ /* set database flags. */
+ if ((result = (*db)->set_flags(*db, flags)) != 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "bdbhpt could not set flags for %s database. "
+ "bdbhpt error: %s",
+ db_name, db_strerror(result));
+ return ISC_R_FAILURE;
+ }
+
+ /* open the database. */
+ if ((result = (*db)->open(*db, NULL, db_file, db_name, db_type,
+ DB_RDONLY | bdbhpt_threads, 0)) != 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "bdbhpt could not open %s database in %s. "
+ "bdbhpt error: %s",
+ db_name, db_file, db_strerror(result));
+ return ISC_R_FAILURE;
+ }
+
+ return ISC_R_SUCCESS;
+}
+
+static isc_result_t
+bdbhpt_create(const char *dlzname, unsigned int argc, char *argv[],
+ void *driverarg, void **dbdata)
+{
+ isc_result_t result;
+ int bdbhptres;
+ int bdbFlags = 0;
+ bdbhpt_instance_t *db = NULL;
+
+ UNUSED(dlzname);
+ UNUSED(driverarg);
+
+ /* verify we have 4 arg's passed to the driver */
+ if (argc != 4) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "bdbhpt driver requires at least "
+ "3 command line args.");
+ return (ISC_R_FAILURE);
+ }
+
+ switch((char) *argv[1]) {
+ /*
+ * Transactional mode. Highest safety - lowest speed.
+ */
+ case 'T':
+ case 't':
+ bdbFlags = DB_INIT_MPOOL | DB_INIT_LOCK |
+ DB_INIT_LOG | DB_INIT_TXN;
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
+ "bdbhpt driver using transactional mode.");
+ break;
+ /*
+ * Concurrent mode. Lower safety (no rollback) -
+ * higher speed.
+ */
+ case 'C':
+ case 'c':
+ bdbFlags = DB_INIT_CDB | DB_INIT_MPOOL;
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
+ "bdbhpt driver using concurrent mode.");
+ break;
+ /*
+ * Private mode. No inter-process communication & no locking.
+ * Lowest saftey - highest speed.
+ */
+ case 'P':
+ case 'p':
+ bdbFlags = DB_PRIVATE | DB_INIT_MPOOL;
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
+ "bdbhpt driver using private mode.");
+ break;
+ default:
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "bdbhpt driver requires the operating mode "
+ "be set to P or C or T. You specified '%s'",
+ argv[1]);
+ return (ISC_R_FAILURE);
+ }
+
+ /* allocate and zero memory for driver structure */
+ db = isc_mem_get(ns_g_mctx, sizeof(bdbhpt_instance_t));
+ if (db == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Could not allocate memory for "
+ "database instance object.");
+ return (ISC_R_NOMEMORY);
+ }
+ memset(db, 0, sizeof(bdbhpt_instance_t));
+
+ /* attach to the memory context */
+ isc_mem_attach(ns_g_mctx, &db->mctx);
+
+ /*
+ * create bdbhpt environment
+ * Basically bdbhpt allocates and assigns memory to db->dbenv
+ */
+ bdbhptres = db_env_create(&db->dbenv, 0);
+ if (bdbhptres != 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "bdbhpt environment could not be created. "
+ "bdbhpt error: %s",
+ db_strerror(bdbhptres));
+ result = ISC_R_FAILURE;
+ goto init_cleanup;
+ }
+
+ /* open bdbhpt environment */
+ bdbhptres = db->dbenv->open(db->dbenv, argv[2],
+ bdbFlags | bdbhpt_threads | DB_CREATE, 0);
+ if (bdbhptres != 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "bdbhpt environment at '%s' could not be opened."
+ " bdbhpt error: %s",
+ argv[2], db_strerror(bdbhptres));
+ result = ISC_R_FAILURE;
+ goto init_cleanup;
+ }
+
+ /* open dlz_data database. */
+ result = bdbhpt_opendb(db->dbenv, DB_UNKNOWN, &db->data,
+ dlz_data, argv[3], DB_DUP | DB_DUPSORT);
+ if (result != ISC_R_SUCCESS)
+ goto init_cleanup;
+
+ /* open dlz_xfr database. */
+ result = bdbhpt_opendb(db->dbenv, DB_UNKNOWN, &db->xfr,
+ dlz_xfr, argv[3], DB_DUP | DB_DUPSORT);
+ if (result != ISC_R_SUCCESS)
+ goto init_cleanup;
+
+ /* open dlz_zone database. */
+ result = bdbhpt_opendb(db->dbenv, DB_UNKNOWN, &db->zone,
+ dlz_zone, argv[3], 0);
+ if (result != ISC_R_SUCCESS)
+ goto init_cleanup;
+
+ /* open dlz_client database. */
+ result = bdbhpt_opendb(db->dbenv, DB_UNKNOWN, &db->client,
+ dlz_client, argv[3], DB_DUP | DB_DUPSORT);
+ if (result != ISC_R_SUCCESS)
+ goto init_cleanup;
+
+ *dbdata = db;
+
+ return(ISC_R_SUCCESS);
+
+ init_cleanup:
+
+ bdbhpt_cleanup(db);
+ return result;
+}
+
+static void
+bdbhpt_destroy(void *driverarg, void *dbdata)
+{
+ UNUSED(driverarg);
+
+ bdbhpt_cleanup((bdbhpt_instance_t *) dbdata);
+}
+
+/*
+ * bdbhpt_authority not needed as authority data is returned by lookup
+ */
+static dns_sdlzmethods_t dlz_bdbhpt_methods = {
+ bdbhpt_create,
+ bdbhpt_destroy,
+ bdbhpt_findzone,
+ bdbhpt_lookup,
+ NULL,
+ bdbhpt_allnodes,
+ bdbhpt_allowzonexfr
+};
+
+/*%
+ * Wrapper around dns_sdlzregister().
+ */
+isc_result_t
+dlz_bdbhpt_init(void) {
+ isc_result_t result;
+
+ /*
+ * Write debugging message to log
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "Registering DLZ bdbhpt driver.");
+
+ result = dns_sdlzregister("bdbhpt", &dlz_bdbhpt_methods, NULL,
+ DNS_SDLZFLAG_RELATIVEOWNER |
+ DNS_SDLZFLAG_RELATIVERDATA |
+ DNS_SDLZFLAG_THREADSAFE,
+ ns_g_mctx, &dlz_bdbhpt);
+ if (result != ISC_R_SUCCESS) {
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "dns_sdlzregister() failed: %s",
+ isc_result_totext(result));
+ result = ISC_R_UNEXPECTED;
+ }
+
+
+ return result;
+}
+
+/*%
+ * Wrapper around dns_sdlzunregister().
+ */
+void
+dlz_bdbhpt_clear(void) {
+
+ /*
+ * Write debugging message to log
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "Unregistering DLZ bdbhpt driver.");
+
+ if (dlz_bdbhpt != NULL)
+ dns_sdlzunregister(&dlz_bdbhpt);
+}
+
+#endif
diff --git a/contrib/dlz/drivers/dlz_drivers.c b/contrib/dlz/drivers/dlz_drivers.c
new file mode 100644
index 0000000..e2c6a6e
--- /dev/null
+++ b/contrib/dlz/drivers/dlz_drivers.c
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: dlz_drivers.c,v 1.2 2005/09/05 00:10:55 marka Exp $ */
+
+/*! \file */
+
+#include <config.h>
+
+#include <isc/result.h>
+
+/*
+ * Pull in declarations for this module's functions.
+ */
+
+#include <dlz/dlz_drivers.h>
+
+/*
+ * Pull in driver-specific stuff.
+ */
+
+#ifdef DLZ_STUB
+#include <dlz/dlz_stub_driver.h>
+#endif
+
+#ifdef DLZ_POSTGRES
+#include <dlz/dlz_postgres_driver.h>
+#endif
+
+#ifdef DLZ_MYSQL
+#include <dlz/dlz_mysql_driver.h>
+#endif
+
+#ifdef DLZ_FILESYSTEM
+#include <dlz/dlz_filesystem_driver.h>
+#endif
+
+#ifdef DLZ_BDB
+#include <dlz/dlz_bdb_driver.h>
+#include <dlz/dlz_bdbhpt_driver.h>
+#endif
+
+#ifdef DLZ_LDAP
+#include <dlz/dlz_ldap_driver.h>
+#endif
+
+#ifdef DLZ_ODBC
+#include <dlz/dlz_odbc_driver.h>
+#endif
+
+/*%
+ * Call init functions for all relevant DLZ drivers.
+ */
+
+isc_result_t
+dlz_drivers_init(void) {
+
+ isc_result_t result = ISC_R_SUCCESS;
+
+#ifdef DLZ_STUB
+ result = dlz_stub_init();
+ if (result != ISC_R_SUCCESS)
+ return (result);
+#endif
+
+#ifdef DLZ_POSTGRES
+ result = dlz_postgres_init();
+ if (result != ISC_R_SUCCESS)
+ return (result);
+#endif
+
+#ifdef DLZ_MYSQL
+ result = dlz_mysql_init();
+ if (result != ISC_R_SUCCESS)
+ return (result);
+#endif
+
+#ifdef DLZ_FILESYSTEM
+ result = dlz_fs_init();
+ if (result != ISC_R_SUCCESS)
+ return (result);
+#endif
+
+#ifdef DLZ_BDB
+ result = dlz_bdb_init();
+ if (result != ISC_R_SUCCESS)
+ return (result);
+ result = dlz_bdbhpt_init();
+ if (result != ISC_R_SUCCESS)
+ return (result);
+#endif
+
+#ifdef DLZ_LDAP
+ result = dlz_ldap_init();
+ if (result != ISC_R_SUCCESS)
+ return (result);
+#endif
+
+#ifdef DLZ_ODBC
+ result = dlz_odbc_init();
+ if (result != ISC_R_SUCCESS)
+ return (result);
+#endif
+
+ return (result);
+}
+
+/*%
+ * Call shutdown functions for all relevant DLZ drivers.
+ */
+
+void
+dlz_drivers_clear(void) {
+
+#ifdef DLZ_STUB
+ dlz_stub_clear();
+#endif
+
+#ifdef DLZ_POSTGRES
+ dlz_postgres_clear();
+#endif
+
+#ifdef DLZ_MYSQL
+ dlz_mysql_clear();
+#endif
+
+#ifdef DLZ_FILESYSTEM
+ dlz_fs_clear();
+#endif
+
+#ifdef DLZ_BDB
+ dlz_bdb_clear();
+ dlz_bdbhpt_clear();
+#endif
+
+#ifdef DLZ_LDAP
+ dlz_ldap_clear();
+#endif
+
+#ifdef DLZ_ODBC
+ dlz_odbc_clear();
+#endif
+
+}
diff --git a/contrib/dlz/drivers/dlz_filesystem_driver.c b/contrib/dlz/drivers/dlz_filesystem_driver.c
new file mode 100644
index 0000000..d41d5ac
--- /dev/null
+++ b/contrib/dlz/drivers/dlz_filesystem_driver.c
@@ -0,0 +1,1048 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (C) 1999-2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef DLZ_FILESYSTEM
+
+#include <config.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <sys/stat.h>
+
+#include <dns/log.h>
+#include <dns/sdlz.h>
+#include <dns/result.h>
+
+#include <isc/dir.h>
+#include <isc/mem.h>
+#include <isc/platform.h>
+#include <isc/print.h>
+#include <isc/result.h>
+#include <isc/util.h>
+
+#include <named/globals.h>
+
+#include <dlz/dlz_filesystem_driver.h>
+
+static dns_sdlzimplementation_t *dlz_fs = NULL;
+
+typedef struct config_data {
+ char *basedir;
+ int basedirsize;
+ char *datadir;
+ int datadirsize;
+ char *xfrdir;
+ int xfrdirsize;
+ int splitcnt;
+ char separator;
+ char pathsep;
+ isc_mem_t *mctx;
+} config_data_t;
+
+typedef struct dir_entry dir_entry_t;
+
+struct dir_entry {
+ char dirpath[ISC_DIR_PATHMAX];
+ ISC_LINK(dir_entry_t) link;
+};
+
+typedef ISC_LIST(dir_entry_t) dlist_t;
+
+/* forward reference */
+
+static void
+fs_destroy(void *driverarg, void *dbdata);
+
+/*
+ * Private methods
+ */
+
+static isc_boolean_t
+is_safe(const char *input)
+{
+ unsigned int i;
+ unsigned int len = strlen(input);
+
+ /* check that only allowed characters are in the domain name */
+ for (i=0; i < len; i++) {
+ /* '.' is allowed, but has special requirements */
+ if (input[i] == '.') {
+ /* '.' is not allowed as first char */
+ if (i == 0)
+ return ISC_FALSE;
+ /* '..', two dots together is not allowed. */
+ else if (input[i-1] == '.')
+ return ISC_FALSE;
+ /* '.' is not allowed as last char */
+ if (i == len)
+ return ISC_FALSE;
+ /* only 1 dot in ok location, continue at next char */
+ continue;
+ }
+ /* '-' is allowed, continue at next char */
+ if (input[i] == '-')
+ continue;
+ /* 0-9 is allowed, continue at next char */
+ if (input[i] >= '0' && input[i] <= '9')
+ continue;
+ /* A-Z uppercase is allowed, continue at next char */
+ if (input[i] >= 'A' && input[i] <= 'Z')
+ continue;
+ /* a-z lowercase is allowed, continue at next char */
+ if (input[i] >= 'a' && input[i] <= 'z')
+ continue;
+
+ /*
+ * colon needs to be allowed for IPV6 client
+ * addresses. Not dangerous in domain names, as not a
+ * special char.
+ */
+ if (input[i] == ':')
+ continue;
+
+ /*
+ * '@' needs to be allowed for in zone data. Not
+ * dangerous in domain names, as not a special char.
+ */
+ if (input[i] == '@')
+ continue;
+
+ /*
+ * if we reach this point we have encountered a
+ * disallowed char!
+ */
+ return ISC_FALSE;
+ }
+ /* everything ok. */
+ return ISC_TRUE;
+}
+
+static isc_result_t
+create_path_helper(char *out, const char *in, config_data_t *cd)
+{
+
+ char *tmpString;
+ char *tmpPtr;
+ int i;
+
+ tmpString = isc_mem_strdup(ns_g_mctx, in);
+ if (tmpString == NULL)
+ return (ISC_R_NOMEMORY);
+
+ /*
+ * don't forget is_safe guarantees '.' will NOT be the
+ * first/last char
+ */
+ while ((tmpPtr = strrchr(tmpString, '.')) != NULL) {
+ i = 0;
+ while (tmpPtr[i+1] != '\0') {
+ if (cd->splitcnt < 1)
+ strcat(out, (char *) &tmpPtr[i+1]);
+ else
+ strncat(out, (char *) &tmpPtr[i+1],
+ cd->splitcnt);
+ strncat(out, (char *) &cd->pathsep, 1);
+ if (cd->splitcnt == 0)
+ break;
+ if (strlen((char *) &tmpPtr[i+1]) <=
+ (unsigned int) cd->splitcnt)
+ break;
+ i += cd->splitcnt;
+ }
+ tmpPtr[0] = '\0';
+ }
+
+ /* handle the "first" label properly */
+ i=0;
+ tmpPtr = tmpString;
+ while (tmpPtr[i] != '\0') {
+ if (cd->splitcnt < 1)
+ strcat(out, (char *) &tmpPtr[i]);
+ else
+ strncat(out, (char *) &tmpPtr[i], cd->splitcnt);
+ strncat(out, (char *) &cd->pathsep, 1);
+ if (cd->splitcnt == 0)
+ break;
+ if (strlen((char *) &tmpPtr[i]) <=
+ (unsigned int) cd->splitcnt)
+ break;
+ i += cd->splitcnt;
+ }
+
+ isc_mem_free(ns_g_mctx, tmpString);
+ return (ISC_R_SUCCESS);
+}
+
+/*%
+ * Checks to make sure zone and host are safe. If safe, then
+ * hashes zone and host strings to build a path. If zone / host
+ * are not safe an error is returned.
+ */
+
+static isc_result_t
+create_path(const char *zone, const char *host, const char *client,
+ config_data_t *cd, char **path)
+{
+
+ char *tmpPath;
+ int pathsize;
+ int len;
+ isc_result_t result;
+
+ /* we require a zone & cd parameter */
+ REQUIRE(zone != NULL);
+ REQUIRE(cd != NULL);
+ /* require path to be a pointer to NULL */
+ REQUIRE(path != NULL && *path == NULL);
+ /*
+ * client and host may both be NULL, but they can't both be
+ * NON-NULL
+ */
+ REQUIRE( (host == NULL && client == NULL) ||
+ (host != NULL && client == NULL) ||
+ (host == NULL && client != NULL) );
+
+ /* if the requested zone is "unsafe", return error */
+ if (is_safe(zone) != ISC_TRUE)
+ return (ISC_R_FAILURE);
+
+ /* if host was passed, verify that it is safe */
+ if ((host != NULL) && (is_safe(host) != ISC_TRUE) )
+ return (ISC_R_FAILURE);
+
+ /* if host was passed, verify that it is safe */
+ if ((client != NULL) && (is_safe(client) != ISC_TRUE) )
+ return (ISC_R_FAILURE);
+
+ /* Determine how much memory the split up string will require */
+ if (host != NULL)
+ len = strlen(zone) + strlen(host);
+ else if (client != NULL)
+ len = strlen(zone) + strlen(client);
+ else
+ len = strlen(zone);
+
+ /*
+ * even though datadir and xfrdir will never be in the same
+ * string we only waste a few bytes by allocating for both,
+ * and then we are safe from buffer overruns.
+ */
+ pathsize = len + cd->basedirsize +
+ cd->datadirsize + cd->xfrdirsize + 4;
+
+ /* if we are splitting names, we will need extra space. */
+ if (cd->splitcnt > 0)
+ pathsize += len/cd->splitcnt;
+
+ tmpPath = isc_mem_allocate(ns_g_mctx , pathsize * sizeof(char));
+ if (tmpPath == NULL) {
+ /* write error message */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Filesystem driver unable to "
+ "allocate memory in create_path().");
+ result = ISC_R_NOMEMORY;
+ goto cleanup_mem;
+ }
+
+ /*
+ * build path string.
+ * start out with base directory.
+ */
+ strcpy(tmpPath, cd->basedir);
+
+ /* add zone name - parsed properly */
+ if ((result = create_path_helper(tmpPath, zone, cd)) != ISC_R_SUCCESS)
+ goto cleanup_mem;
+
+ /*
+ * When neither client or host is passed we are building a
+ * path to see if a zone is supported. We require that a zone
+ * path have the "data dir" directory contained within it so
+ * that we know this zone is really supported. Otherwise,
+ * this zone may not really be supported because we are
+ * supporting a delagated sub zone.
+ *
+ * Example:
+ *
+ * We are supporting long.domain.com and using a splitcnt of
+ * 0. the base dir is "/base-dir/" and the data dir is
+ * "/.datadir" We want to see if we are authoritative for
+ * domain.com. Path /base-dir/com/domain/.datadir since
+ * /base-dir/com/domain/.datadir does not exist, we are not
+ * authoritative for the domain "domain.com". However we are
+ * authoritative for the domain "long.domain.com" because the
+ * path /base-dir/com/domain/long/.datadir does exist!
+ */
+
+ /* if client is passed append xfr dir, otherwise append data dir */
+ if (client != NULL) {
+ strcat(tmpPath, cd->xfrdir);
+ strncat(tmpPath, (char *) &cd->pathsep, 1);
+ strcat(tmpPath, client);
+ } else {
+ strcat(tmpPath, cd->datadir);
+ }
+
+ /* if host not null, add it. */
+ if (host != NULL) {
+ strncat(tmpPath, (char *) &cd->pathsep, 1);
+ if ((result = create_path_helper(tmpPath, host,
+ cd)) != ISC_R_SUCCESS)
+ goto cleanup_mem;
+ }
+
+ /* return the path we built. */
+ *path = tmpPath;
+
+ /* return success */
+ result = ISC_R_SUCCESS;
+
+ cleanup_mem:
+ /* cleanup memory */
+
+ /* free tmpPath memory */
+ if (tmpPath != NULL && result != ISC_R_SUCCESS)
+ isc_mem_free(ns_g_mctx, tmpPath);
+
+ /* free tmpPath memory */
+ return result;
+}
+
+static isc_result_t
+process_dir(isc_dir_t dir, void *passback, config_data_t *cd,
+ dlist_t *dir_list, unsigned int basedirlen)
+{
+
+ char tmp[ISC_DIR_PATHMAX + ISC_DIR_NAMEMAX];
+ int astPos;
+ struct stat sb;
+ isc_result_t result = ISC_R_FAILURE;
+ char *endp;
+ char *type;
+ char *ttlStr;
+ char *data;
+ char host[ISC_DIR_NAMEMAX];
+ char *tmpString;
+ char *tmpPtr;
+ int ttl;
+ int i;
+ int len;
+ dir_entry_t *direntry;
+ isc_boolean_t foundHost;
+
+ tmp[0] = '\0'; /* set 1st byte to '\0' so strcpy works right. */
+ host[0] = '\0';
+ foundHost = ISC_FALSE;
+
+ /* copy base directory name to tmp. */
+ strcpy(tmp, dir.dirname);
+
+ /* dir.dirname will always have '*' as the last char. */
+ astPos = strlen(dir.dirname) - 1;
+
+ /* if dir_list != NULL, were are performing a zone xfr */
+ if (dir_list != NULL) {
+ /* if splitcnt == 0, determine host from path. */
+ if (cd->splitcnt == 0) {
+ if (strlen(tmp) - 3 > basedirlen) {
+ tmp[astPos-1] = '\0';
+ tmpString = (char *) &tmp[basedirlen+1];
+ /* handle filesystem's special wildcard "-" */
+ if (strcmp(tmpString, "-") == 0) {
+ strcpy(host, "*");
+ } else {
+ /*
+ * not special wildcard -- normal name
+ */
+ while ((tmpPtr = strrchr(tmpString,
+ cd->pathsep))
+ != NULL) {
+ strcat(host, tmpPtr + 1);
+ strcat(host, ".");
+ tmpPtr[0] = '\0';
+ }
+ strcat(host, tmpString);
+ }
+
+ foundHost = ISC_TRUE;
+ /* set tmp again for use later */
+ strcpy(tmp, dir.dirname);
+ }
+ } else {
+ /*
+ * if splitcnt != 0 determine host from
+ * ".host" directory entry
+ */
+ while (isc_dir_read(&dir) == ISC_R_SUCCESS) {
+ if (strncasecmp(".host",
+ dir.entry.name, 5) == 0) {
+ /*
+ * handle filesystem's special
+ * wildcard "-"
+ */
+ if (strcmp((char *) &dir.entry.name[6],
+ "-") == 0)
+ strcpy(host, "*");
+ else
+ strcpy(host,
+ (char *)
+ &dir.entry.name[6]);
+ foundHost = ISC_TRUE;
+ break;
+ }
+ }
+ /* reset dir list for use later */
+ isc_dir_reset(&dir);
+ } /* end of else */
+ }
+
+ while (isc_dir_read(&dir) == ISC_R_SUCCESS) {
+
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
+ "Filesystem driver Dir name:"
+ " '%s' Dir entry: '%s'\n",
+ dir.dirname, dir.entry.name);
+
+ /* skip any entries starting with "." */
+ if (dir.entry.name[0] == '.')
+ continue;
+
+ /*
+ * get rid of '*', set to NULL. Effectively trims
+ * string from previous loop to base directory only
+ * while still leaving memory for concat to be
+ * performed next.
+ */
+
+ tmp[astPos] = '\0';
+
+ /* add name to base directory name. */
+ strcat(tmp, dir.entry.name);
+
+ /* make sure we can stat entry */
+ if (stat(tmp, &sb) == 0 ) {
+ /* if entry is a directory */
+ if ((sb.st_mode & S_IFDIR) != 0) {
+ /*
+ * if dir list is NOT NULL, add dir to
+ * dir list
+ */
+ if (dir_list != NULL) {
+ direntry =
+ isc_mem_get(ns_g_mctx,
+ sizeof(dir_entry_t));
+ if (direntry == NULL)
+ return (ISC_R_NOMEMORY);
+ strcpy(direntry->dirpath, tmp);
+ ISC_LINK_INIT(direntry, link);
+ ISC_LIST_APPEND(*dir_list, direntry,
+ link);
+ result = ISC_R_SUCCESS;
+ }
+ continue;
+
+ /*
+ * if entry is a file be sure we do
+ * not add entry to DNS results if we
+ * are performing a zone xfr and we
+ * could not find a host entry.
+ */
+
+ } else if (dir_list != NULL &&
+ foundHost == ISC_FALSE) {
+ continue;
+ }
+ } else /* if we cannot stat entry, skip it. */
+ continue;
+
+ type = dir.entry.name;
+ ttlStr = strchr(type, cd->separator);
+ if (ttlStr == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Filesystem driver: "
+ "%s could not be parsed properly",
+ tmp);
+ return ISC_R_FAILURE;
+ }
+
+ /* replace separator char with NULL to split string */
+ ttlStr[0] = '\0';
+ /* start string after NULL of previous string */
+ ttlStr = (char *) &ttlStr[1];
+
+ data = strchr(ttlStr, cd->separator);
+ if (data == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Filesystem driver: "
+ "%s could not be parsed properly",
+ tmp);
+ return ISC_R_FAILURE;
+ }
+
+ /* replace separator char with NULL to split string */
+ data[0] = '\0';
+
+ /* start string after NULL of previous string */
+ data = (char *) &data[1];
+
+ /* replace all cd->separator chars with a space. */
+ len = strlen(data);
+
+ for (i=0; i < len; i++) {
+ if (data[i] == cd->separator)
+ data[i] = ' ';
+ }
+
+ /* convert text to int, make sure it worked right */
+ ttl = strtol(ttlStr, &endp, 10);
+ if (*endp != '\0' || ttl < 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Filesystem driver "
+ "ttl must be a postive number");
+ }
+
+ /* pass data back to Bind */
+ if (dir_list == NULL)
+ result = dns_sdlz_putrr((dns_sdlzlookup_t *) passback,
+ type, ttl, data);
+ else
+ result = dns_sdlz_putnamedrr((dns_sdlzallnodes_t *)
+ passback,
+ (char *) host,
+ type, ttl, data);
+
+ /* if error, return error right away */
+ if (result != ISC_R_SUCCESS)
+ return result;
+ } /* end of while loop */
+
+ return result;
+}
+
+/*
+ * SDLZ interface methods
+ */
+
+static isc_result_t
+fs_allowzonexfr(void *driverarg, void *dbdata, const char *name,
+ const char *client)
+{
+
+ isc_result_t result;
+ char *path;
+ struct stat sb;
+ config_data_t *cd;
+ path = NULL;
+
+ UNUSED(driverarg);
+
+ cd = (config_data_t *) dbdata;
+
+ if (create_path(name, NULL, client, cd, &path) != ISC_R_SUCCESS) {
+ return (ISC_R_NOTFOUND);
+ }
+
+ if (stat(path, &sb) != 0) {
+ result = ISC_R_NOTFOUND;
+ goto complete_AXFR;
+ }
+
+ if ((sb.st_mode & S_IFREG) != 0) {
+ result = ISC_R_SUCCESS;
+ goto complete_AXFR;
+ }
+
+ result = ISC_R_NOTFOUND;
+
+ complete_AXFR:
+ isc_mem_free(ns_g_mctx, path);
+ return result;
+}
+
+static isc_result_t
+fs_allnodes(const char *zone, void *driverarg, void *dbdata,
+ dns_sdlzallnodes_t *allnodes)
+{
+
+ isc_result_t result;
+ dlist_t *dir_list;
+ config_data_t *cd;
+ char *basepath;
+ unsigned int basepathlen;
+ struct stat sb;
+ isc_dir_t dir;
+ dir_entry_t *dir_entry;
+ dir_entry_t *next_de;
+
+ basepath = NULL;
+ dir_list = NULL;
+
+ UNUSED(driverarg);
+ UNUSED(allnodes);
+
+ cd = (config_data_t *) dbdata;
+
+ /* allocate memory for list */
+ dir_list = isc_mem_get(ns_g_mctx, sizeof(dlist_t));
+ if (dir_list == NULL) {
+ result = ISC_R_NOTFOUND;
+ goto complete_allnds;
+ }
+
+ /* initialize list */
+ ISC_LIST_INIT(*dir_list);
+
+ if (create_path(zone, NULL, NULL, cd, &basepath) != ISC_R_SUCCESS) {
+ return (ISC_R_NOTFOUND);
+ }
+
+ /* remove path separator at end of path so stat works properly */
+ basepathlen = strlen(basepath);
+
+ if (stat(basepath, &sb) != 0) {
+ result = ISC_R_NOTFOUND;
+ goto complete_allnds;
+ }
+
+ if ((sb.st_mode & S_IFDIR) == 0) {
+ result = ISC_R_NOTFOUND;
+ goto complete_allnds;
+ }
+
+ /* initialize and open directory */
+ isc_dir_init(&dir);
+ result = isc_dir_open(&dir, basepath);
+
+ /* if directory open failed, return error. */
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Unable to open %s directory to read entries.",
+ basepath);
+ result = ISC_R_FAILURE;
+ goto complete_allnds;
+ }
+
+ /* process the directory */
+ result = process_dir(dir, allnodes, cd, dir_list, basepathlen);
+
+ /* close the directory */
+ isc_dir_close(&dir);
+
+ if (result != ISC_R_SUCCESS)
+ goto complete_allnds;
+
+ /* get first dir entry from list. */
+ dir_entry = ISC_LIST_HEAD(*dir_list);
+ while (dir_entry != NULL) {
+
+ result = isc_dir_open(&dir, dir_entry->dirpath);
+ /* if directory open failed, return error. */
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Unable to open %s "
+ "directory to read entries.",
+ basepath);
+ result = ISC_R_FAILURE;
+ goto complete_allnds;
+ }
+
+ /* process the directory */
+ result = process_dir(dir, allnodes, cd, dir_list, basepathlen);
+
+ /* close the directory */
+ isc_dir_close(&dir);
+
+ if (result != ISC_R_SUCCESS)
+ goto complete_allnds;
+
+ dir_entry = ISC_LIST_NEXT(dir_entry, link);
+ } /* end while */
+
+ complete_allnds:
+ if (dir_list != NULL) {
+ /* clean up entries from list. */
+ dir_entry = ISC_LIST_HEAD(*dir_list);
+ while (dir_entry != NULL) {
+ next_de = ISC_LIST_NEXT(dir_entry, link);
+ isc_mem_put(ns_g_mctx, dir_entry, sizeof(dir_entry_t));
+ dir_entry = next_de;
+ } /* end while */
+ isc_mem_put(ns_g_mctx, dir_list, sizeof(dlist_t));
+ }
+
+ if (basepath != NULL)
+ isc_mem_free(ns_g_mctx, basepath);
+
+ return result;
+}
+
+static isc_result_t
+fs_findzone(void *driverarg, void *dbdata, const char *name)
+{
+
+ isc_result_t result;
+ char *path;
+ struct stat sb;
+ path = NULL;
+
+ UNUSED(driverarg);
+
+ if (create_path(name, NULL, NULL, (config_data_t *) dbdata,
+ &path) != ISC_R_SUCCESS) {
+ return (ISC_R_NOTFOUND);
+ }
+
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
+ "Filesystem driver Findzone() Checking for path: '%s'\n",
+ path);
+
+ if (stat(path, &sb) != 0) {
+ result = ISC_R_NOTFOUND;
+ goto complete_FZ;
+ }
+
+ if ((sb.st_mode & S_IFDIR) != 0) {
+ result = ISC_R_SUCCESS;
+ goto complete_FZ;
+ }
+
+ result = ISC_R_NOTFOUND;
+
+ complete_FZ:
+
+ isc_mem_free(ns_g_mctx, path);
+ return result;
+}
+
+static isc_result_t
+fs_lookup(const char *zone, const char *name, void *driverarg,
+ void *dbdata, dns_sdlzlookup_t *lookup)
+{
+ isc_result_t result;
+ char *path;
+ struct stat sb;
+ isc_dir_t dir;
+ path = NULL;
+
+ UNUSED(driverarg);
+ UNUSED(lookup);
+
+ if (strcmp(name, "*") == 0)
+ /*
+ * handle filesystem's special wildcard "-"
+ */
+ result = create_path(zone, "-", NULL,
+ (config_data_t *) dbdata, &path);
+ else
+ result = create_path(zone, name, NULL,
+ (config_data_t *) dbdata, &path);
+
+ if ( result != ISC_R_SUCCESS) {
+ return (ISC_R_NOTFOUND);
+ }
+
+ /* remove path separator at end of path so stat works properly */
+ path[strlen(path)-1] = '\0';
+
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
+ "Filesystem driver lookup() Checking for path: '%s'\n",
+ path);
+
+
+ if (stat(path, &sb) != 0) {
+ result = ISC_R_NOTFOUND;
+ goto complete_lkup;
+ }
+
+ if ((sb.st_mode & S_IFDIR) == 0) {
+ result = ISC_R_NOTFOUND;
+ goto complete_lkup;
+ }
+
+ /* initialize and open directory */
+ isc_dir_init(&dir);
+ result = isc_dir_open(&dir, path);
+
+ /* if directory open failed, return error. */
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Unable to open %s directory to read entries.",
+ path);
+ result = ISC_R_FAILURE;
+ goto complete_lkup;
+ }
+
+ /* process any records in the directory */
+ result = process_dir(dir, lookup, (config_data_t *) dbdata, NULL, 0);
+
+ /* close the directory */
+ isc_dir_close(&dir);
+
+ complete_lkup:
+
+ isc_mem_free(ns_g_mctx, path);
+ return result;
+}
+
+static isc_result_t
+fs_create(const char *dlzname, unsigned int argc, char *argv[],
+ void *driverarg, void **dbdata)
+{
+ config_data_t *cd;
+ char *endp;
+ int len;
+ char pathsep;
+
+ UNUSED(driverarg);
+ UNUSED(dlzname);
+
+ /* we require 5 command line args. */
+ if (argc != 6) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Filesystem driver requires "
+ "6 command line args.");
+ return (ISC_R_FAILURE);
+ }
+
+ if (strlen(argv[5]) > 1) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Filesystem driver can only "
+ "accept a single character for separator.");
+ return (ISC_R_FAILURE);
+ }
+
+ /* verify base dir ends with '/' or '\' */
+ len = strlen(argv[1]);
+ if (argv[1][len-1] != '\\' && argv[1][len-1] != '/') {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Base dir parameter for filesystem driver "
+ "should end with %s",
+ "either '/' or '\\' ");
+ return (ISC_R_FAILURE);
+ }
+
+ /* determine and save path separator for later */
+ if (argv[1][len-1] == '\\')
+ pathsep = '\\';
+ else
+ pathsep = '/';
+
+ /* allocate memory for our config data */
+ cd = isc_mem_get(ns_g_mctx, sizeof(config_data_t));
+ if (cd == NULL)
+ goto no_mem;
+
+ /* zero the memory */
+ memset(cd, 0, sizeof(config_data_t));
+
+ cd->pathsep = pathsep;
+
+ /* get and store our base directory */
+ cd->basedir = isc_mem_strdup(ns_g_mctx, argv[1]);
+ if (cd->basedir == NULL)
+ goto no_mem;
+ cd->basedirsize = strlen(cd->basedir);
+
+ /* get and store our data sub-dir */
+ cd->datadir = isc_mem_strdup(ns_g_mctx, argv[2]);
+ if (cd->datadir == NULL)
+ goto no_mem;
+ cd->datadirsize = strlen(cd->datadir);
+
+ /* get and store our zone xfr sub-dir */
+ cd->xfrdir = isc_mem_strdup(ns_g_mctx, argv[3]);
+ if (cd->xfrdir == NULL)
+ goto no_mem;
+ cd->xfrdirsize = strlen(cd->xfrdir);
+
+ /* get and store our directory split count */
+ cd->splitcnt = strtol(argv[4], &endp, 10);
+ if (*endp != '\0' || cd->splitcnt < 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Directory split count must be zero (0) "
+ "or a postive number");
+ }
+
+ /* get and store our separator character */
+ cd->separator = *argv[5];
+
+ /* attach config data to memory context */
+ isc_mem_attach(ns_g_mctx, &cd->mctx);
+
+ /* pass back config data */
+ *dbdata = cd;
+
+ /* return success */
+ return(ISC_R_SUCCESS);
+
+ /* handle no memory error */
+ no_mem:
+
+ /* if we allocated a config data object clean it up */
+ if (cd != NULL)
+ fs_destroy(NULL, cd);
+
+ /* write error message */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Filesystem driver unable to "
+ "allocate memory for config data.");
+
+ /* return error */
+ return (ISC_R_NOMEMORY);
+}
+
+static void
+fs_destroy(void *driverarg, void *dbdata)
+{
+ isc_mem_t *mctx;
+ config_data_t *cd;
+
+ UNUSED(driverarg);
+
+ cd = (config_data_t *) dbdata;
+
+ /*
+ * free memory for each section of config data that was
+ * allocated
+ */
+ if (cd->basedir != NULL)
+ isc_mem_free(ns_g_mctx, cd->basedir);
+
+ if (cd->datadir != NULL)
+ isc_mem_free(ns_g_mctx, cd->datadir);
+
+ if (cd->xfrdir != NULL)
+ isc_mem_free(ns_g_mctx, cd->xfrdir);
+
+ /* hold memory context to use later */
+ mctx = cd->mctx;
+
+ /* free config data memory */
+ isc_mem_put(mctx, cd, sizeof(config_data_t));
+
+ /* detach memory from context */
+ isc_mem_detach(&mctx);
+}
+
+static dns_sdlzmethods_t dlz_fs_methods = {
+ fs_create,
+ fs_destroy,
+ fs_findzone,
+ fs_lookup,
+ NULL,
+ fs_allnodes,
+ fs_allowzonexfr
+};
+
+/*%
+ * Wrapper around dns_sdlzregister().
+ */
+isc_result_t
+dlz_fs_init(void)
+{
+ isc_result_t result;
+
+ /*
+ * Write debugging message to log
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "Registering DLZ filesystem driver.");
+
+ result = dns_sdlzregister("filesystem", &dlz_fs_methods, NULL,
+ DNS_SDLZFLAG_RELATIVEOWNER |
+ DNS_SDLZFLAG_RELATIVERDATA,
+ ns_g_mctx, &dlz_fs);
+ if (result != ISC_R_SUCCESS) {
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "dns_sdlzregister() failed: %s",
+ isc_result_totext(result));
+ result = ISC_R_UNEXPECTED;
+ }
+
+ return result;
+}
+
+/*%
+ * Wrapper around dns_sdlzunregister().
+ */
+void
+dlz_fs_clear(void) {
+
+ /*
+ * Write debugging message to log
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "Unregistering DLZ filesystem driver.");
+
+ if (dlz_fs != NULL)
+ dns_sdlzunregister(&dlz_fs);
+}
+
+#endif
diff --git a/contrib/dlz/drivers/dlz_ldap_driver.c b/contrib/dlz/drivers/dlz_ldap_driver.c
new file mode 100644
index 0000000..35d7548
--- /dev/null
+++ b/contrib/dlz/drivers/dlz_ldap_driver.c
@@ -0,0 +1,1339 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (C) 1999-2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef DLZ_LDAP
+
+#include <config.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <dns/log.h>
+#include <dns/sdlz.h>
+#include <dns/result.h>
+
+#include <isc/mem.h>
+#include <isc/platform.h>
+#include <isc/print.h>
+#include <isc/result.h>
+#include <isc/string.h>
+#include <isc/util.h>
+
+#include <named/globals.h>
+
+#include <dlz/sdlz_helper.h>
+#include <dlz/dlz_ldap_driver.h>
+
+/*
+ * Need older API functions from ldap.h.
+ */
+#define LDAP_DEPRECATED 1
+
+#include <ldap.h>
+
+#define SIMPLE "simple"
+#define KRB41 "krb41"
+#define KRB42 "krb42"
+#define V2 "v2"
+#define V3 "v3"
+
+static dns_sdlzimplementation_t *dlz_ldap = NULL;
+
+#define dbc_search_limit 30
+#define ALLNODES 1
+#define ALLOWXFR 2
+#define AUTHORITY 3
+#define FINDZONE 4
+#define LOOKUP 5
+
+/*%
+ * Structure to hold everthing needed by this "instance" of the LDAP
+ * driver remember, the driver code is only loaded once, but may have
+ * many separate instances.
+ */
+
+typedef struct {
+
+#ifdef ISC_PLATFORM_USETHREADS
+ db_list_t *db; /*%< handle to a list of DB */
+#else
+ dbinstance_t *db; /*%< handle to db */
+#endif
+ int method; /*%< security authentication method */
+ char *user; /*%< who is authenticating */
+ char *cred; /*%< password for simple authentication method */
+ int protocol; /*%< LDAP communication protocol version */
+ char *hosts; /*%< LDAP server hosts */
+
+} ldap_instance_t;
+
+/* forward references */
+
+static isc_result_t
+dlz_ldap_findzone(void *driverarg, void *dbdata, const char *name);
+
+static void
+dlz_ldap_destroy(void *driverarg, void *dbdata);
+
+/*
+ * Private methods
+ */
+
+/*% checks that the LDAP URL parameters make sense */
+
+static isc_result_t
+dlz_ldap_checkURL(char *URL, int attrCnt, const char *msg) {
+
+ isc_result_t result = ISC_R_SUCCESS;
+ int ldap_result;
+ LDAPURLDesc *ldap_url = NULL;
+
+ if (!ldap_is_ldap_url(URL)) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%s query is not a valid LDAP URL", msg);
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+
+ ldap_result = ldap_url_parse(URL, &ldap_url);
+ if (ldap_result != LDAP_SUCCESS || ldap_url == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "parsing %s query failed", msg);
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+
+ if (ldap_count_values(ldap_url->lud_attrs) < attrCnt) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%s query must specify at least "
+ "%d attributes to return",
+ msg, attrCnt);
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+
+ if (ldap_url->lud_host != NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%s query must not specify a host", msg);
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+
+ if (ldap_url->lud_port != 389) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%s query must not specify a port", msg);
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+
+ if (ldap_url->lud_dn == NULL || strlen (ldap_url->lud_dn) < 1) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%s query must specify a search base", msg);
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+
+ if (ldap_url->lud_exts != NULL || ldap_url->lud_crit_exts != 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%s uses extensions. "
+ "The driver does not support LDAP extensions.",
+ msg);
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+
+ cleanup:
+
+ if (ldap_url != NULL)
+ ldap_free_urldesc(ldap_url);
+
+ return result;
+}
+/*% Connects / reconnects to LDAP server */
+
+static isc_result_t
+dlz_ldap_connect(ldap_instance_t *dbi, dbinstance_t *dbc) {
+
+ isc_result_t result;
+ int ldap_result;
+
+ /* if we have a connection, get ride of it. */
+ if (dbc->dbconn != NULL) {
+ ldap_unbind_s((LDAP *) dbc->dbconn);
+ dbc->dbconn = NULL;
+ }
+
+ /* now connect / reconnect. */
+
+ /* initialize. */
+ dbc->dbconn = ldap_init(dbi->hosts, LDAP_PORT);
+ if (dbc->dbconn == NULL)
+ return ISC_R_NOMEMORY;
+
+ /* set protocol version. */
+ ldap_result = ldap_set_option((LDAP *) dbc->dbconn,
+ LDAP_OPT_PROTOCOL_VERSION,
+ &(dbi->protocol));
+ if (ldap_result != LDAP_SUCCESS) {
+ result = ISC_R_NOPERM;
+ goto cleanup;
+ }
+
+ /* "bind" to server. i.e. send username / pass */
+ ldap_result = ldap_bind_s((LDAP *) dbc->dbconn, dbi->user,
+ dbi->cred, dbi->method);
+ if (ldap_result != LDAP_SUCCESS) {
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+
+ return ISC_R_SUCCESS;
+
+ cleanup:
+
+ /* cleanup if failure. */
+ if (dbc->dbconn != NULL) {
+ ldap_unbind_s((LDAP *) dbc->dbconn);
+ dbc->dbconn = NULL;
+ }
+
+ return result;
+}
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+
+/*%
+ * Properly cleans up a list of database instances.
+ * This function is only used when the driver is compiled for
+ * multithreaded operation.
+ */
+static void
+ldap_destroy_dblist(db_list_t *dblist)
+{
+
+ dbinstance_t *ndbi = NULL;
+ dbinstance_t *dbi = NULL;
+
+ /* get the first DBI in the list */
+ ndbi = ISC_LIST_HEAD(*dblist);
+
+ /* loop through the list */
+ while (ndbi != NULL) {
+ dbi = ndbi;
+ /* get the next DBI in the list */
+ ndbi = ISC_LIST_NEXT(dbi, link);
+ /* release DB connection */
+ if (dbi->dbconn != NULL)
+ ldap_unbind_s((LDAP *) dbi->dbconn);
+ /* release all memory that comprised a DBI */
+ destroy_sqldbinstance(dbi);
+ }
+ /* release memory for the list structure */
+ isc_mem_put(ns_g_mctx, dblist, sizeof(db_list_t));
+}
+
+/*%
+ * Loops through the list of DB instances, attempting to lock
+ * on the mutex. If successful, the DBI is reserved for use
+ * and the thread can perform queries against the database.
+ * If the lock fails, the next one in the list is tried.
+ * looping continues until a lock is obtained, or until
+ * the list has been searched dbc_search_limit times.
+ * This function is only used when the driver is compiled for
+ * multithreaded operation.
+ */
+
+static dbinstance_t *
+ldap_find_avail_conn(db_list_t *dblist)
+{
+ dbinstance_t *dbi = NULL;
+ dbinstance_t *head;
+ int count = 0;
+
+ /* get top of list */
+ head = dbi = ISC_LIST_HEAD(*dblist);
+
+ /* loop through list */
+ while (count < dbc_search_limit) {
+ /* try to lock on the mutex */
+ if (isc_mutex_trylock(&dbi->instance_lock) == ISC_R_SUCCESS)
+ return dbi; /* success, return the DBI for use. */
+
+ /* not successful, keep trying */
+ dbi = ISC_LIST_NEXT(dbi, link);
+
+ /* check to see if we have gone to the top of the list. */
+ if (dbi == NULL) {
+ count++;
+ dbi = head;
+ }
+ }
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_INFO,
+ "LDAP driver unable to find available connection "
+ "after searching %d times",
+ count);
+ return NULL;
+}
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+static isc_result_t
+ldap_process_results(LDAP *dbc, LDAPMessage *msg, char ** attrs,
+ void *ptr, isc_boolean_t allnodes)
+{
+ isc_result_t result = ISC_R_SUCCESS;
+ int i = 0;
+ int j;
+ int len;
+ char *attribute = NULL;
+ LDAPMessage *entry;
+ char *endp = NULL;
+ char *host = NULL;
+ char *type = NULL;
+ char *data = NULL;
+ char **vals = NULL;
+ int ttl;
+
+ /* make sure there are at least some attributes to process. */
+ REQUIRE(attrs != NULL || attrs[0] != NULL);
+
+ /* get the first entry to process */
+ entry = ldap_first_entry(dbc, msg);
+ if (entry == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_INFO,
+ "LDAP no entries to process.");
+ return ISC_R_FAILURE;
+ }
+
+ /* loop through all entries returned */
+ while (entry != NULL) {
+
+ /* reset for this loop */
+ ttl = 0;
+ len = 0;
+ i = 0;
+ attribute = attrs[i];
+
+ /* determine how much space we need for data string */
+ for (j=0; attrs[j] != NULL; j++) {
+ /* get the list of values for this attribute. */
+ vals = ldap_get_values(dbc, entry, attrs[j]);
+ /* skip empty attributes. */
+ if (vals == NULL || ldap_count_values(vals) < 1)
+ continue;
+ /*
+ * we only use the first value. this driver
+ * does not support multi-valued attributes.
+ */
+ len = len + strlen(vals[0]) + 1;
+ /* free vals for next loop */
+ ldap_value_free(vals);
+ } /* end for (j=0; attrs[j] != NULL, j++) loop */
+
+ /* allocate memory for data string */
+ data = isc_mem_allocate(ns_g_mctx, len + 1);
+ if (data == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "LDAP driver unable to allocate memory "
+ "while processing results");
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+
+ /*
+ * Make sure data is null termed at the beginning so
+ * we can check if any data was stored to it later.
+ */
+ data[0] = '\0';
+
+ /* reset j to re-use below */
+ j = 0;
+
+ /* loop through the attributes in the order specified. */
+ while (attribute != NULL) {
+
+ /* get the list of values for this attribute. */
+ vals = ldap_get_values(dbc, entry, attribute);
+
+ /* skip empty attributes. */
+ if (vals == NULL || vals[0] == NULL) {
+ /* increment attibute pointer */
+ attribute = attrs[++i];
+ /* start loop over */
+ continue;
+ }
+
+ /*
+ * j initially = 0. Increment j each time we
+ * set a field that way next loop will set
+ * next field.
+ */
+ switch(j) {
+ case 0:
+ j++;
+ /*
+ * convert text to int, make sure it
+ * worked right
+ */
+ ttl = strtol(vals[0], &endp, 10);
+ if (*endp != '\0' || ttl < 0) {
+ isc_log_write(dns_lctx,
+ DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ,
+ ISC_LOG_ERROR,
+ "LDAP driver ttl must "
+ "be a postive number");
+ goto cleanup;
+ }
+ break;
+ case 1:
+ j++;
+ type = isc_mem_strdup(ns_g_mctx, vals[0]);
+ break;
+ case 2:
+ j++;
+ if (allnodes == isc_boolean_true) {
+ host = isc_mem_strdup(ns_g_mctx,
+ vals[0]);
+ } else {
+ strcpy(data, vals[0]);
+ }
+ break;
+ case 3:
+ j++;
+ if (allnodes == isc_boolean_true) {
+ strcpy(data, vals[0]);
+ } else {
+ strcat(data, " ");
+ strcat(data, vals[0]);
+ }
+ break;
+ default:
+ strcat(data, " ");
+ strcat(data, vals[0]);
+ break;
+ } /* end switch(j) */
+
+ /* free values */
+ ldap_value_free(vals);
+ vals = NULL;
+
+ /* increment attibute pointer */
+ attribute = attrs[++i];
+ } /* end while (attribute != NULL) */
+
+ if (type == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "LDAP driver unable "
+ "to retrieve dns type");
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+ if (strlen(data) < 1) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "LDAP driver unable "
+ "to retrieve dns data");
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+ if (allnodes == isc_boolean_true) {
+ if (strcasecmp(host, "~") == 0)
+ result = dns_sdlz_putnamedrr(
+ (dns_sdlzallnodes_t *) ptr,
+ "*", type, ttl, data);
+ else
+ result = dns_sdlz_putnamedrr(
+ (dns_sdlzallnodes_t *) ptr,
+ host, type, ttl, data);
+ }
+ else
+ result = dns_sdlz_putrr((dns_sdlzlookup_t *) ptr,
+ type, ttl, data);
+
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "LDAP driver failed "
+ "while sending data to Bind.");
+ goto cleanup;
+ }
+
+ /* free memory for type, data and host for next loop */
+ isc_mem_free(ns_g_mctx, type);
+ isc_mem_free(ns_g_mctx, data);
+ if (host != NULL)
+ isc_mem_free(ns_g_mctx, host);
+
+ /* get the next entry to process */
+ entry = ldap_next_entry(dbc, entry);
+ } /* end while (entry != NULL) */
+
+ cleanup:
+
+ /* de-allocate memory */
+ if (vals != NULL)
+ ldap_value_free(vals);
+ if (host != NULL)
+ isc_mem_free(ns_g_mctx, host);
+ if (type != NULL)
+ isc_mem_free(ns_g_mctx, type);
+ if (data != NULL)
+ isc_mem_free(ns_g_mctx, data);
+
+ return result;
+}
+
+/*%
+ * This function is the real core of the driver. Zone, record
+ * and client strings are passed in (or NULL is passed if the
+ * string is not available). The type of query we want to run
+ * is indicated by the query flag, and the dbdata object is passed
+ * passed in to. dbdata really holds either:
+ * 1) a list of database instances (in multithreaded mode) OR
+ * 2) a single database instance (in single threaded mode)
+ * The function will construct the query and obtain an available
+ * database instance (DBI). It will then run the query and hopefully
+ * obtain a result set.
+ */
+static isc_result_t
+ldap_get_results(const char *zone, const char *record,
+ const char *client, unsigned int query,
+ void *dbdata, void *ptr)
+{
+ isc_result_t result;
+ dbinstance_t *dbi = NULL;
+ char *querystring = NULL;
+ LDAPURLDesc *ldap_url = NULL;
+ int ldap_result = 0;
+ LDAPMessage *ldap_msg = NULL;
+ int i;
+ int entries;
+
+ /* get db instance / connection */
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /* find an available DBI from the list */
+ dbi = ldap_find_avail_conn((db_list_t *)
+ ((ldap_instance_t *)dbdata)->db);
+
+#else /* ISC_PLATFORM_USETHREADS */
+
+ /*
+ * only 1 DBI - no need to lock instance lock either
+ * only 1 thread in the whole process, no possible contention.
+ */
+ dbi = (dbinstance_t *) ((ldap_instance_t *)dbdata)->db;
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ /* if DBI is null, can't do anything else */
+ if (dbi == NULL)
+ return ISC_R_FAILURE;
+
+ /* set fields */
+ if (zone != NULL) {
+ dbi->zone = isc_mem_strdup(ns_g_mctx, zone);
+ if (dbi->zone == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ } else {
+ dbi->zone = NULL;
+ }
+ if (record != NULL) {
+ dbi->record = isc_mem_strdup(ns_g_mctx, record);
+ if (dbi->record == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ } else {
+ dbi->record = NULL;
+ }
+ if (client != NULL) {
+ dbi->client = isc_mem_strdup(ns_g_mctx, client);
+ if (dbi->client == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ } else {
+ dbi->client = NULL;
+ }
+
+ /* what type of query are we going to run? */
+ switch(query) {
+ case ALLNODES:
+ /*
+ * if the query was not passed in from the config file
+ * then we can't run it. return not_implemented, so
+ * it's like the code for that operation was never
+ * built into the driver.... AHHH flexibility!!!
+ */
+ if (dbi->allnodes_q == NULL) {
+ result = ISC_R_NOTIMPLEMENTED;
+ goto cleanup;
+ } else {
+ querystring = build_querystring(ns_g_mctx,
+ dbi->allnodes_q);
+ }
+ break;
+ case ALLOWXFR:
+ /* same as comments as ALLNODES */
+ if (dbi->allowxfr_q == NULL) {
+ result = ISC_R_NOTIMPLEMENTED;
+ goto cleanup;
+ } else {
+ querystring = build_querystring(ns_g_mctx,
+ dbi->allowxfr_q);
+ }
+ break;
+ case AUTHORITY:
+ /* same as comments as ALLNODES */
+ if (dbi->authority_q == NULL) {
+ result = ISC_R_NOTIMPLEMENTED;
+ goto cleanup;
+ } else {
+ querystring = build_querystring(ns_g_mctx,
+ dbi->authority_q);
+ }
+ break;
+ case FINDZONE:
+ /* this is required. It's the whole point of DLZ! */
+ if (dbi->findzone_q == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "No query specified for findzone. "
+ "Findzone requires a query");
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ } else {
+ querystring = build_querystring(ns_g_mctx,
+ dbi->findzone_q);
+ }
+ break;
+ case LOOKUP:
+ /* this is required. It's also a major point of DLZ! */
+ if (dbi->lookup_q == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "No query specified for lookup. "
+ "Lookup requires a query");
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ } else {
+ querystring = build_querystring(ns_g_mctx,
+ dbi->lookup_q);
+ }
+ break;
+ default:
+ /*
+ * this should never happen. If it does, the code is
+ * screwed up!
+ */
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "Incorrect query flag passed to "
+ "ldap_get_results");
+ result = ISC_R_UNEXPECTED;
+ goto cleanup;
+ }
+
+ /* if the querystring is null, Bummer, outta RAM. UPGRADE TIME!!! */
+ if (querystring == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+
+ /*
+ * output the full query string during debug so we can see
+ * what lame error the query has.
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
+ "\nQuery String: %s\n", querystring);
+
+ /* break URL down into it's component parts, if error cleanup */
+ ldap_result = ldap_url_parse(querystring, &ldap_url);
+ if (ldap_result != LDAP_SUCCESS || ldap_url == NULL) {
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+
+ for (i=0; i < 3; i++) {
+
+ /*
+ * dbi->dbconn may be null if trying to reconnect on a
+ * previous query failed.
+ */
+ if (dbi->dbconn == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_INFO,
+ "LDAP driver attempting to re-connect");
+
+ result = dlz_ldap_connect((ldap_instance_t *) dbdata,
+ dbi);
+ if (result != ISC_R_SUCCESS) {
+ result = ISC_R_FAILURE;
+ continue;
+ }
+ }
+
+ /* perform ldap search syncronously */
+ ldap_result = ldap_search_s((LDAP *) dbi->dbconn,
+ ldap_url->lud_dn,
+ ldap_url->lud_scope,
+ ldap_url->lud_filter,
+ ldap_url->lud_attrs, 0, &ldap_msg);
+
+ /*
+ * check return code. No such object is ok, just
+ * didn't find what we wanted
+ */
+ switch(ldap_result) {
+ case LDAP_NO_SUCH_OBJECT:
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
+ "No object found matching "
+ "query requirements");
+ result = ISC_R_NOTFOUND;
+ goto cleanup;
+ break;
+ case LDAP_SUCCESS: /* on success do nothing */
+ result = ISC_R_SUCCESS;
+ i = 3;
+ break;
+ case LDAP_SERVER_DOWN:
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_INFO,
+ "LDAP driver attempting to re-connect");
+ result = dlz_ldap_connect((ldap_instance_t *) dbdata,
+ dbi);
+ if (result != ISC_R_SUCCESS)
+ result = ISC_R_FAILURE;
+ break;
+ default:
+ /*
+ * other errors not ok. Log error message and
+ * get out
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "LDAP error: %s",
+ ldap_err2string(ldap_result));
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ break;
+ } /* close switch(ldap_result) */
+ } /* end for (int i=0 i < 3; i++) */
+
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+
+ switch(query) {
+ case ALLNODES:
+ result = ldap_process_results((LDAP *) dbi->dbconn, ldap_msg,
+ ldap_url->lud_attrs,
+ ptr, isc_boolean_true);
+ break;
+ case AUTHORITY:
+ case LOOKUP:
+ result = ldap_process_results((LDAP *) dbi->dbconn, ldap_msg,
+ ldap_url->lud_attrs,
+ ptr, isc_boolean_false);
+ break;
+ case ALLOWXFR:
+ entries = ldap_count_entries((LDAP *) dbi->dbconn, ldap_msg);
+ if (entries == 0)
+ result = ISC_R_NOPERM;
+ else if (entries > 0)
+ result = ISC_R_SUCCESS;
+ else
+ result = ISC_R_FAILURE;
+ break;
+ case FINDZONE:
+ entries = ldap_count_entries((LDAP *) dbi->dbconn, ldap_msg);
+ if (entries == 0)
+ result = ISC_R_NOTFOUND;
+ else if (entries > 0)
+ result = ISC_R_SUCCESS;
+ else
+ result = ISC_R_FAILURE;
+ break;
+ default:
+ /*
+ * this should never happen. If it does, the code is
+ * screwed up!
+ */
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "Incorrect query flag passed to "
+ "ldap_get_results");
+ result = ISC_R_UNEXPECTED;
+ }
+
+
+ cleanup:
+ /* it's always good to cleanup after yourself */
+
+ /* if we retrieved results, free them */
+ if (ldap_msg != NULL)
+ ldap_msgfree(ldap_msg);
+
+ if (ldap_url != NULL)
+ ldap_free_urldesc(ldap_url);
+
+ /* cleanup */
+ if (dbi->zone != NULL)
+ isc_mem_free(ns_g_mctx, dbi->zone);
+ if (dbi->record != NULL)
+ isc_mem_free(ns_g_mctx, dbi->record);
+ if (dbi->client != NULL)
+ isc_mem_free(ns_g_mctx, dbi->client);
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /* release the lock so another thread can use this dbi */
+ isc_mutex_unlock(&dbi->instance_lock);
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ /* release query string */
+ if (querystring != NULL)
+ isc_mem_free(ns_g_mctx, querystring );
+
+ /* return result */
+ return result;
+}
+
+/*
+ * DLZ methods
+ */
+
+static isc_result_t
+dlz_ldap_allowzonexfr(void *driverarg, void *dbdata, const char *name,
+ const char *client)
+{
+ isc_result_t result;
+
+ UNUSED(driverarg);
+
+ /* check to see if we are authoritative for the zone first */
+ result = dlz_ldap_findzone(driverarg, dbdata, name);
+ if (result != ISC_R_SUCCESS) {
+ return result;
+ }
+
+ /* get all the zone data */
+ return ldap_get_results(name, NULL, client, ALLOWXFR, dbdata, NULL);
+}
+
+static isc_result_t
+dlz_ldap_allnodes(const char *zone, void *driverarg, void *dbdata,
+ dns_sdlzallnodes_t *allnodes)
+{
+ UNUSED(driverarg);
+ return ldap_get_results(zone, NULL, NULL, ALLNODES, dbdata, allnodes);
+}
+
+static isc_result_t
+dlz_ldap_authority(const char *zone, void *driverarg, void *dbdata,
+ dns_sdlzlookup_t *lookup)
+{
+ UNUSED(driverarg);
+ return ldap_get_results(zone, NULL, NULL, AUTHORITY, dbdata, lookup);
+}
+
+static isc_result_t
+dlz_ldap_findzone(void *driverarg, void *dbdata, const char *name)
+{
+ UNUSED(driverarg);
+ return ldap_get_results(name, NULL, NULL, FINDZONE, dbdata, NULL);
+}
+
+static isc_result_t
+dlz_ldap_lookup(const char *zone, const char *name, void *driverarg,
+ void *dbdata, dns_sdlzlookup_t *lookup)
+{
+ UNUSED(driverarg);
+ if (strcmp(name, "*") == 0)
+ return ldap_get_results(zone, "~", NULL,
+ LOOKUP, dbdata, lookup);
+ else
+ return ldap_get_results(zone, name, NULL,
+ LOOKUP, dbdata, lookup);
+}
+
+
+static isc_result_t
+dlz_ldap_create(const char *dlzname, unsigned int argc, char *argv[],
+ void *driverarg, void **dbdata)
+{
+
+ isc_result_t result;
+ ldap_instance_t *ldap_inst = NULL;
+ dbinstance_t *dbi = NULL;
+ int protocol;
+ int method;
+
+#ifdef ISC_PLATFORM_USETHREADS
+ /* if multi-threaded, we need a few extra variables. */
+ int dbcount;
+ char *endp;
+/* db_list_t *dblist = NULL; */
+ int i;
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ UNUSED(dlzname);
+ UNUSED(driverarg);
+
+#ifdef ISC_PLATFORM_USETHREADS
+ /* if debugging, let user know we are multithreaded. */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
+ "LDAP driver running multithreaded");
+#else /* ISC_PLATFORM_USETHREADS */
+ /* if debugging, let user know we are single threaded. */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
+ "LDAP driver running single threaded");
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ if (argc < 9) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "LDAP driver requires at least "
+ "8 command line args.");
+ return (ISC_R_FAILURE);
+ }
+
+ /* no more than 13 arg's should be passed to the driver */
+ if (argc > 12) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "LDAP driver cannot accept more than "
+ "11 command line args.");
+ return (ISC_R_FAILURE);
+ }
+
+ /* determine protocol version. */
+ if (strncasecmp(argv[2], V2, strlen(V2)) == 0) {
+ protocol = 2;
+ } else if (strncasecmp(argv[2], V3, strlen(V3)) == 0) {
+ protocol = 3;
+ } else {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "LDAP driver protocol must be either %s or %s",
+ V2, V3);
+ return (ISC_R_FAILURE);
+ }
+
+ /* determine connection method. */
+ if (strncasecmp(argv[3], SIMPLE, strlen(SIMPLE)) == 0) {
+ method = LDAP_AUTH_SIMPLE;
+ } else if (strncasecmp(argv[3], KRB41, strlen(KRB41)) == 0) {
+ method = LDAP_AUTH_KRBV41;
+ } else if (strncasecmp(argv[3], KRB42, strlen(KRB42)) == 0) {
+ method = LDAP_AUTH_KRBV42;
+ } else {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "LDAP driver authentication method must be "
+ "one of %s, %s or %s",
+ SIMPLE, KRB41, KRB42);
+ return (ISC_R_FAILURE);
+ }
+
+ /* multithreaded build can have multiple DB connections */
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /* check how many db connections we should create */
+ dbcount = strtol(argv[1], &endp, 10);
+ if (*endp != '\0' || dbcount < 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "LDAP driver database connection count "
+ "must be positive.");
+ return (ISC_R_FAILURE);
+ }
+#endif
+
+ /* check that LDAP URL parameters make sense */
+ switch(argc) {
+ case 12:
+ result = dlz_ldap_checkURL(argv[11], 0, "allow zone transfer");
+ if (result != ISC_R_SUCCESS)
+ return result;
+ case 11:
+ result = dlz_ldap_checkURL(argv[10], 3, "all nodes");
+ if (result != ISC_R_SUCCESS)
+ return result;
+ case 10:
+ if (strlen(argv[9]) > 0) {
+ result = dlz_ldap_checkURL(argv[9], 3, "authority");
+ if (result != ISC_R_SUCCESS)
+ return result;
+ }
+ case 9:
+ result = dlz_ldap_checkURL(argv[8], 3, "lookup");
+ if (result != ISC_R_SUCCESS)
+ return result;
+ result = dlz_ldap_checkURL(argv[7], 0, "find zone");
+ if (result != ISC_R_SUCCESS)
+ return result;
+ break;
+ default:
+ /* not really needed, should shut up compiler. */
+ result = ISC_R_FAILURE;
+ }
+
+ /* allocate memory for LDAP instance */
+ ldap_inst = isc_mem_get(ns_g_mctx, sizeof(ldap_instance_t));
+ if (ldap_inst == NULL)
+ return (ISC_R_NOMEMORY);
+ memset(ldap_inst, 0, sizeof(ldap_instance_t));
+
+ /* store info needed to automatically re-connect. */
+ ldap_inst->protocol = protocol;
+ ldap_inst->method = method;
+ ldap_inst->hosts = isc_mem_strdup(ns_g_mctx, argv[6]);
+ if (ldap_inst->hosts == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ ldap_inst->user = isc_mem_strdup(ns_g_mctx, argv[4]);
+ if (ldap_inst->user == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ ldap_inst->cred = isc_mem_strdup(ns_g_mctx, argv[5]);
+ if (ldap_inst->cred == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+
+#ifdef ISC_PLATFORM_USETHREADS
+ /* allocate memory for database connection list */
+ ldap_inst->db = isc_mem_get(ns_g_mctx, sizeof(db_list_t));
+ if (ldap_inst->db == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+
+ /* initialize DB connection list */
+ ISC_LIST_INIT(*(ldap_inst->db));
+
+ /*
+ * create the appropriate number of database instances (DBI)
+ * append each new DBI to the end of the list
+ */
+ for (i = 0; i < dbcount; i++) {
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ /* how many queries were passed in from config file? */
+ switch(argc) {
+ case 9:
+ result = build_sqldbinstance(ns_g_mctx, NULL, NULL,
+ NULL, argv[7], argv[8],
+ NULL, &dbi);
+ break;
+ case 10:
+ result = build_sqldbinstance(ns_g_mctx, NULL, NULL,
+ argv[9], argv[7], argv[8],
+ NULL, &dbi);
+ break;
+ case 11:
+ result = build_sqldbinstance(ns_g_mctx, argv[10], NULL,
+ argv[9], argv[7], argv[8],
+ NULL, &dbi);
+ break;
+ case 12:
+ result = build_sqldbinstance(ns_g_mctx, argv[10],
+ argv[11], argv[9],
+ argv[7], argv[8],
+ NULL, &dbi);
+ break;
+ default:
+ /* not really needed, should shut up compiler. */
+ result = ISC_R_FAILURE;
+ }
+
+ if (result == ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "LDAP driver created "
+ "database instance object.");
+ } else { /* unsuccessful?, log err msg and cleanup. */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "LDAP driver could not create "
+ "database instance object.");
+ goto cleanup;
+ }
+
+#ifdef ISC_PLATFORM_USETHREADS
+ /* when multithreaded, build a list of DBI's */
+ ISC_LINK_INIT(dbi, link);
+ ISC_LIST_APPEND(*(ldap_inst->db), dbi, link);
+#else
+ /*
+ * when single threaded, hold onto the one connection
+ * instance.
+ */
+ ldap_inst->db = dbi;
+
+#endif
+ /* attempt to connect */
+ result = dlz_ldap_connect(ldap_inst, dbi);
+
+ /*
+ * if db connection cannot be created, log err msg and
+ * cleanup.
+ */
+ switch(result) {
+ /* success, do nothing */
+ case ISC_R_SUCCESS:
+ break;
+ /*
+ * no memory means ldap_init could not
+ * allocate memory
+ */
+ case ISC_R_NOMEMORY:
+#ifdef ISC_PLATFORM_USETHREADS
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "LDAP driver could not allocate memory "
+ "for connection number %u",
+ i+1);
+#else
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "LDAP driver could not allocate memory "
+ "for connection");
+#endif
+ goto cleanup;
+ break;
+ /*
+ * no perm means ldap_set_option could not set
+ * protocol version
+ */
+ case ISC_R_NOPERM:
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "LDAP driver could not "
+ "set protocol version.");
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ break;
+ /* failure means couldn't connect to ldap server */
+ case ISC_R_FAILURE:
+#ifdef ISC_PLATFORM_USETHREADS
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "LDAP driver could not "
+ "bind connection number %u to server.",
+ i+1);
+#else
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "LDAP driver could not "
+ "bind connection to server.");
+#endif
+ goto cleanup;
+ break;
+ /*
+ * default should never happen. If it does,
+ * major errors.
+ */
+ default:
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "dlz_ldap_create() failed: %s",
+ isc_result_totext(result));
+ result = ISC_R_UNEXPECTED;
+ goto cleanup;
+ break;
+ } /* end switch(result) */
+
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /* set DBI = null for next loop through. */
+ dbi = NULL;
+ } /* end for loop */
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+
+ /* set dbdata to the ldap_instance we created. */
+ *dbdata = ldap_inst;
+
+ /* hey, we got through all of that ok, return success. */
+ return(ISC_R_SUCCESS);
+
+ cleanup:
+
+ dlz_ldap_destroy(NULL, ldap_inst);
+
+ return(ISC_R_FAILURE);
+}
+
+void
+dlz_ldap_destroy(void *driverarg, void *dbdata)
+{
+
+ UNUSED(driverarg);
+
+ if (dbdata != NULL) {
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /* cleanup the list of DBI's */
+ ldap_destroy_dblist((db_list_t *)
+ ((ldap_instance_t *)dbdata)->db);
+
+#else /* ISC_PLATFORM_USETHREADS */
+
+ /* release connection */
+ if (((ldap_instance_t *)dbdata)->db->dbconn != NULL)
+ ldap_unbind_s((LDAP *)
+ ((ldap_instance_t *)dbdata)->db->dbconn);
+
+ /* destroy single DB instance */
+ destroy_sqldbinstance(((ldap_instance_t *)dbdata)->db);
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ if (((ldap_instance_t *)dbdata)->hosts != NULL)
+ isc_mem_free(ns_g_mctx,
+ ((ldap_instance_t *)dbdata)->hosts);
+
+ if (((ldap_instance_t *)dbdata)->user != NULL)
+ isc_mem_free(ns_g_mctx,
+ ((ldap_instance_t *)dbdata)->user);
+
+ if (((ldap_instance_t *)dbdata)->cred != NULL)
+ isc_mem_free(ns_g_mctx,
+ ((ldap_instance_t *)dbdata)->cred);
+
+ isc_mem_put(ns_g_mctx, dbdata, sizeof(ldap_instance_t));
+ }
+}
+
+static dns_sdlzmethods_t dlz_ldap_methods = {
+ dlz_ldap_create,
+ dlz_ldap_destroy,
+ dlz_ldap_findzone,
+ dlz_ldap_lookup,
+ dlz_ldap_authority,
+ dlz_ldap_allnodes,
+ dlz_ldap_allowzonexfr
+};
+
+/*%
+ * Wrapper around dns_sdlzregister().
+ */
+isc_result_t
+dlz_ldap_init(void) {
+ isc_result_t result;
+
+ /*
+ * Write debugging message to log
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "Registering DLZ ldap driver.");
+
+ result = dns_sdlzregister("ldap", &dlz_ldap_methods, NULL,
+ DNS_SDLZFLAG_RELATIVEOWNER |
+ DNS_SDLZFLAG_RELATIVERDATA,
+ ns_g_mctx, &dlz_ldap);
+ if (result != ISC_R_SUCCESS) {
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "dns_sdlzregister() failed: %s",
+ isc_result_totext(result));
+ result = ISC_R_UNEXPECTED;
+ }
+
+
+ return result;
+}
+
+/*%
+ * Wrapper around dns_sdlzunregister().
+ */
+void
+dlz_ldap_clear(void) {
+
+ /*
+ * Write debugging message to log
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "Unregistering DLZ ldap driver.");
+
+ if (dlz_ldap != NULL)
+ dns_sdlzunregister(&dlz_ldap);
+}
+
+#endif
diff --git a/contrib/dlz/drivers/dlz_mysql_driver.c b/contrib/dlz/drivers/dlz_mysql_driver.c
new file mode 100644
index 0000000..ea32d39
--- /dev/null
+++ b/contrib/dlz/drivers/dlz_mysql_driver.c
@@ -0,0 +1,1060 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (C) 1999-2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef DLZ_MYSQL
+
+#include <config.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <dns/log.h>
+#include <dns/sdlz.h>
+#include <dns/result.h>
+
+#include <isc/mem.h>
+#include <isc/platform.h>
+#include <isc/print.h>
+#include <isc/result.h>
+#include <isc/string.h>
+#include <isc/util.h>
+
+#include <named/globals.h>
+
+#include <dlz/sdlz_helper.h>
+#include <dlz/dlz_mysql_driver.h>
+
+#include <mysql.h>
+
+static dns_sdlzimplementation_t *dlz_mysql = NULL;
+
+#define dbc_search_limit 30
+#define ALLNODES 1
+#define ALLOWXFR 2
+#define AUTHORITY 3
+#define FINDZONE 4
+#define COUNTZONE 5
+#define LOOKUP 6
+
+#define safeGet(in) in == NULL ? "" : in
+
+/*
+ * Private methods
+ */
+
+/*%
+ * Allocates memory for a new string, and then constructs the new
+ * string by "escaping" the input string. The new string is
+ * safe to be used in queries. This is necessary because we cannot
+ * be sure of what types of strings are passed to us, and we don't
+ * want special characters in the string causing problems.
+ */
+
+static char *
+mysqldrv_escape_string(MYSQL *mysql, const char *instr) {
+
+ char *outstr;
+ unsigned int len;
+
+ if (instr == NULL)
+ return NULL;
+
+ len = strlen(instr);
+
+ outstr = isc_mem_allocate(ns_g_mctx ,(2 * len * sizeof(char)) + 1);
+ if (outstr == NULL)
+ return NULL;
+
+ mysql_real_escape_string(mysql, outstr, instr, len);
+
+ return outstr;
+}
+
+/*%
+ * This function is the real core of the driver. Zone, record
+ * and client strings are passed in (or NULL is passed if the
+ * string is not available). The type of query we want to run
+ * is indicated by the query flag, and the dbdata object is passed
+ * passed in to. dbdata really holds a single database instance.
+ * The function will construct and run the query, hopefully getting
+ * a result set.
+ */
+
+static isc_result_t
+mysql_get_resultset(const char *zone, const char *record,
+ const char *client, unsigned int query,
+ void *dbdata, MYSQL_RES **rs)
+{
+ isc_result_t result;
+ dbinstance_t *dbi = NULL;
+ char *querystring = NULL;
+ unsigned int i = 0;
+ unsigned int j = 0;
+ int qres = 0;
+
+ if (query != COUNTZONE)
+ REQUIRE(*rs == NULL);
+ else
+ REQUIRE(rs == NULL);
+
+ /* get db instance / connection */
+ dbi = (dbinstance_t *) dbdata;
+
+ /* if DBI is null, can't do anything else */
+ if (dbi == NULL) {
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+
+ /* what type of query are we going to run? */
+ switch(query) {
+ case ALLNODES:
+ /*
+ * if the query was not passed in from the config file
+ * then we can't run it. return not_implemented, so
+ * it's like the code for that operation was never
+ * built into the driver.... AHHH flexibility!!!
+ */
+ if (dbi->allnodes_q == NULL) {
+ result = ISC_R_NOTIMPLEMENTED;
+ goto cleanup;
+ }
+ break;
+ case ALLOWXFR:
+ /* same as comments as ALLNODES */
+ if (dbi->allowxfr_q == NULL) {
+ result = ISC_R_NOTIMPLEMENTED;
+ goto cleanup;
+ }
+ break;
+ case AUTHORITY:
+ /* same as comments as ALLNODES */
+ if (dbi->authority_q == NULL) {
+ result = ISC_R_NOTIMPLEMENTED;
+ goto cleanup;
+ }
+ break;
+ case FINDZONE:
+ /* this is required. It's the whole point of DLZ! */
+ if (dbi->findzone_q == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "No query specified for findzone. "
+ "Findzone requires a query");
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+ break;
+ case COUNTZONE:
+ /* same as comments as ALLNODES */
+ if (dbi->countzone_q == NULL) {
+ result = ISC_R_NOTIMPLEMENTED;
+ goto cleanup;
+ }
+ break;
+ case LOOKUP:
+ /* this is required. It's also a major point of DLZ! */
+ if (dbi->lookup_q == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "No query specified for lookup. "
+ "Lookup requires a query");
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+ break;
+ default:
+ /*
+ * this should never happen. If it does, the code is
+ * screwed up!
+ */
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "Incorrect query flag passed to "
+ "mysql_get_resultset");
+ result = ISC_R_UNEXPECTED;
+ goto cleanup;
+ }
+
+
+ /*
+ * was a zone string passed? If so, make it safe for use in
+ * queries.
+ */
+ if (zone != NULL) {
+ dbi->zone = mysqldrv_escape_string((MYSQL *) dbi->dbconn,
+ zone);
+ if (dbi->zone == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ } else { /* no string passed, set the string pointer to NULL */
+ dbi->zone = NULL;
+ }
+
+ /*
+ * was a record string passed? If so, make it safe for use in
+ * queries.
+ */
+ if (record != NULL) {
+ dbi->record = mysqldrv_escape_string((MYSQL *) dbi->dbconn,
+ record);
+ if (dbi->record == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ } else { /* no string passed, set the string pointer to NULL */
+ dbi->record = NULL;
+ }
+
+ /*
+ * was a client string passed? If so, make it safe for use in
+ * queries.
+ */
+ if (client != NULL) {
+ dbi->client = mysqldrv_escape_string((MYSQL *) dbi->dbconn,
+ client);
+ if (dbi->client == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ } else { /* no string passed, set the string pointer to NULL */
+ dbi->client = NULL;
+ }
+
+ /*
+ * what type of query are we going to run? this time we build
+ * the actual query to run.
+ */
+ switch(query) {
+ case ALLNODES:
+ querystring = build_querystring(ns_g_mctx, dbi->allnodes_q);
+ break;
+ case ALLOWXFR:
+ querystring = build_querystring(ns_g_mctx, dbi->allowxfr_q);
+ break;
+ case AUTHORITY:
+ querystring = build_querystring(ns_g_mctx, dbi->authority_q);
+ break;
+ case FINDZONE:
+ querystring = build_querystring(ns_g_mctx, dbi->findzone_q);
+ break;
+ case COUNTZONE:
+ querystring = build_querystring(ns_g_mctx, dbi->countzone_q);
+ break;
+ case LOOKUP:
+ querystring = build_querystring(ns_g_mctx, dbi->lookup_q);
+ break;
+ default:
+ /*
+ * this should never happen. If it does, the code is
+ * screwed up!
+ */
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "Incorrect query flag passed to "
+ "mysql_get_resultset");
+ result = ISC_R_UNEXPECTED;
+ goto cleanup;
+ }
+
+ /* if the querystring is null, Bummer, outta RAM. UPGRADE TIME!!! */
+ if (querystring == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+
+ /*
+ * output the full query string during debug so we can see
+ * what lame error the query has.
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
+ "\nQuery String: %s\n", querystring);
+
+ /* attempt query up to 3 times. */
+ for (i=0; i < 3; i++) {
+ qres = mysql_query((MYSQL *) dbi->dbconn, querystring);
+ if (qres == 0)
+ break;
+ for (j=0; mysql_ping((MYSQL *) dbi->dbconn) != 0 && j < 4; j++)
+ ;
+ }
+
+ if (qres == 0) {
+ result = ISC_R_SUCCESS;
+ if (query != COUNTZONE) {
+ *rs = mysql_store_result((MYSQL *) dbi->dbconn);
+ if (*rs == NULL)
+ result = ISC_R_FAILURE;
+ }
+ } else {
+ result = ISC_R_FAILURE;
+ }
+
+
+ cleanup:
+ /* it's always good to cleanup after yourself */
+
+ /* if we couldn't even get DBI, just return NULL */
+ if (dbi == NULL)
+ return ISC_R_FAILURE;
+
+ /* free dbi->zone string */
+ if (dbi->zone != NULL)
+ isc_mem_free(ns_g_mctx, dbi->zone);
+
+ /* free dbi->record string */
+ if (dbi->record != NULL)
+ isc_mem_free(ns_g_mctx, dbi->record);
+
+ /* free dbi->client string */
+ if (dbi->client != NULL)
+ isc_mem_free(ns_g_mctx, dbi->client);
+
+ /* release query string */
+ if (querystring != NULL)
+ isc_mem_free(ns_g_mctx, querystring);
+
+ /* return result */
+ return result;
+}
+
+/*%
+ * The processing of result sets for lookup and authority are
+ * exactly the same. So that functionality has been moved
+ * into this function to minimize code.
+ */
+
+static isc_result_t
+mysql_process_rs(dns_sdlzlookup_t *lookup, MYSQL_RES *rs)
+{
+ isc_result_t result = ISC_R_NOTFOUND;
+ MYSQL_ROW row;
+ unsigned int fields;
+ unsigned int j;
+ unsigned int len;
+ char *tmpString;
+ char *endp;
+ int ttl;
+
+ row = mysql_fetch_row(rs); /* get a row from the result set */
+ fields = mysql_num_fields(rs); /* how many columns in result set */
+ while (row != NULL) {
+ switch(fields) {
+ case 1:
+ /*
+ * one column in rs, it's the data field. use
+ * default type of A record, and default TTL
+ * of 86400
+ */
+ result = dns_sdlz_putrr(lookup, "a", 86400,
+ safeGet(row[0]));
+ break;
+ case 2:
+ /*
+ * two columns, data field, and data type.
+ * use default TTL of 86400.
+ */
+ result = dns_sdlz_putrr(lookup, safeGet(row[0]), 86400,
+ safeGet(row[1]));
+ break;
+ case 3:
+ /*
+ * three columns, all data no defaults.
+ * convert text to int, make sure it worked
+ * right.
+ */
+ ttl = strtol(safeGet(row[0]), &endp, 10);
+ if (*endp != '\0' || ttl < 0) {
+ isc_log_write(dns_lctx,
+ DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "mysql driver ttl must be "
+ "a postive number");
+ }
+ result = dns_sdlz_putrr(lookup, safeGet(row[1]), ttl,
+ safeGet(row[2]));
+ break;
+ default:
+ /*
+ * more than 3 fields, concatenate the last
+ * ones together. figure out how long to make
+ * string.
+ */
+ for (j=2, len=0; j < fields; j++) {
+ len += strlen(safeGet(row[j])) + 1;
+ }
+ /*
+ * allocate string memory, allow for NULL to
+ * term string
+ */
+ tmpString = isc_mem_allocate(ns_g_mctx, len + 1);
+ if (tmpString == NULL) {
+ /* major bummer, need more ram */
+ isc_log_write(dns_lctx,
+ DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "mysql driver unable "
+ "to allocate memory for "
+ "temporary string");
+ mysql_free_result(rs);
+ return (ISC_R_FAILURE); /* Yeah, I'd say! */
+ }
+ /* copy field to tmpString */
+ strcpy(tmpString, safeGet(row[2]));
+
+
+ /*
+ * concat the rest of fields together, space
+ * between each one.
+ */
+ for (j=3; j < fields; j++) {
+ strcat(tmpString, " ");
+ strcat(tmpString, safeGet(row[j]));
+ }
+ /* convert text to int, make sure it worked right */
+ ttl = strtol(safeGet(row[0]), &endp, 10);
+ if (*endp != '\0' || ttl < 0) {
+ isc_log_write(dns_lctx,
+ DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "mysql driver ttl must be "
+ "a postive number");
+ }
+ /* ok, now tell Bind about it. */
+ result = dns_sdlz_putrr(lookup, safeGet(row[1]),
+ ttl, tmpString);
+ /* done, get rid of this thing. */
+ isc_mem_free(ns_g_mctx, tmpString);
+ }
+ /* I sure hope we were successful */
+ if (result != ISC_R_SUCCESS) {
+ /* nope, get rid of the Result set, and log a msg */
+ mysql_free_result(rs);
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "dns_sdlz_putrr returned error. "
+ "Error code was: %s",
+ isc_result_totext(result));
+ return (ISC_R_FAILURE);
+ }
+ row = mysql_fetch_row(rs); /* get next row */
+ }
+
+ /* free result set memory */
+ mysql_free_result(rs);
+
+ /* return result code */
+ return result;
+}
+
+/*
+ * SDLZ interface methods
+ */
+
+/*% determine if the zone is supported by (in) the database */
+
+static isc_result_t
+mysql_findzone(void *driverarg, void *dbdata, const char *name)
+{
+ isc_result_t result;
+ MYSQL_RES *rs = NULL;
+ my_ulonglong rows;
+
+ UNUSED(driverarg);
+
+ /* run the query and get the result set from the database. */
+ result = mysql_get_resultset(name, NULL, NULL, FINDZONE, dbdata, &rs);
+ /* if we didn't get a result set, log an err msg. */
+ if (result != ISC_R_SUCCESS || rs == NULL) {
+ if (rs != NULL)
+ mysql_free_result(rs);
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "mysql driver unable to return "
+ "result set for findzone query");
+ return (ISC_R_FAILURE);
+ }
+ /* count how many rows in result set */
+ rows = mysql_num_rows(rs);
+ /* get rid of result set, we are done with it. */
+ mysql_free_result(rs);
+
+ /* if we returned any rows, zone is supported. */
+ if (rows > 0) {
+ mysql_get_resultset(name, NULL, NULL, COUNTZONE, dbdata, NULL);
+ return (ISC_R_SUCCESS);
+ }
+
+ /* no rows returned, zone is not supported. */
+ return (ISC_R_NOTFOUND);
+}
+
+/*% Determine if the client is allowed to perform a zone transfer */
+static isc_result_t
+mysql_allowzonexfr(void *driverarg, void *dbdata, const char *name,
+ const char *client)
+{
+ isc_result_t result;
+ MYSQL_RES *rs = NULL;
+ my_ulonglong rows;
+
+ UNUSED(driverarg);
+
+ /* first check if the zone is supported by the database. */
+ result = mysql_findzone(driverarg, dbdata, name);
+ if (result != ISC_R_SUCCESS)
+ return (ISC_R_NOTFOUND);
+
+ /*
+ * if we get to this point we know the zone is supported by
+ * the database the only questions now are is the zone
+ * transfer is allowed for this client and did the config file
+ * have an allow zone xfr query.
+ *
+ * Run our query, and get a result set from the database.
+ */
+ result = mysql_get_resultset(name, NULL, client, ALLOWXFR,
+ dbdata, &rs);
+ /* if we get "not implemented", send it along. */
+ if (result == ISC_R_NOTIMPLEMENTED)
+ return result;
+ /* if we didn't get a result set, log an err msg. */
+ if (result != ISC_R_SUCCESS || rs == NULL) {
+ if (rs != NULL)
+ mysql_free_result(rs);
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "mysql driver unable to return "
+ "result set for allow xfr query");
+ return (ISC_R_FAILURE);
+ }
+ /* count how many rows in result set */
+ rows = mysql_num_rows(rs);
+ /* get rid of result set, we are done with it. */
+ mysql_free_result(rs);
+
+ /* if we returned any rows, zone xfr is allowed. */
+ if (rows > 0)
+ return (ISC_R_SUCCESS);
+
+ /* no rows returned, zone xfr not allowed */
+ return (ISC_R_NOPERM);
+}
+
+/*%
+ * If the client is allowed to perform a zone transfer, the next order of
+ * business is to get all the nodes in the zone, so bind can respond to the
+ * query.
+ */
+static isc_result_t
+mysql_allnodes(const char *zone, void *driverarg, void *dbdata,
+ dns_sdlzallnodes_t *allnodes)
+{
+ isc_result_t result;
+ MYSQL_RES *rs = NULL;
+ MYSQL_ROW row;
+ unsigned int fields;
+ unsigned int j;
+ unsigned int len;
+ char *tmpString;
+ char *endp;
+ int ttl;
+
+ UNUSED(driverarg);
+
+ /* run the query and get the result set from the database. */
+ result = mysql_get_resultset(zone, NULL, NULL, ALLNODES, dbdata, &rs);
+ /* if we get "not implemented", send it along */
+ if (result == ISC_R_NOTIMPLEMENTED)
+ return result;
+ /* if we didn't get a result set, log an err msg. */
+ if (result != ISC_R_SUCCESS) {
+ if (rs != NULL)
+ mysql_free_result(rs);
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "mysql driver unable to return "
+ "result set for all nodes query");
+ return (ISC_R_FAILURE);
+ }
+
+ result = ISC_R_NOTFOUND;
+
+ row = mysql_fetch_row(rs); /* get a row from the result set */
+ fields = mysql_num_fields(rs); /* how many columns in result set */
+ while (row != NULL) {
+ if (fields < 4) { /* gotta have at least 4 columns */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "mysql driver too few fields returned "
+ "by all nodes query");
+ }
+ /* convert text to int, make sure it worked right */
+ ttl = strtol(safeGet(row[0]), &endp, 10);
+ if (*endp != '\0' || ttl < 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "mysql driver ttl must be "
+ "a postive number");
+ }
+ if (fields == 4) {
+ /* tell Bind about it. */
+ result = dns_sdlz_putnamedrr(allnodes, safeGet(row[2]),
+ safeGet(row[1]), ttl,
+ safeGet(row[3]));
+ } else {
+ /*
+ * more than 4 fields, concatenate the last
+ * ones together. figure out how long to make
+ * string.
+ */
+ for (j=3, len=0; j < fields; j++) {
+ len += strlen(safeGet(row[j])) + 1;
+ }
+ /* allocate memory, allow for NULL to term string */
+ tmpString = isc_mem_allocate(ns_g_mctx, len + 1);
+ if (tmpString == NULL) { /* we need more ram. */
+ isc_log_write(dns_lctx,
+ DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "mysql driver unable "
+ "to allocate memory for "
+ "temporary string");
+ mysql_free_result(rs);
+ return (ISC_R_FAILURE);
+ }
+ /* copy this field to tmpString */
+ strcpy(tmpString, safeGet(row[3]));
+ /* concatonate the rest, with spaces between */
+ for (j=4; j < fields; j++) {
+ strcat(tmpString, " ");
+ strcat(tmpString, safeGet(row[j]));
+ }
+ /* tell Bind about it. */
+ result = dns_sdlz_putnamedrr(allnodes, safeGet(row[2]),
+ safeGet(row[1]),
+ ttl, tmpString);
+ isc_mem_free(ns_g_mctx, tmpString);
+ }
+ /* if we weren't successful, log err msg */
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "dns_sdlz_putnamedrr returned error. "
+ "Error code was: %s",
+ isc_result_totext(result));
+ result = ISC_R_FAILURE;
+ break;
+ }
+ /* get next row from the result set */
+ row = mysql_fetch_row(rs);
+ }
+
+ /* free result set memory */
+ mysql_free_result(rs);
+
+ return result;
+}
+
+/*% if the lookup function does not return SOA or NS records for the zone,
+ * use this function to get that information for Bind.
+ */
+
+static isc_result_t
+mysql_authority(const char *zone, void *driverarg, void *dbdata,
+ dns_sdlzlookup_t *lookup)
+{
+ isc_result_t result;
+ MYSQL_RES *rs = NULL;
+
+ UNUSED(driverarg);
+
+ /* run the query and get the result set from the database. */
+ result = mysql_get_resultset(zone, NULL, NULL, AUTHORITY, dbdata, &rs);
+ /* if we get "not implemented", send it along */
+ if (result == ISC_R_NOTIMPLEMENTED)
+ return result;
+ /* if we didn't get a result set, log an err msg. */
+ if (result != ISC_R_SUCCESS) {
+ if (rs != NULL)
+ mysql_free_result(rs);
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "mysql driver unable to return "
+ "result set for authority query");
+ return (ISC_R_FAILURE);
+ }
+ /*
+ * lookup and authority result sets are processed in the same
+ * manner mysql_process_rs does the job for both functions.
+ */
+ return mysql_process_rs(lookup, rs);
+}
+
+/*% if zone is supported, lookup up a (or multiple) record(s) in it */
+static isc_result_t
+mysql_lookup(const char *zone, const char *name, void *driverarg,
+ void *dbdata, dns_sdlzlookup_t *lookup)
+{
+ isc_result_t result;
+ MYSQL_RES *rs = NULL;
+
+ UNUSED(driverarg);
+
+ /* run the query and get the result set from the database. */
+ result = mysql_get_resultset(zone, name, NULL, LOOKUP, dbdata, &rs);
+ /* if we didn't get a result set, log an err msg. */
+ if (result != ISC_R_SUCCESS) {
+ if (rs != NULL)
+ mysql_free_result(rs);
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "mysql driver unable to return "
+ "result set for lookup query");
+ return (ISC_R_FAILURE);
+ }
+ /*
+ * lookup and authority result sets are processed in the same manner
+ * mysql_process_rs does the job for both functions.
+ */
+ return mysql_process_rs(lookup, rs);
+}
+
+/*%
+ * create an instance of the driver. Remember, only 1 copy of the driver's
+ * code is ever loaded, the driver has to remember which context it's
+ * operating in. This is done via use of the dbdata argument which is
+ * passed into all query functions.
+ */
+static isc_result_t
+mysql_create(const char *dlzname, unsigned int argc, char *argv[],
+ void *driverarg, void **dbdata)
+{
+ isc_result_t result;
+ dbinstance_t *dbi = NULL;
+ char *tmp = NULL;
+ char *dbname = NULL;
+ char *host = NULL;
+ char *user = NULL;
+ char *pass = NULL;
+ char *socket = NULL;
+ int port;
+ MYSQL *dbc;
+ char *endp;
+ int j;
+ unsigned int flags = 0;
+
+ UNUSED(driverarg);
+ UNUSED(dlzname);
+
+ /* verify we have at least 4 arg's passed to the driver */
+ if (argc < 4) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "mysql driver requires "
+ "at least 4 command line args.");
+ return (ISC_R_FAILURE);
+ }
+
+ /* no more than 8 arg's should be passed to the driver */
+ if (argc > 8) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "mysql driver cannot accept "
+ "more than 7 command line args.");
+ return (ISC_R_FAILURE);
+ }
+
+ /* parse connection string and get paramters. */
+
+ /* get db name - required */
+ dbname = getParameterValue(argv[1], "dbname=");
+ if (dbname == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "mysql driver requires a dbname parameter.");
+ result = ISC_R_FAILURE;
+ goto full_cleanup;
+ }
+
+ /* get db port. Not required, but must be > 0 if specified */
+ tmp = getParameterValue(argv[1], "port=");
+ if (tmp == NULL) {
+ port = 0;
+ } else {
+ port = strtol(tmp, &endp, 10);
+ if (*endp != '\0' || port < 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Mysql driver port "
+ "must be a positive number.");
+ isc_mem_free(ns_g_mctx, tmp);
+ result = ISC_R_FAILURE;
+ goto full_cleanup;
+ }
+ isc_mem_free(ns_g_mctx, tmp);
+ }
+
+ /* how many queries were passed in from config file? */
+ switch(argc) {
+ case 4:
+ result = build_sqldbinstance(ns_g_mctx, NULL, NULL, NULL,
+ argv[2], argv[3], NULL, &dbi);
+ break;
+ case 5:
+ result = build_sqldbinstance(ns_g_mctx, NULL, NULL, argv[4],
+ argv[2], argv[3], NULL, &dbi);
+ break;
+ case 6:
+ result = build_sqldbinstance(ns_g_mctx, argv[5], NULL, argv[4],
+ argv[2], argv[3], NULL, &dbi);
+ break;
+ case 7:
+ result = build_sqldbinstance(ns_g_mctx, argv[5],
+ argv[6], argv[4],
+ argv[2], argv[3], NULL, &dbi);
+ break;
+ case 8:
+ result = build_sqldbinstance(ns_g_mctx, argv[5],
+ argv[6], argv[4],
+ argv[2], argv[3], argv[7], &dbi);
+ break;
+ default:
+ /* not really needed, should shut up compiler. */
+ result = ISC_R_FAILURE;
+ }
+
+ /* unsuccessful?, log err msg and cleanup. */
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "mysql driver could not create "
+ "database instance object.");
+ result = ISC_R_FAILURE;
+ goto full_cleanup;
+ }
+
+ /* create and set db connection */
+ dbi->dbconn = mysql_init(NULL);
+
+ /* if db connection cannot be created, log err msg and cleanup. */
+ if (dbi->dbconn == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "mysql driver could not allocate "
+ "memory for database connection");
+ result = ISC_R_FAILURE;
+ goto full_cleanup;
+ }
+
+ tmp = getParameterValue(argv[1], "compress=");
+ if (tmp != NULL) {
+ if (strcasecmp(tmp, "true") == 0)
+ flags = CLIENT_COMPRESS;
+ isc_mem_free(ns_g_mctx, tmp);
+ }
+
+ tmp = getParameterValue(argv[1], "ssl=");
+ if (tmp != NULL) {
+ if (strcasecmp(tmp, "true") == 0)
+ flags = flags | CLIENT_SSL;
+ isc_mem_free(ns_g_mctx, tmp);
+ }
+
+ tmp = getParameterValue(argv[1], "space=");
+ if (tmp != NULL) {
+ if (strcasecmp(tmp, "ignore") == 0)
+ flags = flags | CLIENT_IGNORE_SPACE;
+ isc_mem_free(ns_g_mctx, tmp);
+ }
+
+ dbc = NULL;
+ host = getParameterValue(argv[1], "host=");
+ user = getParameterValue(argv[1], "user=");
+ pass = getParameterValue(argv[1], "pass=");
+ socket = getParameterValue(argv[1], "socket=");
+
+ for (j=0; dbc == NULL && j < 4; j++)
+ dbc = mysql_real_connect((MYSQL *) dbi->dbconn, host,
+ user, pass, dbname, port, socket,
+ flags);
+
+ /* let user know if we couldn't connect. */
+ if (dbc == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "mysql driver failed to create "
+ "database connection after 4 attempts");
+ result = ISC_R_FAILURE;
+ goto full_cleanup;
+ }
+
+ /* return db connection via dbdata */
+ *dbdata = dbi;
+
+ result = ISC_R_SUCCESS;
+ goto cleanup;
+
+ full_cleanup:
+
+ destroy_sqldbinstance(dbi);
+
+ cleanup:
+
+ if (dbname != NULL)
+ isc_mem_free(ns_g_mctx, dbname);
+ if (host != NULL)
+ isc_mem_free(ns_g_mctx, host);
+ if (user != NULL)
+ isc_mem_free(ns_g_mctx, user);
+ if (pass != NULL)
+ isc_mem_free(ns_g_mctx, pass);
+ if (socket != NULL)
+ isc_mem_free(ns_g_mctx, socket);
+
+
+ return result;
+}
+
+/*%
+ * destroy the driver. Remember, only 1 copy of the driver's
+ * code is ever loaded, the driver has to remember which context it's
+ * operating in. This is done via use of the dbdata argument.
+ * so we really only need to clean it up since we are not using driverarg.
+ */
+
+static void
+mysql_destroy(void *driverarg, void *dbdata)
+{
+ dbinstance_t *dbi;
+
+ UNUSED(driverarg);
+
+ dbi = (dbinstance_t *) dbdata;
+
+ /* release DB connection */
+ if (dbi->dbconn != NULL)
+ mysql_close((MYSQL *) dbi->dbconn);
+
+ /* destroy DB instance */
+ destroy_sqldbinstance(dbi);
+}
+
+/* pointers to all our runtime methods. */
+/* this is used during driver registration */
+/* i.e. in dlz_mysql_init below. */
+static dns_sdlzmethods_t dlz_mysql_methods = {
+ mysql_create,
+ mysql_destroy,
+ mysql_findzone,
+ mysql_lookup,
+ mysql_authority,
+ mysql_allnodes,
+ mysql_allowzonexfr
+};
+
+/*%
+ * Wrapper around dns_sdlzregister().
+ */
+isc_result_t
+dlz_mysql_init(void) {
+ isc_result_t result;
+
+ /*
+ * Write debugging message to log
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "Registering DLZ mysql driver.");
+
+ /* Driver is always threadsafe. Because of the way MySQL handles
+ * threads the MySQL driver can only be used when bind is run single
+ * threaded. Using MySQL with Bind running multi-threaded is not
+ * allowed. When using the MySQL driver "-n1" should always be
+ * passed to Bind to guarantee single threaded operation.
+ */
+ result = dns_sdlzregister("mysql", &dlz_mysql_methods, NULL,
+ DNS_SDLZFLAG_RELATIVEOWNER |
+ DNS_SDLZFLAG_RELATIVERDATA |
+ DNS_SDLZFLAG_THREADSAFE,
+ ns_g_mctx, &dlz_mysql);
+ /* if we can't register the driver, there are big problems. */
+ if (result != ISC_R_SUCCESS) {
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "dns_sdlzregister() failed: %s",
+ isc_result_totext(result));
+ result = ISC_R_UNEXPECTED;
+ }
+
+
+ return result;
+}
+
+/*%
+ * Wrapper around dns_sdlzunregister().
+ */
+void
+dlz_mysql_clear(void) {
+
+ /*
+ * Write debugging message to log
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "Unregistering DLZ mysql driver.");
+
+ /* unregister the driver. */
+ if (dlz_mysql != NULL)
+ dns_sdlzunregister(&dlz_mysql);
+}
+
+#endif
diff --git a/contrib/dlz/drivers/dlz_odbc_driver.c b/contrib/dlz/drivers/dlz_odbc_driver.c
new file mode 100644
index 0000000..eb088a2
--- /dev/null
+++ b/contrib/dlz/drivers/dlz_odbc_driver.c
@@ -0,0 +1,1568 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (C) 1999-2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef DLZ_ODBC
+
+#include <config.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <dns/log.h>
+#include <dns/sdlz.h>
+#include <dns/result.h>
+
+#include <isc/mem.h>
+#include <isc/platform.h>
+#include <isc/print.h>
+#include <isc/result.h>
+#include <isc/string.h>
+#include <isc/util.h>
+
+#include <named/globals.h>
+
+#include <dlz/sdlz_helper.h>
+#include <dlz/dlz_odbc_driver.h>
+
+#include <sql.h>
+#include <sqlext.h>
+#include <sqltypes.h>
+
+static dns_sdlzimplementation_t *dlz_odbc = NULL;
+
+#define dbc_search_limit 30
+#define ALLNODES 1
+#define ALLOWXFR 2
+#define AUTHORITY 3
+#define FINDZONE 4
+#define LOOKUP 5
+
+#define sqlOK(a) ((a == SQL_SUCCESS || a == SQL_SUCCESS_WITH_INFO) ? -1 : 0)
+
+/*
+ * Private Structures
+ */
+
+/*
+ * structure to hold ODBC connection & statement
+ */
+
+typedef struct{
+ SQLHDBC dbc;
+ SQLHSTMT stmnt;
+} odbc_db_t;
+
+/*
+ * Structure to hold everthing needed by this "instance" of the odbc driver
+ * remember, the driver code is only loaded once, but may have many separate
+ * instances
+ */
+
+typedef struct {
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+ db_list_t *db; /* handle to a list of DB */
+
+#else
+
+ dbinstance_t *db; /* handle to db */
+
+#endif
+
+ SQLHENV sql_env; /* handle to SQL environment */
+ SQLCHAR *dsn;
+ SQLCHAR *user;
+ SQLCHAR *pass;
+} odbc_instance_t;
+
+/* forward reference */
+
+static size_t
+odbc_makesafe(char *to, const char *from, size_t length);
+
+/*
+ * Private methods
+ */
+
+static SQLSMALLINT
+safeLen(void *a) {
+ if (a == NULL)
+ return 0;
+ return strlen((char *) a);
+}
+
+/*% propertly cleans up an odbc_instance_t */
+
+static void
+destroy_odbc_instance(odbc_instance_t *odbc_inst) {
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+ dbinstance_t *ndbi = NULL;
+ dbinstance_t *dbi = NULL;
+
+ /* get the first DBI in the list */
+ ndbi = ISC_LIST_HEAD(*odbc_inst->db);
+
+ /* loop through the list */
+ while (ndbi != NULL) {
+ dbi = ndbi;
+ /* get the next DBI in the list */
+ ndbi = ISC_LIST_NEXT(dbi, link);
+
+ /* if we have a connection / statement object in memory */
+ if (dbi->dbconn != NULL) {
+ /* free statement handle */
+ if (((odbc_db_t *) (dbi->dbconn))->stmnt != NULL) {
+ SQLFreeHandle(SQL_HANDLE_STMT,
+ ((odbc_db_t *)
+ (dbi->dbconn))->stmnt);
+ ((odbc_db_t *) (dbi->dbconn))->stmnt = NULL;
+ }
+
+ /* disconnect from database & free connection handle */
+ if (((odbc_db_t *) (dbi->dbconn))->dbc != NULL) {
+ SQLDisconnect(((odbc_db_t *)
+ dbi->dbconn)->dbc);
+ SQLFreeHandle(SQL_HANDLE_DBC,
+ ((odbc_db_t *)
+ (dbi->dbconn))->dbc);
+ ((odbc_db_t *) (dbi->dbconn))->dbc = NULL;
+ }
+
+ /* free memory that held connection & statement. */
+ isc_mem_free(ns_g_mctx, dbi->dbconn);
+ }
+ /* release all memory that comprised a DBI */
+ destroy_sqldbinstance(dbi);
+ }
+ /* release memory for the list structure */
+ isc_mem_put(ns_g_mctx, odbc_inst->db, sizeof(db_list_t));
+
+#else /* ISC_PLATFORM_USETHREADS */
+
+ /* free statement handle */
+ if (((odbc_db_t *) (odbc_inst->db->dbconn))->stmnt != NULL) {
+ SQLFreeHandle(SQL_HANDLE_STMT,
+ ((odbc_db_t *) (odbc_inst->db->dbconn))->stmnt);
+ ((odbc_db_t *) (odbc_inst->db->dbconn))->stmnt = NULL;
+ }
+
+ /* disconnect from database, free connection handle */
+ if (((odbc_db_t *) (odbc_inst->db->dbconn))->dbc != NULL) {
+ SQLDisconnect(((odbc_db_t *) (odbc_inst->db->dbconn))->dbc);
+ SQLFreeHandle(SQL_HANDLE_DBC,
+ ((odbc_db_t *) (odbc_inst->db->dbconn))->dbc);
+ ((odbc_db_t *) (odbc_inst->db->dbconn))->dbc = NULL;
+ }
+ /* free mem for the odbc_db_t structure held in db */
+ if (((odbc_db_t *) odbc_inst->db->dbconn) != NULL) {
+ isc_mem_free(ns_g_mctx, odbc_inst->db->dbconn);
+ odbc_inst->db->dbconn = NULL;
+ }
+
+ if (odbc_inst->db != NULL)
+ destroy_sqldbinstance(odbc_inst->db);
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+
+ /* free sql environment */
+ if (odbc_inst->sql_env != NULL)
+ SQLFreeHandle(SQL_HANDLE_ENV, odbc_inst->sql_env);
+
+ /* free ODBC instance strings */
+ if (odbc_inst->dsn != NULL)
+ isc_mem_free(ns_g_mctx, odbc_inst->dsn);
+ if (odbc_inst->pass != NULL)
+ isc_mem_free(ns_g_mctx, odbc_inst->pass);
+ if (odbc_inst->user != NULL)
+ isc_mem_free(ns_g_mctx, odbc_inst->user);
+
+ /* free memory for odbc_inst */
+ if (odbc_inst != NULL)
+ isc_mem_put(ns_g_mctx, odbc_inst, sizeof(odbc_instance_t));
+
+}
+
+/*% Connects to database, and creates ODBC statements */
+
+static isc_result_t
+odbc_connect(odbc_instance_t *dbi, odbc_db_t **dbc) {
+
+ odbc_db_t *ndb = *dbc;
+ SQLRETURN sqlRes;
+ isc_result_t result = ISC_R_SUCCESS;
+
+ if (ndb != NULL) {
+ /*
+ * if db != null, we have to do some cleanup
+ * if statement handle != null free it
+ */
+ if (ndb->stmnt != NULL) {
+ SQLFreeHandle(SQL_HANDLE_STMT, ndb->stmnt);
+ ndb->stmnt = NULL;
+ }
+
+ /* if connection handle != null free it */
+ if (ndb->dbc != NULL) {
+ SQLFreeHandle(SQL_HANDLE_DBC, ndb->dbc);
+ ndb->dbc = NULL;
+ }
+ } else {
+ ndb = isc_mem_allocate(ns_g_mctx, sizeof(odbc_db_t));
+ if (ndb == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Odbc driver unable to allocate memory");
+ return ISC_R_NOMEMORY;
+ }
+ memset(ndb, 0, sizeof(odbc_db_t));
+ }
+
+ sqlRes = SQLAllocHandle(SQL_HANDLE_DBC, dbi->sql_env, &(ndb->dbc));
+ if (!sqlOK(sqlRes)) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Odbc driver unable to allocate memory");
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+
+ sqlRes = SQLConnect(ndb->dbc, dbi->dsn, safeLen(dbi->dsn), dbi->user,
+ safeLen(dbi->user), dbi->pass, safeLen(dbi->pass));
+ if (!sqlOK(sqlRes)) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Odbc driver unable to connect");
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+
+ sqlRes = SQLAllocHandle(SQL_HANDLE_STMT, ndb->dbc, &(ndb->stmnt));
+ if (!sqlOK(sqlRes)) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Odbc driver unable to allocate memory");
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+
+ *dbc = ndb;
+
+ return ISC_R_SUCCESS;
+
+ cleanup:
+
+ if (ndb != NULL) {
+
+ /* if statement handle != null free it */
+ if (ndb->stmnt != NULL) {
+ SQLFreeHandle(SQL_HANDLE_STMT, ndb->stmnt);
+ ndb->stmnt = NULL;
+ }
+
+ /* if connection handle != null free it */
+ if (ndb->dbc != NULL) {
+ SQLDisconnect(ndb->dbc);
+ SQLFreeHandle(SQL_HANDLE_DBC, ndb->dbc);
+ ndb->dbc = NULL;
+ }
+ /* free memory holding ndb */
+ isc_mem_free(ns_g_mctx, ndb);
+ }
+
+ return result;
+}
+
+/*%
+ * Loops through the list of DB instances, attempting to lock
+ * on the mutex. If successful, the DBI is reserved for use
+ * and the thread can perform queries against the database.
+ * If the lock fails, the next one in the list is tried.
+ * looping continues until a lock is obtained, or until
+ * the list has been searched dbc_search_limit times.
+ * This function is only used when the driver is compiled for
+ * multithreaded operation.
+ */
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+static dbinstance_t *
+odbc_find_avail_conn(db_list_t *dblist)
+{
+ dbinstance_t *dbi = NULL;
+ dbinstance_t *head;
+ int count = 0;
+
+ /* get top of list */
+ head = dbi = ISC_LIST_HEAD(*dblist);
+
+ /* loop through list */
+ while (count < dbc_search_limit) {
+ /* try to lock on the mutex */
+ if (isc_mutex_trylock(&dbi->instance_lock) == ISC_R_SUCCESS)
+ return dbi; /* success, return the DBI for use. */
+
+ /* not successful, keep trying */
+ dbi = ISC_LIST_NEXT(dbi, link);
+
+ /* check to see if we have gone to the top of the list. */
+ if (dbi == NULL) {
+ count++;
+ dbi = head;
+ }
+ }
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_INFO,
+ "Odbc driver unable to find available "
+ "connection after searching %d times",
+ count);
+ return NULL;
+}
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+/*% Allocates memory for a new string, and then constructs the new
+ * string by "escaping" the input string. The new string is
+ * safe to be used in queries. This is necessary because we cannot
+ * be sure of what types of strings are passed to us, and we don't
+ * want special characters in the string causing problems.
+ */
+
+static char *
+odbc_escape_string(const char *instr) {
+
+ char *outstr;
+ unsigned int len;
+
+ if (instr == NULL)
+ return NULL;
+
+ len = strlen(instr);
+
+ outstr = isc_mem_allocate(ns_g_mctx ,(2 * len * sizeof(char)) + 1);
+ if (outstr == NULL)
+ return NULL;
+
+ odbc_makesafe(outstr, instr, len);
+
+ return outstr;
+}
+
+/* ---------------
+ * Escaping arbitrary strings to get valid SQL strings/identifiers.
+ *
+ * Replaces "\\" with "\\\\" and "'" with "''".
+ * length is the length of the buffer pointed to by
+ * from. The buffer at to must be at least 2*length + 1 characters
+ * long. A terminating NUL character is written.
+ *
+ * NOTICE!!!
+ * This function was borrowed directly from PostgreSQL's libpq.
+ *
+ * The copyright statements from the original file containing this
+ * function are included below:
+ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ * ---------------
+ */
+
+static size_t
+odbc_makesafe(char *to, const char *from, size_t length)
+{
+ const char *source = from;
+ char *target = to;
+ unsigned int remaining = length;
+
+ while (remaining > 0)
+ {
+ switch (*source)
+ {
+ case '\\':
+ *target = '\\';
+ target++;
+ *target = '\\';
+ /* target and remaining are updated below. */
+ break;
+
+ case '\'':
+ *target = '\'';
+ target++;
+ *target = '\'';
+ /* target and remaining are updated below. */
+ break;
+
+ default:
+ *target = *source;
+ /* target and remaining are updated below. */
+ }
+ source++;
+ target++;
+ remaining--;
+ }
+
+ /* Write the terminating NUL character. */
+ *target = '\0';
+
+ return target - to;
+}
+
+/*%
+ * This function is the real core of the driver. Zone, record
+ * and client strings are passed in (or NULL is passed if the
+ * string is not available). The type of query we want to run
+ * is indicated by the query flag, and the dbdata object is passed
+ * passed in to. dbdata really holds either:
+ * 1) a list of database instances (in multithreaded mode) OR
+ * 2) a single database instance (in single threaded mode)
+ * The function will construct the query and obtain an available
+ * database instance (DBI). It will then run the query and hopefully
+ * obtain a result set. The data base instance that is used is returned
+ * to the caller so they can get the data from the result set from it.
+ * If successfull, it will be the responsibility of the caller to close
+ * the cursor, and unlock the mutex of the DBI when they are done with it.
+ * If not successfull, this function will perform all the cleanup.
+ */
+
+
+static isc_result_t
+odbc_get_resultset(const char *zone, const char *record,
+ const char *client, unsigned int query,
+ void *dbdata, dbinstance_t **r_dbi)
+{
+
+ isc_result_t result;
+ dbinstance_t *dbi = NULL;
+ char *querystring = NULL;
+ unsigned int j = 0;
+ SQLRETURN sqlRes;
+
+ REQUIRE(*r_dbi == NULL);
+
+ /* get db instance / connection */
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /* find an available DBI from the list */
+ dbi = odbc_find_avail_conn(((odbc_instance_t *) dbdata)->db);
+
+#else /* ISC_PLATFORM_USETHREADS */
+
+ /*
+ * only 1 DBI - no need to lock instance lock either
+ * only 1 thread in the whole process, no possible contention.
+ */
+ dbi = (dbinstance_t *) ((odbc_instance_t *) dbdata)->db;
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ /* if DBI is null, can't do anything else */
+ if (dbi == NULL) {
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+
+ /* what type of query are we going to run? */
+ switch(query) {
+ case ALLNODES:
+ /*
+ * if the query was not passed in from the config file
+ * then we can't run it. return not_implemented, so
+ * it's like the code for that operation was never
+ * built into the driver.... AHHH flexibility!!!
+ */
+ if (dbi->allnodes_q == NULL) {
+ result = ISC_R_NOTIMPLEMENTED;
+ goto cleanup;
+ }
+ break;
+ case ALLOWXFR:
+ /* same as comments as ALLNODES */
+ if (dbi->allowxfr_q == NULL) {
+ result = ISC_R_NOTIMPLEMENTED;
+ goto cleanup;
+ }
+ break;
+ case AUTHORITY:
+ /* same as comments as ALLNODES */
+ if (dbi->authority_q == NULL) {
+ result = ISC_R_NOTIMPLEMENTED;
+ goto cleanup;
+ }
+ break;
+ case FINDZONE:
+ /* this is required. It's the whole point of DLZ! */
+ if (dbi->findzone_q == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "No query specified for findzone. "
+ "Findzone requires a query");
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+ break;
+ case LOOKUP:
+ /* this is required. It's also a major point of DLZ! */
+ if (dbi->lookup_q == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "No query specified for lookup. "
+ "Lookup requires a query");
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+ break;
+ default:
+ /*
+ * this should never happen. If it does, the code is
+ * screwed up!
+ */
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "Incorrect query flag passed to "
+ "odbc_get_resultset");
+ result = ISC_R_UNEXPECTED;
+ goto cleanup;
+ }
+
+
+ /*
+ * was a zone string passed? If so, make it safe for use in
+ * queries.
+ */
+ if (zone != NULL) {
+ dbi->zone = odbc_escape_string(zone);
+ if (dbi->zone == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ } else { /* no string passed, set the string pointer to NULL */
+ dbi->zone = NULL;
+ }
+
+ /*
+ * was a record string passed? If so, make it safe for use in
+ * queries.
+ */
+ if (record != NULL) {
+ dbi->record = odbc_escape_string(record);
+ if (dbi->record == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ } else { /* no string passed, set the string pointer to NULL */
+ dbi->record = NULL;
+ }
+
+ /*
+ * was a client string passed? If so, make it safe for use in
+ * queries.
+ */
+ if (client != NULL) {
+ dbi->client = odbc_escape_string(client);
+ if (dbi->client == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ } else { /* no string passed, set the string pointer to NULL */
+ dbi->client = NULL;
+ }
+
+ /*
+ * what type of query are we going to run?
+ * this time we build the actual query to run.
+ */
+ switch(query) {
+ case ALLNODES:
+ querystring = build_querystring(ns_g_mctx, dbi->allnodes_q);
+ break;
+ case ALLOWXFR:
+ querystring = build_querystring(ns_g_mctx, dbi->allowxfr_q);
+ break;
+ case AUTHORITY:
+ querystring = build_querystring(ns_g_mctx, dbi->authority_q);
+ break;
+ case FINDZONE:
+ querystring = build_querystring(ns_g_mctx, dbi->findzone_q);
+ break;
+ case LOOKUP:
+ querystring = build_querystring(ns_g_mctx, dbi->lookup_q);
+ break;
+ default:
+ /*
+ * this should never happen. If it does, the code is
+ * screwed up!
+ */
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "Incorrect query flag passed to "
+ "odbc_get_resultset");
+ result = ISC_R_UNEXPECTED;
+ goto cleanup;
+ }
+
+ /* if the querystring is null, Bummer, outta RAM. UPGRADE TIME!!! */
+ if (querystring == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+
+ /* output the full query string during debug so we can see */
+ /* what lame error the query has. */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
+ "\nQuery String: %s\n", querystring);
+
+ /* attempt query up to 3 times. */
+ for (j=0; j < 3; j++) {
+ /* try to get result set */
+ sqlRes = SQLExecDirect(((odbc_db_t *) dbi->dbconn)->stmnt,
+ (SQLCHAR *) querystring,
+ (SQLINTEGER) strlen(querystring));
+
+ /* if error, reset DB connection */
+ if (!sqlOK(sqlRes)) {
+ /* close cursor */
+ SQLCloseCursor(((odbc_db_t *) dbi->dbconn)->stmnt);
+ /* attempt to reconnect */
+ result = odbc_connect((odbc_instance_t *) dbdata,
+ (odbc_db_t **) &(dbi->dbconn));
+ /* check if we reconnected */
+ if (result != ISC_R_SUCCESS)
+ break;
+ /* incase this is the last time through the loop */
+ result = ISC_R_FAILURE;
+ } else {
+ result = ISC_R_SUCCESS;
+ /* return dbi */
+ *r_dbi = dbi;
+ /* result set ok, break loop */
+ break;
+ }
+ } /* end for loop */
+
+ cleanup: /* it's always good to cleanup after yourself */
+
+ /* if we couldn't even allocate DBI, just return NULL */
+ if (dbi == NULL)
+ return ISC_R_FAILURE;
+
+ /* free dbi->zone string */
+ if (dbi->zone != NULL)
+ isc_mem_free(ns_g_mctx, dbi->zone);
+
+ /* free dbi->record string */
+ if (dbi->record != NULL)
+ isc_mem_free(ns_g_mctx, dbi->record);
+
+ /* free dbi->client string */
+ if (dbi->client != NULL)
+ isc_mem_free(ns_g_mctx, dbi->client);
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /* if we are done using this dbi, release the lock */
+ if (result != ISC_R_SUCCESS)
+ isc_mutex_unlock(&dbi->instance_lock);
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ /* release query string */
+ if (querystring != NULL)
+ isc_mem_free(ns_g_mctx, querystring );
+
+ /* return result */
+ return result;
+
+}
+
+/*%
+ * Gets a single field from the ODBC statement. The memory for the
+ * returned data is dynamically allocated. If this method is successful
+ * it is the reponsibility of the caller to free the memory using
+ * isc_mem_free(ns_g_mctx, *ptr);
+ */
+
+static isc_result_t
+odbc_getField(SQLHSTMT *stmnt, SQLSMALLINT field, char **data) {
+
+ SQLINTEGER size;
+
+ REQUIRE(data != NULL && *data == NULL);
+
+ if (sqlOK(SQLColAttribute(stmnt, field, SQL_DESC_DISPLAY_SIZE,
+ NULL, 0, NULL, &size)) && size > 0) {
+ *data = isc_mem_allocate(ns_g_mctx, size + 1);
+ if (data != NULL) {
+ if (sqlOK(SQLGetData(stmnt, field, SQL_C_CHAR,
+ *data, size + 1,&size)))
+ return ISC_R_SUCCESS;
+ isc_mem_free(ns_g_mctx, *data);
+ }
+ }
+ return ISC_R_FAILURE;
+}
+
+/*%
+ * Gets multiple fields from the ODBC statement. The memory for the
+ * returned data is dynamically allocated. If this method is successful
+ * it is the reponsibility of the caller to free the memory using
+ * isc_mem_free(ns_g_mctx, *ptr);
+ */
+
+static isc_result_t
+odbc_getManyFields(SQLHSTMT *stmnt, SQLSMALLINT startField,
+ SQLSMALLINT endField, char **retData) {
+
+ isc_result_t result;
+ SQLINTEGER size;
+ int totSize = 0;
+ SQLSMALLINT i;
+ int j = 0;
+ char *data;
+
+ REQUIRE(retData != NULL && *retData == NULL);
+ REQUIRE(startField > 0 && startField <= endField);
+
+ /* determine how large the data is */
+ for (i=startField; i <= endField; i++)
+ if (sqlOK(SQLColAttribute(stmnt, i, SQL_DESC_DISPLAY_SIZE,
+ NULL, 0, NULL, &size)) && size > 0) {
+ /* always allow for a " " (space) character */
+ totSize += (size + 1);
+ /* after the data item */
+ }
+
+ if (totSize < 1)
+ return ISC_R_FAILURE;
+
+ /* allow for a "\n" at the end of the string/ */
+ data = isc_mem_allocate(ns_g_mctx, ++totSize);
+ if (data == NULL)
+ return ISC_R_NOMEMORY;
+
+ result = ISC_R_FAILURE;
+
+ /* get the data and concat all fields into a large string */
+ for (i=startField; i <= endField; i++) {
+ if (sqlOK(SQLGetData(stmnt, i, SQL_C_CHAR, &(data[j]),
+ totSize - j, &size))) {
+ if (size > 0) {
+ j += size;
+ data[j++] = ' ';
+ data[j] = '\0';
+ result = ISC_R_SUCCESS;
+ }
+ } else {
+ isc_mem_free(ns_g_mctx, data);
+ return ISC_R_FAILURE;
+ }
+ }
+
+ if (result != ISC_R_SUCCESS) {
+ isc_mem_free(ns_g_mctx, data);
+ return result;
+ }
+
+ *retData = data;
+ return ISC_R_SUCCESS;
+
+}
+
+/*%
+ * The processing of result sets for lookup and authority are
+ * exactly the same. So that functionality has been moved
+ * into this function to minimize code.
+ */
+
+static isc_result_t
+odbc_process_rs(dns_sdlzlookup_t *lookup, dbinstance_t *dbi)
+{
+
+
+ isc_result_t result;
+ SQLSMALLINT fields;
+ SQLHSTMT *stmnt;
+ char *ttl_s;
+ char *type;
+ char *data;
+ char *endp;
+ int ttl;
+
+ REQUIRE(dbi != NULL);
+
+ stmnt = ((odbc_db_t *) (dbi->dbconn))->stmnt;
+
+ /* get number of columns */
+ if (!sqlOK(SQLNumResultCols(stmnt, &fields))) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Odbc driver unable to process result set");
+ result = ISC_R_FAILURE;
+ goto process_rs_cleanup;
+ }
+
+ /* get things ready for processing */
+ result = ISC_R_FAILURE;
+
+ while (sqlOK(SQLFetch(stmnt))) {
+
+ /* set to null for next pass through */
+ data = type = ttl_s = NULL;
+
+ switch(fields) {
+ case 1:
+ /*
+ * one column in rs, it's the data field. use
+ * default type of A record, and default TTL
+ * of 86400. attempt to get data, & tell bind
+ * about it.
+ */
+ if ((result = odbc_getField(stmnt, 1,
+ &data)) == ISC_R_SUCCESS) {
+ result = dns_sdlz_putrr(lookup, "a",
+ 86400, data);
+ }
+ break;
+ case 2:
+ /*
+ * two columns, data field, and data type.
+ * use default TTL of 86400. attempt to get
+ * DNS type & data, then tell bind about it.
+ */
+ if ((result = odbc_getField(stmnt, 1,
+ &type)) == ISC_R_SUCCESS &&
+ (result = odbc_getField(stmnt, 2,
+ &data)) == ISC_R_SUCCESS) {
+ result = dns_sdlz_putrr(lookup, type,
+ 86400, data);
+ }
+ break;
+ default:
+ /*
+ * 3 fields or more, concatenate the last ones
+ * together. attempt to get DNS ttl, type,
+ * data then tell Bind about them.
+ */
+ if ((result = odbc_getField(stmnt, 1, &ttl_s))
+ == ISC_R_SUCCESS &&
+ (result = odbc_getField(stmnt, 2, &type))
+ == ISC_R_SUCCESS &&
+ (result = odbc_getManyFields(stmnt, 3,
+ fields, &data))
+ == ISC_R_SUCCESS) {
+ /* try to convert ttl string to int */
+ ttl = strtol(ttl_s, &endp, 10);
+ /* failure converting ttl. */
+ if (*endp != '\0' || ttl < 0) {
+ isc_log_write(dns_lctx,
+ DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ,
+ ISC_LOG_ERROR,
+ "Odbc driver ttl must "
+ "be a postive number");
+ result = ISC_R_FAILURE;
+ } else {
+ /*
+ * successful converting TTL,
+ * tell Bind everything
+ */
+ result = dns_sdlz_putrr(lookup, type,
+ ttl, data);
+ }
+ } /* closes bid if () */
+ } /* closes switch(fields) */
+
+ /* clean up mem */
+ if (ttl_s != NULL)
+ isc_mem_free(ns_g_mctx, ttl_s);
+ if (type != NULL)
+ isc_mem_free(ns_g_mctx, type);
+ if (data != NULL)
+ isc_mem_free(ns_g_mctx, data);
+
+ /* I sure hope we were successful */
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "dns_sdlz_putrr returned error. "
+ "Error code was: %s",
+ isc_result_totext(result));
+ result = ISC_R_FAILURE;
+ goto process_rs_cleanup;
+ }
+ } /* closes while loop */
+
+ process_rs_cleanup:
+
+ /* close cursor */
+ SQLCloseCursor(((odbc_db_t *) (dbi->dbconn))->stmnt);
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /* free lock on dbi so someone else can use it. */
+ isc_mutex_unlock(&dbi->instance_lock);
+
+#endif
+
+ return result;
+}
+
+/*
+ * SDLZ interface methods
+ */
+
+/*% determine if the zone is supported by (in) the database */
+
+static isc_result_t
+odbc_findzone(void *driverarg, void *dbdata, const char *name)
+{
+
+ isc_result_t result;
+ dbinstance_t *dbi = NULL;
+
+ UNUSED(driverarg);
+
+ /* run the query and get the result set from the database. */
+ /* if result != ISC_R_SUCCESS cursor and mutex already cleaned up. */
+ /* so we don't have to do it here. */
+ result = odbc_get_resultset(name, NULL, NULL, FINDZONE, dbdata, &dbi);
+
+ /* Check that we got a result set with data */
+ if (result == ISC_R_SUCCESS &&
+ !sqlOK(SQLFetch(((odbc_db_t *) (dbi->dbconn))->stmnt))) {
+ result = ISC_R_NOTFOUND;
+ }
+
+ if (dbi != NULL) {
+ /* get rid of result set, we are done with it. */
+ SQLCloseCursor(((odbc_db_t *) (dbi->dbconn))->stmnt);
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /* free lock on dbi so someone else can use it. */
+ isc_mutex_unlock(&dbi->instance_lock);
+#endif
+ }
+
+ return result;
+}
+
+/*% Determine if the client is allowed to perform a zone transfer */
+static isc_result_t
+odbc_allowzonexfr(void *driverarg, void *dbdata, const char *name,
+ const char *client)
+{
+ isc_result_t result;
+ dbinstance_t *dbi = NULL;
+
+ UNUSED(driverarg);
+
+ /* first check if the zone is supported by the database. */
+ result = odbc_findzone(driverarg, dbdata, name);
+ if (result != ISC_R_SUCCESS)
+ return (ISC_R_NOTFOUND);
+
+ /*
+ * if we get to this point we know the zone is supported by
+ * the database. the only questions now are is the zone
+ * transfer is allowed for this client and did the config file
+ * have an allow zone xfr query
+ *
+ * Run our query, and get a result set from the database. if
+ * result != ISC_R_SUCCESS cursor and mutex already cleaned
+ * up, so we don't have to do it here.
+ */
+ result = odbc_get_resultset(name, NULL, client, ALLOWXFR,
+ dbdata, &dbi);
+
+ /* if we get "not implemented", send it along. */
+ if (result == ISC_R_NOTIMPLEMENTED)
+ return result;
+
+ /* Check that we got a result set with data */
+ if (result == ISC_R_SUCCESS &&
+ !sqlOK(SQLFetch(((odbc_db_t *) (dbi->dbconn))->stmnt))) {
+ result = ISC_R_NOPERM;
+ }
+
+ if (dbi != NULL) {
+ /* get rid of result set, we are done with it. */
+ SQLCloseCursor(((odbc_db_t *) (dbi->dbconn))->stmnt);
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /* free lock on dbi so someone else can use it. */
+ isc_mutex_unlock(&dbi->instance_lock);
+#endif
+
+ }
+
+ return result;
+}
+
+/*%
+ * If the client is allowed to perform a zone transfer, the next order of
+ * business is to get all the nodes in the zone, so bind can respond to the
+ * query.
+ */
+
+static isc_result_t
+odbc_allnodes(const char *zone, void *driverarg, void *dbdata,
+ dns_sdlzallnodes_t *allnodes)
+{
+
+ isc_result_t result;
+ dbinstance_t *dbi = NULL;
+ SQLHSTMT *stmnt;
+ SQLSMALLINT fields;
+ char *data;
+ char *type;
+ char *ttl_s;
+ int ttl;
+ char *host;
+ char *endp;
+
+ UNUSED(driverarg);
+
+ /* run the query and get the result set from the database. */
+ result = odbc_get_resultset(zone, NULL, NULL, ALLNODES, dbdata, &dbi);
+
+ /* if we get "not implemented", send it along */
+ if (result == ISC_R_NOTIMPLEMENTED)
+ return result;
+
+ /* if we didn't get a result set, log an err msg. */
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Odbc driver unable to return "
+ "result set for all nodes query");
+ return (ISC_R_FAILURE);
+ }
+
+ stmnt = ((odbc_db_t *) (dbi->dbconn))->stmnt;
+
+ /* get number of columns */
+ if (!sqlOK(SQLNumResultCols(stmnt, &fields))) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Odbc driver unable to process result set");
+ result = ISC_R_FAILURE;
+ goto allnodes_cleanup;
+ }
+
+ if (fields < 4) { /* gotta have at least 4 columns */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Odbc driver too few fields returned by "
+ "all nodes query");
+ result = ISC_R_FAILURE;
+ goto allnodes_cleanup;
+ }
+
+ /* get things ready for processing */
+ result = ISC_R_FAILURE;
+
+ while (sqlOK(SQLFetch(stmnt))) {
+
+ /* set to null for next pass through */
+ data = host = type = ttl_s = NULL;
+
+ /*
+ * attempt to get DNS ttl, type, host, data then tell
+ * Bind about them
+ */
+ if ((result = odbc_getField(stmnt, 1,
+ &ttl_s)) == ISC_R_SUCCESS &&
+ (result = odbc_getField(stmnt, 2,
+ &type)) == ISC_R_SUCCESS &&
+ (result = odbc_getField(stmnt, 3,
+ &host)) == ISC_R_SUCCESS &&
+ (result = odbc_getManyFields(stmnt, 4, fields,
+ &data)) == ISC_R_SUCCESS) {
+ /* convert ttl string to int */
+ ttl = strtol(ttl_s, &endp, 10);
+ /* failure converting ttl. */
+ if (*endp != '\0' || ttl < 0) {
+ isc_log_write(dns_lctx,
+ DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Odbc driver ttl must be "
+ "a postive number");
+ result = ISC_R_FAILURE;
+ } else {
+ /* successful converting TTL, tell Bind */
+ result = dns_sdlz_putnamedrr(allnodes, host,
+ type, ttl, data);
+ }
+ } /* closes big if () */
+
+ /* clean up mem */
+ if (ttl_s != NULL)
+ isc_mem_free(ns_g_mctx, ttl_s);
+ if (type != NULL)
+ isc_mem_free(ns_g_mctx, type);
+ if (host != NULL)
+ isc_mem_free(ns_g_mctx, host);
+ if (data != NULL)
+ isc_mem_free(ns_g_mctx, data);
+
+ /* if we weren't successful, log err msg */
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "dns_sdlz_putnamedrr returned error. "
+ "Error code was: %s",
+ isc_result_totext(result));
+ result = ISC_R_FAILURE;
+ goto allnodes_cleanup;
+ }
+ } /* closes while loop */
+
+ allnodes_cleanup:
+
+ /* close cursor */
+ SQLCloseCursor(((odbc_db_t *) (dbi->dbconn))->stmnt);
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /* free lock on dbi so someone else can use it. */
+ isc_mutex_unlock(&dbi->instance_lock);
+
+#endif
+
+ return result;
+}
+
+/*%
+ * if the lookup function does not return SOA or NS records for the zone,
+ * use this function to get that information for Bind.
+ */
+
+static isc_result_t
+odbc_authority(const char *zone, void *driverarg, void *dbdata,
+ dns_sdlzlookup_t *lookup)
+{
+ isc_result_t result;
+ dbinstance_t *dbi = NULL;
+
+ UNUSED(driverarg);
+
+ /* run the query and get the result set from the database. */
+ result = odbc_get_resultset(zone, NULL, NULL, AUTHORITY, dbdata, &dbi);
+ /* if we get "not implemented", send it along */
+ if (result == ISC_R_NOTIMPLEMENTED)
+ return result;
+ /* if we didn't get a result set, log an err msg. */
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Odbc driver unable to return "
+ "result set for authority query");
+ return (ISC_R_FAILURE);
+ }
+ /* lookup and authority result sets are processed in the same manner */
+ /* odbc_process_rs does the job for both functions. */
+ return odbc_process_rs(lookup, dbi);
+}
+
+/*% if zone is supported, lookup up a (or multiple) record(s) in it */
+
+static isc_result_t
+odbc_lookup(const char *zone, const char *name, void *driverarg,
+ void *dbdata, dns_sdlzlookup_t *lookup)
+{
+ isc_result_t result;
+ dbinstance_t *dbi = NULL;
+
+ UNUSED(driverarg);
+
+ /* run the query and get the result set from the database. */
+ result = odbc_get_resultset(zone, name, NULL, LOOKUP, dbdata, &dbi);
+ /* if we didn't get a result set, log an err msg. */
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Odbc driver unable to return "
+ "result set for lookup query");
+ return (ISC_R_FAILURE);
+ }
+ /* lookup and authority result sets are processed in the same manner */
+ /* odbc_process_rs does the job for both functions. */
+ return odbc_process_rs(lookup, dbi);
+}
+
+/*%
+ * create an instance of the driver. Remember, only 1 copy of the driver's
+ * code is ever loaded, the driver has to remember which context it's
+ * operating in. This is done via use of the dbdata argument which is
+ * passed into all query functions.
+ */
+static isc_result_t
+odbc_create(const char *dlzname, unsigned int argc, char *argv[],
+ void *driverarg, void **dbdata)
+{
+ isc_result_t result;
+ odbc_instance_t *odbc_inst = NULL;
+ dbinstance_t *db = NULL;
+ SQLRETURN sqlRes;
+
+#ifdef ISC_PLATFORM_USETHREADS
+ /* if multi-threaded, we need a few extra variables. */
+ int dbcount;
+ int i;
+ char *endp;
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ UNUSED(dlzname);
+ UNUSED(driverarg);
+
+#ifdef ISC_PLATFORM_USETHREADS
+ /* if debugging, let user know we are multithreaded. */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
+ "Odbc driver running multithreaded");
+#else /* ISC_PLATFORM_USETHREADS */
+ /* if debugging, let user know we are single threaded. */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
+ "Odbc driver running single threaded");
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ /* verify we have at least 5 arg's passed to the driver */
+ if (argc < 5) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Odbc driver requires at least "
+ "4 command line args.");
+ return (ISC_R_FAILURE);
+ }
+
+ /* no more than 8 arg's should be passed to the driver */
+ if (argc > 8) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Odbc driver cannot accept more than "
+ "7 command line args.");
+ return (ISC_R_FAILURE);
+ }
+
+ /* multithreaded build can have multiple DB connections */
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /* check how many db connections we should create */
+ dbcount = strtol(argv[1], &endp, 10);
+ if (*endp != '\0' || dbcount < 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Odbc driver database connection count "
+ "must be positive.");
+ return (ISC_R_FAILURE);
+ }
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ /* allocate memory for odbc instance */
+ odbc_inst = isc_mem_get(ns_g_mctx, sizeof(odbc_instance_t));
+ if (odbc_inst == NULL)
+ return (ISC_R_NOMEMORY);
+ memset(odbc_inst, 0, sizeof(odbc_instance_t));
+
+ /* parse connection string and get paramters. */
+
+ /* get odbc database dsn - required */
+ odbc_inst->dsn = (SQLCHAR *) getParameterValue(argv[2],
+ "dsn=");
+ if (odbc_inst->dsn == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "odbc driver requires a dns parameter.");
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+ /* get odbc database username */
+ /* if no username was passed, set odbc_inst.user = NULL; */
+ odbc_inst->user = (SQLCHAR *) getParameterValue(argv[2],
+ "user=");
+
+ /* get odbc database password */
+ /* if no password was passed, set odbc_inst.pass = NULL; */
+ odbc_inst->pass = (SQLCHAR *) getParameterValue(argv[2], "pass=");
+
+ /* create odbc environment & set environment to ODBC V3 */
+ if (odbc_inst->sql_env == NULL) {
+ /* create environment handle */
+ sqlRes = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE,
+ &(odbc_inst->sql_env));
+ if (!sqlOK(sqlRes)) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_INFO,
+ "Odbc driver unable to allocate memory");
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ /*set ODBC version = 3 */
+ sqlRes = SQLSetEnvAttr(odbc_inst->sql_env,
+ SQL_ATTR_ODBC_VERSION,
+ (void *) SQL_OV_ODBC3, 0);
+ if (!sqlOK(sqlRes)) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_INFO,
+ "Unable to configure ODBC environment");
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ }
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /* allocate memory for database connection list */
+ odbc_inst->db = isc_mem_get(ns_g_mctx, sizeof(db_list_t));
+ if (odbc_inst->db == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+
+
+ /* initialize DB connection list */
+ ISC_LIST_INIT(*odbc_inst->db);
+
+ /* create the appropriate number of database instances (DBI) */
+ /* append each new DBI to the end of the list */
+ for (i=0; i < dbcount; i++) {
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ /* how many queries were passed in from config file? */
+ switch(argc) {
+ case 5:
+ result = build_sqldbinstance(ns_g_mctx, NULL, NULL,
+ NULL, argv[3], argv[4],
+ NULL, &db);
+ break;
+ case 6:
+ result = build_sqldbinstance(ns_g_mctx, NULL, NULL,
+ argv[5], argv[3], argv[4],
+ NULL, &db);
+ break;
+ case 7:
+ result = build_sqldbinstance(ns_g_mctx, argv[6], NULL,
+ argv[5], argv[3], argv[4],
+ NULL, &db);
+ break;
+ case 8:
+ result = build_sqldbinstance(ns_g_mctx, argv[6],
+ argv[7], argv[5], argv[3],
+ argv[4], NULL, &db);
+ break;
+ default:
+ /* not really needed, should shut up compiler. */
+ result = ISC_R_FAILURE;
+ }
+
+ /* unsuccessful?, log err msg and cleanup. */
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Odbc driver could not create "
+ "database instance object.");
+ goto cleanup;
+ }
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /* when multithreaded, build a list of DBI's */
+ ISC_LINK_INIT(db, link);
+ ISC_LIST_APPEND(*odbc_inst->db, db, link);
+
+#endif
+
+ result = odbc_connect(odbc_inst, (odbc_db_t **) &(db->dbconn));
+
+ if (result != ISC_R_SUCCESS) {
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /*
+ * if multi threaded, let user know which
+ * connection failed. user could be
+ * attempting to create 10 db connections and
+ * for some reason the db backend only allows
+ * 9.
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Odbc driver failed to create database "
+ "connection number %u after 3 attempts",
+ i+1);
+#else
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Odbc driver failed to create database "
+ "connection after 3 attempts");
+#endif
+ goto cleanup;
+ }
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /* set DB = null for next loop through. */
+ db = NULL;
+
+ } /* end for loop */
+
+#else
+ /* tell odbc_inst about the db connection we just created. */
+ odbc_inst->db = db;
+
+#endif
+
+ /* set dbdata to the odbc_instance we created. */
+ *dbdata = odbc_inst;
+
+ /* hey, we got through all of that ok, return success. */
+ return(ISC_R_SUCCESS);
+
+ cleanup:
+
+ destroy_odbc_instance(odbc_inst);
+
+ return result;
+}
+
+/*%
+ * destroy an instance of the driver. Remember, only 1 copy of the driver's
+ * code is ever loaded, the driver has to remember which context it's
+ * operating in. This is done via use of the dbdata argument.
+ * so we really only need to clean it up since we are not using driverarg.
+ */
+
+static void
+odbc_destroy(void *driverarg, void *dbdata)
+{
+ UNUSED(driverarg);
+
+ destroy_odbc_instance((odbc_instance_t *) dbdata);
+}
+
+
+/* pointers to all our runtime methods. */
+/* this is used during driver registration */
+/* i.e. in dlz_odbc_init below. */
+static dns_sdlzmethods_t dlz_odbc_methods = {
+ odbc_create,
+ odbc_destroy,
+ odbc_findzone,
+ odbc_lookup,
+ odbc_authority,
+ odbc_allnodes,
+ odbc_allowzonexfr
+};
+
+/*%
+ * Wrapper around dns_sdlzregister().
+ */
+isc_result_t
+dlz_odbc_init(void) {
+ isc_result_t result;
+
+ /*
+ * Write debugging message to log
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "Registering DLZ odbc driver.");
+
+ /*
+ * Driver is always threadsafe. When multithreaded all
+ * functions use multithreaded code. When not multithreaded,
+ * all functions can only be entered once, but only 1 thread
+ * of operation is available in Bind. So everything is still
+ * threadsafe.
+ */
+ result = dns_sdlzregister("odbc", &dlz_odbc_methods, NULL,
+ DNS_SDLZFLAG_RELATIVEOWNER |
+ DNS_SDLZFLAG_RELATIVERDATA |
+ DNS_SDLZFLAG_THREADSAFE,
+ ns_g_mctx, &dlz_odbc);
+ /* if we can't register the driver, there are big problems. */
+ if (result != ISC_R_SUCCESS) {
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "dns_sdlzregister() failed: %s",
+ isc_result_totext(result));
+ result = ISC_R_UNEXPECTED;
+ }
+
+
+ return result;
+}
+
+/*%
+ * Wrapper around dns_sdlzunregister().
+ */
+void
+dlz_odbc_clear(void) {
+
+ /*
+ * Write debugging message to log
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "Unregistering DLZ odbc driver.");
+
+ /* unregister the driver. */
+ if (dlz_odbc != NULL)
+ dns_sdlzunregister(&dlz_odbc);
+}
+
+#endif
diff --git a/contrib/dlz/drivers/dlz_postgres_driver.c b/contrib/dlz/drivers/dlz_postgres_driver.c
new file mode 100644
index 0000000..5cad59e
--- /dev/null
+++ b/contrib/dlz/drivers/dlz_postgres_driver.c
@@ -0,0 +1,1372 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (C) 1999-2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef DLZ_POSTGRES
+
+#include <config.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <dns/log.h>
+#include <dns/sdlz.h>
+#include <dns/result.h>
+
+#include <isc/mem.h>
+#include <isc/platform.h>
+#include <isc/print.h>
+#include <isc/result.h>
+#include <isc/string.h>
+#include <isc/util.h>
+
+#include <named/globals.h>
+
+#include <dlz/sdlz_helper.h>
+#include <dlz/dlz_postgres_driver.h>
+
+/* temporarily include time. */
+#include <time.h>
+
+#include <libpq-fe.h>
+
+static dns_sdlzimplementation_t *dlz_postgres = NULL;
+
+#define dbc_search_limit 30
+#define ALLNODES 1
+#define ALLOWXFR 2
+#define AUTHORITY 3
+#define FINDZONE 4
+#define LOOKUP 5
+
+/*
+ * Private methods
+ */
+
+/* ---------------
+ * Escaping arbitrary strings to get valid SQL strings/identifiers.
+ *
+ * Replaces "\\" with "\\\\" and "'" with "''".
+ * length is the length of the buffer pointed to by
+ * from. The buffer at to must be at least 2*length + 1 characters
+ * long. A terminating NUL character is written.
+ *
+ * NOTICE!!!
+ * This function was borrowed directly from PostgreSQL's libpq.
+ * The function was originally called PQescapeString and renamed
+ * to postgres_makesafe to avoid a naming collision.
+ * PQescapeString is a new function made available in Postgres 7.2.
+ * For some reason the function is not properly exported on Win32
+ * builds making the function unavailable on Windows. Also, since
+ * this function is new it would require building this driver with
+ * the libpq 7.2. By borrowing this function the Windows problem
+ * is solved, and the dependence on libpq 7.2 is removed. Libpq is
+ * still required of course, but an older version should work now too.
+ *
+ * The copyright statements from the original file containing this
+ * function are included below:
+ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ * ---------------
+ */
+
+static size_t
+postgres_makesafe(char *to, const char *from, size_t length)
+{
+ const char *source = from;
+ char *target = to;
+ unsigned int remaining = length;
+
+ while (remaining > 0)
+ {
+ switch (*source)
+ {
+ case '\\':
+ *target = '\\';
+ target++;
+ *target = '\\';
+ /* target and remaining are updated below. */
+ break;
+
+ case '\'':
+ *target = '\'';
+ target++;
+ *target = '\'';
+ /* target and remaining are updated below. */
+ break;
+
+ default:
+ *target = *source;
+ /* target and remaining are updated below. */
+ }
+ source++;
+ target++;
+ remaining--;
+ }
+
+ /* Write the terminating NUL character. */
+ *target = '\0';
+
+ return target - to;
+}
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+/*%
+ * Properly cleans up a list of database instances.
+ * This function is only used when the driver is compiled for
+ * multithreaded operation.
+ */
+static void
+postgres_destroy_dblist(db_list_t *dblist)
+{
+
+ dbinstance_t *ndbi = NULL;
+ dbinstance_t *dbi = NULL;
+
+ /* get the first DBI in the list */
+ ndbi = ISC_LIST_HEAD(*dblist);
+
+ /* loop through the list */
+ while (ndbi != NULL) {
+ dbi = ndbi;
+ /* get the next DBI in the list */
+ ndbi = ISC_LIST_NEXT(dbi, link);
+ /* release DB connection */
+ if (dbi->dbconn != NULL)
+ PQfinish((PGconn *) dbi->dbconn);
+ /* release all memory that comprised a DBI */
+ destroy_sqldbinstance(dbi);
+ }
+ /* release memory for the list structure */
+ isc_mem_put(ns_g_mctx, dblist, sizeof(db_list_t));
+}
+
+/*%
+ * Loops through the list of DB instances, attempting to lock
+ * on the mutex. If successful, the DBI is reserved for use
+ * and the thread can perform queries against the database.
+ * If the lock fails, the next one in the list is tried.
+ * looping continues until a lock is obtained, or until
+ * the list has been searched dbc_search_limit times.
+ * This function is only used when the driver is compiled for
+ * multithreaded operation.
+ */
+
+static dbinstance_t *
+postgres_find_avail_conn(db_list_t *dblist)
+{
+ dbinstance_t *dbi = NULL;
+ dbinstance_t *head;
+ int count = 0;
+
+ /* get top of list */
+ head = dbi = ISC_LIST_HEAD(*dblist);
+
+ /* loop through list */
+ while (count < dbc_search_limit) {
+ /* try to lock on the mutex */
+ if (isc_mutex_trylock(&dbi->instance_lock) == ISC_R_SUCCESS)
+ return dbi; /* success, return the DBI for use. */
+
+ /* not successful, keep trying */
+ dbi = ISC_LIST_NEXT(dbi, link);
+
+ /* check to see if we have gone to the top of the list. */
+ if (dbi == NULL) {
+ count++;
+ dbi = head;
+ }
+ }
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_INFO,
+ "Postgres driver unable to find available connection "
+ "after searching %d times",
+ count);
+ return NULL;
+}
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+/*%
+ * Allocates memory for a new string, and then constructs the new
+ * string by "escaping" the input string. The new string is
+ * safe to be used in queries. This is necessary because we cannot
+ * be sure of what types of strings are passed to us, and we don't
+ * want special characters in the string causing problems.
+ */
+
+static char *
+postgres_escape_string(const char *instr) {
+
+ char *outstr;
+ unsigned int len;
+
+ if (instr == NULL)
+ return NULL;
+
+ len = strlen(instr);
+
+ outstr = isc_mem_allocate(ns_g_mctx ,(2 * len * sizeof(char)) + 1);
+ if (outstr == NULL)
+ return NULL;
+
+ postgres_makesafe(outstr, instr, len);
+ /* PQescapeString(outstr, instr, len); */
+
+ return outstr;
+}
+
+/*%
+ * This function is the real core of the driver. Zone, record
+ * and client strings are passed in (or NULL is passed if the
+ * string is not available). The type of query we want to run
+ * is indicated by the query flag, and the dbdata object is passed
+ * passed in to. dbdata really holds either:
+ * 1) a list of database instances (in multithreaded mode) OR
+ * 2) a single database instance (in single threaded mode)
+ * The function will construct the query and obtain an available
+ * database instance (DBI). It will then run the query and hopefully
+ * obtain a result set. Postgres is nice, in that once the result
+ * set is returned, we can make the db connection available for another
+ * thread to use, while this thread continues on. So, the DBI is made
+ * available ASAP by unlocking the instance_lock after we have cleaned
+ * it up properly.
+ */
+static isc_result_t
+postgres_get_resultset(const char *zone, const char *record,
+ const char *client, unsigned int query,
+ void *dbdata, PGresult **rs)
+{
+ isc_result_t result;
+ dbinstance_t *dbi = NULL;
+ char *querystring = NULL;
+ unsigned int i = 0;
+ unsigned int j = 0;
+
+ /* temporarily get a unique thread # */
+ unsigned int dlz_thread_num = 1+(int) (1000.0*rand()/(RAND_MAX+1.0));
+
+ REQUIRE(*rs == NULL);
+
+#if 0
+ /* temporary logging message */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%d Getting DBI", dlz_thread_num);
+#endif
+
+ /* get db instance / connection */
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /* find an available DBI from the list */
+ dbi = postgres_find_avail_conn((db_list_t *) dbdata);
+
+#else /* ISC_PLATFORM_USETHREADS */
+
+ /*
+ * only 1 DBI - no need to lock instance lock either
+ * only 1 thread in the whole process, no possible contention.
+ */
+ dbi = (dbinstance_t *) dbdata;
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+#if 0
+ /* temporary logging message */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%d Got DBI - checking query", dlz_thread_num);
+#endif
+
+ /* if DBI is null, can't do anything else */
+ if (dbi == NULL) {
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+
+ /* what type of query are we going to run? */
+ switch(query) {
+ case ALLNODES:
+ /*
+ * if the query was not passed in from the config file
+ * then we can't run it. return not_implemented, so
+ * it's like the code for that operation was never
+ * built into the driver.... AHHH flexibility!!!
+ */
+ if (dbi->allnodes_q == NULL) {
+ result = ISC_R_NOTIMPLEMENTED;
+ goto cleanup;
+ }
+ break;
+ case ALLOWXFR:
+ /* same as comments as ALLNODES */
+ if (dbi->allowxfr_q == NULL) {
+ result = ISC_R_NOTIMPLEMENTED;
+ goto cleanup;
+ }
+ break;
+ case AUTHORITY:
+ /* same as comments as ALLNODES */
+ if (dbi->authority_q == NULL) {
+ result = ISC_R_NOTIMPLEMENTED;
+ goto cleanup;
+ }
+ break;
+ case FINDZONE:
+ /* this is required. It's the whole point of DLZ! */
+ if (dbi->findzone_q == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "No query specified for findzone. "
+ "Findzone requires a query");
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+ break;
+ case LOOKUP:
+ /* this is required. It's also a major point of DLZ! */
+ if (dbi->lookup_q == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "No query specified for lookup. "
+ "Lookup requires a query");
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+ break;
+ default:
+ /*
+ * this should never happen. If it does, the code is
+ * screwed up!
+ */
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "Incorrect query flag passed to "
+ "postgres_get_resultset");
+ result = ISC_R_UNEXPECTED;
+ goto cleanup;
+ }
+
+#if 0
+ /* temporary logging message */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%d checked query", dlz_thread_num);
+#endif
+
+ /*
+ * was a zone string passed? If so, make it safe for use in
+ * queries.
+ */
+ if (zone != NULL) {
+ dbi->zone = postgres_escape_string(zone);
+ if (dbi->zone == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ } else { /* no string passed, set the string pointer to NULL */
+ dbi->zone = NULL;
+ }
+
+#if 0
+ /* temporary logging message */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%d did zone", dlz_thread_num);
+#endif
+
+ /*
+ * was a record string passed? If so, make it safe for use in
+ * queries.
+ */
+ if (record != NULL) {
+ dbi->record = postgres_escape_string(record);
+ if (dbi->record == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ } else { /* no string passed, set the string pointer to NULL */
+ dbi->record = NULL;
+ }
+
+
+#if 0
+ /* temporary logging message */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%d did record", dlz_thread_num);
+#endif
+
+ /*
+ * was a client string passed? If so, make it safe for use in
+ * queries.
+ */
+ if (client != NULL) {
+ dbi->client = postgres_escape_string(client);
+ if (dbi->client == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ } else { /* no string passed, set the string pointer to NULL */
+ dbi->client = NULL;
+ }
+
+#if 0
+ /* temporary logging message */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%d did client", dlz_thread_num);
+#endif
+
+ /*
+ * what type of query are we going to run?
+ * this time we build the actual query to run.
+ */
+ switch(query) {
+ case ALLNODES:
+ querystring = build_querystring(ns_g_mctx, dbi->allnodes_q);
+ break;
+ case ALLOWXFR:
+ querystring = build_querystring(ns_g_mctx, dbi->allowxfr_q);
+ break;
+ case AUTHORITY:
+ querystring = build_querystring(ns_g_mctx, dbi->authority_q);
+ break;
+ case FINDZONE:
+ querystring = build_querystring(ns_g_mctx, dbi->findzone_q);
+ break;
+ case LOOKUP:
+ querystring = build_querystring(ns_g_mctx, dbi->lookup_q);
+ break;
+ default:
+ /*
+ * this should never happen. If it does, the code is
+ * screwed up!
+ */
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "Incorrect query flag passed to "
+ "postgres_get_resultset");
+ result = ISC_R_UNEXPECTED;
+ goto cleanup;
+ }
+
+#if 0
+ /* temporary logging message */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%d built query", dlz_thread_num);
+#endif
+
+ /* if the querystring is null, Bummer, outta RAM. UPGRADE TIME!!! */
+ if (querystring == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+
+#if 0
+ /* temporary logging message */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%d query is '%s'", dlz_thread_num, querystring);
+#endif
+
+ /*
+ * output the full query string during debug so we can see
+ * what lame error the query has.
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
+ "\nQuery String: %s\n", querystring);
+
+ /* attempt query up to 3 times. */
+ for (j=0; j < 3; j++) {
+#if 0
+ /* temporary logging message */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%d executing query for %d time",
+ dlz_thread_num, j);
+#endif
+ /* try to get result set */
+ *rs = PQexec((PGconn *)dbi->dbconn, querystring );
+ result = ISC_R_SUCCESS;
+ /*
+ * if result set is null, reset DB connection, max 3
+ * attempts.
+ */
+ for (i=0; *rs == NULL && i < 3; i++) {
+#if 0
+ /* temporary logging message */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%d resetting connection",
+ dlz_thread_num);
+#endif
+ result = ISC_R_FAILURE;
+ PQreset((PGconn *) dbi->dbconn);
+ /* connection ok, break inner loop */
+ if (PQstatus((PGconn *) dbi->dbconn) == CONNECTION_OK)
+ break;
+ }
+ /* result set ok, break outter loop */
+ if (PQresultStatus(*rs) == PGRES_TUPLES_OK) {
+#if 0
+ /* temporary logging message */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%d rs ok", dlz_thread_num);
+#endif
+ break;
+ } else {
+ /* we got a result set object, but it's not right. */
+#if 0
+ /* temporary logging message */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%d clearing rs", dlz_thread_num);
+#endif
+ PQclear(*rs); /* get rid of it */
+ /* in case this was the last attempt */
+ result = ISC_R_FAILURE;
+ }
+ }
+
+ cleanup:
+ /* it's always good to cleanup after yourself */
+
+#if 0
+ /* temporary logging message */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%d cleaning up", dlz_thread_num);
+#endif
+
+ /* if we couldn't even allocate DBI, just return NULL */
+ if (dbi == NULL)
+ return ISC_R_FAILURE;
+
+ /* free dbi->zone string */
+ if (dbi->zone != NULL)
+ isc_mem_free(ns_g_mctx, dbi->zone);
+
+ /* free dbi->record string */
+ if (dbi->record != NULL)
+ isc_mem_free(ns_g_mctx, dbi->record);
+
+ /* free dbi->client string */
+ if (dbi->client != NULL)
+ isc_mem_free(ns_g_mctx, dbi->client);
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+#if 0
+ /* temporary logging message */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%d unlocking mutex", dlz_thread_num);
+#endif
+
+ /* release the lock so another thread can use this dbi */
+ isc_mutex_unlock(&dbi->instance_lock);
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ /* release query string */
+ if (querystring != NULL)
+ isc_mem_free(ns_g_mctx, querystring );
+
+#if 0
+ /* temporary logging message */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "%d returning", dlz_thread_num);
+#endif
+
+ /* return result */
+ return result;
+}
+
+/*%
+ * The processing of result sets for lookup and authority are
+ * exactly the same. So that functionality has been moved
+ * into this function to minimize code.
+ */
+
+static isc_result_t
+postgres_process_rs(dns_sdlzlookup_t *lookup, PGresult *rs)
+{
+ isc_result_t result;
+ unsigned int i;
+ unsigned int rows;
+ unsigned int fields;
+ unsigned int j;
+ unsigned int len;
+ char *tmpString;
+ char *endp;
+ int ttl;
+
+ rows = PQntuples(rs); /* how many rows in result set */
+ fields = PQnfields(rs); /* how many columns in result set */
+ for (i=0; i < rows; i++) {
+ switch(fields) {
+ case 1:
+ /*
+ * one column in rs, it's the data field. use
+ * default type of A record, and default TTL
+ * of 86400
+ */
+ result = dns_sdlz_putrr(lookup, "a", 86400,
+ PQgetvalue(rs, i, 0));
+ break;
+ case 2:
+ /* two columns, data field, and data type.
+ * use default TTL of 86400.
+ */
+ result = dns_sdlz_putrr(lookup, PQgetvalue(rs, i, 0),
+ 86400, PQgetvalue(rs, i, 1));
+ break;
+ case 3:
+ /* three columns, all data no defaults.
+ * convert text to int, make sure it worked
+ * right.
+ */
+ ttl = strtol(PQgetvalue(rs, i, 0), &endp, 10);
+ if (*endp != '\0' || ttl < 0) {
+ isc_log_write(dns_lctx,
+ DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Postgres driver ttl must be "
+ "a positive number");
+ }
+ result = dns_sdlz_putrr(lookup, PQgetvalue(rs, i, 1),
+ ttl, PQgetvalue(rs, i, 2));
+ break;
+ default:
+ /*
+ * more than 3 fields, concatenate the last
+ * ones together. figure out how long to make
+ * string
+ */
+ for (j=2, len=0; j < fields; j++) {
+ len += strlen(PQgetvalue(rs, i, j)) + 1;
+ }
+ /*
+ * allocate string memory, allow for NULL to
+ * term string
+ */
+ tmpString = isc_mem_allocate(ns_g_mctx, len + 1);
+ if (tmpString == NULL) {
+ /* major bummer, need more ram */
+ isc_log_write(dns_lctx,
+ DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Postgres driver unable to "
+ "allocate memory for "
+ "temporary string");
+ PQclear(rs);
+ return (ISC_R_FAILURE); /* Yeah, I'd say! */
+ }
+ /* copy field to tmpString */
+ strcpy(tmpString, PQgetvalue(rs, i, 2));
+ /*
+ * concat the rest of fields together, space
+ * between each one.
+ */
+ for (j=3; j < fields; j++) {
+ strcat(tmpString, " ");
+ strcat(tmpString, PQgetvalue(rs, i, j));
+ }
+ /* convert text to int, make sure it worked right */
+ ttl = strtol(PQgetvalue(rs, i, 0), &endp, 10);
+ if (*endp != '\0' || ttl < 0) {
+ isc_log_write(dns_lctx,
+ DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Postgres driver ttl must be "
+ "a postive number");
+ }
+ /* ok, now tell Bind about it. */
+ result = dns_sdlz_putrr(lookup, PQgetvalue(rs, i, 1),
+ ttl, tmpString);
+ /* done, get rid of this thing. */
+ isc_mem_free(ns_g_mctx, tmpString);
+ }
+ /* I sure hope we were successful */
+ if (result != ISC_R_SUCCESS) {
+ /* nope, get rid of the Result set, and log a msg */
+ PQclear(rs);
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "dns_sdlz_putrr returned error. "
+ "Error code was: %s",
+ isc_result_totext(result));
+ return (ISC_R_FAILURE);
+ }
+ }
+
+ /* free result set memory */
+ PQclear(rs);
+
+ /* if we did return results, we are successful */
+ if (rows > 0)
+ return (ISC_R_SUCCESS);
+
+ /* empty result set, no data found */
+ return (ISC_R_NOTFOUND);
+}
+
+/*
+ * SDLZ interface methods
+ */
+
+/*% determine if the zone is supported by (in) the database */
+
+static isc_result_t
+postgres_findzone(void *driverarg, void *dbdata, const char *name)
+{
+ isc_result_t result;
+ PGresult *rs = NULL;
+ unsigned int rows;
+ UNUSED(driverarg);
+
+ /* run the query and get the result set from the database. */
+ result = postgres_get_resultset(name, NULL, NULL,
+ FINDZONE, dbdata, &rs);
+ /* if we didn't get a result set, log an err msg. */
+ if (result != ISC_R_SUCCESS) {
+ if (rs != NULL)
+ PQclear(rs);
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Postgres driver unable to return "
+ "result set for findzone query");
+ return (ISC_R_FAILURE);
+ }
+ /* count how many rows in result set */
+ rows = PQntuples(rs);
+ /* get rid of result set, we are done with it. */
+ PQclear(rs);
+
+ /* if we returned any rows, zone is supported. */
+ if (rows > 0)
+ return (ISC_R_SUCCESS);
+
+ /* no rows returned, zone is not supported. */
+ return (ISC_R_NOTFOUND);
+}
+
+/*% Determine if the client is allowed to perform a zone transfer */
+static isc_result_t
+postgres_allowzonexfr(void *driverarg, void *dbdata, const char *name,
+ const char *client)
+{
+ isc_result_t result;
+ PGresult *rs = NULL;
+ unsigned int rows;
+ UNUSED(driverarg);
+
+ /* first check if the zone is supported by the database. */
+ result = postgres_findzone(driverarg, dbdata, name);
+ if (result != ISC_R_SUCCESS)
+ return (ISC_R_NOTFOUND);
+
+ /*
+ * if we get to this point we know the zone is supported by
+ * the database the only questions now are is the zone
+ * transfer is allowed for this client and did the config file
+ * have an allow zone xfr query.
+ *
+ * Run our query, and get a result set from the database.
+ */
+ result = postgres_get_resultset(name, NULL, client,
+ ALLOWXFR, dbdata, &rs);
+ /* if we get "not implemented", send it along. */
+ if (result == ISC_R_NOTIMPLEMENTED)
+ return result;
+ /* if we didn't get a result set, log an err msg. */
+ if (result != ISC_R_SUCCESS) {
+ if (rs != NULL)
+ PQclear(rs);
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Postgres driver unable to return "
+ "result set for allow xfr query");
+ return (ISC_R_FAILURE);
+ }
+ /* count how many rows in result set */
+ rows = PQntuples(rs);
+ /* get rid of result set, we are done with it. */
+ PQclear(rs);
+
+ /* if we returned any rows, zone xfr is allowed. */
+ if (rows > 0)
+ return (ISC_R_SUCCESS);
+
+ /* no rows returned, zone xfr not allowed */
+ return (ISC_R_NOPERM);
+}
+
+/*%
+ * If the client is allowed to perform a zone transfer, the next order of
+ * business is to get all the nodes in the zone, so bind can respond to the
+ * query.
+ */
+static isc_result_t
+postgres_allnodes(const char *zone, void *driverarg, void *dbdata,
+ dns_sdlzallnodes_t *allnodes)
+{
+ isc_result_t result;
+ PGresult *rs = NULL;
+ unsigned int i;
+ unsigned int rows;
+ unsigned int fields;
+ unsigned int j;
+ unsigned int len;
+ char *tmpString;
+ char *endp;
+ int ttl;
+
+ UNUSED(driverarg);
+
+ /* run the query and get the result set from the database. */
+ result = postgres_get_resultset(zone, NULL, NULL,
+ ALLNODES, dbdata, &rs);
+ /* if we get "not implemented", send it along */
+ if (result == ISC_R_NOTIMPLEMENTED)
+ return result;
+ /* if we didn't get a result set, log an err msg. */
+ if (result != ISC_R_SUCCESS) {
+ if (rs != NULL)
+ PQclear(rs);
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Postgres driver unable to return "
+ "result set for all nodes query");
+ return (ISC_R_FAILURE);
+ }
+
+ rows = PQntuples(rs); /* how many rows in result set */
+ fields = PQnfields(rs); /* how many columns in result set */
+ for (i=0; i < rows; i++) {
+ if (fields < 4) { /* gotta have at least 4 columns */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Postgres driver too few fields "
+ "returned by all nodes query");
+ }
+ /* convert text to int, make sure it worked right */
+ ttl = strtol(PQgetvalue(rs, i, 0), &endp, 10);
+ if (*endp != '\0' || ttl < 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Postgres driver ttl must be "
+ "a postive number");
+ }
+ if (fields == 4) {
+ /* tell Bind about it. */
+ result = dns_sdlz_putnamedrr(allnodes,
+ PQgetvalue(rs, i, 2),
+ PQgetvalue(rs, i, 1),
+ ttl,
+ PQgetvalue(rs, i, 3));
+ } else {
+ /*
+ * more than 4 fields, concatonat the last
+ * ones together. figure out how long to make
+ * string
+ */
+ for (j=3, len=0; j < fields; j++) {
+ len += strlen(PQgetvalue(rs, i, j)) + 1;
+ }
+ /* allocate memory, allow for NULL to term string */
+ tmpString = isc_mem_allocate(ns_g_mctx, len + 1);
+ if (tmpString == NULL) { /* we need more ram. */
+ isc_log_write(dns_lctx,
+ DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Postgres driver unable to "
+ "allocate memory for "
+ "temporary string");
+ PQclear(rs);
+ return (ISC_R_FAILURE);
+ }
+ /* copy this field to tmpString */
+ strcpy(tmpString, PQgetvalue(rs, i, 3));
+ /* concatonate the rest, with spaces between */
+ for (j=4; j < fields; j++) {
+ strcat(tmpString, " ");
+ strcat(tmpString, PQgetvalue(rs, i, j));
+ }
+ /* tell Bind about it. */
+ result = dns_sdlz_putnamedrr(allnodes,
+ PQgetvalue(rs, i, 2),
+ PQgetvalue(rs, i, 1),
+ ttl, tmpString);
+ isc_mem_free(ns_g_mctx, tmpString);
+ }
+ /* if we weren't successful, log err msg */
+ if (result != ISC_R_SUCCESS) {
+ PQclear(rs);
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "dns_sdlz_putnamedrr returned error. "
+ "Error code was: %s",
+ isc_result_totext(result));
+ return (ISC_R_FAILURE);
+ }
+ }
+
+ /* free result set memory */
+ PQclear(rs);
+
+ /* if we did return results, we are successful */
+ if (rows > 0)
+ return (ISC_R_SUCCESS);
+
+ /* empty result set, no data found */
+ return (ISC_R_NOTFOUND);
+}
+
+/*%
+ * if the lookup function does not return SOA or NS records for the zone,
+ * use this function to get that information for Bind.
+ */
+
+static isc_result_t
+postgres_authority(const char *zone, void *driverarg, void *dbdata,
+ dns_sdlzlookup_t *lookup)
+{
+ isc_result_t result;
+ PGresult *rs = NULL;
+
+ UNUSED(driverarg);
+
+ /* run the query and get the result set from the database. */
+ result = postgres_get_resultset(zone, NULL, NULL,
+ AUTHORITY, dbdata, &rs);
+ /* if we get "not implemented", send it along */
+ if (result == ISC_R_NOTIMPLEMENTED)
+ return result;
+ /* if we didn't get a result set, log an err msg. */
+ if (result != ISC_R_SUCCESS) {
+ if (rs != NULL)
+ PQclear(rs);
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Postgres driver unable to return "
+ "result set for authority query");
+ return (ISC_R_FAILURE);
+ }
+ /*
+ * lookup and authority result sets are processed in the same
+ * manner postgres_process_rs does the job for both
+ * functions.
+ */
+ return postgres_process_rs(lookup, rs);
+}
+
+/*% if zone is supported, lookup up a (or multiple) record(s) in it */
+static isc_result_t
+postgres_lookup(const char *zone, const char *name, void *driverarg,
+ void *dbdata, dns_sdlzlookup_t *lookup)
+{
+ isc_result_t result;
+ PGresult *rs = NULL;
+
+ UNUSED(driverarg);
+
+ /* run the query and get the result set from the database. */
+ result = postgres_get_resultset(zone, name, NULL, LOOKUP, dbdata, &rs);
+ /* if we didn't get a result set, log an err msg. */
+ if (result != ISC_R_SUCCESS) {
+ if (rs != NULL)
+ PQclear(rs);
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Postgres driver unable to "
+ "return result set for lookup query");
+ return (ISC_R_FAILURE);
+ }
+ /*
+ * lookup and authority result sets are processed in the same
+ * manner postgres_process_rs does the job for both functions.
+ */
+ return postgres_process_rs(lookup, rs);
+}
+
+/*%
+ * create an instance of the driver. Remember, only 1 copy of the driver's
+ * code is ever loaded, the driver has to remember which context it's
+ * operating in. This is done via use of the dbdata argument which is
+ * passed into all query functions.
+ */
+static isc_result_t
+postgres_create(const char *dlzname, unsigned int argc, char *argv[],
+ void *driverarg, void **dbdata)
+{
+ isc_result_t result;
+ dbinstance_t *dbi = NULL;
+ unsigned int j;
+
+#ifdef ISC_PLATFORM_USETHREADS
+ /* if multi-threaded, we need a few extra variables. */
+ int dbcount;
+ db_list_t *dblist = NULL;
+ int i;
+ char *endp;
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ UNUSED(driverarg);
+ UNUSED(dlzname);
+
+/* seed random # generator */
+ srand( (unsigned)time( NULL ) );
+
+
+#ifdef ISC_PLATFORM_USETHREADS
+ /* if debugging, let user know we are multithreaded. */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
+ "Postgres driver running multithreaded");
+#else /* ISC_PLATFORM_USETHREADS */
+ /* if debugging, let user know we are single threaded. */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
+ "Postgres driver running single threaded");
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ /* verify we have at least 5 arg's passed to the driver */
+ if (argc < 5) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Postgres driver requires at least "
+ "4 command line args.");
+ return (ISC_R_FAILURE);
+ }
+
+ /* no more than 8 arg's should be passed to the driver */
+ if (argc > 8) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Postgres driver cannot accept more than "
+ "7 command line args.");
+ return (ISC_R_FAILURE);
+ }
+
+ /* multithreaded build can have multiple DB connections */
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /* check how many db connections we should create */
+ dbcount = strtol(argv[1], &endp, 10);
+ if (*endp != '\0' || dbcount < 0) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Postgres driver database connection count "
+ "must be positive.");
+ return (ISC_R_FAILURE);
+ }
+
+ /* allocate memory for database connection list */
+ dblist = isc_mem_get(ns_g_mctx, sizeof(db_list_t));
+ if (dblist == NULL)
+ return (ISC_R_NOMEMORY);
+
+ /* initialize DB connection list */
+ ISC_LIST_INIT(*dblist);
+
+ /*
+ * create the appropriate number of database instances (DBI)
+ * append each new DBI to the end of the list
+ */
+ for (i=0; i < dbcount; i++) {
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ /* how many queries were passed in from config file? */
+ switch(argc) {
+ case 5:
+ result = build_sqldbinstance(ns_g_mctx, NULL, NULL,
+ NULL, argv[3], argv[4],
+ NULL, &dbi);
+ break;
+ case 6:
+ result = build_sqldbinstance(ns_g_mctx, NULL, NULL,
+ argv[5], argv[3], argv[4],
+ NULL, &dbi);
+ break;
+ case 7:
+ result = build_sqldbinstance(ns_g_mctx, argv[6], NULL,
+ argv[5], argv[3], argv[4],
+ NULL, &dbi);
+ break;
+ case 8:
+ result = build_sqldbinstance(ns_g_mctx, argv[6],
+ argv[7], argv[5], argv[3],
+ argv[4], NULL, &dbi);
+ break;
+ default:
+ /* not really needed, should shut up compiler. */
+ result = ISC_R_FAILURE;
+ }
+
+
+ if (result == ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "Postgres driver created database "
+ "instance object.");
+ } else { /* unsuccessful?, log err msg and cleanup. */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Postgres driver could not create "
+ "database instance object.");
+ goto cleanup;
+ }
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /* when multithreaded, build a list of DBI's */
+ ISC_LINK_INIT(dbi, link);
+ ISC_LIST_APPEND(*dblist, dbi, link);
+
+#endif
+
+ /* create and set db connection */
+ dbi->dbconn = PQconnectdb(argv[2]);
+ /*
+ * if db connection cannot be created, log err msg and
+ * cleanup.
+ */
+ if (dbi->dbconn == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Postgres driver could not allocate "
+ "memory for database connection");
+ goto cleanup;
+ }
+
+ /* if we cannot connect the first time, try 3 more times. */
+ for (j = 0;
+ PQstatus((PGconn *) dbi->dbconn) != CONNECTION_OK &&
+ j < 3;
+ j++)
+ PQreset((PGconn *) dbi->dbconn);
+
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+ /*
+ * if multi threaded, let user know which connection
+ * failed. user could be attempting to create 10 db
+ * connections and for some reason the db backend only
+ * allows 9
+ */
+ if (PQstatus((PGconn *) dbi->dbconn) != CONNECTION_OK) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Postgres driver failed to create "
+ "database connection number %u "
+ "after 4 attempts",
+ i + 1);
+ goto cleanup;
+ }
+
+ /* set DBI = null for next loop through. */
+ dbi = NULL;
+ } /* end for loop */
+
+ /* set dbdata to the list we created. */
+ *dbdata = dblist;
+
+#else /* ISC_PLATFORM_USETHREADS */
+ /* if single threaded, just let user know we couldn't connect. */
+ if (PQstatus((PGconn *) dbi->dbconn) != CONNECTION_OK) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Postgres driver failed to create database "
+ "connection after 4 attempts");
+ goto cleanup;
+ }
+
+ /*
+ * single threaded build can only use 1 db connection, return
+ * it via dbdata
+ */
+ *dbdata = dbi;
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ /* hey, we got through all of that ok, return success. */
+ return(ISC_R_SUCCESS);
+
+ cleanup:
+
+#ifdef ISC_PLATFORM_USETHREADS
+ /*
+ * if multithreaded, we could fail because only 1 connection
+ * couldn't be made. We should cleanup the other successful
+ * connections properly.
+ */
+ postgres_destroy_dblist(dblist);
+
+#else /* ISC_PLATFORM_USETHREADS */
+ if (dbi != NULL)
+ destroy_sqldbinstance(dbi);
+
+#endif /* ISC_PLATFORM_USETHREADS */
+ return(ISC_R_FAILURE);
+}
+
+/*%
+ * destroy an instance of the driver. Remember, only 1 copy of the driver's
+ * code is ever loaded, the driver has to remember which context it's
+ * operating in. This is done via use of the dbdata argument.
+ * so we really only need to clean it up since we are not using driverarg.
+ */
+static void
+postgres_destroy(void *driverarg, void *dbdata)
+{
+
+#ifdef ISC_PLATFORM_USETHREADS
+
+ UNUSED(driverarg);
+ /* cleanup the list of DBI's */
+ postgres_destroy_dblist((db_list_t *) dbdata);
+
+#else /* ISC_PLATFORM_USETHREADS */
+
+ dbinstance_t *dbi;
+
+ UNUSED(driverarg);
+
+ dbi = (dbinstance_t *) dbdata;
+
+ /* release DB connection */
+ if (dbi->dbconn != NULL)
+ PQfinish((PGconn *) dbi->dbconn);
+
+ /* destroy single DB instance */
+ destroy_sqldbinstance(dbi);
+
+#endif /* ISC_PLATFORM_USETHREADS */
+}
+
+/* pointers to all our runtime methods. */
+/* this is used during driver registration */
+/* i.e. in dlz_postgres_init below. */
+static dns_sdlzmethods_t dlz_postgres_methods = {
+ postgres_create,
+ postgres_destroy,
+ postgres_findzone,
+ postgres_lookup,
+ postgres_authority,
+ postgres_allnodes,
+ postgres_allowzonexfr
+};
+
+/*%
+ * Wrapper around dns_sdlzregister().
+ */
+isc_result_t
+dlz_postgres_init(void) {
+ isc_result_t result;
+
+ /*
+ * Write debugging message to log
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "Registering DLZ postgres driver.");
+
+ /*
+ * Driver is always threadsafe. When multithreaded all
+ * functions use multithreaded code. When not multithreaded,
+ * all functions can only be entered once, but only 1 thread
+ * of operation is available in Bind. So everything is still
+ * threadsafe.
+ */
+ result = dns_sdlzregister("postgres", &dlz_postgres_methods, NULL,
+ DNS_SDLZFLAG_RELATIVEOWNER |
+ DNS_SDLZFLAG_RELATIVERDATA |
+ DNS_SDLZFLAG_THREADSAFE,
+ ns_g_mctx, &dlz_postgres);
+ /* if we can't register the driver, there are big problems. */
+ if (result != ISC_R_SUCCESS) {
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "dns_sdlzregister() failed: %s",
+ isc_result_totext(result));
+ result = ISC_R_UNEXPECTED;
+ }
+
+
+ return result;
+}
+
+/*%
+ * Wrapper around dns_sdlzunregister().
+ */
+void
+dlz_postgres_clear(void) {
+
+ /*
+ * Write debugging message to log
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "Unregistering DLZ postgres driver.");
+
+ /* unregister the driver. */
+ if (dlz_postgres != NULL)
+ dns_sdlzunregister(&dlz_postgres);
+}
+
+#endif
diff --git a/contrib/dlz/drivers/dlz_stub_driver.c b/contrib/dlz/drivers/dlz_stub_driver.c
new file mode 100644
index 0000000..f9a3bb8
--- /dev/null
+++ b/contrib/dlz/drivers/dlz_stub_driver.c
@@ -0,0 +1,331 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (C) 1999-2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef DLZ_STUB
+
+#include <config.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <dns/log.h>
+#include <dns/sdlz.h>
+#include <dns/result.h>
+
+#include <isc/mem.h>
+#include <isc/print.h>
+#include <isc/result.h>
+#include <isc/util.h>
+
+#include <named/globals.h>
+
+#include <dlz/dlz_stub_driver.h>
+
+static dns_sdlzimplementation_t *dlz_stub = NULL;
+
+typedef struct config_data {
+ char *myzone;
+ char *myname;
+ char *myip;
+ isc_mem_t *mctx;
+} config_data_t;
+
+/*
+ * SDLZ methods
+ */
+
+static isc_result_t
+stub_dlz_allnodes(const char *zone, void *driverarg, void *dbdata,
+ dns_sdlzallnodes_t *allnodes)
+{
+ config_data_t *cd;
+ isc_result_t result;
+
+ UNUSED(zone);
+ UNUSED(driverarg);
+
+ cd = (config_data_t *) dbdata;
+
+ result = dns_sdlz_putnamedrr(allnodes, cd->myname, "soa", 86400,
+ "web root.localhost. "
+ "0 28800 7200 604800 86400");
+ if (result != ISC_R_SUCCESS)
+ return (ISC_R_FAILURE);
+ result = dns_sdlz_putnamedrr(allnodes, "ns", "ns", 86400, cd->myname);
+ if (result != ISC_R_SUCCESS)
+ return (ISC_R_FAILURE);
+ result = dns_sdlz_putnamedrr(allnodes, cd->myname, "a", 1, cd->myip);
+ if (result != ISC_R_SUCCESS)
+ return (ISC_R_FAILURE);
+ return (ISC_R_SUCCESS);
+}
+
+static isc_result_t
+stub_dlz_allowzonexfr(void *driverarg, void *dbdata, const char *name,
+ const char *client)
+{
+ UNUSED(driverarg);
+ UNUSED(dbdata);
+ UNUSED(name);
+ UNUSED(client);
+ return ISC_R_SUCCESS;
+}
+
+static isc_result_t
+stub_dlz_authority(const char *zone, void *driverarg, void *dbdata,
+ dns_sdlzlookup_t *lookup)
+{
+ isc_result_t result;
+ config_data_t *cd;
+
+ UNUSED(driverarg);
+
+ cd = (config_data_t *) dbdata;
+
+ if (strcmp(zone, cd->myzone) == 0) {
+ result = dns_sdlz_putsoa(lookup, cd->myname,
+ "root.localhost.", 0);
+ if (result != ISC_R_SUCCESS)
+ return (ISC_R_FAILURE);
+
+ result = dns_sdlz_putrr(lookup, "ns", 86400, cd->myname);
+ if (result != ISC_R_SUCCESS)
+ return (ISC_R_FAILURE);
+
+ return (ISC_R_SUCCESS);
+ }
+ return (ISC_R_NOTFOUND);
+}
+
+static isc_result_t
+stub_dlz_findzonedb(void *driverarg, void *dbdata, const char *name)
+{
+
+ config_data_t *cd;
+
+ UNUSED(driverarg);
+
+ cd = (config_data_t *) dbdata;
+
+ /* Write info message to log */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "dlz_stub findzone looking for '%s'", name);
+
+ if (strcmp(cd->myzone, name) == 0)
+ return (ISC_R_SUCCESS);
+ else
+ return (ISC_R_SUCCESS);
+}
+
+
+static isc_result_t
+stub_dlz_lookup(const char *zone, const char *name, void *driverarg,
+ void *dbdata, dns_sdlzlookup_t *lookup)
+{
+ isc_result_t result;
+ config_data_t *cd;
+
+ UNUSED(zone);
+ UNUSED(driverarg);
+
+ cd = (config_data_t *) dbdata;
+
+ if (strcmp(name, cd->myname) == 0) {
+ result = dns_sdlz_putrr(lookup, "a", 1, cd->myip);
+ if (result != ISC_R_SUCCESS)
+ return (ISC_R_FAILURE);
+
+ return (ISC_R_SUCCESS);
+ }
+ return (ISC_R_FAILURE);
+
+}
+
+
+static isc_result_t
+stub_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
+ void *driverarg, void **dbdata)
+{
+
+ config_data_t *cd;
+
+ UNUSED(driverarg);
+
+ if (argc < 4)
+ return (ISC_R_FAILURE);
+ /*
+ * Write info message to log
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_INFO,
+ "Loading '%s' using DLZ_stub driver. "
+ "Zone: %s, Name: %s IP: %s",
+ dlzname, argv[1], argv[2], argv[3]);
+
+ cd = isc_mem_get(ns_g_mctx, sizeof(config_data_t));
+ if ((cd) == NULL) {
+ return (ISC_R_NOMEMORY);
+ }
+
+ memset(cd, 0, sizeof(config_data_t));
+
+ cd->myzone = isc_mem_strdup(ns_g_mctx, argv[1]);
+ if (cd->myzone == NULL) {
+ isc_mem_put(ns_g_mctx, cd, sizeof(config_data_t));
+ return (ISC_R_NOMEMORY);
+ }
+
+ cd->myname = isc_mem_strdup(ns_g_mctx, argv[2]);
+ if (cd->myname == NULL) {
+ isc_mem_put(ns_g_mctx, cd, sizeof(config_data_t));
+ isc_mem_free(ns_g_mctx, cd->myzone);
+ return (ISC_R_NOMEMORY);
+ }
+
+ cd->myip = isc_mem_strdup(ns_g_mctx, argv[3]);
+ if (cd->myip == NULL) {
+ isc_mem_put(ns_g_mctx, cd, sizeof(config_data_t));
+ isc_mem_free(ns_g_mctx, cd->myname);
+ isc_mem_free(ns_g_mctx, cd->myzone);
+ return (ISC_R_NOMEMORY);
+ }
+
+ isc_mem_attach(ns_g_mctx, &cd->mctx);
+
+ *dbdata = cd;
+
+ return(ISC_R_SUCCESS);
+}
+
+static void
+stub_dlz_destroy(void *driverarg, void *dbdata)
+{
+ config_data_t *cd;
+ isc_mem_t *mctx;
+
+ UNUSED(driverarg);
+
+ cd = (config_data_t *) dbdata;
+
+ /*
+ * Write debugging message to log
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "Unloading DLZ_stub driver.");
+
+ isc_mem_free(ns_g_mctx, cd->myzone);
+ isc_mem_free(ns_g_mctx, cd->myname);
+ isc_mem_free(ns_g_mctx, cd->myip);
+ mctx = cd->mctx;
+ isc_mem_put(mctx, cd, sizeof(config_data_t));
+ isc_mem_detach(&mctx);
+}
+
+static dns_sdlzmethods_t dlz_stub_methods = {
+ stub_dlz_create,
+ stub_dlz_destroy,
+ stub_dlz_findzonedb,
+ stub_dlz_lookup,
+ stub_dlz_authority,
+ stub_dlz_allnodes,
+ stub_dlz_allowzonexfr
+};
+
+/*%
+ * Wrapper around dns_sdlzregister().
+ */
+isc_result_t
+dlz_stub_init(void) {
+ isc_result_t result;
+
+ /*
+ * Write debugging message to log
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "Registering DLZ_stub driver.");
+
+ result = dns_sdlzregister("dlz_stub", &dlz_stub_methods, NULL,
+ DNS_SDLZFLAG_RELATIVEOWNER |
+ DNS_SDLZFLAG_RELATIVERDATA,
+ ns_g_mctx, &dlz_stub);
+ if (result != ISC_R_SUCCESS) {
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "dns_sdlzregister() failed: %s",
+ isc_result_totext(result));
+ result = ISC_R_UNEXPECTED;
+ }
+
+
+ return result;
+}
+
+/*
+ * Wrapper around dns_sdlzunregister().
+ */
+void
+dlz_stub_clear(void) {
+
+ /*
+ * Write debugging message to log
+ */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
+ "Unregistering DLZ_stub driver.");
+
+ if (dlz_stub != NULL)
+ dns_sdlzunregister(&dlz_stub);
+}
+
+#endif
diff --git a/contrib/dlz/drivers/include/dlz/dlz_bdb_driver.h b/contrib/dlz/drivers/include/dlz/dlz_bdb_driver.h
new file mode 100644
index 0000000..1d706fc
--- /dev/null
+++ b/contrib/dlz/drivers/include/dlz/dlz_bdb_driver.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef DLZ_BDB_DRIVER_H
+#define DLZ_BDB_DRIVER_H
+
+isc_result_t
+dlz_bdb_init(void);
+
+void
+dlz_bdb_clear(void);
+
+#endif
diff --git a/contrib/dlz/drivers/include/dlz/dlz_bdbhpt_driver.h b/contrib/dlz/drivers/include/dlz/dlz_bdbhpt_driver.h
new file mode 100644
index 0000000..0ccbc8d
--- /dev/null
+++ b/contrib/dlz/drivers/include/dlz/dlz_bdbhpt_driver.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef DLZ_BDBHPT_DRIVER_H
+#define DLZ_BDBHPT_DRIVER_H
+
+isc_result_t
+dlz_bdbhpt_init(void);
+
+void
+dlz_bdbhpt_clear(void);
+
+#endif
diff --git a/contrib/dlz/drivers/include/dlz/dlz_drivers.h b/contrib/dlz/drivers/include/dlz/dlz_drivers.h
new file mode 100644
index 0000000..dce7cd2
--- /dev/null
+++ b/contrib/dlz/drivers/include/dlz/dlz_drivers.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: dlz_drivers.h,v 1.2 2005/09/05 00:10:58 marka Exp $ */
+
+#ifndef DLZ_DRIVERS_H
+#define DLZ_DRIVERS_H 1
+
+/*! \file */
+
+isc_result_t
+dlz_drivers_init(void);
+
+void
+dlz_drivers_clear(void);
+
+#endif /* DLZ_DRIVERS_H */
diff --git a/contrib/dlz/drivers/include/dlz/dlz_filesystem_driver.h b/contrib/dlz/drivers/include/dlz/dlz_filesystem_driver.h
new file mode 100644
index 0000000..627427d
--- /dev/null
+++ b/contrib/dlz/drivers/include/dlz/dlz_filesystem_driver.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef DLZ_FILESYSTEM_DRIVER_H
+#define DLZ_FILESYSTEM_DRIVER_H
+
+isc_result_t
+dlz_fs_init(void);
+
+void
+dlz_fs_clear(void);
+
+#endif
diff --git a/contrib/dlz/drivers/include/dlz/dlz_ldap_driver.h b/contrib/dlz/drivers/include/dlz/dlz_ldap_driver.h
new file mode 100644
index 0000000..51efbf4
--- /dev/null
+++ b/contrib/dlz/drivers/include/dlz/dlz_ldap_driver.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef DLZ_LDAP_DRIVER_H
+#define DLZ_LDAP_DRIVER_H
+
+isc_result_t
+dlz_ldap_init(void);
+
+void
+dlz_ldap_clear(void);
+
+#endif
diff --git a/contrib/dlz/drivers/include/dlz/dlz_mysql_driver.h b/contrib/dlz/drivers/include/dlz/dlz_mysql_driver.h
new file mode 100644
index 0000000..b742838
--- /dev/null
+++ b/contrib/dlz/drivers/include/dlz/dlz_mysql_driver.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef DLZ_MYSQL_DRIVER_H
+#define DLZ_MYSQL_DRIVER_H
+
+isc_result_t
+dlz_mysql_init(void);
+
+void
+dlz_mysql_clear(void);
+
+#endif
diff --git a/contrib/dlz/drivers/include/dlz/dlz_odbc_driver.h b/contrib/dlz/drivers/include/dlz/dlz_odbc_driver.h
new file mode 100644
index 0000000..5a072d8
--- /dev/null
+++ b/contrib/dlz/drivers/include/dlz/dlz_odbc_driver.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef DLZ_ODBC_DRIVER_H
+#define DLZ_ODBC_DRIVER_H
+
+isc_result_t
+dlz_odbc_init(void);
+
+void
+dlz_odbc_clear(void);
+
+#endif
diff --git a/contrib/dlz/drivers/include/dlz/dlz_postgres_driver.h b/contrib/dlz/drivers/include/dlz/dlz_postgres_driver.h
new file mode 100644
index 0000000..3416dce
--- /dev/null
+++ b/contrib/dlz/drivers/include/dlz/dlz_postgres_driver.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef DLZ_POSTGRES_DRIVER_H
+#define DLZ_POSTGRES_DRIVER_H
+
+isc_result_t
+dlz_postgres_init(void);
+
+void
+dlz_postgres_clear(void);
+
+#endif
diff --git a/contrib/dlz/drivers/include/dlz/dlz_stub_driver.h b/contrib/dlz/drivers/include/dlz/dlz_stub_driver.h
new file mode 100644
index 0000000..a517c69
--- /dev/null
+++ b/contrib/dlz/drivers/include/dlz/dlz_stub_driver.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef DLZ_STUB_DRIVER_H
+#define DLZ_STUB_DRIVER_H
+
+isc_result_t
+dlz_stub_init(void);
+
+void
+dlz_stub_clear(void);
+
+#endif
diff --git a/contrib/dlz/drivers/include/dlz/sdlz_helper.h b/contrib/dlz/drivers/include/dlz/sdlz_helper.h
new file mode 100644
index 0000000..764a05a
--- /dev/null
+++ b/contrib/dlz/drivers/include/dlz/sdlz_helper.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef SDLZHELPER_H
+#define SDLZHELPER_H
+
+/*
+ * Types
+ */
+#define SDLZH_REQUIRE_CLIENT 0x01
+#define SDLZH_REQUIRE_QUERY 0x02
+#define SDLZH_REQUIRE_RECORD 0x04
+#define SDLZH_REQUIRE_ZONE 0x08
+
+typedef struct query_segment query_segment_t;
+typedef ISC_LIST(query_segment_t) query_list_t;
+typedef struct dbinstance dbinstance_t;
+typedef ISC_LIST(dbinstance_t) db_list_t;
+typedef struct driverinstance driverinstance_t;
+
+/*%
+ * a query segment is all the text between our special tokens
+ * special tokens are %zone%, %record%, %client%
+ */
+struct query_segment {
+ void *sql;
+ unsigned int strlen;
+ isc_boolean_t direct;
+ ISC_LINK(query_segment_t) link;
+};
+
+/*%
+ * a database instance contains everything we need for running
+ * a query against the database. Using it each separate thread
+ * can dynamically construct a query and execute it against the
+ * database. The "instance_lock" and locking code in the driver's
+ * make sure no two threads try to use the same DBI at a time.
+ */
+struct dbinstance {
+ void *dbconn;
+ query_list_t *allnodes_q;
+ query_list_t *allowxfr_q;
+ query_list_t *authority_q;
+ query_list_t *findzone_q;
+ query_list_t *lookup_q;
+ query_list_t *countzone_q;
+ char *query_buf;
+ char *zone;
+ char *record;
+ char *client;
+ isc_mem_t *mctx;
+ isc_mutex_t instance_lock;
+ ISC_LINK(dbinstance_t) link;
+};
+
+/*
+ * Method declarations
+ */
+
+/* see the code in sdlz_helper.c for more information on these methods */
+
+char *
+sdlzh_build_querystring(isc_mem_t *mctx, query_list_t *querylist);
+
+isc_result_t
+sdlzh_build_sqldbinstance(isc_mem_t *mctx, const char *allnodes_str,
+ const char *allowxfr_str, const char *authority_str,
+ const char *findzone_str, const char *lookup_str,
+ const char *countzone_str, dbinstance_t **dbi);
+
+void
+sdlzh_destroy_sqldbinstance(dbinstance_t *dbi);
+
+char *
+sdlzh_get_parameter_value(isc_mem_t *mctx, const char *input, const char* key);
+
+/* Compatability with existing DLZ drivers */
+
+#define build_querystring sdlzh_build_querystring
+#define build_sqldbinstance sdlzh_build_sqldbinstance
+#define destroy_sqldbinstance sdlzh_destroy_sqldbinstance
+
+#define getParameterValue(x,y) sdlzh_get_parameter_value(ns_g_mctx, (x), (y))
+
+#endif /* SDLZHELPER_H */
diff --git a/contrib/dlz/drivers/rules.in b/contrib/dlz/drivers/rules.in
new file mode 100644
index 0000000..9caabcb
--- /dev/null
+++ b/contrib/dlz/drivers/rules.in
@@ -0,0 +1,47 @@
+# Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+# $Id: rules.in,v 1.2 2005/09/05 00:10:57 marka Exp $
+
+dlz_drivers.@O@: ${DLZ_DRIVER_DIR}/dlz_drivers.c ${DLZ_DRIVER_DIR}/include/dlz/dlz_drivers.h
+ ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/dlz_drivers.c
+
+sdlz_helper.@O@: ${DLZ_DRIVER_DIR}/sdlz_helper.c ${DLZ_DRIVER_DIR}/include/dlz/sdlz_helper.h
+ ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/sdlz_helper.c
+
+
+dlz_bdb_driver.@O@: ${DLZ_DRIVER_DIR}/dlz_bdb_driver.c ${DLZ_DRIVER_DIR}/include/dlz/dlz_bdb_driver.h
+ ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/dlz_bdb_driver.c
+
+dlz_bdbhpt_driver.@O@: ${DLZ_DRIVER_DIR}/dlz_bdbhpt_driver.c ${DLZ_DRIVER_DIR}/include/dlz/dlz_bdbhpt_driver.h
+ ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/dlz_bdbhpt_driver.c
+
+dlz_filesystem_driver.@O@: ${DLZ_DRIVER_DIR}/dlz_filesystem_driver.c ${DLZ_DRIVER_DIR}/include/dlz/dlz_filesystem_driver.h
+ ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/dlz_filesystem_driver.c
+
+dlz_ldap_driver.@O@: ${DLZ_DRIVER_DIR}/dlz_ldap_driver.c ${DLZ_DRIVER_DIR}/include/dlz/dlz_ldap_driver.h
+ ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/dlz_ldap_driver.c
+
+dlz_mysql_driver.@O@: ${DLZ_DRIVER_DIR}/dlz_mysql_driver.c ${DLZ_DRIVER_DIR}/include/dlz/dlz_mysql_driver.h
+ ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/dlz_mysql_driver.c
+
+dlz_odbc_driver.@O@: ${DLZ_DRIVER_DIR}/dlz_odbc_driver.c ${DLZ_DRIVER_DIR}/include/dlz/dlz_odbc_driver.h
+ ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/dlz_odbc_driver.c
+
+dlz_postgres_driver.@O@: ${DLZ_DRIVER_DIR}/dlz_postgres_driver.c ${DLZ_DRIVER_DIR}/include/dlz/dlz_postgres_driver.h
+ ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/dlz_postgres_driver.c
+
+dlz_stub_driver.@O@: ${DLZ_DRIVER_DIR}/dlz_stub_driver.c ${DLZ_DRIVER_DIR}/include/dlz/dlz_stub_driver.h
+ ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c ${DLZ_DRIVER_DIR}/dlz_stub_driver.c
+
diff --git a/contrib/dlz/drivers/sdlz_helper.c b/contrib/dlz/drivers/sdlz_helper.c
new file mode 100644
index 0000000..ea33db1
--- /dev/null
+++ b/contrib/dlz/drivers/sdlz_helper.c
@@ -0,0 +1,531 @@
+/*
+ * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
+ * conceived and contributed by Rob Butler.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (C) 1999-2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef DLZ
+
+#include <config.h>
+
+#include <dns/log.h>
+#include <dns/result.h>
+
+#include <isc/mem.h>
+#include <isc/result.h>
+#include <isc/string.h>
+#include <isc/util.h>
+
+#include <dlz/sdlz_helper.h>
+
+/*
+ * sdlz helper methods
+ */
+
+/*%
+ * properly destroys a querylist by de-allocating the
+ * memory for each query segment, and then the list itself
+ */
+
+static void
+destroy_querylist(isc_mem_t *mctx, query_list_t **querylist)
+{
+ query_segment_t *tseg = NULL;
+ query_segment_t *nseg = NULL;
+
+ REQUIRE(mctx != NULL);
+
+ /* if query list is null, nothing to do */
+ if (*querylist == NULL)
+ return;
+
+ /* start at the top of the list */
+ nseg = ISC_LIST_HEAD(**querylist);
+ while (nseg != NULL) { /* loop, until end of list */
+ tseg = nseg;
+ /*
+ * free the query segment's text string but only if it
+ * was really a query segment, and not a pointer to
+ * %zone%, or %record%, or %client%
+ */
+ if (tseg->sql != NULL && tseg->direct == isc_boolean_true)
+ isc_mem_free(mctx, tseg->sql);
+ /* get the next query segment, before we destroy this one. */
+ nseg = ISC_LIST_NEXT(nseg, link);
+ /* deallocate this query segment. */
+ isc_mem_put(mctx, tseg, sizeof(query_segment_t));
+ }
+ /* deallocate the query segment list */
+ isc_mem_put(mctx, *querylist, sizeof(query_list_t));
+}
+
+/*% constructs a query list by parsing a string into query segments */
+static isc_result_t
+build_querylist(isc_mem_t *mctx, const char *query_str, char **zone,
+ char **record, char **client, query_list_t **querylist,
+ unsigned int flags)
+{
+ isc_result_t result;
+ isc_boolean_t foundzone = isc_boolean_false;
+ isc_boolean_t foundrecord = isc_boolean_false;
+ isc_boolean_t foundclient = isc_boolean_false;
+ char *temp_str = NULL;
+ char *right_str = NULL;
+ query_list_t *tql;
+ query_segment_t *tseg = NULL;
+
+ REQUIRE(querylist != NULL && *querylist == NULL);
+ REQUIRE(mctx != NULL);
+
+ /* if query string is null, or zero length */
+ if (query_str == NULL || strlen(query_str) < 1) {
+ if ((flags & SDLZH_REQUIRE_QUERY) == 0)
+ /* we don't need it were ok. */
+ return (ISC_R_SUCCESS);
+ else
+ /* we did need it, PROBLEM!!! */
+ return (ISC_R_FAILURE);
+ }
+
+ /* allocate memory for query list */
+ tql = isc_mem_get(mctx, sizeof(query_list_t));
+ /* couldn't allocate memory. Problem!! */
+ if (tql == NULL)
+ return (ISC_R_NOMEMORY);
+
+ /* initialize the query segment list */
+ ISC_LIST_INIT(*tql);
+
+ /* make a copy of query_str so we can chop it up */
+ temp_str = right_str = isc_mem_strdup(mctx, query_str);
+ /* couldn't make a copy, problem!! */
+ if (right_str == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+
+ /* loop through the string and chop it up */
+ while (right_str != NULL) {
+ /* allocate memory for tseg */
+ tseg = isc_mem_get(mctx, sizeof(query_segment_t));
+ if (tseg == NULL) { /* no memory, clean everything up. */
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ tseg->sql = NULL;
+ tseg->direct = isc_boolean_false;
+ /* initialize the query segment link */
+ ISC_LINK_INIT(tseg, link);
+ /* append the query segment to the list */
+ ISC_LIST_APPEND(*tql, tseg, link);
+
+ /*
+ * split string at the first "%". set query segment to
+ * left portion
+ */
+ tseg->sql = isc_mem_strdup(mctx,
+ isc_string_separate(&right_str,
+ "%"));
+ if (tseg->sql == NULL) {
+ /* no memory, clean everything up. */
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ /* tseg->sql points directly to a string. */
+ tseg->direct = isc_boolean_true;
+ tseg->strlen = strlen(tseg->sql);
+
+ /* check if we encountered "%zone%" token */
+ if (strcasecmp(tseg->sql, "zone") == 0) {
+ /*
+ * we don't really need, or want the "zone"
+ * text, so get rid of it.
+ */
+ isc_mem_free(mctx, tseg->sql);
+ /* set tseg->sql to in-direct zone string */
+ tseg->sql = (char**) zone;
+ tseg->strlen = 0;
+ /* tseg->sql points in-directly to a string */
+ tseg->direct = isc_boolean_false;
+ foundzone = isc_boolean_true;
+ /* check if we encountered "%record%" token */
+ } else if (strcasecmp(tseg->sql, "record") == 0) {
+ /*
+ * we don't really need, or want the "record"
+ * text, so get rid of it.
+ */
+ isc_mem_free(mctx, tseg->sql);
+ /* set tseg->sql to in-direct record string */
+ tseg->sql = (char**) record;
+ tseg->strlen = 0;
+ /* tseg->sql points in-directly poinsts to a string */
+ tseg->direct = isc_boolean_false;
+ foundrecord = isc_boolean_true;
+ /* check if we encountered "%client%" token */
+ } else if (strcasecmp(tseg->sql, "client") == 0) {
+ /*
+ * we don't really need, or want the "client"
+ * text, so get rid of it.
+ */
+ isc_mem_free(mctx, tseg->sql);
+ /* set tseg->sql to in-direct record string */
+ tseg->sql = (char**) client;
+ tseg->strlen = 0;
+ /* tseg->sql points in-directly poinsts to a string */
+ tseg->direct = isc_boolean_false;
+ foundclient = isc_boolean_true;
+ }
+ }
+
+ /* we don't need temp_str any more */
+ isc_mem_free(mctx, temp_str);
+ /*
+ * add checks later to verify zone and record are found if
+ * necessary.
+ */
+
+ /* if this query requires %client%, make sure we found it */
+ if (((flags & SDLZH_REQUIRE_CLIENT) != 0) && (!foundclient) ) {
+ /* Write error message to log */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Required token %%client%% not found.");
+ result = ISC_R_FAILURE;
+ goto flag_fail;
+ }
+
+ /* if this query requires %record%, make sure we found it */
+ if (((flags & SDLZH_REQUIRE_RECORD) != 0) && (!foundrecord) ) {
+ /* Write error message to log */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Required token %%record%% not found.");
+ result = ISC_R_FAILURE;
+ goto flag_fail;
+ }
+
+ /* if this query requires %zone%, make sure we found it */
+ if (((flags & SDLZH_REQUIRE_ZONE) != 0) && (!foundzone) ) {
+ /* Write error message to log */
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Required token %%zone%% not found.");
+ result = ISC_R_FAILURE;
+ goto flag_fail;
+ }
+
+ /* pass back the query list */
+ *querylist = (query_list_t *) tql;
+
+ /* return success */
+ return (ISC_R_SUCCESS);
+
+ cleanup:
+ /* get rid of temp_str */
+ if (temp_str != NULL)
+ isc_mem_free(mctx, temp_str);
+
+ flag_fail:
+ /* get rid of what was build of the query list */
+ if (tql != NULL)
+ destroy_querylist(mctx, &tql);
+ return result;
+}
+
+/*%
+ * build a query string from query segments, and dynamic segments
+ * dynamic segments replace where the tokens %zone%, %record%, %client%
+ * used to be in our queries from named.conf
+ */
+char *
+sdlzh_build_querystring(isc_mem_t *mctx, query_list_t *querylist)
+{
+ query_segment_t *tseg = NULL;
+ unsigned int length = 0;
+ char *qs = NULL;
+
+ REQUIRE(mctx != NULL);
+ REQUIRE(querylist != NULL);
+
+ /* start at the top of the list */
+ tseg = ISC_LIST_HEAD(*querylist);
+ while (tseg != NULL) {
+ /*
+ * if this is a query segment, use the
+ * precalculated string length
+ */
+ if (tseg->direct == isc_boolean_true)
+ length += tseg->strlen;
+ else /* calculate string length for dynamic segments. */
+ length += strlen(* (char**) tseg->sql);
+ /* get the next segment */
+ tseg = ISC_LIST_NEXT(tseg, link);
+ }
+
+ /* allocate memory for the string */
+ qs = isc_mem_allocate(mctx, length + 1);
+ /* couldn't allocate memory, We need more ram! */
+ if (qs == NULL)
+ return NULL;
+
+ /* start at the top of the list again */
+ tseg = ISC_LIST_HEAD(*querylist);
+ /* copy the first item in the list to the query string */
+ if (tseg->direct == isc_boolean_true) /* query segment */
+ strcpy(qs, tseg->sql);
+ else
+ strcpy(qs, * (char**) tseg->sql); /* dynamic segment */
+
+ /* concatonate the rest of the segments */
+ while ((tseg = ISC_LIST_NEXT(tseg, link)) != NULL) {
+ if (tseg->direct == isc_boolean_true)
+ /* query segments */
+ strcat(qs, tseg->sql);
+ else
+ /* dynamic segments */
+ strcat(qs, * (char**) tseg->sql);
+ }
+
+ return qs;
+}
+
+/*% constructs a sql dbinstance (DBI) */
+isc_result_t
+sdlzh_build_sqldbinstance(isc_mem_t *mctx, const char *allnodes_str,
+ const char *allowxfr_str, const char *authority_str,
+ const char *findzone_str, const char *lookup_str,
+ const char *countzone_str, dbinstance_t **dbi)
+{
+
+ isc_result_t result;
+ dbinstance_t *db = NULL;
+
+ REQUIRE(dbi != NULL && *dbi == NULL);
+ REQUIRE(mctx != NULL);
+
+ /* allocate and zero memory for driver structure */
+ db = isc_mem_get(mctx, sizeof(dbinstance_t));
+ if (db == NULL) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Could not allocate memory for "
+ "database instance object.");
+ return (ISC_R_NOMEMORY);
+ }
+ memset(db, 0, sizeof(dbinstance_t));
+ db->dbconn = NULL;
+ db->client = NULL;
+ db->record = NULL;
+ db->zone = NULL;
+ db->mctx = NULL;
+ db->query_buf = NULL;
+ db->allnodes_q = NULL;
+ db->allowxfr_q = NULL;
+ db->authority_q = NULL;
+ db->findzone_q = NULL;
+ db->countzone_q = NULL;
+ db->lookup_q = NULL;
+
+ /* attach to the memory context */
+ isc_mem_attach(mctx, &db->mctx);
+
+ /* initialize the reference count mutex */
+ result = isc_mutex_init(&db->instance_lock);
+ if (result != ISC_R_SUCCESS) {
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "isc_mutex_init() failed: %s",
+ isc_result_totext(result));
+ goto cleanup;
+ }
+
+ /* build the all nodes query list */
+ result = build_querylist(mctx, allnodes_str, &db->zone,
+ &db->record, &db->client,
+ &db->allnodes_q, SDLZH_REQUIRE_ZONE);
+ /* if unsuccessful, log err msg and cleanup */
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Could not build all nodes query list");
+ goto cleanup;
+ }
+
+ /* build the allow zone transfer query list */
+ result = build_querylist(mctx, allowxfr_str, &db->zone,
+ &db->record, &db->client,
+ &db->allowxfr_q,
+ SDLZH_REQUIRE_ZONE | SDLZH_REQUIRE_CLIENT);
+ /* if unsuccessful, log err msg and cleanup */
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Could not build allow xfr query list");
+ goto cleanup;
+ }
+
+ /* build the authority query, query list */
+ result = build_querylist(mctx, authority_str, &db->zone,
+ &db->record, &db->client,
+ &db->authority_q, SDLZH_REQUIRE_ZONE);
+ /* if unsuccessful, log err msg and cleanup */
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Could not build authority query list");
+ goto cleanup;
+ }
+
+ /* build findzone query, query list */
+ result = build_querylist(mctx, findzone_str, &db->zone,
+ &db->record, &db->client,
+ &db->findzone_q, SDLZH_REQUIRE_ZONE);
+ /* if unsuccessful, log err msg and cleanup */
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Could not build find zone query list");
+ goto cleanup;
+ }
+
+ /* build countzone query, query list */
+ result = build_querylist(mctx, countzone_str, &db->zone,
+ &db->record, &db->client,
+ &db->countzone_q, SDLZH_REQUIRE_ZONE);
+ /* if unsuccessful, log err msg and cleanup */
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Could not build count zone query list");
+ goto cleanup;
+ }
+
+ /* build lookup query, query list */
+ result = build_querylist(mctx, lookup_str, &db->zone,
+ &db->record, &db->client,
+ &db->lookup_q, SDLZH_REQUIRE_RECORD);
+ /* if unsuccessful, log err msg and cleanup */
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Could not build lookup query list");
+ goto cleanup;
+ }
+
+ /* pass back the db instance */
+ *dbi = (dbinstance_t *) db;
+
+ /* return success */
+ return (ISC_R_SUCCESS);
+
+ cleanup:
+ /* destroy whatever was build of the db instance */
+ destroy_sqldbinstance(db);
+ /* return failure */
+ return (ISC_R_FAILURE);
+}
+
+void
+sdlzh_destroy_sqldbinstance(dbinstance_t *dbi)
+{
+ isc_mem_t *mctx;
+
+ /* save mctx for later */
+ mctx = dbi->mctx;
+
+ /* destroy any query lists we created */
+ destroy_querylist(mctx, &dbi->allnodes_q);
+ destroy_querylist(mctx, &dbi->allowxfr_q);
+ destroy_querylist(mctx, &dbi->authority_q);
+ destroy_querylist(mctx, &dbi->findzone_q);
+ destroy_querylist(mctx, &dbi->countzone_q);
+ destroy_querylist(mctx, &dbi->lookup_q);
+
+ /* get rid of the mutex */
+ isc_mutex_destroy(&dbi->instance_lock);
+
+ /* return, and detach the memory */
+ isc_mem_put(mctx, dbi, sizeof(dbinstance_t));
+ isc_mem_detach(&mctx);
+}
+
+char *
+sdlzh_get_parameter_value(isc_mem_t *mctx, const char *input, const char* key)
+{
+ int keylen;
+ char *keystart;
+ char value[255];
+ int i;
+
+ if (key == NULL || input == NULL || strlen(input) < 1)
+ return NULL;
+
+ keylen = strlen(key);
+
+ if (keylen < 1)
+ return NULL;
+
+ keystart = strstr(input, key);
+
+ if (keystart == NULL)
+ return NULL;
+
+ REQUIRE(mctx != NULL);
+
+ for (i = 0; i < 255; i++) {
+ value[i] = keystart[keylen + i];
+ if (value[i] == ' ' || value[i] == '\0') {
+ value[i] = '\0';
+ break;
+ }
+ }
+
+ return isc_mem_strdup(mctx, value);
+}
+
+#endif
diff --git a/contrib/dnssec-tools/README b/contrib/dnssec-tools/README
new file mode 100644
index 0000000..d45b75a
--- /dev/null
+++ b/contrib/dnssec-tools/README
@@ -0,0 +1,9 @@
+
+ DNSSEC Tools
+
+ DNSSEC tools from SPARTA is a useful tools set in particular
+ "trustman" which can be used to manage trusted-keys in named.conf.
+
+ http://www.dnssec-tools.org/
+
+ http://www.dnssec-tools.org/wiki/index.php/Recursive_Server#Trustman
diff --git a/contrib/idn/idnkit-1.0-src/ChangeLog b/contrib/idn/idnkit-1.0-src/ChangeLog
new file mode 100644
index 0000000..085e3bd
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/ChangeLog
@@ -0,0 +1,856 @@
+2003-03-16
+ * idnkit 1.0 release.
+
+ * DISTFILES, README, README.ja, INSTALL, INSTALL.ja: delete BIND8,
+ Squid and libiconv patches.
+
+2003-03-13
+ * wsock/config/idnconf.tcl: change the version number to '1.0'.
+
+2003-03-12
+ * Makefile.in, lib/Makefile.in: Add 'make install-config' to
+ Makefile target.
+
+2003-03-11
+ * patch/bind9/bind-9.2.2-patch: created.
+
+2003-03-06
+ * lib/punycode.c: idn__punycode_encode() outputs an error message
+ if the input string is over PUNYCODE_MAXINPUT (the value is 3800).
+
+2003-03-05
+ * include/idn/api.h, include/idn/checker.h,
+ include/idn/nameprep.h, include/idn/res.h, include/idn/version.h,
+ lib/Makefile.in, lib/checker.c, lib/idn.conf.sample.in,
+ lib/mapper.c, lib/nameprep.c, lib/nameprepdata.c,
+ lib/normalizer.c, lib/tests/checker.tsy, lib/tests/mapper.tsy,
+ lib/tests/nameprep.tsy, lib/tests/normalizer.tsy,
+ man/idn.conf.5.in, tools/idnconv/idnconv.1, wsock/bin/idn.conf:
+ Add NAMEPREP version 'RFC3491', and remove 'nameprep-11'.
+
+2003-02-18
+ * lib/tests/api-init1.tsy, lib/tests/api-init2.tsy,
+ lib/tests/api-init3.tsy, lib/tests/api-init4-1.tsy,
+ lib/tests/api-init4-2.tsy, lib/tests/api-init4-3.tsy,
+ lib/tests/api-init5-1.tsy, lib/tests/api-init5-2.tsy,
+ lib/tests/api-init5-3.tsy, lib/tests/api.tsy, lib/tests/converter.tsy,
+ lib/tests/res.tsy, lib/tests/punycode.c: Change ACE prefix of Punycode
+ from `zq--' to `xn--'.
+
+2003-02-13
+ * lib/make.wnt: remove dependencies on obsolete files.
+
+ * INSTALL, INSTALL.ja, configure.in, aclocal.m4: Delete configure's
+ --with-punycode-prefix option.
+
+2003-02-05
+ * lib/res.c: improve performance when encoding/decoding
+ loooooooong domain names.
+
+2003-01-22
+ * lib/res.c: idn_res_encodename() and idn_res_decodename() in
+ libidnkit returns `idn_invalid_name' if local converter is not
+ available.
+
+2003-01-20
+ * lib/normalize.c, lib/unormalize.c, include/idn/unormalize.h,
+ lib/tests/normalizer.tsy: unicode-form-c or unicode-form-c/3.2.0 is
+ no longer supported.
+
+ * lib/mapselector.c, lib/tests/mapselector.tsy:
+ idn_mapselector_add() outputs an error message if invalid scheme
+ name or TLD is given.
+
+ * lib/checker.c, lib/normalizer.c, lib/mapselector.c, lib/res.c:
+ modify error messages.
+
+ * lib/result.c: modify an error message for `idn_invalid_length'.
+
+2003-01-16
+ * lib/checker.c, lib/idn.conf.sample.in, lib/mapper.c, lib/nameprep.c,
+ lib/normalizer.c, lib/unicode.c, lib/tests/checker.tsy,
+ lib/tests/mapper.tsy, lib/tests/nameprep.tsy, lib/tests/normalizer.tsy,
+ man/idn.conf.5.in, tools/idnconv/idnconv.1:
+ delete support for nameprep-03 and nameprep-09.
+
+ * lib/unicodedata_301.c, lib/unicodedata_310.c, DISTFILES:
+ unicodedata_301.c and unicodedata_310.c are removed.
+
+2003-01-14
+ * tools/idnconv/idnconv.c, tools/idnconv/util.c, tools/idnconv/util.h:
+ remove the restriction on the length of input lines. idnconv can
+ now handle very long lines.
+
+2003-01-10
+ * lib/converter.c: fix a bug in extending intermediate buffer
+ in converter_iconv_convtoucs4(), which causes incorrect
+ codeset conversion when the input string is very long.
+
+2002-12-06
+ * idnkit 1.0pr2 release (preview release).
+
+2002-12-03
+ * lib/mapper.c, lib/normalize.c: Don't check whether an input string
+ is STD3 ASCII label.
+ lib/res.c: Skip localmap if the string is STD3 ASCII label.
+
+2002-12-02
+ * lib/tests/iconvchk.c, lib/tests/Makefile.in: enable to check
+ whether codeset names "eucJP" and "SJIS" are available in iconv.
+
+2002-12-01
+ * tools/runidn/stub.c: use RTLD_NEXT for dlsym() if it is available.
+
+2002-11-29
+ * almost all files: change the license terms.
+
+2002-11-25
+ * lib/tests/codeset.h: define character encoding names here.
+ * lib/tests/api-init1.tsy, lib/tests/api-init2.tsy,
+ lib/tests/api-init3.tsy, lib/tests/api-init4-3.tsy,
+ lib/tests/api-init5-3.tsy, lib/tests/converter.tsy,
+ lib/tests/mapselector.tsy, lib/tests/resconf.tsy: include `codeset.h'.
+ lib/tests/api-init4-1.tsy, lib/tests/api-init4-2.tsy,
+ lib/tests/api-init5-1.tsy, lib/tests/api-init5-2.tsy,
+ lib/tests/mapselector.tsy, lib/tests/resconf.tsy:
+ Delete the unused cpp macro EUCJP_ENCODING_NAME.
+ * INSTALL, INSTALL.ja: describe `lib/tests/codeset.h'.
+
+ * lib/converter.c: Fix bugs in converter_uescape_convfromucs4()
+ and converter_uescape_convtoucs4() that libidnkit might crash
+ when `from' is very long.
+
+2002-11-15
+ * Makefile.in: `make distclean' also removes `libtool'.
+
+2002-10-25
+ * lib/resconf.c: enable the IDN_CONVERTER_RTCHECK flag when it
+ calls idn_converter_create().
+ * tools/idnconv/util.c: enable the IDN_CONVERTER_RTCHECK flag
+ when it calls idn_converter_setlocalconvertername() or
+ idn_converter_setidnconvertername().
+
+2002-09-20
+ * wsock/README.txt, wsock/README_j.txt: add description on
+ "Force local DLL reference" button.
+
+2002-09-19
+ * idnkit 1.0pr1 release (preview release).
+
+2002-09-13
+ * README, README.ja: update URIs.
+
+ * lib/Makefile.in, lib/tests/Makefile.in: generate libidntest and
+ libidntestlite for test programs.
+
+2002-09-09
+ * wsock/wsock11/dlldef.h, wsock/wsock11/dllfunc.c,
+ wsock/wsock11/dllload.c, wsock/wsock11/dllmain.c,
+ wsock/wsock20/dlldef.h, wsock/wsock20/dllfunc.c,
+ wsock/wsock20/dllload.c, wsock/wsock20/dllmain.c: take out
+ DLL load/unload from DllMain(). load/unload is delayed until
+ it is really necessary.
+ * wsock/common/checkdll.c, wsock/common/wrapcommon.h: move DLL
+ load/unload functions from wsock/{ws11,ws20}/dllmain.c.
+ * wsock/printf.c: make logging more effective.
+
+ * DISTFILES: remove wsock/common/dllmain.c, which is no longer used.
+
+2002-09-05
+ * lib/mapper.c: fix a bug that idn_mapper_add(ctx, "filemap") aborts.
+
+2002-09-04
+ * lib/nameprep.c: GCC says that a variable declared in
+ idn_nameprep_isvalidbidi() might be used uninitialized. Fixed.
+
+ * wsock/common/convert.c, wsock/common/printf.c,
+ wsock/common/wrapcommon.h: always reset log output callback procedure
+ before calling idnkit library functions.
+ * wsock/wsock11/dllmain.c, wsock/wsock20/dllmain.c: reset
+ log output callback before unloading.
+
+2002-09-03
+ * lib/tests/testygen, lib/tests/testsuite.c, lib/tests/testsuite.h:
+ add verbose and partial exec modes.
+
+2002-08-29
+ * idnkit 020829 snapshot release.
+
+2002-08-28
+ * lib/tests/testygen: fix generation of main(). It didn't destroy
+ a testsuite context.
+ * lib/tests/testsuite.c: fix a double free bug in
+ idn_testsuite_destroy().
+
+ * lib/filemapper.c: fix one memory leak in read_file().
+ * lib/filemapper.c: fix buffer expansion bug in ucsbuf_grow().
+ * lib/res.c: plug up memory leak in idn_res_decodename().
+
+ * lib/tests/setenv.c: fix memory leak bug.
+
+ * lib/filemapper.c, lib/ucsmap.c, lib/ucsset.c: fix misuse of
+ realloc().
+
+ * lib/converter.c: plug up memory leak in
+ converter_iconv_openfromucs4() and converter_iconv_opentoucs4().
+
+2002-08-27
+ * lib/tests/Makefile.in: support the case where the build directory
+ is different from the source directory.
+
+ * lib/tests/Makefile.in: perform tests for lite library only if
+ `--enable-liteonly' has been specified at configuration.
+
+ * lib/tests/setenv.c, lib/tests/setenv.h, lib/tests/Makefile.in,
+ configure.in: support systems which lack setenv() and/or unsetenv().
+
+ * configure.in, lib/Makefile.in, lib/idn.conf.sample, INSTALL,
+ INSTALL.ja: delete `--with-preference'.
+
+2002-08-26
+ * lib/tests/testygen: new option `-L', which suppresses `#line'
+ cpp lines on output.
+
+ * DISTFILES: Add files for tests.
+ * INSTALL, INSTALL.ja: add the `Test' section.
+
+ * lib/resconf.c: fix trace message of idn_resconf_create().
+
+ * win/README.WIN: update the contents.
+
+ * wsock/config/idnconf.tcl: do not display `force local DLL
+ reference' button on Windows 95 and NT, since it is meaningless
+ for these old OSes.
+
+2002-08-22
+ * lib/mapper.c, lib/normalizer.c: add the procedure for the case
+ that ctx->nschems is 0 to idn_mapper_map() and
+ idn_normalizer_normalize().
+
+ * lib/delimitermap.c: idn_delimitermap_add() and
+ idn_delimitermap_addall() reject a request to add an invalid
+ codepoint.
+
+2002-08-21
+ * lib/api.c: fix a bug that api_nameinit() didn't call
+ idn_resconf_initialize().
+ * lib/api.c: don't set the `ininitialized' flag if idn_nameinit()
+ returns with an error.
+ * lib/api.c, include/idn/api.h: add idn__setconffile().
+
+ * lib/mapselector.c: idn_mapselector_map() and idn_mapselector_map2()
+ now accept `tld' beginning with a dot.
+
+2002-08-20
+ * wsock/common/checkdll.c: back out 0812 change because the check
+ method doesn't seem to work correctly on WinMe.
+ * wsock/wsock11/dllload.c, wsock/wsock20/dllload.c: add some trace
+ statements.
+ * wsock/config/idnconf.tcl: do not install winsock2 wrapper on
+ Win98/Me.
+
+ * lib/tests/testsuite.c, lib/tests/testsuite.h, lib/tests/testygen:
+ exit the testcase if ASSERT fails.
+
+ * lib/tests/testsuite.c, lib/tests/testsuite.h:
+ replace ASSERT_PTRNOTNULL with ASSERT_PTR_NE.
+
+ * lib/tests/testutil.c, lib/testuil.h: new file.
+ It provides create_conf_file().
+
+2002-08-19
+ * lib/resconf.c: if application calls idn_resconf_create() before
+ idn_resconf_initialize(), idnkit returns `idn_failure'.
+
+2002-08-15
+ * lib/tests/testsuite.c, lib/tests/testsuite.h, lib/tests/testygen:
+ add two assertion macros: ASSERT_PTR and ASSERT_PTRNOTNULL.
+
+ * lib/converter.c: fix some warning messages.
+
+2002-08-14
+ * lib/resconf.c: fix a but that idnkit aborts if a line in config
+ file lacks an argument.
+
+ * wsock/common/hook.c, wsock/wsock11/dllfunc.c, wsock/wsock20/dllfunc.c
+ : make name resolver APIs return the domain name verbatim (instead
+ of returning error) when name decoding fails.
+
+2002-08-13
+ * lib/Makefile.in, lib/checker.c, lib/converter.c, lib/delimitermap.c,
+ lib/filechecker.c, lib/filemapper.c, lib/mapper.c, lib/mapselector.c,
+ lib/nameprep.c, lib/normalizer.c, lib/punycode.c, lib/race.c,
+ lib/resconf.c, lib/unormalize.c: delete main routines for test.
+
+ * lib/tests/: new directory.
+ * configure.in: Check for path of perl command.
+
+ * wsock/config/idnconf.tcl: correct OS version check routine.
+
+2002-08-12
+ * lib/make.wnt: change amcacez.* to punycode.*.
+ * wsock/common/encoding.c, wsock/common/dump.c, wsock/common/convert.c,
+ wsock/commn/hook.c, wsock/common/printf.c, wsock/common/wrapcommon.h,
+ wsock/wsock11/dllfunc.c, wsock/wsock11/dllload.c,
+ wsock/wsock20/dllfunc.c, wsock/wsock20/dllload.c: add extra argument
+ (specifying buffer length) to some interface functions, in order to
+ prevent possible buffer overflow.
+ * wsock/common/printf.c: increase message buffer size.
+ * wsock/wsock11/dllmain.c, wsock/wsock20/dllmain.c: call initialize
+ routine before first log output.
+ * wsock/common/checkdll.c: use light-weight DLL checking using
+ LoadLibraryEx.
+
+ * lib/res.c: fix bugs in idn_res_encodename(), idn_res_decodename()
+ and idn_res_decodename2(). They fell into infinite loops when
+ given `tolen' is 0.
+
+2002-08-08
+ * lib/resconf.c, lib/res.c: remove unused functions and variables.
+
+ * lib/Makefile.in tools/idnconv/Makefile.in,
+ tools/runidn/Makefile.in: add @CPPFLAGS@ to $(CFLAGS).
+
+ * lib/res.c: idn_res_decodename2() copies `from' to `to' and
+ returns immediately when the `actions' argument is 0.
+
+2002-08-07
+ * lib/resconf.c: fix a bug in parse_conf() that if `nameprep' or
+ `idn-encoding' directive is defined twice, default value is set
+ to the directive.
+ * lib/resconf.c: cosmetic changes.
+ delete parse_map(), parse_normalize(), parse_prohibit(),
+ parse_unassigned() and parse_bidi().
+
+ * lib/amcacez.c, include/idn/amcacez.h: renamed to lib/punycode.c
+ and include/idn/punycode.h.
+
+ * include/idn/converter.h, lib/converter.h: define
+ idn_converter_getrealname() externally instead of statically
+ defined get_realname().
+
+2002-08-06
+ * lib/resconf.c: arrange processes of obsolete commands in
+ idn_res_loadfile().
+
+ * INSTALL, INSTALL.ja, man/idn.conf.5.in, tools/idnconv/idnconv.1:
+ remove description of RACE and AMC-ACE-Z.
+
+ * lib/resconf.c: fix a bug in handling of local-converter.
+
+ * lib/converter.c: add initialization check in
+ idn_converter_aliasfile() and idn_converter_resetalias().
+
+ * lib/converter.c: free context memory at some right places in
+ idn_converter_create().
+
+2002-08-05
+ * configure.in, lib/Makefile.in, lib/aliaslist.sh: also add the
+ "UTF-8" entry if --with-utf8=NAME option of configure is specified,
+ and NAME is not "UTF-8".
+
+ * tools/idnconv/idnconv.c: call idn_converter_destroy() after
+ idn_resconf_getidnconverter() and idn_resconf_getlocalconverter()
+ in main().
+
+ * lib/res.c: fix a bug in idn_res_decodename2().
+ When the function called idn_res_decodename(), assertion check in
+ idn_res_decodename() may have failed.
+
+ * lib/res.c: call idn_delimitermap_destroy() after
+ idn_resconf_getdelimitermap() in idn_res_encodename() and
+ idn_res_decodename().
+
+2002-08-02
+ * lib/res.c: fix mismatched pointer type in idn_res_decodename2().
+ * lib/res.c: fix a bug in handling of `auxencoding', in
+ idn_res_decodename2().
+
+2002-08-01
+ * lib/resconf.c: fix two memory leaks in parse_conf().
+
+ * lib/aliaslist.c: fix an error of size measurement in
+ create_item().
+
+2002-07-31
+ * lib/converter.c: AMC-ACE-Z and RACE are now extra ACE.
+
+2002-07-30
+ * idnkit 020730 snapshot release.
+
+ * lib/resconf.c: fix a bug in idn_resconf_create() that it
+ misses initializing `ctx->bidi_checker'.
+
+2002-07-29
+ * tools/idnconv/idnconv.1: describe bidi character check.
+
+2002-07-24
+ * lib/resconf.c: force to add bidi checker at parsing nameprep
+ entry in config file.
+
+2002-07-19
+ * include/idn/checker.h, include/idn/nameprep.h,
+ include/idn/res.h, include/idn/resconf.h, man/idn.conf.5.in,
+ man/libidnkit.3.in, lib/checker.c, lib/nameprep.c, lib/res.c,
+ lib/resconf.c, tools/idnconv/idnconv.c: add bidirectional label
+ check routine.
+
+ * include/idn/api.h, include/idn/res.h, lib/api.c, lib/res.c,
+ tools/idnconv/idnconv.c, tools/idnconv/util.c,
+ tools/idnconv/util.h: change the type of action flag at conversion
+ functions and define it as ``idn_action_t''.
+
+2002-07-18
+ * wsock/config/idnconf.tcl: implement .exe.local file
+ creation/deletion feature.
+ * lib/make.wnt: update list of files according to the recent
+ changes of the library.
+
+2002-07-12
+ * include/idn/nameprpe.h: define idn_biditype_t.
+ * lib/nameprep_template.c, lib/nameprep.c: support for bidi type
+ check is added.
+
+2002-07-11
+ * idnkit 020711 snapshot release.
+
+2002-07-09
+ * man/Makefile.in, man/idn.conf.5.in: force to make and install
+ manpage of idnalias.conf (merely a copy of idn.conf's manpage).
+
+2002-07-08
+ * DISTFILES: `lib/dude.c' and `include/idn/dude.h' are removed.
+ * DISTFILES: `util/Makefile' is added.
+
+ * tools/idnconv/idnconv.c: fix typo in decode_file().
+
+ * tools/idnconv/idnconv.c: Support "-reverse -out ACE".
+
+ * lib/res.c: fix bugs in label_idndecode() and label_idnencode_ace().
+ If UCS4 to UTF-8 conversion is failed with idn_buffer_overflow,
+ we must extends the size of local buffer and try the conversion
+ again.
+
+2002-07-05
+ * tools/idnconv/idnconv.c: treat input as the string of the local
+ encoding specified by "-out" option at reverse conversion.
+
+ * include/idn/api.h, lib/api.c: add idn_decodename2() function.
+
+ * include/idn/res.h, lib/res.c: add idn_res_decodename2()
+ function.
+
+ * include/idn/res.h, lib/res.c: restore IDN_DELIMMAP flag.
+
+2002-07-02
+ * lib/unicodedata_320.c, lib/checker.c, lib/idn.conf.sample.in,
+ lib/mapper.c, lib/nameprep.c, lib/nameprepdata.c, lib/normalizer.c,
+ lib/unicode.c, unicodedata_320.c, include/idn/nameprep.c, DISTFILES,
+ man/idn.conf.5.in: Support NAMEPREP-11 which adopts Unicode-3.2.
+ Support for NAMEPREP-06, -08, -09 are removed.
+
+2002-07-01
+ * tools/idnconv/idnconv.1: added `-A' option.
+
+ * include/idn/res.h, lib/res.c: redefine IDN_ENCODE_QUERY,
+ IDN_DECODE_QUERY, IDN_ENCODE_STORED, IDN_DECODE_STORED, IDN_ENCODE_APP
+ and IDN_DECODE_APP.
+
+2002-06-26
+ * lib/resconf.c, include/idn/resconf.h: define
+ idn_resconf_getauxidnconverter(), idn_resconf_setauxidnconverter()
+ and idn_resconf_setauxidnconvertername().
+
+2002-06-20
+ * lib/res.c: use action flags at round trip check.
+
+2002-06-19
+ * include/idn/res.h, lib/res.c: remove IDN_UNASCHECK flag from
+ IDN_NAMEPREP.
+
+ * include/idn/res.h, lib/res.c: add IDN_ENCODE_QUERY,
+ IDN_DECODE_QUERY, IDN_ENCODE_STORED, and IDN_DECODE_STORED flags.
+
+ * include/idn/res.h, lib/res.c: IDN_ENCODE_APP and IDN_DECODE_APP
+ have same value as flags for conversion of the query string
+ (IDN_ENCODE_QUERY and IDN_DECODE_QUERY) now.
+
+2002-06-17
+ * include/idn/Makefile.in, lib/Makefile.in, lib/converter.c,
+ tools/runidn/Makefile.in, configure, INSTALL, INSTALL.ja:
+ delete DUDE support.
+ * include/idn/dude.h, lib/dude.c: deleted.
+
+ * README, README.ja: update URL of mdnkit FAQ.
+
+ * include/idn/res.h, lib/res.c, lib/idn.conf.sample.in,
+ lib/delimitermap.c, man/libidnkit.3.in: add default delimiters
+ defined in IDNA specification and always forced to do delimiter
+ mapping.
+
+ * lib/resconf.c, man/idn.conf.5.in: remove "delimiter-map" entry
+ support of configuration file.
+
+ * tools/idnconv/idnconv.c, tools/idnconv/idnconv.1: remove
+ "-delimiter-map" and "-d" options.
+
+2002-06-13
+ * wsock/common/encoding.c: fix registry key setting so that
+ it matches what documents say.
+
+2002-06-11
+ * include/idn/delimitermap.h: remove idn_delimitermap_fix()
+ declaration.
+
+2002-06-10
+ * wsock/wsock2/dllfunc.c: fix a bug which makes wrapping of
+ getaddrinfo()/getnameinfo() always fail.
+
+2002-06-05
+ * wsock/wsock2/dllfunc.c, wsock/wsock2/dllstub.c,
+ wsock/wsock2/ws2_32.def: add new APIs introduced by WinXP.
+
+2002-05-22
+ * tools/idnconv/util.c: reset alias information before loading
+ alias information file.
+
+2002-05-20
+ * idnkit 1.0rc1 release.
+
+ * include/idn/res.h: fix typo in a comment.
+
+2002-05-17
+ * include/idn/version.h: set IDNKIT_VERSION to "1.0rc1".
+
+2002-05-13
+ * tools/rpm/mdnkit.spec: renamed to idnkit.spec, and revised
+ for idnkit-1.0.
+
+2002-05-09
+ * tools/idnconv/idnconv.c: now `idnconv -r' can convert a file
+ from ACE to ACE.
+
+2002-05-08
+ * lib/idn.conf.sample.in: delete "encoding-alias-file" entry
+ because idnkit does not support it any longer.
+
+ * lib/nameprepdata.c lib/nameprep.c, lib/mapper.c, lib/normalizer.c,
+ lib/checker.c, lib/idn.conf.sample.in, man/idn.conf.5.in,
+ tools/idnconv/idnconv.1: support NAMEPREP-09.
+
+ * lib/mapper.c, lib/normalizer.c, lib/checker.c, lib/mapselector.c,
+ * lib/res.c, lib/race.c: spmplify local buffer managements.
+
+ * tools/idnconv/idnconv.c, tools/idnconv/util.c, tools/idnconv/util.h:
+ fix a bug that wrong local encoding is set to a resconf context.
+
+2002-05-07
+ * tools/idnconv/util.c: delete set_reverse_context().
+ * tools/idnconv/idnconv.c: fix a serious bug in -reverse conversion.
+
+2002-05-04
+ * include/idn/util.h, lib/converter.c, lib/resconf.c, lib/util.c:
+ simplify Windows registry retrieval function interface.
+ * wsock/common/convert.c, wsock/common/dump.c,
+ wsock/common/encoding.c, wsock/common/wrapcommon.h: fix type
+ conflicts.
+ * wsock/wsock11/dlldef.h, wsock/wsock11/dllmain.c,
+ wsock/wsock20/dlldef.h, wsock/wsock20/dllmain.c: fix typo.
+ * wsock/common/jpnicmdn.def, wsock/common/jpnicmdn.h,
+ wsock/config/mdnconf.tcl: removed.
+ * DISTFILES: add new files, remove obsolete files.
+
+2002-05-02
+ * tools/idnconv/util.c: create a new function set_reverse_context().
+ * tools/idnconv/idnconv.c: fix a bug in handing of reference count
+ of idn_resconf_t contexts.
+
+ * lib/amcacez.c, lib/race.c, lib/dude.c, lib/delimitermap.c,
+ lib/checker.c, lib/mapper.c, lib/mapselector.c, lib/converter.c,
+ lib/normalizer.c, lib/res.c, lib/ucs4.c, lib/debug.c,
+ include/idn/debug.h: output valuable trace logs for developpers.
+
+ * lib/res.c: fix double free bugs.
+
+ * lib/checker.c, include/idn/checker.h: for symbols of the checker
+ module, use `idn_' prefix instead of `idn__' by default.
+
+ * wsock/common/checkdll.c, wsock/common/convert.c,
+ wsock/common/dump.c, wsock/common/encoding.c, wsock/common/hook.c,
+ wsock/common/printf.c, wsock/common/make.wnt,
+ wsock/wsock11/dlldef.h, wsock/wsock11/dllfunc.c,
+ wsock/wsock11/dllload.c , wsock/wsock11/dllmain.c,
+ wsock/wsock11/dllstub.c, wsock/wsock11/make.wnt,
+ wsock/wsock20/dlldef.h, wsock/wsock20/dllfunc.c,
+ wsock/wsock20/dllload.c , wsock/wsock20/dllmain.c,
+ wsock/wsock20/dllstub.c, wsock/wsock20/make.wnt: adapt idnkit
+ interface, change name from `mDN Wrapper' to `idn wrapper'.
+ * wsock/common/wrapcommon.h: created.
+ * wsock/config/idnconf.tcl: created.
+
+2002-05-01
+ * include/idn/util.h, lib/converter.c, lib/resonf.c, lib/util.c:
+ Move alias information initialization scheme from the resconf
+ context initialization to the converter module initialization.
+
+ * tools/idnconv/idnconv.c: fix a bug in main().
+ Wrong localconverer/idnconverter may be set to resconf2.
+
+2002-04-30
+ * lib/res.c, tools/idnconv/idnconv.c: accept non-ace encoding as
+ idn-encoding and ace encoding as local-encoding at normal conversion.
+
+2002-04-23
+ * man/idn.conf.5.in: use the term "unassigned codepoint", not
+ "unassigned character".
+
+2002-04-19
+ * include/idn/api.h, include/idn/res.h:
+ delete cpp macros for backward compatibility, since they are defined
+ in include/mdn/api.h and include/mdn/res.h.
+
+ * include/idn/checker.h, include/idn/converter.h,
+ include/idn/delimitermap.h, include/idn/filechecker.h,
+ include/idn/filemapper.h, include/idn/mapper.h,
+ include/idn/mapselector.h, include/idn/nameprep.h,
+ include/idn/normalizer.h, include/idn/unormalize.h:
+ fix obsolete descriptions.
+
+2002-04-17
+ * idnkit 1.0beta2 release.
+
+2002-04-16
+ * configure.in: check AC_FIND_SYSTEM_SHOBJ(libnsl),
+ AC_CHECK_LIB(socket, socket) and AC_CHECK_LIB(nsl, inet_addr)
+ in case of --enable-runidn.
+
+2002-04-15
+ * tools/idnconv/idnconv.1: fix the "REVERSE CONVERSION MECHANISM"
+ section.
+
+2002-04-12
+ * lib/res.c, include/idn/res.h: rename `idn_res_actionstostring()'
+ to `idn__res_actionstostring()'.
+ * lib/mapper.c, lib/checker.c, lib/converter.c: output trace log
+ which shows scheme a name the module is going to perform.
+
+2002-04-10
+ * man/idn.conf.5.in: delete the "SETFILE SECTION".
+
+2002-04-09
+ * tools/runidn/resolver.c: call idn_nameinit() and then call
+ idn_encodename() or idn_decodename().
+
+2002-04-08
+ * include/idn/export.h: created.
+ * include/idn/Makefile.h, DISTFILES: add export.h.
+ * include/idn/api.h, include/idn/converter.h, include/idn/debug.h,
+ include/idn/delimitermap.h, include/idn/localencoding.h,
+ include/idn/log.h, include/idn/mapper.h, include/idn/mapselector.h,
+ include/idn/nameprep.h, include/idn/normalizer.h, include/idn/res.h,
+ include/idn/resconf.h, include/idn/result.h, include/idn/ucs4.h,
+ include/idn/ucsmap.h, include/idn/ucsset.h, include/idn/unormalize.h,
+ include/idn/utf8.h, include/idn/version.h: include export.h. mark
+ exportable functions with IDN_EXPORT macro.
+ * lib/make.wnt: modify to create DLLs.
+ * configure.in: add existance check for pwd.h.
+ * configure, include/config.h.in: rebuilt.
+ * lib/resconf.c, lib/localencoding.c: port to Win32.
+ * include/mdn/version.h: include <idn/version.h> for the declaration
+ of idn_version_getstring().
+ * tools/make.wnt, tools/idnconv/make.wnt: created.
+ * make.wnt: add tools subdirectory.
+ * DISTFILES: add tools/make.wnt and tools/idnconv/make.wnt.
+
+ * include/idn/mapselector.h, lib/mapselector.c:
+ add idn_mapselector_getnotld() and idn_mapselector_getdefaulttld().
+ Instead delete idn_mapselector_no_tld and idn_mapselector_default.
+
+ * lib/api.c, include/mdn/api.h: define mdn_nameinit(),
+ mdn_encodename() and mdn_decodename().
+
+ * DISTFILES: delete `patch/bind8/bind-8.2.3-patch' and
+ `tools/rpm/mdnsproxy.init'.
+
+ * include/idn/aliaslist.h, include/idn/converter.h,
+ lib/aliaslist.c, lib/converter.c: enable to add an alias
+ information item to either top or bottom of the alias information
+ list.
+
+2002-04-05
+ * include/idn/resconf.h, lib/resconf.c: add
+ idn_resconf_setdefaults().
+ * lib/resconf.c: call idn_converter_aliasfile() at parsing the
+ default alias information file automatically.
+ * include/idn/api.h, lib/api.c: modify api_nameinit() to enable to
+ choose initialization scheme.
+
+ * tools/idnconv/idnconv.c, tools/idnconv/idnconv.1: delete `-map',
+ `-normalize', `-prohibit' and `-unassigned' options.
+ * tools/idnconv/idnconv.c: use default configuration if `-noconf'
+ is specified.
+
+2002-04-04
+ * tools/idnconv/idnconv.1: fix obsolete description.
+ * tools/runidn/runidn.1: likewise.
+
+2002-04-02
+ * configure.in: add --enable-mdnkit-compat option.
+ * include/mdn/Makefile.in, include/mdn/api.h,
+ include/mdn/localencoding.h, include/mdn/log.h, include/mdn/res.h,
+ include/mdn/resconf.h, include/mdn/result.h, include/mdn/utf8.h,
+ include/mdn/version.h: re-added.
+ * include/Makefile.in: add `idn' to SUBDIRS.
+ * lib/Makefile.in, tools/idnconv/Makefile.in, tools/runidn/Makefile.in,
+ man/Makefile.in: support --enable-mdnkit-compat.
+ * lib/localencoding.c, lib/resconf.c: ditto.
+ * INSTALL: ditto.
+
+ * Makefile.in, include/Makefile.in, include/idn/Makefile.in,
+ include/mdn/Makefile, lib/Makefile.in, tools/Makefile.in,
+ tools/idnconv/Makefile.in, tools/runidn/Makefile.in,
+ man/Makefile.in, map/Makefile.in: support DESTDIR and distclean.
+
+2002-03-28
+ * include/idn/api.h: enclose the contents with `extern "C" {...}'
+ if C++ compiler is used.
+
+2002-03-27
+ * man/Makefile.in: generate and install idnrc.5.
+ * man/idn.conf.5.in: describe the user configuration file ~/.idnrc.
+
+ * tools/idnconv/idnconv.1: add missing description of -nolengthcheck,
+ -noasciicheck and -noroundtrip options.
+
+ * lib/checker.c, lib/mapper.c, lib/normalizer.c,
+ lib/idn.conf.sample.in, tools/idnconv/idnconv.1, man/idn.conf.5.in:
+ Add nameprep-08 support, and delete -05 and -07 instead.
+
+2002-03-26
+ * idnkit 1.0beta1 release.
+
+ * NEWS: add description about Major changes in mDNkit 2.3, 2.3.1,
+ 2.4.
+ * NEWS: add description about Major changes in idnkit
+ version1.0beta1.
+
+2002-03-25
+ * DISTFILES: add bind-8.3.1-patch and bind-9.2.0-patch.
+ delete bind-9.1.3-patch.
+
+2002-03-22
+ * lib/mapselector.c: fix a bug in handling of the special TLD `-'.
+
+2002-03-20
+ * lib/converter.c: fix a bug in idn_converter_convtoucs4().
+
+ * lib/res.c: fix a bug that IDN_LENCHECK overlook an empty label
+ generated by nameprep-map or localmap (e.g. "XXX.\u{200b}").
+ * lib/res.c: fix a bug that libidnkit aborts when it decodes "."
+
+ * lib/Makefile.in, tools/runidn/Makefile.in: change library
+ version.
+ * include/idn/version.h: set version `1.0beta1'.
+
+ * configure, configure.in: modify some error messages.
+
+2002-03-19
+ * man/idn.conf.5.in, lib/idn.conf.sample.in, tools/idnconv/idnconv.1:
+ delete DUDE from a list of supported encodings.
+
+ * lib/aliaslist.c, lib/debug.c, lib/strhash.c, lib/ucs4.c: they are
+ private modules.
+
+ * include/idn/resolver.h: moved to tools/runidn/resolver.h.
+
+ * tools/runidn/Makefile.in, tools/idnconv/Makefile.in:
+ insert `-I$(srcdir)' into INCS.
+
+2002-03-18
+ * aclocal.m4, configure, configure.in, include/config.h.in,
+ Makefile.in, map/Makefile.in, src/lib/idn.conf.sample.in,
+ tools/idnconv/selectiveencode.h: replace `MDN' with `IDN'.
+
+ * lib/aliaslist.c: change WARNING message into INFO message when
+ idn_aliaslist_aliasfile() finds an error in alias information
+ file.
+ * lib/resconf.c: change user configuration file name.
+ * lib/resconf.c: add procedure to check the existence of default
+ alias information file before letting converter parse the file.
+ * lib/resconf.c: call idn_converter_aliasfile() even when basic
+ configuration files are not found at all.
+
+ * tools/idnconv/idnconv.c: use hexadecimal numbers for values
+ associated with FLAGS_ macros.
+
+ * include/idn/result.h, lib/result.c: rename `idn_too_long' to
+ `idn_invalid_length'.
+ * lib/res.c: In IDN_LENCHECK, return `idn_invalid_length' for an
+ empty label, but return `idn_success'' for the "." domain name.
+
+ * lib/converter.c: DUDE is now extra ACE.
+
+ * lib/mapselector.c, include/idn/mapselector.h: change types of
+ `idn_mapselector_no_tld' and `idn_mapselector_default' from
+ (const unsigned long []) to (const unsigned long *).
+
+ * DISTFILES: syncronize current source structure.
+
+2002-03-14
+ * configure, configure.in, include/config.h.in: add
+ `--enable-runidn' option to configure script. Unless the value
+ for this option is set to `yes', runidn command will not be
+ complied and installed.
+
+2002-03-13
+ * man/libidnkit.3.in: describe new idnkit API.
+ * man/idn.conf.5.in: use the term `internationalized' rather than
+ `multilingual'.
+ * lib/Makefile.in: create idnalias.conf.sample correctly even if
+ the object directory is different from the source directory.
+
+2002-03-12
+ * configure, configure.in, lib/Makefile.in: add
+ `--enable-liteonly' option to configure script and change
+ description of lib/Makefile.in for designating compilation and
+ installation of libidnkitlite alone.
+
+2002-03-08
+ * mDNkit is now renamed to idnkit. Also files, directories,
+ commands and function names are renamed (e.g. mdnconv -> idnconv).
+
+2002-03-07
+ * include/mdn/nameprep.h, lib/nameprep.c, lib/resconf.c: enable
+ libmdn(lite) to run without configuration file and alias file, and
+ also enable to support user configuration file.
+
+2002-03-05
+ * include/mdn/aliaslist.h, lib/aliaslist.c: change year
+ description to `2002' in copyright notice.
+ * lib/aliaslist.c: fix the initialization scheme of structure's
+ members at creation of both list item and list itself.
+ * lib/aliaslist.c: fix the order of function free() call when
+ an error occurs at list item creation.
+ * make.wnt: remove descriptions related to mdnsproxy.
+
+2002-03-04
+ * include/mdn/aliaslist.h, include/mdn/amcacez.h, include/mdn/assert.h,
+ include/mdn/checker.h, include/mdn/converter.h, include/mdn/debug.h,
+ include/mdn/delimitermap.h, include/mdn/dude.h,
+ include/mdn/filechecker.h, include/mdn/filemapper.h,
+ include/mdn/localencoding.h, include/mdn/log.h, include/mdn/logmacro.h,
+ include/mdn/mapper.h, include/mdn/mapselector.h,
+ include/mdn/nameprep.h, include/mdn/normalizer.h, include/mdn/race.h,
+ include/mdn/res.h, include/mdn/resconf.h, include/mdn/resolver.h,
+ include/mdn/result.h, include/mdn/strhash.h, include/mdn/ucs4.h,
+ include/mdn/ucsmap.h, include/mdn/ucsset.h, include/mdn/unicode.h,
+ include/mdn/unormalize.h, include/mdn/utf8.h, include/mdn/util.h,
+ include/mdn/version.h: enclose the contents with `extern "C" {...}'
+ if C++ compiler is used.
+ * DISTFILES, Makefile.in, configure, configure.in:
+ remove descriptions related to mdnsproxy.
+
+2002-03-01
+ * include/mdn/result.h, lib/result.h: define new error code
+ `mdn_too_long'.
+ * lib/res.c: return `mdn_too_long' if MDN_LENCHECK is failed.
diff --git a/contrib/idn/idnkit-1.0-src/DISTFILES b/contrib/idn/idnkit-1.0-src/DISTFILES
new file mode 100644
index 0000000..f0bc02e
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/DISTFILES
@@ -0,0 +1,191 @@
+# $Id: DISTFILES,v 1.1.1.1 2003/06/04 00:25:02 marka Exp $
+README
+README.ja
+INSTALL
+INSTALL.ja
+ChangeLog
+DISTFILES
+LICENSE.txt
+Makefile.in
+NEWS
+make.wnt
+acconfig.h
+aclocal.m4
+config.guess
+config.sub
+ltconfig
+ltmain.sh
+configure.in
+configure
+install-sh
+mkinstalldirs
+include/Makefile.in
+include/config.h.in
+include/config.h.win
+include/idn/Makefile.in
+include/idn/aliaslist.h
+include/idn/api.h
+include/idn/assert.h
+include/idn/checker.h
+include/idn/converter.h
+include/idn/debug.h
+include/idn/delimitermap.h
+include/idn/export.h
+include/idn/filechecker.h
+include/idn/filemapper.h
+include/idn/localencoding.h
+include/idn/log.h
+include/idn/logmacro.h
+include/idn/mapper.h
+include/idn/mapselector.h
+include/idn/nameprep.h
+include/idn/normalizer.h
+include/idn/punycode.h
+include/idn/race.h
+include/idn/res.h
+include/idn/resconf.h
+include/idn/result.h
+include/idn/strhash.h
+include/idn/ucs4.h
+include/idn/ucsmap.h
+include/idn/ucsset.h
+include/idn/unicode.h
+include/idn/unormalize.h
+include/idn/utf8.h
+include/idn/util.h
+include/idn/version.h
+include/mdn/Makefile.in
+include/mdn/api.h
+include/mdn/localencoding.h
+include/mdn/log.h
+include/mdn/res.h
+include/mdn/resconf.h
+include/mdn/result.h
+include/mdn/utf8.h
+include/mdn/version.h
+lib/Makefile.in
+lib/aliaslist.c
+lib/api.c
+lib/checker.c
+lib/converter.c
+lib/debug.c
+lib/delimitermap.c
+lib/filechecker.c
+lib/filemapper.c
+lib/localencoding.c
+lib/log.c
+lib/make.wnt
+lib/mapper.c
+lib/mapselector.c
+lib/nameprep.c
+lib/nameprep_template.c
+lib/nameprepdata.c
+lib/normalizer.c
+lib/punycode.c
+lib/race.c
+lib/res.c
+lib/resconf.c
+lib/result.c
+lib/strhash.c
+lib/ucs4.c
+lib/ucsmap.c
+lib/ucsset.c
+lib/unicode.c
+lib/unicode_template.c
+lib/unicodedata_320.c
+lib/unormalize.c
+lib/utf8.c
+lib/util.c
+lib/version.c
+lib/idn.conf.sample.in
+lib/aliaslist.sh
+lib/tests/Makefile.in
+lib/tests/api-init1.tsy
+lib/tests/api-init2.tsy
+lib/tests/api-init3.tsy
+lib/tests/api-init4-1.tsy
+lib/tests/api-init4-2.tsy
+lib/tests/api-init4-3.tsy
+lib/tests/api-init5-1.tsy
+lib/tests/api-init5-2.tsy
+lib/tests/api-init5-3.tsy
+lib/tests/api.tsy
+lib/tests/checker.tsy
+lib/tests/codeset.h
+lib/tests/converter.tsy
+lib/tests/delimitermap.tsy
+lib/tests/iconvchk.c
+lib/tests/mapper.tsy
+lib/tests/mapselector.tsy
+lib/tests/nameprep.tsy
+lib/tests/normalizer.tsy
+lib/tests/res.tsy
+lib/tests/resconf.tsy
+lib/tests/setenv.c
+lib/tests/setenv.h
+lib/tests/testsuite.c
+lib/tests/testsuite.h
+lib/tests/testutil.c
+lib/tests/testutil.h
+lib/tests/testygen
+lib/tests/ucs4.tsy
+lib/tests/utffilter
+tools/Makefile.in
+tools/idnconv/Makefile.in
+tools/idnconv/make.wnt
+tools/idnconv/idnconv.c
+tools/idnconv/selectiveencode.c
+tools/idnconv/selectiveencode.h
+tools/idnconv/util.c
+tools/idnconv/util.h
+tools/idnconv/idnconv.1
+tools/idnconv/idnslookup.in
+tools/make.wnt
+tools/rpm/idnkit.spec
+tools/runidn/Makefile.in
+tools/runidn/resolver.c
+tools/runidn/resolver.h
+tools/runidn/stub.c
+tools/runidn/stub.h
+tools/runidn/runidn.1
+tools/runidn/runidn.in
+man/Makefile.in
+man/libidnkit.3.in
+man/idn.conf.5.in
+patch/bind9/bind-9.2.1-patch
+patch/bind9/bind-9.2.2-patch
+win/README.WIN
+wsock/README.txt
+wsock/README_j.txt
+wsock/make.wnt
+wsock/common/checkdll.c
+wsock/common/convert.c
+wsock/common/dump.c
+wsock/common/encoding.c
+wsock/common/hook.c
+wsock/common/make.wnt
+wsock/common/printf.c
+wsock/common/wrapcommon.h
+wsock/config/make.wnt
+wsock/config/idnconf.tcl
+wsock/wsock11/dlldef.h
+wsock/wsock11/dllfunc.c
+wsock/wsock11/dllload.c
+wsock/wsock11/dllmain.c
+wsock/wsock11/dllstub.c
+wsock/wsock11/make.wnt
+wsock/wsock11/wsock32.def
+wsock/wsock20/dlldef.h
+wsock/wsock20/dllfunc.c
+wsock/wsock20/dllload.c
+wsock/wsock20/dllmain.c
+wsock/wsock20/dllstub.c
+wsock/wsock20/make.wnt
+wsock/wsock20/ws2_32.def
+util/Makefile
+util/SparseMap.pm
+util/UCD.pm
+util/generate_nameprep_data.pl
+util/generate_normalize_data.pl
+map/Makefile.in
+map/jp.map
diff --git a/contrib/idn/idnkit-1.0-src/INSTALL b/contrib/idn/idnkit-1.0-src/INSTALL
new file mode 100644
index 0000000..6257f65
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/INSTALL
@@ -0,0 +1,309 @@
+
+ idnkit
+ Compilation and Installation
+ Japan Network Information Center (JPNIC)
+
+
+This file explains how to compile and install the source package.
+These procedures take the following steps:
+
+ + Prerequisite: making iconv() available
+ + System Configuration: running `configure' script
+ + Compilation: running `make'
+ + Test: running `make test' (optional)
+ + Installation: running `make install'
+ + Site Configuration: tailoring `idn.conf'
+ + Configuration Check (optional)
+ + Clean up (optional)
+
+See also the following section if you'd like to apply patch and install
+BIND9.
+
+ + Applying patches
+
+0. Prerequisite
+
+If you want to install generic idnkit library with code conversion
+support, and also if your system's library does not have iconv()
+function, which is a general codeset conversion utility, install iconv
+as an external library. You also need external library if the
+system's implementation cannot handle UTF-8 encoding, or it doesn't
+support some encodings which your client applications uses.
+
+You can get a free version of iconv() implementation (under LGPL
+license, aka GNU libiconv) from:
+
+ ftp://ftp.gnu.org/gnu/libiconv/
+ and mirrors of that site.
+
+But if you don't want code conversion support and you want to install
+idnkitlite library without iconv support alone, you have not install
+external library. Instead, set `--enable-liteonly' value to "yes" at
+configure script execution.
+
+
+1. Running configure script
+
+Run `configure' script in the top directory. This checks various
+characteristics of your system and it will create Makefiles and
+config.h appropriate for your system.
+
+ % ./configure
+
+`configure' accepts many options. Here is a list of some important
+options.
+
+ --prefix=PREFIX
+ Specifies the prefix of install directories of idnkit. The
+ default is /usr/local.
+
+ --enable-runidn
+ Build `runidn' command. The default is "no".
+
+ You cannot set this option "yes" when `--enable-liteonly' is
+ also set "yes".
+
+ --with-libiconv=LIBICONV_PREFIX
+ If you have installed GNU libiconv and would like to link it
+ to idnkit, specify this option. The argument LIBICONV_PREFIX
+ is install prefix of GNU libiconv. If the argument is omitted,
+ PREFIX (derived from --prefix=PREFIX option) is assumed.
+
+ --with-libiconv is shorthand option for GNU libiconv.
+
+ --with-libiconv=/usr/local
+
+ This is equivalent to:
+
+ --with-iconv-include='-I/usr/local/include'
+ --with-iconv='-L/usr/local/lib -R/usr/local/lib -liconv'
+
+ If both the shorthand option (--with-libiconv) and longhand
+ options (--with-iconv-include and/or --with-iconv) are specified,
+ the longhand options have priority.
+
+ You cannot set this option when --enable-liteonly is set
+ "yes", because libidnkitlite library doesn't need iconv
+ support.
+
+ --with-iconv-include=ICONV_INCDIR
+ If the header file "iconv.h" resides in a directory where your
+ C compiler doesn't search by default, specify the directory as
+ DIR like this:
+
+ --with-iconv-include=/usr/local/include
+
+ You cannot set this option when `--enable-liteonly' is set
+ "yes", because libidnkitlite library doesn't need iconv
+ support.
+
+ --with-iconv=ICONV_LIB
+ If your libc doesn't contain iconv(), specify the library
+ that contains iconv(). For example, if iconv() is libiconv
+ in /usr/local/lib, you should specify:
+
+ --with-iconv="-L/usr/local/lib -liconv"
+
+ Note that if the library is a shared one, you might also want
+ to specify -R option, like:
+
+ --with-iconv="-L/usr/local/lib -R/usr/local/lib -liconv"
+
+ You cannot set this option when `--enable-liteonly' is set
+ "yes", because libidnkitlite library doesn't need iconv
+ support.
+
+ --with-iconv-sofile=SOFILE_PATH
+ The runidn command in this kit needs to know the pathname of
+ shared library file that contains iconv(), if iconv() is not
+ part of libc. idnkit tries to find out the pathname from the
+ informaiton provided by `--with-iconv' option described above.
+ But when it fails, you have to specify it with this option,
+ like:
+
+ --with-iconv-sofile=/usr/local/lib/libiconv.so.2.0
+
+ You cannot set this option when `--enable-liteonly' is set
+ "yes", because libidnkitlite library doesn't need iconv
+ support.
+
+ --with-utf8=UTF8_NAME
+ If your iconv() (precisely, iconv_open()) does not accept
+ "UTF-8" as the name of UTF-8 encoding, specify the name for
+ it. For example if your iconv() uses "utf8" instead, you
+ should specify:
+
+ --with-utf8=utf8
+
+
+2. Other configure options
+
+The configure script has many other options though they are not widely
+used:
+
+ --exec-prefix=EXEC_PREFIX
+ Specifies the prefix of install directories for machine-specific
+ files. The default is PREFIX (derived from `--prefix=PREFIX'
+ and its default is /usr/local).
+
+ --bindir=BINDIR
+ Specifies the install directory for idnconv and runidn.
+ The default is EXEC_PREFIX/bin.
+
+ --libdir=LIBDIR
+ Specifies the install directory for the libraries (libidnkit
+ and libidnkitlite). The default is EXEC_PREFIX/lib.
+
+ --includedir=INCDIR
+ Specifies the install directory for the header files of the
+ libraries. The default is PREFIX/include.
+
+ --sysconfdir=SYSCONFDIR
+ Specifies the install directory for sample configuration files
+ of the libraries. The default is PREFIX/etc.
+
+ --mandir=MANDIR
+ Specifies the base install directory for online manuals.
+ The default is PREFIX/man.
+
+ --datadir=DATADIR
+ Specifies the base install directory for machine independent
+ data files. The default is PREFIX/share. Some data files for
+ idnkit will be put under the DATADIR/idnkit directory.
+
+ --enable-debug
+ Enable debugging codes. The fault is "no".
+
+ --enable-shared
+ Build shared library. The fault is "yes".
+
+ --enable-static
+ Build static library. The fault is "yes".
+
+ --enable-liteonly
+ Build the `libidnlkitite' library only. Do not build the
+ `libidnkit' library, idnconv and runidn. The fault is "no".
+
+ If you want to set "yes" to this option, you cannot specify it
+ together with `--enable-runidn', `--with-libiconv',
+ `--with-iconv-include', `--with-iconv' or `--with-iconv-sofile'.
+
+To see the list of available options, you should run it with --help
+option.
+
+ % ./configure --help
+
+
+3. Compiling
+
+Run `make' for compilation.
+
+ % make
+
+
+4. Test
+
+Optionally, type `make test' to compile and run test programs.
+Note that Perl 5 is required for comipilation of the test programs.
+
+ % make test
+
+The test programs assume that iconv() on the system recognizes the
+encoding name "EUC-JP" as Japanese EUC, and "SJIS" as Japanese Shift
+JIS. If iconv() on the system doesn't support the encoding name,
+please edit `lib/tests/codeset.h' before `make test'.
+
+*Note*
+ If you use standard iconv which is attached as default on Solaris,
+ converter's test "idn_converter_convfromucs4()" may fail. But it's
+ not the problem because the result is derived from the difference of
+ specification of iconv. So please ignore it if you run the test on
+ Solaris.
+
+
+5. Installation
+
+Run `make install' to install binaries and manuals. Don't forget to
+become a super-user before the installation.
+
+ % su
+ # make install
+
+*Note*
+ If you have installed pre-release versions of idnkit (such as 1.0pr1),
+ idnkit-1.0 may not work correctly because of the old configuration
+ file 'idn.conf'. If this is the case, you should overwrite existing
+ configuration files with the new ones by executing the following command
+ after 'make install'.
+
+ # make install-config
+
+
+6. Configuration and usage
+
+Edit the `idn.conf' configuation file if you'd like to cosutomize
+conversion/normalization rules of idnkit. Please refer the manual
+for `idn.conf' for details. A sample configuration (`idn.conf.sample')
+is also provided for your convenience.
+
+The sample configuration file has also been installed as `idn.conf'
+if it has not exist on your system.
+
+Also online manuals for `idnconv' and `runidn' commands are available.
+Please refer them for the usage and configuration of these commands.
+
+ % man idn.conf
+ % man idnconv
+ % man runidn
+
+
+7. Check your configuration
+
+A simple shell script `idnslookup' is available in the directory
+`tools/idnconv', with which you can make queries for internationalized
+domain names. It may help you check your configuration.
+
+The usage of `idnslookup' is:
+
+ % tools/idnconv/idnslookup <domain-name> <dns-server>
+
+Suppose that <domain-name> is an internationalized domain name written
+in the local codeset (see ``LOCAL CODESET'' in the `idn.conf' man page
+for details), and <dns-server> is a hostname or IP address of DNS
+server.
+
+`idnslookup' inquires <idn-domain-name> from <dns-server>, using
+`idnconv' and `nslookup' commands. If something is wrong, you will
+see an error message output by `idnconv', `nslookup' or `idnslookup'
+itself.
+
+
+8. Clean up
+
+Run `make clean' to delete files generated by `make' and `make test'
+from the idnkit source directory. (Files installed by `make install'
+are not removed.)
+
+ % make clean
+
+Run `make distclean' instead to also delete files generated by
+`configure'.
+
+ % make distclean
+
+After `make distclean', you can run `configure' and compile idnkit for
+another system using the source directory.
+
+
+Appendix A. Applying patches
+
+This distribution also contains patches for BIND9.
+The top of these patch files describe how to apply the patch and
+(re)install.
+
+Note that on Solaris, "patch" command that comes with the system
+sometimes doesn't work correctly. You may want to install the GNU
+version of the command (http://www.gnu.org/software/patch/) and use
+it.
+
+; $Id: INSTALL,v 1.1.1.1 2003/06/04 00:24:59 marka Exp $
diff --git a/contrib/idn/idnkit-1.0-src/INSTALL.ja b/contrib/idn/idnkit-1.0-src/INSTALL.ja
new file mode 100644
index 0000000..66778b6
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/INSTALL.ja
@@ -0,0 +1,310 @@
+
+ idnkit
+ $B%3%s%Q%$%k$H%$%s%9%H!<%k$NJ}K!(B
+ ($B<R(B) $BF|K\%M%C%H%o!<%/%$%s%U%)%a!<%7%g%s%;%s%?!<(B (JPNIC)
+
+
+$BK\%Q%C%1!<%8$N%3%s%Q%$%k$*$h$S%$%s%9%H!<%k$O!"<!$N$h$&$J%9%F%C%W$G9T(B
+$B$$$^$9!#(B
+
+ + $BA0=`Hw(B: iconv() $B$,MxMQ$G$-$k$h$&$K$9$k(B
+ + $B%7%9%F%`@_Dj(B: `configure' $B%9%/%j%W%H$N<B9T(B
+ + $B%3%s%Q%$%k(B: `make' $B$N<B9T(B
+ + $B%F%9%H(B: `make test' $B$N<B9T(B ($B>JN,2D(B)
+ + $B%$%s%9%H!<%k(B: `make install' $B$N<B9T(B
+ + $B%5%$%HKh$N@_Dj(B: `idn.conf' $B$K$h$k@_Dj(B
+ + $B@_Dj$N3NG'(B ($B>JN,2D(B)
+ + $B8eJRIU$1(B ($B>JN,2D(B)
+
+BIND9 $B$K%Q%C%A$rEv$F$F%$%s%9%H!<%k$7$?$$>l9g$O!"<!$N9`$b;2>H$7$F2<$5$$!#(B
+
+ + $B%Q%C%A$NEv$FJ}(B
+
+0. $BA0=`Hw(B
+
+$B$b$7$"$J$?$,%3!<%IJQ495!G=$r%5%]!<%H$7$?DL>o$N(B idnkit $B%i%$%V%i%j$r%$%s%9(B
+$B%H!<%k$9$k$D$b$j$G$"$j!"$^$?$"$J$?$,;HMQ$7$F$$$k%7%9%F%`$N%i%$%V%i%j$K(B
+iconv() $B$,$J$$>l9g!"$"$k$$$O$"$C$F$b(B UTF-8 $B$r07$&$3$H$,$G$-$J$$>l9g$K$O(B
+$B$"$i$+$8$a(B iconv() $B$r%$%s%9%H!<%k$7$F$*$$$F$/$@$5$$!#(Biconv() $B$O!"Nc$($P(B
+GNU libiconv $B$H8F$P$l$k%U%j!<(B (LGPL) $B$N<BAu$,(B
+
+ ftp://ftp.gnu.org/gnu/libiconv/
+ $B$^$?$O$=$N%_%i!<%5%$%H(B
+
+$B$+$iF~<j2DG=$G$9!#(B
+
+$B$?$@$7!"%3!<%IJQ49$rI,MW$H$;$:!"(Blite $B%P!<%8%g%s$N%i%$%V%i%j$N$_$r%$%s%9(B
+$B%H!<%k$9$k$N$G$"$l$P!"(Biconv() $B$r4^$`%i%$%V%i%j$OI,MW$"$j$^$;$s!#$=$N>l9g!"(B
+configure $B%9%/%j%W%H$N<B9T;~$K(B `--enable-liteonly' $B%*%W%7%g%s$NCM$r(B
+"yes" $B$K%;%C%H$7$F$/$@$5$$!#(B
+
+
+1. configure $B%9%/%j%W%H$N<B9T(B
+
+$B%H%C%W%G%#%l%/%H%j$K$"$k(B configure $B%9%/%j%W%H$r<B9T$7$F$/$@$5$$!#(B
+
+ % ./configure
+
+configure $B%9%/%j%W%H$K$O!"?tB?$/$N%*%W%7%g%s$,MQ0U$5$l$F$$$^$9!#$=$N$&(B
+$B$A=EMW$H;W$o$l$k$b$N$O<!$NDL$j$G$9!#(B
+
+ --prefix=PREFIX
+ idnkit $B$r%$%s%9%H!<%k$9$k%G%#%l%/%H%j$N%Q%9$r;XDj$7$^$9!#%G%U%)(B
+ $B%k%H$O(B /usr/local $B$G$9!#(B
+
+ --enable-runidn
+ runidn $B%3%^%s%I$r:n@.$7$F!"%$%s%9%H!<%k$7$^$9!#%G%U%)%k%H$O(B "no"
+ ($B:n@.$7$J$$(B) $B$G$9!#(B
+
+ --with-libiconv=LIBICONV_PREFIX
+ $B%$%s%9%H!<%k:Q$_$N(B GNU libiconv $B$r(B idnkit $B$K%j%s%/$5$;$k>l9g$O!"(B
+ $B$3$N%*%W%7%g%s$r;XDj$7$F2<$5$$!#0z?t(B LIBICONV_PREFIX $B$K$O!"(BGNU
+ libiconv $B$,%$%s%9%H!<%k$5$l$F$$$k0LCV$r;XDj$7$^$9!#0z?t$r>JN,(B
+ $B$9$k$H!"(BPREFIX (PREFIX $B$NCM$O(B --prefix=PREFIX $B$+$iF3=P$5$l$^$9(B)
+ $B$r;XDj$7$?$b$N$H8+$J$5$l$^$9!#(B
+
+ --with-libiconv $B$O(B GNU libiconv $BMQ$NC;=L7A$N%*%W%7%g%s$G(B
+
+ --with-libiconv=/usr/local
+
+ $B$3$l$O<!$HEy2A$K$J$j$^$9!#(B
+
+ --with-iconv-include='-I/usr/local/include'
+ --with-iconv='-L/usr/local/lib -R/usr/local/lib -liconv'
+
+ $BC;=L7A$N%*%W%7%g%s(B (--with-libiconv) $B$HDL>oMQ$N%*%W%7%g%s(B
+ (--with-iconv-include, --with-iconv) $B$rN>J}$H$b;XDj$7$?>l9g$O!"(B
+ $BDL>oMQ$N%*%W%7%g%s$[$&$,M%@h$5$l$^$9!#(B
+
+ $B$3$N%*%W%7%g%s$O(B --enable-liteonly $B$r(B "yes" $B$K$7$?>l9g$O;XDj$9$k(B
+ $B$3$H$O$G$-$^$;$s!#$3$l$O!"(Blibidnkitlite $B%i%$%V%i%j$,(B iconv $B%5%]!<(B
+ $B%H$rI,MW$H$7$J$$$?$a$G$9!#(B
+
+ --with-iconv-include=ICONV_INCDIR
+ C $B%3%s%Q%$%i$,DL>o$G$O8!:w$7$J$$%G%#%l%/%H%j$K(B "iconv.h" $B$,CV(B
+ $B$+$l$F$$$k>l9g!"<!$N$h$&$K$7$F$=$N%G%#%l%/%H%j$r;XDj$7$^$9!#(B
+
+ --with-iconv-include=/usr/local/include
+
+ $B$3$N%*%W%7%g%s$O(B --enable-liteonly $B$r(B "yes" $B$K$7$?>l9g$O;XDj$9$k(B
+ $B$3$H$O$G$-$^$;$s!#$3$l$O!"(Blibidnkitlite $B%i%$%V%i%j$,(B iconv $B%5%]!<(B
+ $B%H$rI,MW$H$7$J$$$?$a$G$9!#(B
+
+ --with-iconv=ICONV_LIB
+ libc $B$K(B iconv $B$,F~$C$F$$$J$$>l9g(B ($B>e5-$N%Q%C%1!<%8$rF~$l$?(B
+ $B>l9g$J$I(B) $B$K!"(Biconv $B$N%i%$%V%i%j$r;XDj$7$^$9!#Nc$($P(B
+
+ --with-iconv="-L/usr/local/lib -liconv"
+
+ $B$N$h$&$K;XDj$7$^$9!#$b$7(B iconv $B$,6&M-%i%$%V%i%j$K$J$C$F$$$k(B
+ $B>l9g$K$O!"(B-R $B%*%W%7%g%s$b;XDj$7$F(B
+
+ --with-iconv="-L/usr/local/lib -R/usr/local/lib -liconv"
+
+ $B$H$9$kI,MW$,$"$k$+$b$7$l$^$;$s!#(B
+
+ $B$3$N%*%W%7%g%s$O(B --enable-liteonly $B$r(B "yes" $B$K$7$?>l9g$O;XDj$9$k(B
+ $B$3$H$O$G$-$^$;$s!#$3$l$O!"(Blibidnkitlite $B%i%$%V%i%j$,(B iconv $B%5%]!<(B
+ $B%H$rI,MW$H$7$J$$$?$a$G$9!#(B
+
+ --with-iconv-sofile=SOFILE_PATH
+ idnkit $B$K4^$^$l$F$$$k(B runidn $B%3%^%s%I$O!"(Biconv() $B$,(B libc $B$N0l(B
+ $BIt$H$7$FDs6!$5$l$J$$$H$-$K!"(Biconv() $B$r4^$`6&M-%i%$%V%i%j$X$N%Q(B
+ $B%9L>$rCN$kI,MW$,$"$j$^$9!#(Bidnkit $B$O!"(B--with-iconv $B%*%W%7%g%s$N(B
+ $B5-=R$r4p$K%Q%9L>$r8!:w$7$^$9$,!"$3$l$K<:GT$7$?$H$-$K!"0J2<$N$h(B
+ $B$&$K6&M-%i%$%V%i%j$r;XDj$9$k$3$H$,$G$-$^$9!#(B
+
+ --with-iconv-sofile=/usr/local/lib/libiconv.so.2.0
+
+ $B$3$N%*%W%7%g%s$O(B --enable-liteonly $B$r(B "yes" $B$K$7$?>l9g$O;XDj$9$k(B
+ $B$3$H$O$G$-$^$;$s!#$3$l$O!"(Blibidnkitlite $B%i%$%V%i%j$,(B iconv $B%5%]!<(B
+ $B%H$rI,MW$H$7$J$$$?$a$G$9!#(B
+
+ --with-utf8=UTF8_NAME
+ iconv $B$K(B utf-8 $B%(%s%3!<%G%#%s%0$r;XDj$9$k>l9g!"K\%i%$%V%i%j$O(B
+ $B%G%U%)%k%H$G$O(B "UTF-8" $B$H$$$&L>A0$r;XDj$7$^$9!#$b$7$"$J$?$N(B
+ $B%7%9%F%`$N(B iconv $B$,(B "UTF-8" $B$H$$$&L>A0$r<u$1IU$1$J$$>l9g$K$O!"(B
+ $BBe$j$NL>A0$r;XDj$7$^$9!#Nc$($P(B "UTF-8" $B$G$O$J$/(B "utf8" $B$N(B
+ $B>l9g$K$O<!$N$h$&$K;XDj$7$^$9!#(B
+
+ --with-utf8=utf8
+
+
+2. $B$=$NB>$N(B configure $B$N%*%W%7%g%s(B
+
+$B$=$l$[$I$h$/;H$&$o$1$G$O$"$j$^$;$s$,!"(Bconfigure $B$K$OA09`$N$b$N0J30$K(B
+$B$bMM!9$J%*%W%7%g%s$,MQ0U$5$l$F$$$^$9!#(B
+
+ --exec-prefix=EXEC_PREFIX
+ $B%^%7%s8GM-$N%U%!%$%k$r%$%s%9%H!<%k$9$k%G%#%l%/%H%j$N%Q%9$r;XDj(B
+ $B$7$^$9!#%G%U%)%k%H$O(B PREFIX (``--prefix=PREFIX'' $B$K$h$C$F;XDj(B
+ $B2DG=!"(BPREFIX $B$N%G%U%)%k%H$O(B /usr/local) $B$K$J$j$^$9!#(B
+
+ --bindir=BINDIR
+ idnconv $B$H(B runidn $B$r%$%s%9%H!<%k$9$k%G%#%l%/%H%j$r;XDj$7$^$9!#(B
+ $B%G%U%)%k%H$G$O(B EXEC_PREFIX/bin $B$G$9!#(B
+
+ --libdir=LIBDIR
+ $B%i%$%V%i%j(B (libidnkit $B$*$h$S(B libidnkitlite) $B$r%$%s%9%H!<%k$9$k(B
+ $B%G%#%l%/%H%j$r;XDj$7$^$9!#%G%U%)%k%H$G$O(B EXEC_PREFIX/lib $B$G$9!#(B
+
+ --includedir=INCDIR
+ $B%i%$%V%i%j$N%X%C%@%U%!%$%k$r%$%s%9%H!<%k$9$k%G%#%l%/%H%j$r;XDj(B
+ $B$7$^$9!#%G%U%)%k%H$G$O(B PREFIX/include $B$G$9!#(B
+
+ --sysconfdir=SYSCONFDIR
+ $B%i%$%V%i%j$N@_Dj%U%!%$%k$N%5%s%W%k$r%$%s%9%H!<%k$9$k%G%#%l%/%H(B
+ $B%j$r;XDj$7$^$9!#%G%U%)%k%H$G$O(B PREFIX/etc $B$G$9!#(B
+
+ --mandir=MANDIR
+ $B%*%s%i%$%s%^%K%e%"%k$N%$%s%9%H!<%k%G%#%l%/%H%j$r;XDj$7$^$9!#(B
+ $B%G%U%)%k%H$G$O(B PREFIX/man $B$G$9!#(B
+
+ --datadir=DATADIR
+ $B0[$J$k%^%7%s$G6&M-2DG=$J%U%!%$%k$r%$%s%9%H!<%k$9$k%G%#%l%/%H%j(B
+ $B$r;XDj$7$^$9!#%G%U%)%k%H$O(B PREFIX/share $B$G$9!#(BDATADIR/idnkit
+ $B$N2<$K!"(Bidnkit $B$G;HMQ$9$k4v$D$+$N%G!<%?%U%!%$%k$,%$%s%9%H!<%k(B
+ $B$5$l$^$9!#(B
+
+ --enable-debug
+ $B%G%P%C%0MQ$N%3!<%I$rM-8z$K$7$^$9!#%G%U%)%k%H$O(B "no" ($BL58z(B) $B$G$9!#(B
+
+ --enable-shared
+ $B6&M-%i%$%V%i%j$r:n@.$7$^$9!#%G%U%)%k%H$O(B "yes" ($B:n@.$9$k(B) $B$G$9!#(B
+
+ --enable-static
+ $B@EE*%i%$%V%i%j$r:n@.$7$^$9!#%G%U%)%k%H$O(B "yes" ($B:n@.$9$k(B) $B$G$9!#(B
+
+ --enable-liteonly
+ libidnkitlite $B%i%$%V%i%j$N$_$r:n@.$7$^$9!#(Blibidnkit $B%i%$%V%i%j!"(B
+ idnconv, runidn $B$O:n@.$7$^$;$s!#%G%U%)%k%H$O(B "no" ($B$=$l0J30$N(B
+ $B$b$N$b:n@.$9$k(B) $B$G$9!#(B
+
+ $B$3$N%*%W%7%g%s$NCM$r(B "yes" $B$K$9$k>l9g!"(B `--enable-runidn'
+ `--with-libiconv' `--with-iconv-include' `--with-iconv'
+ `--with-iconv-sofile' $B$OF1;~$K;XDj$9$k$3$H$O$G$-$^$;$s!#(B
+
+configure $B$K$OB>$K$bB?$/$N%*%W%7%g%s$,$"$j$^$9$,!";D$j$O0lHLE*$J%*%W%7%g(B
+$B%s$J$N$G@bL@$O>J$-$^$9!#(B
+
+ % ./configure --help
+
+$B$r<B9T$9$k$H%*%W%7%g%s$N0lMw$,I=<($5$l$^$9!#(B
+
+
+3. $B%3%s%Q%$%k(B
+
+configure $B$r<B9T$9$k$H(B Makefile $B$J$I$,@8@.$5$l$^$9$N$G!"B3$1$F(B make$B$r(B
+$B<B9T$7$F%3%s%Q%$%k$7$^$9!#(B
+
+ % make
+
+
+4. $B%F%9%H(B
+
+$B%F%9%H%W%m%0%i%`$r%3%s%Q%$%k$7!"<B9T$9$k$K$O(B `make test' $B$r<B9T$7$^$9(B
+($B>JN,$7$F$b9=$$$^$;$s(B)$B!#%F%9%H%W%m%0%i%`$N%3%s%Q%$%k$K$O!"(BPerl 5 $B$,I,(B
+$BMW$G$9!#(B
+
+ % make test
+
+$B$J$*!"(Biconv() $B$,(B "EUC-JP" $B$rF|K\8l(B EUC $B$N%(%s%3!<%G%#%s%0L>>N$H$7$FG'(B
+$B<1$7!"(B"SJIS" $B$rF|K\8l%7%U%H(B JIS $B$N%(%s%3!<%G%#%s%0L>>N$H$7$FG'<1$9$k$3(B
+$B$H$r!"%F%9%H%W%m%0%i%`$G$OA0Ds$H$7$F$$$^$9!#$b$7!"G'<1$7$J$$$h$&$G$"$l(B
+$B$P!"(B`make test' $B<B9TA0$K(B `lib/tests/codeset.h' $B$rJT=8$7$F2<$5$$!#(B
+
+*$BCm0U(B*
+ Solaris $B$K$*$$$F(B OS $BI8=`$N(B iconv $B$r;HMQ$7$F$$$k>l9g!"(Bconverter $B$N(B
+ idn_converter_convfromucs4() $B$N%F%9%H$,<:GT$9$k$3$H$,$"$j$^$9!#$3$l(B
+ $B$O(B iconv $B$N;EMM$N0c$$$K$h$k$b$N$J$N$G!">e5-4D6-$K$*$$$F%$%s%9%H!<%k(B
+ $B$r9T$C$F$$$k>l9g$OL5;k$7$F$/$@$5$$!#(B
+
+
+5. $B%$%s%9%H!<%k(B
+
+$B%9!<%Q%f!<%6$K$J$C$F%$%s%9%H!<%k$7$^$9!#(B
+
+ % su
+ # make install
+
+*$BCm0U(B*
+ idnkit $B$N(B 1.0 $B0JA0$N%P!<%8%g%s(B (1.0pr1 $B$J$I(B) $B$,$9$G$K%$%s%9%H!<%k$5(B
+ $B$l$F$$$k>l9g!"%$%s%9%H!<%k$5$l$?@_Dj%U%!%$%k(B 'idn.conf' $B$NFbMF$,8E$$(B
+ $B$?$a!"(Bidnkit-1.0$B$,@5$7$/F0:n$7$^$;$s!#$3$N$?$a!"(Bidnkit-1.0 $BMQ$N@_Dj(B
+ $B%U%!%$%k$r>e=q$-%$%s%9%H!<%k$9$kI,MW$,$"$j$^$9!#(Bmake install $B<B9T8e!"(B
+ $B0J2<$N%3%^%s%I$r<B9T$7$F$/$@$5$$!#(B
+
+ # make install-config
+
+
+6. $B@_Dj$H;HMQJ}K!(B
+
+idnkit $B$N@55,2=$*$h$SJQ495,B'$r%+%9%?%^%$%:$7$9$k$J$i!"@_Dj%U%!%$%k(B
+`idn.conf' $B$rJT=8$7$^$9!#$3$N@_Dj%U%!%$%k$N>\:Y$K$D$$$F$O(B idn.conf $B$N(B
+$B%*%s%i%$%s%^%K%e%"%k$r$4Mw$/$@$5$$!#$^$?@_DjNc$,=q$+$l$?%5%s%W%k%U%!%$(B
+$B%k(B (idn.conf.sample) $B$b%$%s%9%H!<%k$5$l$^$9$N$G$4MxMQ$/$@$5$$!#(B
+
+$B%7%9%F%`$K@_Dj%U%!%$%k$,B8:_$7$J$+$C$?>l9g!"$3$N%5%s%W%k$N@_Dj%U%!%$%k(B
+$B$O(B `idn.conf' $B$H$7$F$b%$%s%9%H!<%k$5$l$^$9!#(B
+
+$B$^$?!"(Bidnconv$B!"(Brunidn $B$H$$$C$?%D!<%k$N%*%s%i%$%s%^%K%e%"%k$bDs6!$5$l$F(B
+$B$$$^$9!#$3$l$i$N%3%^%s%I$N;H$$J}!"@_DjJ}K!$K4X$7$F$O$=$A$i$r;2>H$7$F$/(B
+$B$@$5$$!#(B
+
+ % man idn.conf
+ % man idnconv
+ % man runidn
+
+
+7. $B@_Dj$N3NG'(B
+
+`idnslookup' $B$H$$$&4JC1$J%7%'%k%9%/%j%W%H$,(B tools/idnconv $B%G%#%l%/%H%j(B
+$B$KMQ0U$5$l$F$$$^$9!#$3$N%9%/%j%W%H$r;H$&$H(B DNS $B%5!<%P$KBP$7$F9q:]2=%I(B
+$B%a%$%sL>$rLd$$9g$o$;$k$3$H$,$G$-$^$9!#@_Dj%U%!%$%k$N3NG'$KLrN)$D$+$bCN(B
+$B$l$^$;$s!#(B
+
+`idnslookup' $B$N;HMQJ}K!$O!"<!$NDL$j$G$9!#(B
+
+ % tools/idnconv/idnslookup <domain-name> <dns-server>
+
+$B$3$3$G(B <domain-name> $B$O%m!<%+%k%3!<%I%;%C%H(B ($B>\$7$/$O(B idn.conf $B$N%^%K%e(B
+$B%"%k$N(B ``LOCAL CODESET'' $B$r;2>H$N$3$H(B) $B$G=q$+$l$?9q:]2=%I%a%$%sL>$G!"(B
+<dns-server> $B$O(B DNS $B%5!<%P$N%[%9%HL>$b$7$/$O(B IP $B%"%I%l%9$G$9!#(B
+
+`idnslookup' $B$O(B `idnconv' $B$*$h$S(B `nslookup' $B%3%^%s%I$rMQ$$$F!"(B
+<dns-server> $B$KBP$7$F(B <domain-name> $B$r0z$-$K9T$-$^$9!#@_Dj$K2?$+4V0c$$(B
+$B$,$"$l$P!"(B`idnconv', `nslookup', $B$"$k$$$O(B `idnslookup' $B<+?H$K$h$k%(%i!<(B
+$B%a%C%;!<%8$,=PNO$5$l$^$9!#(B
+
+
+8. $B8eJRIU$1(B
+
+`make' $B$*$h$S(B `make test' $B$K$h$C$F@8@.$5$l$?%U%!%$%k$r(B idnkit $B$N%=!<(B
+$B%9%G%#%l%/%H%j$+$i:o=|$9$k$K$O!"(B`make clean' $B$r<B9T$7$F2<$5$$!#(B
+(`make install' $B$N:]$K%$%s%9%H!<%k$5$l$?%U%!%$%k$O!":o=|$5$l$^$;$s!#(B)
+
+ % make clean
+
+`configure' $B$G@8@.$5$l$?%U%!%$%k$b0l=o$K:o=|$9$k$J$i!"Be$o$j$K(B `make
+distclean' $B$r<B9T$7$^$9!#(B
+
+ % make distclean
+
+`make distclean' $B$r9T$($P!"$3$N%=!<%9%G%#%l%/%H%j$r;H$C$F!"A02s$H$OJL(B
+$B$N%7%9%F%`8~$1$K(B `configure' $B$*$h$S(B idnkit $B$N%3%s%Q%$%k$r9T$&$3$H$,$G(B
+$B$-$k$h$&$K$J$j$^$9!#(B
+
+
+$BIUO?(B A. $B%Q%C%A$NEv$FJ}(B
+
+$B$3$NG[I[%-%C%H$K$O!"(BBIND9 $B$KBP$9$k%Q%C%A$,4^$^$l$F$$$^$9!#(B
+$B%Q%C%A$NEv$FJ}$O!"%Q%C%A%U%!%$%k$N@hF,$K=q$+$l$F$$$^$9$N$G$=$A$i$r;2>H(B
+$B$7$F$/$@$5$$!#(B
+
+Solaris $B$G$O!"%7%9%F%`IUB0$N(B patch $B%3%^%s%I$,@5>o$KF0:n$7$J$$$3$H$,$"(B
+$B$j$^$9!#$=$N$h$&$J>l9g$K$O!"(BGNU $B%P!<%8%g%s$N(B patch
+(http://www.gnu.org/software/patch/) $B$r%$%s%9%H!<%k$7$F!"$3$l$r;HMQ$7(B
+$B$F$/$@$5$$!#(B
+
+
+; $Id: INSTALL.ja,v 1.1.1.1 2003/06/04 00:25:00 marka Exp $
diff --git a/contrib/idn/idnkit-1.0-src/LICENSE.txt b/contrib/idn/idnkit-1.0-src/LICENSE.txt
new file mode 100644
index 0000000..1f1e0a0
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/LICENSE.txt
@@ -0,0 +1,39 @@
+Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved.
+
+By using this file, you agree to the terms and conditions set forth bellow.
+
+ LICENSE TERMS AND CONDITIONS
+
+The following License Terms and Conditions apply, unless a different
+license is obtained from Japan Network Information Center ("JPNIC"),
+a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+Chiyoda-ku, Tokyo 101-0047, Japan.
+
+1. Use, Modification and Redistribution (including distribution of any
+ modified or derived work) in source and/or binary forms is permitted
+ under this License Terms and Conditions.
+
+2. Redistribution of source code must retain the copyright notices as they
+ appear in each source code file, this License Terms and Conditions.
+
+3. Redistribution in binary form must reproduce the Copyright Notice,
+ this License Terms and Conditions, in the documentation and/or other
+ materials provided with the distribution. For the purposes of binary
+ distribution the "Copyright Notice" refers to the following language:
+ "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+
+4. The name of JPNIC may not be used to endorse or promote products
+ derived from this Software without specific prior written approval of
+ JPNIC.
+
+5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
diff --git a/contrib/idn/idnkit-1.0-src/Makefile.in b/contrib/idn/idnkit-1.0-src/Makefile.in
new file mode 100644
index 0000000..cf6d8c8
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/Makefile.in
@@ -0,0 +1,79 @@
+# $Id: Makefile.in,v 1.1.1.1 2003/06/04 00:25:03 marka Exp $
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+PERL = perl
+MKTARPKG = ../util/mktarpkg
+SHELL = @SHELL@
+
+SUBDIRS = include lib man tools map
+
+all: force all-subdirs
+test check: force test-subdirs
+install: force install-subdirs
+clean: force clean-subdirs
+distclean: force distclean-localdir distclean-subdirs
+
+distclean-localdir:
+ rm -f config.status config.cache config.log libtool Makefile
+
+all-subdirs install-subdirs clean-subdirs distclean-subdirs test-subdirs:
+ @target=`echo $@ | sed 's/-subdirs$$//'`; \
+ for d in $(SUBDIRS); do \
+ (cd $$d; $(MAKE) DESTDIR=$(DESTDIR) $$target); \
+ done
+
+install-config:
+ (cd lib; $(MAKE) install-config);
+
+dist: force
+ @v=`sed -ne '/^# *define *IDNKIT_VERSION/s/^.*"\([^"]*\)".*$$/\1/p' \
+ $(srcdir)/include/idn/version.h`; \
+ echo generate idnkit-$$v-src.tar.gz; \
+ cd $(srcdir); \
+ $(PERL) $(MKTARPKG) --gzip=9 idnkit-$$v-src
+
+force:
diff --git a/contrib/idn/idnkit-1.0-src/NEWS b/contrib/idn/idnkit-1.0-src/NEWS
new file mode 100644
index 0000000..52943ae
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/NEWS
@@ -0,0 +1,186 @@
+; $Id: NEWS,v 1.1.1.1 2003/06/04 00:25:03 marka Exp $
+
+Major changes in idnkit version 1.0:
+
+* Change ACE prefix of Punycode from 'zq--' to 'xn--'. And delete
+ configure's --with-punycode-prefix option.
+
+* Add NAMEPREP version RFC3491. Other versions of NAMEPREP are
+ removed.
+
+* Enable idnconv to handle a input line as long as memory permitted
+ when encoding/decoding.
+
+* unicode-form-c and unicode-form-c/3.2.0 are not supported.
+
+* Unicode 3.0.1 and Unicode 3.1.0 are not supported.
+
+* Delete BIND8, Squid and GNU libiconv patches.
+
+Major changes in idnkit version 1.0-pr2:
+
+* The license of idnkit is changed to a less restrictive one. See
+ LICENSE.txt for the new license.
+
+* The local codeset name used in the test suite, which is hard-coded
+ in the previous version, can be specified by a separate header file.
+
+* IDN encoding and decoding now always check the validity of the
+ result by performing roundtrip conversion check.
+
+Major changes in idnkit version 1.0-pr1:
+
+* Some test cases are added to the testsuite.
+
+* The testsuite can run on OpenBSD.
+
+Major changes in idnkit version 020829:
+
+* Testsuit is added for the library behavior check.
+ Testsuit and testcases are in lib/tests. Read INSTALL (INSTALL.ja)
+ for details. Tests aim at api, checker, converter, delimitermap,
+ mapper, mapselecter, normalizer, res, resconf, and ucs4 at the
+ moment.
+
+* "amcacez" module is renamed to "punycode".
+
+* AMC-ACE-Z and RACE are now treated as extra ACE.
+
+* Add "--with-utf8=NAME" option to configure script.
+
+Major changes in idnkit version 020730:
+
+* Complete bidi check support for NAMEPREP draft -11.
+
+* Type definitions of action flags for conversion APIs are changed
+ from int to idn_action_t.
+
+* Add -nobidicheck option to idnconv command.
+
+Major changes in idnkit version 020711:
+
+* Default delimiters are added according to IDNA-10.
+
+* ``delimiter-map'' entry in config file is removed.
+
+* Add Unicode version 3.2 support.
+
+* Add preliminary support of NAMEPREP draft -11.
+ This version supports NAMEPREP draft -11 without bidirectional label
+ check.
+
+* Supported NAMEPREP versions are changed.
+ idnkit supports NAMEPREP draft version -03, -10, and -11. Others
+ are removed.
+
+* IDN encoding DUDE is removed.
+
+* New action flags are available for conversion APIs.
+ IDN_ENCODE_QUERY, IDN_DECODE_QUERY, IDN_ENCODE_STORED, and
+ IDN_DECODE_STORED are newly created according to IDNA specification.
+ See include/idn/res.h for precise description.
+
+* Action flags IDN_ENCODE_APP, IDN_DECODE_APP and IDN_NAMEPREP change
+ those behavior.
+ See include/idn/res.h for precise description.
+
+* New decode APIs are created.
+ idn_decodename2() and idn_res_decodename2() are defined to add
+ conversion process from "IDN string encoded in local encoding" to
+ UTF-8 before actual decode process of IDN.
+
+* idnconv with -reverse option treats input as IDN string(s) encoded
+ in local encoding specified by -out option.
+
+* idnconv recognizes `-A' option which is synonym for `-noasciicheck'.
+
+* (Windows) idn Wrapper can run on Windows XP.
+
+* BIND-8 patch for BIND-8.3.3 is available and other patches of BIND-8
+ are removed.
+
+Major changes in idnkit version 1.0-rc1:
+
+* NAMEPREP draft -09 is supported.
+
+* idnconv now accepts any encodings specified as argument for `-in'
+ or `-out' option. `-out' accepts non-ACE, and `-in' accepts ACE.
+
+* In configuration file, `encoding-alias-file' entry is not supported
+ any longer. It is simply ignored.
+
+Major changes in idnkit version 1.0-beta2:
+
+* Supported nameprep version is changed.
+ Now idnkit supports nameprep-03, nameprep-06, and nameprep-08.
+ Nameprep-05 and nameprep-07 are not supported any more.
+
+* Compatibility with mDNkit is added.
+ This feature provides applications formerly written using mDNkit
+ library with some source level compatibilities. If you want to use
+ this feature, set `--enable-mdnkit-compat' option at execution time
+ of configure script.
+
+* Now idnkit can set up easily without configuration file.
+ As this feature is added, initialization function and some behavior
+ of top level API are changed.
+
+* BIND-8 patch supports IDN conversion in itself.
+
+* (Windows) idnkit library looks for configuration files with registry
+ information.
+
+* (Windows) idnkit library returns "CP<code page number>" as local
+ encoding name when the environment variable "IDN_LOCAL_CODESET" is
+ not set.
+
+* (Windows) libidnkit/libidnkitlite are now installed as DLL.
+
+* (Windows) idnconv can be executed as a console application.
+
+Major changes in idnkit version 1.0-beta1:
+
+* mDNkit has been renamed idnkit.
+ This means all symbols with "mdn" are renamed with "idn". For
+ example, a function `mdn_encodename()' is now `idn_encodename()', an
+ environment variable "MDN_DISABLE" is "IDN_DISABLE", system
+ configuretion file is "idn.conf", `runmdn' command is `runidn', and
+ so forth.
+
+* Also, library name has been changed to "libidnkit(lite)".
+
+* `mdnsproxy' command has been removed.
+
+* `runidn' (formerly known as `runmdn') command is not installed by
+ default.
+ If you want to install it, set "yes" to `--enable-runidn' option
+ when you run configure script.
+
+* idnkitlite library only instalation is supported.
+ Set "yes" to `--enable-liteonly' option at execution of configure
+ script to use this feature.
+
+* BIND-9.1.3 patch has been removed.
+
+* User configuration file is supported.
+ idnkit now uses ".idnrc" in user's home directory for configuration
+ of whole scheme. If there is no user configuration file, then it
+ tries to load the system configuration file "idn.conf".
+
+* idnkit is now able to run without configuration file.
+ If there are no configuration files (both of user's and system's),
+ it sets normal configurations (the latest nameprep scheme it
+ supports and the IDN encoding "Punycode") automatically at runtime.
+
+* Encoding alias information file is supported. (by generic libidnkit)
+ Its name is "idnalias.conf" by default and it should be located in
+ same directory where the system configuration file is. Example
+ alias information file "idnalias.conf.sample" is installed
+ automatically.
+
+* APIs are renewed. See manpage.
+
+* Now idnkit has full support of IDNA-07.
+
+* Internal representation of domain name is changed to UCS4 in place
+ of UTF-8.
diff --git a/contrib/idn/idnkit-1.0-src/README b/contrib/idn/idnkit-1.0-src/README
new file mode 100644
index 0000000..5923b77
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/README
@@ -0,0 +1,159 @@
+
+ idnkit
+ -- internationalized domain name toolkit --
+ version 1.0
+ Japan Network Information Center (JPNIC)
+
+
+Table of contents of this file:
+
+ 1. Overview
+ 2. Directory structure of this distribution
+ 3. Supported systems
+ 4. Contact information
+
+See the file INSTALL for compilation and installation instructions.
+See the file NEWS for a list of major changes in the current release.
+
+
+1. Overview
+
+idnkit, which was originally known as mDNkit, is a toolkit for handling
+internationalized domain names. To handle such names, the following
+features are required:
+
+ + Encoding conversion
+ Multilingualized domain names have to be converted from
+ the encoding application uses (local encoding) to
+ the encoding used for name resolution (IDN encoding), and
+ vice versa. Since domain names in IDN encoding just look
+ like good old ASCII domain names, the encoding is also known
+ as ASCII-compatible encoding (ACE).
+
+ + NAMEPREP
+ Name preparation of domain names before converting to
+ IDN encoding. Basically this is a normalization process
+ of the domain names.
+
+These conversion/nameprep processes to domain names have to be
+performed before they are sent to DNS servers. And since the
+processed domain names (in IDN encoding) consist of only legal ASCII
+characters, no changes are required to DNS servers.
+
+idnkit provides several ways for adding these features.
+
+This kit consists of following components.
+
+ + library for handling internationalized domain names
+ (libidnkit, libidnkitlite)
+ Those libraries implement encoding conversion and nameprep.
+ They provide easy-to-use APIs for handling internationalized
+ domain name in your applications.
+
+ Both libraries provide almost the same API. The difference
+ between them is that libidnkit internally uses iconv() function
+ to provide encoding conversion from UTF-8 to the local encoding
+ (such as iso-8859-1, usually determined by the current locale),
+ and vise versa. The idnconv and runidn commands in this toolkit
+ use libidnkit.
+
+ libidnkitlite is lightweight version of libidnkit. It assumes
+ local encoding is UTF-8 so that it never uses iconv().
+
+ + codeset conversion utility (idnconv)
+ This command can convert internationalized domain name written
+ in local encoding (e.g. EUC-JP) to ACE or the opposite direction.
+ It can also convert named.conf and zone master files for BIND.
+
+ + command which adds IDN feature dynamically to unix applications
+ (runidn)
+ This command enables normal applications to handle
+ internationalized domain names by dynamically attaching special
+ library to them. See ``2. using runidn'' below.
+
+ Note that this command is not installed unless you specify the
+ `--enable-runidn' option to `configure'. See the file `INSTALL'
+ for more information about installation.
+
+ + patch for BIND9 that adds IDN capability
+ This patch adds IDN capability to BIND9. It adds encoding
+ conversion and nameprep features to `dig', `host' and
+ `nslookup'. With the patch, those commands become capable of
+ internationalized domain names.
+
+ + IDN wrapper for Windows applications
+ On windows, name resolving request is passed to WINSOCK DLL. So,
+ replacing WINSOCK DLL with multi-lingual domain name version
+ makes legacy windows applications compatible with IDN. This is
+ wrapper DLL for WINSOCK's name resolving functions. See
+ ``3. using IDN wrapper'' below.
+
+
+2. Directory structure of this distribution
+
+Below is a directory structure of this distribution with some
+important files and their brief description.
+
+ +README this file
+ +README.ja .. in Japanese
+ +INSTALL compilation and installation instructions.
+ +INSTALL.ja .. in Japanese
+ +DISTFILES list of files in this distribution
+ +NEWS what's new in this version
+ +ChangeLog list of changes
+ +Makefile.in toplevel makefile template
+ +configure a `configure' script
+ +include/
+ | +config.h.in template header file for configuration
+ | +idn/ header files for libidnkit and libindkitlite
+ | +mdn/ header files for backward compatibility
+ +lib/ source for libidnkit and libidnkitlite
+ +patch/
+ | +bind9/ BIND9 patch
+ +tools/
+ | +idnconv/ source for idnconv command
+ | +runidn/ source for runidn command
+ +util/ utilities
+ +wsock/ source for IDN wrapper
+
+
+3. Supported systems
+
+We've had successful builds on the following systems:
+
+ -------------------------------------------------------------------
+ OS iconv library configure options
+ ===================================================================
+ FreeBSD 4.7-RELEASE GNU libiconv --with-libiconv
+ for Intel 1.8
+ -------------------------------------------------------------------
+ Red Hat Linux 7.3 standard library none
+ for Intel (glibc)
+ -------------------------------------------------------------------
+ Solaris 9 standard library none
+ for Sparc (libc)
+ -------------------------------------------------------------------
+
+The latest information about supported/unsupported systems will be
+found at the mdnkit FAQ page linked from:
+
+ http://www.nic.ad.jp/en/idn/
+
+
+4. Contact information
+
+Please see
+
+ http://www.nic.ad.jp/en/idn/
+
+for the latest news about this kit.
+Bug reports and comments on this kit should be sent to
+
+ mdnkit-bugs@nic.ad.jp
+and
+ idn-cmt@nic.ad.jp
+
+respectively.
+
+
+; $Id: README,v 1.1.1.1 2003/06/04 00:24:58 marka Exp $
diff --git a/contrib/idn/idnkit-1.0-src/README.ja b/contrib/idn/idnkit-1.0-src/README.ja
new file mode 100644
index 0000000..c9394fc
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/README.ja
@@ -0,0 +1,151 @@
+
+ idnkit
+ -- $B9q:]2=%I%a%$%sL>%D!<%k%-%C%H(B --
+ $B%P!<%8%g%s(B 1.0
+ ($B<R(B) $BF|K\%M%C%H%o!<%/%$%s%U%)%a!<%7%g%s%;%s%?!<(B (JPNIC)
+
+
+$B$3$N%U%!%$%k$NL\<!(B:
+
+ 1. $B35MW(B
+ 2. $B%G%#%l%/%H%j9=@.(B
+ 3. $BK\%-%C%H$,BP1~$7$F$$$k%7%9%F%`(B
+ 4. $BK\%-%C%H$K4X$9$k:G?7>pJs!"Ld$$9g$o$;$K$D$$$F(B
+
+$B%3%s%Q%$%k$*$h$S%$%s%9%H!<%kJ}K!$K$D$$$F$O!"(BINSTALL.ja $B$H$$$&%U%!%$%k$r(B
+$B$4Mw2<$5$$!#$3$N%P!<%8%g%s$G$N<g$JJQ99E@$KIU$$$F$O!"(B($B1QJ8$G$9$,(B) NEWS
+$B$H$$$&%U%!%$%k$r$4Mw2<$5$$!#(B
+
+
+1. $B35MW(B
+
+idnkit ($B5l>N(B mDNkit) $B$H$O9q:]2=%I%a%$%sL>$r07$&$?$a$N%D!<%k%-%C%H$G$9!#(B
+$B9q:]2=%I%a%$%sL>$r07$&$?$a$K$O!"<!$N$h$&$J5!G=$,MW5a$5$l$^$9!#(B
+
+$B!&%(%s%3!<%G%#%s%0JQ49(B
+ $B9q:]2=%I%a%$%sL>$KBP$7$F!"$=$N%(%s%3!<%G%#%s%0$r%"%W%j%1!<%7%g%s$,;H(B
+ $BMQ$7$F$$$k$b$N(B ($B%m!<%+%k%(%s%3!<%G%#%s%0(B) $B$+$iL>A02r7h$KMQ$$$i$l$k$b(B
+ $B$N(B (IDN $B%(%s%3!<%G%#%s%0(B) $B$X$NJQ49!"$^$?$=$N5UJ}8~$NJQ49$r9T$$$^$9!#(B
+ $B%I%a%$%sL>$r(B IDN $B%(%s%3!<%G%#%s%0$K$7$?7k2L$O!"=>Mh$N%I%a%$%sL>$HF1(B
+ $B$8$/(B ASCII $BJ8;z$N$_$G9=@.$5$l$k$N$G!"(BIDN $B%(%s%3!<%G%#%s%0$O(BASCII $B8_(B
+ $B49%(%s%3!<%G%#%s%0(B (ACE) $B$H$b8F$P$l$^$9!#(B
+
+$B!&(BNAMEPREP
+ $B%I%a%$%sL>$r(B IDN $B%(%s%3!<%G%#%s%0$KJQ49$9$kA0$K!"L>A0$N@55,2=$r9T$$(B
+ $B$^$9!#$3$l$r(B NAMEPREP $B$H8F$S$^$9!#(B
+
+$B>e5-$N=hM}$O%I%a%$%sL>$r(B DNS $B%5!<%P$KAw$kA0$K<B9T$9$kI,MW$,$"$j$^$9!#(B
+$B=hM}:Q$N%I%a%$%sL>$O(B ASCII $BJ8;z$+$i9=@.$5$l!"=>Mh$N(B ASCII $B%I%a%$%sL>$H(B
+$B$7$F$b@5$7$$7A<0$K$J$C$F$$$k$N$G!"(BDNS $B%5!<%PB&$K$O$J$s$NJQ99$bI,MW$"$j(B
+$B$^$;$s!#(B
+
+$B$3$NG[I[%-%C%H$K$O<!$N$h$&$J$b$N$,4^$^$l$^$9!#(B
+
+$B!&9q:]2=%I%a%$%sL>$r=hM}$9$k$?$a$N%i%$%V%i%j(B (libidnkit, libidnkitlite)
+ $B$3$l$i$N%i%$%V%i%j$G$O!"%(%s%3!<%G%#%s%0JQ49$d(B NAMEPREP $B$N5!G=$r<B(B
+ $BAu$7$F$*$j!"%"%W%j%1!<%7%g%s$,9q:]2=%I%a%$%sL>$r4JC1$K07$($k$h$&$K(B
+ $B$9$k$?$a$N(B API $B$rHw$($F$$$^$9!#(B
+
+ $B$I$A$i$N%i%$%V%i%j$b$[$H$s$IF1$8(B API $B$rDs6!$7$^$9!#N><T$NAj0cE@$G$9(B
+ $B$,!"(Blibidnkit $B$N$[$&$O(B iconv() $B4X?t$r;H$C$F(B UTF-8 $B$H%m!<%+%k%(%s%3!<(B
+ $B%G%#%s%0(B (iso-8859-1 $B$J$I!"DL>o$O(B locale $B$+$i7hDj$5$l$^$9(B) $B$H$N4V$N(B
+ $BJQ495!G=$rDs6!$7$F$$$^$9!#K\%D!<%k%-%C%HIUB0$N(B idnconv $B$*$h$S(B runidn
+ $B$O(B libidnkit $B$r;HMQ$7$F$$$^$9!#(B
+
+ libidnkitlite $B$O(B libidnkit $B$N7ZNLHG$G$9!#%m!<%+%k%(%s%3!<%G%#%s%0$O(B
+ $B>o$K(B UTF-8 $B$@$H2>Dj$7$F$*$j!"(Biconv() $B$O;HMQ$7$^$;$s!#(B
+
+$B!&%3!<%I%;%C%H%3%s%P!<%?(B (idnconv)
+ $B%m!<%+%k%(%s%3!<%G%#%s%0(B ($B$?$H$($P(B EUC-JP) $B$G=q$+$l$?9q:]2=%I%a%$%s(B
+ $BL>$+$i(B ACE $B$X$NJQ49$d!"$=$N5UJQ49$r9T$($k%3%^%s%I$G$9!#(BBIND $BMQ$N(B
+ named.conf $B$d%>!<%s%^%9%?%U%!%$%k$rJQ49$9$k$3$H$b2DG=$G$9!#(B
+
+$B!&(BUNIX $B%"%W%j%1!<%7%g%s$K(B IDN $B5!G=$rF0E*$KDI2C$9$k%3%^%s%I(B (runidn)
+ UNIX $B$NDL>o$N%"%W%j%1!<%7%g%s$G9q:]2=%I%a%$%sL>$r<h$j07$&$?$a$K!"FC(B
+ $BJL$J%i%$%V%i%j$rF0E*$K%j%s%/$9$k$?$a$N%3%^%s%I$G$9!#>\$7$/$O!"8e=R$N(B
+ $B!V(B2. runidn $B$r;H$&!W$r8fMw$/$@$5$$!#(B
+
+ $B$J$*!"(Bconfigure $B<B9T;~$K(B `--enable-runidn' $B$r;XDj$7$J$$$H!"(Brunidn $B$O(B
+ $B%$%s%9%H!<%k$5$l$^$;$s!#%$%s%9%H!<%k$K4X$7$F!">\$7$/$O(B INSTALL.ja $B$H(B
+ $B$$$&%U%!%$%k$r$4Mw$/$@$5$$!#(B
+
+$B!&(BBIND9 $B$K(B IDN $B5!G=$rDI2C$9$k%Q%C%A(B
+ BIND $B$K(B IDN $B$N5!G=$rDI2C$9$k%Q%C%A$G$9!#(B`dig'$B!"(B`host'$B!"(B`nslookup' $B$K(B
+ $B%(%s%3!<%G%#%s%0JQ49$H(B NAMEPREP $B$N5!G=$rDI2C$7!"9q:]2=%I%a%$%sL>$,07(B
+ $B$($k$h$&$K$7$^$9!#(B
+
+$B!&(BWindows $B%"%W%j%1!<%7%g%sMQ$N(B IDN $B%i%C%Q!<(B
+ WINSOCK $B$NL>A02r7h5!G=$KBP$9$k%i%C%Q!<(B DLL $B$G$9!#(BWindows $B>e$G$O!"L>(B
+ $BA02r7h$NMW5a$O!"(BWINSOCK DLL $B$rDL$7$F9T$o$l$^$9!#$=$3$G!"$3$l$r9q:]2=(B
+ $B%I%a%$%sMQ$N(B WINSOCK DLL $B$KCV$-49$($k$3$H$G!"=>Mh$N(B Windows $B%"%W%j%1!<(B
+ $B%7%g%s$G$b(B IDN $B5!G=$r;HMQ$G$-$k$h$&$K$7$^$9!#>\$7$/$O!"8e=R$N(B
+ $B!V(B3. IDN $B%i%C%Q!<$r;H$&!W$r8fMw$/$@$5$$!#(B
+
+
+2. $B%G%#%l%/%H%j9=@.(B
+
+$BG[I[%-%C%H$N%G%#%l%/%H%j9=@.$H!"<gMW$J%U%!%$%k$r<($7$^$9!#(B
+
+ +README $B1Q8lHG$N(B README
+ +README.ja $B$3$N%U%!%$%k(B
+ +INSTALL $B1Q8lHG$N(B INSTALL
+ +INSTALL.ja $B%3%s%Q%$%k$H%$%s%9%H!<%kJ}K!(B
+ +DISTFILES $BG[I[$5$l$k%U%!%$%k0lMw(B
+ +NEWS $B<g$JJQ99(B
+ +ChangeLog $BJQ99>\:Y(B
+ +configure configure $B%9%/%j%W%H(B
+ +Makefile.in $B%H%C%W%l%Y%k$N(B Makefile $B$N%F%s%W%l!<%H(B
+ +include/
+ | +config.h.in config.h $B$N%F%s%W%l!<%H(B
+ | +idn/ libidnkit, libidnkitlite $B$N%X%C%@%U%!%$%k(B
+ | +mdn/ $B5l%P!<%8%g%s$H$N8_49MQ%X%C%@%U%!%$%k(B
+ +lib/ libidnkit, libidnkitlite $B$N%=!<%9(B
+ +patch/
+ | +bind9/ BIND9 $BMQ%Q%C%A(B
+ +tools/
+ | +idnconv/ idnconv $B%3%^%s%I$N%=!<%9(B
+ | +runidn/ runidn $B%3%^%s%I$N%=!<%9(B
+ +util/ $B%f!<%F%#%j%F%#(B
+ +wsock/ IDN $B%i%C%Q!<$N%=!<%9(B
+
+
+3. $BK\%-%C%H$,BP1~$7$F$$$k%7%9%F%`(B
+
+$B@5>o$K%$%s%9%H!<%k$G$-$k$3$H$,3NG'$G$-$F$$$k$N$O!"<!$N%7%9%F%`$G$9!#(B
+
+ ------------------------------------------------------------------
+ OS iconv configure $B$N%*%W%7%g%s(B
+ ==================================================================
+ FreeBSD 4.7-RELEASE GNU libiconv --with-libiconv
+ Intel 1.8
+ -------------------------------------------------------------------
+ Red Hat Linux 7.3 $BI8=`%i%$%V%i%j(B $B$J$7(B
+ Intel (glibc)
+ ------------------------------------------------------------------
+ Solaris 9 $BI8=`%i%$%V%i%j(B $B$J$7(B
+ Sparc (libc)
+ -------------------------------------------------------------------
+
+$BK\%-%C%H$,BP1~$7$F$$$k(B/$B$7$F$$$J$$%7%9%F%`$K4X$9$k:G?7$N>pJs$O!"<!$N$H(B
+$B$3$m$+$iC)$l$k(B mdnkit FAQ $B$N%Z!<%8$K5-$5$l$F$$$^$9!#(B
+
+ http://www.nic.ad.jp/ja/idn/
+
+
+4. $BK\%-%C%H$K4X$9$k:G?7>pJs!"Ld$$9g$o$;$K$D$$$F(B
+
+$BK\%-%C%H$K4X$9$k:G?7>pJs$K$D$$$F$O!"(B
+
+ http://www.nic.ad.jp/ja/idn/
+
+$B$r;2>H$7$F$/$@$5$$(B
+$BK\%-%C%H$K4X$9$k%P%0%l%]!<%H$*$h$S%3%a%s%H$O!"$=$l$>$l(B
+
+ mdnkit-bugs@nic.ad.jp
+$B$*$h$S(B
+ idn-cmt@nic.ad.jp
+
+$B$X$*4j$$$7$^$9!#(B
+
+
+; $Id: README.ja,v 1.1.1.1 2003/06/04 00:24:59 marka Exp $
diff --git a/contrib/idn/idnkit-1.0-src/acconfig.h b/contrib/idn/idnkit-1.0-src/acconfig.h
new file mode 100644
index 0000000..05d90a5
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/acconfig.h
@@ -0,0 +1,53 @@
+/* $Id: acconfig.h,v 1.1.1.1 2003/06/04 00:25:03 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+@TOP@
+
+/* Define as an appropriate type (ex. int) if your system doesn't have. */
+#undef BOOL
+
+@BOTTOM@
+/* Define as the pathname of the shared libc object if your system has one. */
+#undef SOPATH_LIBC
+
+/* Define as the pathname of the shared libnsl object if your system has one. */
+#undef SOPATH_LIBNSL
diff --git a/contrib/idn/idnkit-1.0-src/aclocal.m4 b/contrib/idn/idnkit-1.0-src/aclocal.m4
new file mode 100644
index 0000000..ffb130e
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/aclocal.m4
@@ -0,0 +1,472 @@
+##
+## $Id: aclocal.m4,v 1.1.1.1 2003/06/04 00:25:05 marka Exp $
+##
+AC_DEFUN(AC_FIND_SYSTEM_SHOBJ,[
+AC_MSG_CHECKING(for $1 shared object)
+shobj_name=$1
+shobj_path=
+case "$host" in
+*-hpux*)
+ SOEXT=sl
+ ;;
+*)
+ SOEXT=so
+ ;;
+esac
+for shobj_libdir in /lib /usr/lib; do
+ if test -f $shobj_libdir/$shobj_name.$SOEXT; then
+ shobj_path=$shobj_libdir/$shobj_name.$SOEXT
+ else
+ shobj_path=`ls -r $shobj_libdir/$shobj_name.$SOEXT* 2>/dev/null | head -1`
+ if test "$shobj_path" != "" -a -f "$shobj_path"; then
+ :
+ else
+ shobj_path=
+ fi
+ fi
+ if test "$shobj_path" != ""; then
+ AC_MSG_RESULT($shobj_path)
+ shobj_pathsymbol=SOPATH_`echo $shobj_name | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ AC_DEFINE_UNQUOTED($shobj_pathsymbol, "$shobj_path")
+ break
+ fi
+done
+if test "$shobj_path" = ""; then
+ AC_MSG_RESULT(no)
+fi
+])dnl
+
+## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
+## Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc.
+## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+##
+## As a special exception to the GNU General Public License, if you
+## distribute this file as part of a program that contains a
+## configuration script generated by Autoconf, you may include it under
+## the same distribution terms that you use for the rest of that program.
+
+# serial 40 AC_PROG_LIBTOOL
+AC_DEFUN(AC_PROG_LIBTOOL,
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+
+# Save cache, so that ltconfig can load it
+AC_CACHE_SAVE
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
+DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
+|| AC_MSG_ERROR([libtool configure failed])
+
+# Reload cache, that may have been modified by ltconfig
+AC_CACHE_LOAD
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+AC_DEFUN(AC_LIBTOOL_SETUP,
+[AC_PREREQ(2.13)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_RANLIB])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+dnl
+
+case "$target" in
+NONE) lt_target="$host" ;;
+*) lt_target="$target" ;;
+esac
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags="--cache-file=$cache_file"
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
+[libtool_flags="$libtool_flags --enable-dlopen"])
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[libtool_flags="$libtool_flags --enable-win32-dll"])
+AC_ARG_ENABLE(libtool-lock,
+ [ --disable-libtool-lock avoid locking (might break parallel builds)])
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case "$lt_target" in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw*)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
+])
+esac
+])
+
+# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
+AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
+
+# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
+AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
+
+# AC_ENABLE_SHARED - implement the --enable-shared flag
+# Usage: AC_ENABLE_SHARED[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_SHARED, [dnl
+define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(shared,
+changequote(<<, >>)dnl
+<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
+])
+
+# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
+AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)])
+
+# AC_ENABLE_STATIC - implement the --enable-static flag
+# Usage: AC_ENABLE_STATIC[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_STATIC, [dnl
+define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(static,
+changequote(<<, >>)dnl
+<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
+])
+
+# AC_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)])
+
+
+# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
+# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
+define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(fast-install,
+changequote(<<, >>)dnl
+<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
+])
+
+# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
+AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)])
+
+# AC_PROG_LD - find the path to the GNU or non-GNU linker
+AC_DEFUN(AC_PROG_LD,
+[AC_ARG_WITH(gnu-ld,
+[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$ac_cv_prog_gcc" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by GCC])
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+ # Accept absolute paths.
+changequote(,)dnl
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+changequote([,])dnl
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(ac_cv_path_LD,
+[if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ ac_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ ac_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$ac_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])
+
+AC_DEFUN(AC_PROG_LD_GNU,
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ ac_cv_prog_gnu_ld=yes
+else
+ ac_cv_prog_gnu_ld=no
+fi])
+])
+
+# AC_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN(AC_PROG_NM,
+[AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(ac_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ ac_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -B"
+ break
+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -p"
+ break
+ else
+ ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
+fi])
+NM="$ac_cv_path_NM"
+AC_MSG_RESULT([$NM])
+])
+
+# AC_CHECK_LIBM - check for math library
+AC_DEFUN(AC_CHECK_LIBM,
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case "$lt_target" in
+*-*-beos* | *-*-cygwin*)
+ # These system don't have libm
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, main, LIBM="-lm")
+ ;;
+esac
+])
+
+# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl convenience library and INCLTDL to the include flags for
+# the libltdl header and adds --enable-ltdl-convenience to the
+# configure arguments. Note that LIBLTDL and INCLTDL are not
+# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not
+# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed
+# with '${top_builddir}/' and INCLTDL will be prefixed with
+# '${top_srcdir}/' (note the single quotes!). If your package is not
+# flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ case "$enable_ltdl_convenience" in
+ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+ "") enable_ltdl_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+ esac
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+ INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+])
+
+# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl installable library and INCLTDL to the include flags for
+# the libltdl header and adds --enable-ltdl-install to the configure
+# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
+# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed
+# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will
+# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
+# with '${top_srcdir}/' (note the single quotes!). If your package is
+# not flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ AC_CHECK_LIB(ltdl, main,
+ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+ [if test x"$enable_ltdl_install" = xno; then
+ AC_MSG_WARN([libltdl not installed, but installation disabled])
+ else
+ enable_ltdl_install=yes
+ fi
+ ])
+ if test x"$enable_ltdl_install" = x"yes"; then
+ ac_configure_args="$ac_configure_args --enable-ltdl-install"
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+ INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+ else
+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+ LIBLTDL="-lltdl"
+ INCLTDL=
+ fi
+])
+
+dnl old names
+AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
+AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
+AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
+AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
+AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
+AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
+AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
+
+dnl This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])dnl
diff --git a/contrib/idn/idnkit-1.0-src/config.guess b/contrib/idn/idnkit-1.0-src/config.guess
new file mode 100755
index 0000000..dff9e48
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/config.guess
@@ -0,0 +1,1317 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+
+timestamp='2001-09-04'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Written by Per Bothner <bothner@cygnus.com>.
+# Please send patches to <config-patches@gnu.org>.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit 0 ;;
+ --version | -v )
+ echo "$version" ; exit 0 ;;
+ --help | --h* | -h )
+ echo "$usage"; exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+
+dummy=dummy-$$
+trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script.
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int dummy(){}" > $dummy.c ;
+ for c in cc gcc c89 ; do
+ ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
+ if test $? = 0 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ rm -f $dummy.c $dummy.o $dummy.rel ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # Netbsd (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ # Determine the machine/vendor (is the vendor relevant).
+ case "${UNAME_MACHINE}" in
+ amiga) machine=m68k-unknown ;;
+ arm32) machine=arm-unknown ;;
+ atari*) machine=m68k-atari ;;
+ sun3*) machine=m68k-sun ;;
+ mac68k) machine=m68k-apple ;;
+ macppc) machine=powerpc-apple ;;
+ hp3[0-9][05]) machine=m68k-hp ;;
+ ibmrt|romp-ibm) machine=romp-ibm ;;
+ *) machine=${UNAME_MACHINE}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE}" in
+ i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit 0 ;;
+ alpha:OSF1:*:*)
+ if test $UNAME_RELEASE = "V4.0"; then
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ fi
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ cat <<EOF >$dummy.s
+ .data
+\$Lformat:
+ .byte 37,100,45,37,120,10,0 # "%d-%x\n"
+
+ .text
+ .globl main
+ .align 4
+ .ent main
+main:
+ .frame \$30,16,\$26,0
+ ldgp \$29,0(\$27)
+ .prologue 1
+ .long 0x47e03d80 # implver \$0
+ lda \$2,-1
+ .long 0x47e20c21 # amask \$2,\$1
+ lda \$16,\$Lformat
+ mov \$0,\$17
+ not \$1,\$18
+ jsr \$26,printf
+ ldgp \$29,0(\$26)
+ mov 0,\$16
+ jsr \$26,exit
+ .end main
+EOF
+ eval $set_cc_for_build
+ $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ case `./$dummy` in
+ 0-0)
+ UNAME_MACHINE="alpha"
+ ;;
+ 1-0)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 1-1)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 1-101)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 2-303)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ 2-307)
+ UNAME_MACHINE="alphaev67"
+ ;;
+ 2-1307)
+ UNAME_MACHINE="alphaev68"
+ ;;
+ esac
+ fi
+ rm -f $dummy.s $dummy
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit 0 ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit 0;;
+ amiga:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit 0 ;;
+ arc64:OpenBSD:*:*)
+ echo mips64el-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hkmips:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ pmax:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sgi:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ wgrisc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit 0;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit 0 ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit 0 ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit 0 ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit 0 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ sparc*:NetBSD:*)
+ echo `uname -p`-unknown-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit 0 ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit 0 ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy \
+ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm -f $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit 0 ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit 0 ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit 0 ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit 0 ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit 0 ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit 0 ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit 0 ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit 0 ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo rs6000-ibm-aix3.2.5
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit 0 ;;
+ *:AIX:*:[45])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit 0 ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit 0 ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit 0 ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit 0 ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit 0 ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit 0 ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit 0 ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ case "${HPUX_REV}" in
+ 11.[0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ esac ;;
+ esac
+ fi ;;
+ esac
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
+ if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+ rm -f $dummy.c $dummy
+ fi ;;
+ esac
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo unknown-hitachi-hiuxwe2
+ exit 0 ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit 0 ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit 0 ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit 0 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit 0 ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit 0 ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit 0 ;;
+ hppa*:OpenBSD:*:*)
+ echo hppa-unknown-openbsd
+ exit 0 ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ CRAY*X-MP:*:*:*)
+ echo xmp-cray-unicos
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*T3D:*:*:*)
+ echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY-2:*:*:*)
+ echo cray2-cray-unicos
+ exit 0 ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit 0 ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit 0 ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit 0 ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i386-pc-interix
+ exit 0 ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit 0 ;;
+ arm*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux
+ exit 0 ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ mips:Linux:*:*)
+ case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in
+ big) echo mips-unknown-linux-gnu && exit 0 ;;
+ little) echo mipsel-unknown-linux-gnu && exit 0 ;;
+ esac
+ ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit 0 ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit 0 ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit 0 ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit 0 ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit 0 ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit 0 ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+ exit 0 ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ ld_supported_targets=`cd /; ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit 0 ;;
+ coff-i386)
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ exit 0 ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit 0 ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ cat >$dummy.c <<EOF
+#include <features.h>
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+#ifdef __ELF__
+# ifdef __GLIBC__
+# if __GLIBC__ >= 2
+ printf ("%s-pc-linux-gnu\n", argv[1]);
+# else
+ printf ("%s-pc-linux-gnulibc1\n", argv[1]);
+# endif
+# else
+ printf ("%s-pc-linux-gnulibc1\n", argv[1]);
+# endif
+#else
+ printf ("%s-pc-linux-gnuaout\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit 0 ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit 0 ;;
+ i*86:*:5:[78]*)
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit 0 ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit 0 ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit 0 ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit 0 ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit 0 ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ M68*:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4 && exit 0 ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit 0 ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit 0 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit 0 ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit 0 ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit 0 ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit 0 ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit 0 ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit 0 ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Darwin:*:*)
+ echo `uname -p`-apple-darwin${UNAME_RELEASE}
+ exit 0 ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ if test "${UNAME_MACHINE}" = "x86pc"; then
+ UNAME_MACHINE=pc
+ fi
+ echo `uname -p`-${UNAME_MACHINE}-nto-qnx
+ exit 0 ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit 0 ;;
+ NSR-[KW]:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit 0 ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit 0 ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit 0 ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit 0 ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit 0 ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit 0 ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit 0 ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit 0 ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit 0 ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit 0 ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit 0 ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit 0 ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit 0 ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
+rm -f $dummy.c $dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ c34*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ c38*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ c4*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/contrib/idn/idnkit-1.0-src/config.sub b/contrib/idn/idnkit-1.0-src/config.sub
new file mode 100755
index 0000000..393f13d
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/config.sub
@@ -0,0 +1,1411 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+
+timestamp='2001-09-07'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Please send patches to <config-patches@gnu.org>.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit 0 ;;
+ --version | -v )
+ echo "$version" ; exit 0 ;;
+ --help | --h* | -h )
+ echo "$usage"; exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit 0;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis)
+ os=
+ basic_machine=$1
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | c4x | clipper \
+ | d10v | d30v | dsp16xx \
+ | fr30 \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | m32r | m68000 | m68k | m88k | mcore \
+ | mips16 | mips64 | mips64el | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el | mips64vr4300 \
+ | mips64vr4300el | mips64vr5000 | mips64vr5000el \
+ | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \
+ | mipsisa32 \
+ | mn10200 | mn10300 \
+ | ns16k | ns32k \
+ | openrisc \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | s390 | s390x \
+ | sh | sh[34] | sh[34]eb | shbe | shle \
+ | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \
+ | stormy16 | strongarm \
+ | tahoe | thumb | tic80 | tron \
+ | v850 \
+ | we32k \
+ | x86 | xscale \
+ | z8k)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alphapca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armv*-* \
+ | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c54x-* \
+ | clipper-* | cray2-* | cydra-* \
+ | d10v-* | d30v-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fr30-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | m32r-* \
+ | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | mcore-* \
+ | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
+ | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \
+ | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+ | s390-* | s390x-* \
+ | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \
+ | sparc-* | sparc64-* | sparc86x-* | sparclite-* \
+ | sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \
+ | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
+ | v850-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \
+ | ymp-* \
+ | z8k-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ cray2)
+ basic_machine=cray2-cray
+ os=-unicos
+ ;;
+ [cjt]90)
+ basic_machine=${basic_machine}-cray
+ os=-unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mipsel*-linux*)
+ basic_machine=mipsel-unknown
+ os=-linux-gnu
+ ;;
+ mips*-linux*)
+ basic_machine=mips-unknown
+ os=-linux-gnu
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ mmix*)
+ basic_machine=mmix-knuth
+ os=-mmixware
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5 | k5 | k6 | nexgen)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2)
+ basic_machine=i686-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sparclite-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=t3e-cray
+ os=-unicos
+ ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ windows32)
+ basic_machine=i386-pc
+ os=-windows32-msvcrt
+ ;;
+ xmp)
+ basic_machine=xmp-cray
+ os=-unicos
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ mips)
+ if [ x$os = x-linux-gnu ]; then
+ basic_machine=mips-unknown
+ else
+ basic_machine=mips-mips
+ fi
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh3 | sh4 | sh3eb | sh4eb)
+ basic_machine=sh-unknown
+ ;;
+ sparc | sparcv9 | sparcv9b)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ c4x*)
+ basic_machine=c4x-none
+ os=-coff
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto*)
+ os=-nto-qnx
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -vxsim* | -vxworks*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/contrib/idn/idnkit-1.0-src/configure b/contrib/idn/idnkit-1.0-src/configure
new file mode 100755
index 0000000..1d22dac
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/configure
@@ -0,0 +1,3517 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+ --enable-debug enable debug codes [default=no]"
+ac_help="$ac_help
+ --enable-mdnkit-compat enable mDNkit compatibility mode [default=no]"
+ac_help="$ac_help
+ --enable-extra-ace enable additional ACE converters. [default=no]"
+ac_help="$ac_help
+ --with-utf8=NAME codeset name for UTF-8 encoding [UTF-8]"
+ac_help="$ac_help
+ --enable-liteonly compile and install lite library only [default=no]"
+ac_help="$ac_help
+ --enable-runidn compile and install runidn [default=no]"
+ac_help="$ac_help
+ --with-libiconv=IPREFIX GNU libiconv are installed in IPREFIX [PREFIX]"
+ac_help="$ac_help
+ --with-iconv-include=DIR iconv include files are in DIR []"
+ac_help="$ac_help
+ --with-iconv=LIB special library for iconv []"
+ac_help="$ac_help
+ --with-iconv-sofile=PATH shared library file for libiconv []"
+ac_help="$ac_help
+ --enable-shared[=PKGS] build shared libraries [default=yes]"
+ac_help="$ac_help
+ --enable-static[=PKGS] build static libraries [default=yes]"
+ac_help="$ac_help
+ --enable-fast-install[=PKGS] optimize for fast installation [default=yes]"
+ac_help="$ac_help
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]"
+ac_help="$ac_help
+ --disable-libtool-lock avoid locking (might break parallel builds)"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.13"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=include/idn/converter.h
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:582: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+
+debug=no
+# Check whether --enable-debug or --disable-debug was given.
+if test "${enable_debug+set}" = set; then
+ enableval="$enable_debug"
+ debug=$enableval
+fi
+
+case "$debug" in
+yes)
+ CFLAGS="$CFLAGS -DDEBUG"
+ ;;
+esac
+
+mdnkit_compat=no
+COMPAT_TRUE="#"
+COMPAT_FALSE=
+# Check whether --enable-mdnkit-compat or --disable-mdnkit-compat was given.
+if test "${enable_mdnkit_compat+set}" = set; then
+ enableval="$enable_mdnkit_compat"
+ mdnkit_compat=$enableval
+fi
+
+case "$mdnkit_compat" in
+yes)
+ COMPAT_TRUE=
+ COMPAT_FALSE="#"
+ cat >> confdefs.h <<\EOF
+#define ENABLE_MDNKIT_COMPAT 1
+EOF
+
+ ;;
+no)
+ ;;
+*)
+ { echo "configure: error: You must specify yes or no to --enable-runidn option." 1>&2; exit 1; }
+ ;;
+esac
+
+
+
+extraace=no
+# Check whether --enable-extra-ace or --disable-extra-ace was given.
+if test "${enable_extra_ace+set}" = set; then
+ enableval="$enable_extra_ace"
+ extraace=$enableval
+fi
+
+case "$extraace" in
+no)
+ ;;
+yes)
+ cat >> confdefs.h <<\EOF
+#define IDN_EXTRA_ACE 1
+EOF
+
+ ;;
+*)
+ { echo "configure: error: You must specify yes or no to --enable-extra-ace option." 1>&2; exit 1; }
+ ;;
+esac
+
+UTF8_NAME=no
+# Check whether --with-utf8 or --without-utf8 was given.
+if test "${with_utf8+set}" = set; then
+ withval="$with_utf8"
+ UTF8_NAME=$withval
+fi
+
+case "$UTF8_NAME" in
+no)
+ UTF8_NAME=UTF-8
+ ;;
+yes)
+ { echo "configure: error: You must specify NAME to --with-utf8 option." 1>&2; exit 1; }
+ ;;
+*)
+ cat >> confdefs.h <<EOF
+#define IDN_UTF8_ENCODING_NAME "$UTF8_NAME"
+EOF
+
+ ;;
+esac
+
+
+liteonly=no
+LITEONLY_TRUE="#"
+LITEONLY_FALSE=
+# Check whether --enable-liteonly or --disable-liteonly was given.
+if test "${enable_liteonly+set}" = set; then
+ enableval="$enable_liteonly"
+ liteonly=$enableval
+fi
+
+case "$liteonly" in
+no)
+ ;;
+yes)
+ if test "$install_runidn" = yes ; then
+ { echo "configure: error: you can't set value \"yes\" to --enable-runidn and --enable-liteonly simultaneously, because runidn requires iconv support of generic libidnkit." 1>&2; exit 1; }
+ fi
+ LITEONLY_TRUE=
+ LITEONLY_FALSE="#"
+ ;;
+*)
+ { echo "configure: error: You must specify yes or no to --enable-liteonly option." 1>&2; exit 1; }
+ ;;
+esac
+
+
+
+install_runidn=no
+RUNIDN_TRUE="#"
+RUNIDN_FALSE=
+# Check whether --enable-runidn or --disable-runidn was given.
+if test "${enable_runidn+set}" = set; then
+ enableval="$enable_runidn"
+ install_runidn=$enableval
+fi
+
+case "$install_runidn" in
+no)
+ ;;
+yes)
+ if test "$liteonly" = yes ; then
+ { echo "configure: error: you can't set value \"yes\" to --enable-runidn and --enable-liteonly simultaneously, because runidn requires iconv support of generic libidnkit." 1>&2; exit 1; }
+ fi
+ RUNIDN_TRUE=
+ RUNIDN_FALSE="#"
+ ;;
+*)
+ { echo "configure: error: You must specify yes or no to --enable-runidn option." 1>&2; exit 1; }
+ ;;
+esac
+
+
+
+ICONVINC=
+ICONVLIB=
+
+libiconv=unspec
+# Check whether --with-libiconv or --without-libiconv was given.
+if test "${with_libiconv+set}" = set; then
+ withval="$with_libiconv"
+ libiconv=$withval
+fi
+
+case "$libiconv" in
+unspec)
+ ;;
+no)
+ ICONVINC=
+ ICONVLIB=
+ ;;
+yes)
+ if test "$liteonly" = yes ; then
+ { echo "configure: error: you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support." 1>&2; exit 1; }
+ fi
+ if test X$prefix = XNONE ; then
+ libiconv=$ac_default_prefix
+ else
+ libiconv=$prefix
+ fi
+ ICONVINC="-I$libiconv/include"
+ ICONVLIB="-L$libiconv/lib -R$libiconv/lib -liconv"
+ ;;
+*)
+ if test "$liteonly" = yes ; then
+ { echo "configure: error: you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support." 1>&2; exit 1; }
+ fi
+ ICONVINC="-I$libiconv/include"
+ ICONVLIB="-L$libiconv/lib -R$libiconv/lib -liconv"
+ ;;
+esac
+
+iconv_include=unspec
+# Check whether --with-iconv-include or --without-iconv-include was given.
+if test "${with_iconv_include+set}" = set; then
+ withval="$with_iconv_include"
+ iconv_include=$withval
+fi
+
+case "$iconv_include" in
+unspec)
+ ;;
+no)
+ ICONVINC=
+ ;;
+yes)
+ if test "$liteonly" = yes ; then
+ { echo "configure: error: you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support." 1>&2; exit 1; }
+ fi
+ echo "configure: warning: You must supply DIR to --with-iconv-include option.
+ Ignored." 1>&2
+ ICONVINC=
+ ;;
+*)
+ if test "$liteonly" = yes ; then
+ { echo "configure: error: you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support." 1>&2; exit 1; }
+ fi
+ ICONVINC="-I$iconv_include"
+ ;;
+esac
+
+if test "X$ICONVINC" != X ; then
+ iconv_include="`echo X$ICONVINC | sed -e 's/^X-I//'`"
+ if test ! -f "$iconv_include/iconv.h" ; then
+ { echo "configure: error: iconv.h doesn't exist in $iconv_include" 1>&2; exit 1; }
+ fi
+fi
+
+
+
+iconv=unspec
+# Check whether --with-iconv or --without-iconv was given.
+if test "${with_iconv+set}" = set; then
+ withval="$with_iconv"
+ iconv=$withval
+fi
+
+case "$iconv" in
+unspec)
+ ;;
+no)
+ ICONVLIB=
+ ;;
+yes)
+ if test "$liteonly" = yes ; then
+ { echo "configure: error: you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support." 1>&2; exit 1; }
+ fi
+ echo "configure: warning: You must supply LIB to --with-iconv option.
+ -liconv is assumed." 1>&2
+ ICONVLIB=-liconv
+ ;;
+*)
+ if test "$liteonly" = yes ; then
+ { echo "configure: error: you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support." 1>&2; exit 1; }
+ fi
+ ICONVLIB=$iconv
+ ;;
+esac
+
+
+# Check whether --with-iconv-sofile or --without-iconv-sofile was given.
+if test "${with_iconv_sofile+set}" = set; then
+ withval="$with_iconv_sofile"
+ iconv_file=$withval
+else
+ iconv_file=guess
+fi
+
+ICONVSOFILE=
+case "$iconv_file" in
+no)
+ ICONVSOFILE=none
+ ;;
+yes)
+ if test "$liteonly" = yes ; then
+ { echo "configure: error: you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support." 1>&2; exit 1; }
+ fi
+ { echo "configure: error: You must supply PATH to --with-iconv-sofile option." 1>&2; exit 1; }
+ ;;
+guess)
+ if test "$liteonly" != yes ; then
+ if test "$ICONVLIB" = ""; then
+ ICONVSOFILE=none
+ else
+ echo $ac_n "checking pathname of iconv shared library""... $ac_c" 1>&6
+echo "configure:870: checking pathname of iconv shared library" >&5
+ ic_libdir=
+ ic_libname=
+ case "$host" in
+ *-hpux*)
+ SO=sl
+ ;;
+ *)
+ SO=so
+ ;;
+ esac
+ for arg in $ICONVLIB; do
+ case "$arg" in
+ -L*) ic_libdir="$ic_libdir `echo $arg | sed s/-L//`" ;;
+ -l*) ic_libname=`echo $arg | sed s/-l//` ;;
+ /*.$SO*) ICONVSOFILE=$arg ;;
+ esac
+ done
+ if test "$ICONVSOFILE" = ""; then
+ if test "$ic_libname" = ""; then
+ echo "$ac_t""unknown" 1>&6
+ echo "configure: warning: use --with-iconv-sofile for specifying iconv shared library file" 1>&2
+ ICONVSOFILE=none
+ else
+ if test "$ic_libdir" = ""; then
+ # Standard (and semi-standard) library directories
+ ic_libdir="/lib /usr/lib /usr/local/lib"
+ fi
+ for dir in $ic_libdir; do
+ ICONVSOFILE=`ls -r $dir/lib$ic_libname.$SO* 2>/dev/null | head -1`
+ if test "$ICONVSOFILE" != ""; then
+ break
+ fi
+ done
+ if test "$ICONVSOFILE" != ""; then
+ echo "$ac_t""$ICONVSOFILE" 1>&6
+ else
+ echo "$ac_t""unknown" 1>&6
+ echo "configure: warning: use --with-iconv-sofile for specifying iconv shared library file" 1>&2
+ ICONVSOFILE=none
+ fi
+ fi
+ fi
+ fi
+ else
+ ICONVSOFILE=none
+ fi
+ ;;
+*)
+ if test "$liteonly" = yes ; then
+ { echo "configure: error: you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support." 1>&2; exit 1; }
+ fi
+ ICONVSOFILE=$iconv_file
+ ;;
+esac
+
+
+PRELOAD_VAR="LD_PRELOAD"
+PRELOAD_SEP=":"
+PRELOAD_LAST=""
+case "$host" in
+*-solaris*)
+ PRELOAD_SEP=" "
+ ;;
+*-linux*)
+ PRELOAD_SEP=" "
+ ;;
+*-osf*)
+ PRELOAD_VAR="_RLD_LIST"
+ PRELOAD_LAST=":DEFAULT"
+ ;;
+*-netbsd*)
+ if test -x /usr/bin/file -a -x /usr/bin/grep ; then
+ case "`/usr/bin/file /usr/bin/grep`" in
+ *ELF*)
+ PRELOAD_SEP=" "
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+
+
+
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:959: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:989: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1040: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1072: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 1083 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:1088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1114: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:1119: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1128: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1147: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:1190: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_shared=yes
+fi
+
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval="$enable_static"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_static=yes
+fi
+
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+ enableval="$enable_fast_install"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_fast_install=yes
+fi
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:1312: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+ case $nonopt in
+ NONE) build_alias=$host_alias ;;
+ *) build_alias=$nonopt ;;
+ esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1332: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+ withval="$with_gnu_ld"
+ test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$ac_cv_prog_gcc" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
+echo "configure:1371: checking for ld used by GCC" >&5
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+ # Accept absolute paths.
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
+echo "configure:1395: checking for GNU ld" >&5
+else
+ echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+echo "configure:1398: checking for non-GNU ld" >&5
+fi
+if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ ac_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ ac_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$ac_cv_path_LD"
+if test -n "$LD"; then
+ echo "$ac_t""$LD" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
+echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
+echo "configure:1433: checking if the linker ($LD) is GNU ld" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ ac_cv_prog_gnu_ld=yes
+else
+ ac_cv_prog_gnu_ld=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6
+
+
+echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
+echo "configure:1449: checking for BSD-compatible nm" >&5
+if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ ac_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -B"
+ break
+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -p"
+ break
+ else
+ ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
+fi
+fi
+
+NM="$ac_cv_path_NM"
+echo "$ac_t""$NM" 1>&6
+
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:1485: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ rm -f conftestdata
+if ln -s X conftestdata 2>/dev/null
+then
+ rm -f conftestdata
+ ac_cv_prog_LN_S="ln -s"
+else
+ ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+case "$target" in
+NONE) lt_target="$host" ;;
+*) lt_target="$target" ;;
+esac
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags="--cache-file=$cache_file"
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+ enableval="$enable_libtool_lock"
+ :
+fi
+
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case "$lt_target" in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line 1534 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:1535: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
+echo "configure:1556: checking whether the C compiler needs -belf" >&5
+if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1561 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1568: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ lt_cv_cc_needs_belf=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ lt_cv_cc_needs_belf=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+
+esac
+
+
+# Save cache, so that ltconfig can load it
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
+DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
+|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
+
+# Reload cache, that may have been modified by ltconfig
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+
+
+for ac_prog in perl
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1675: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$PERL" in
+ /*)
+ ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_PERL="$PERL" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_path_PERL="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+fi
+PERL="$ac_cv_path_PERL"
+if test -n "$PERL"; then
+ echo "$ac_t""$PERL" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+test -n "$PERL" && break
+done
+test -n "$PERL" || PERL="perl"
+
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1713: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 1728 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1734: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 1745 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1751: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 1762 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1768: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+for ac_hdr in unistd.h locale.h langinfo.h pwd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1796: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1801 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1806: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+if test "$install_runidn" = yes ; then
+ for ac_hdr in dlfcn.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1837: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1842 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1847: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+fi
+
+saved_CPPFLAGS=$CPPFLAGS
+CPPFLAGS="$CPPFLAGS $ICONVINC"
+if test "$liteonly" != yes ; then
+ ac_safe=`echo "iconv.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for iconv.h""... $ac_c" 1>&6
+echo "configure:1880: checking for iconv.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1885 "configure"
+#include "confdefs.h"
+#include <iconv.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1890: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+{ echo "configure: error: iconv.h doesn't exist" 1>&2; exit 1; }
+fi
+
+fi
+CPPFLAGS=$saved_CPPFLAGS
+
+echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
+echo "configure:1916: checking for uid_t in sys/types.h" >&5
+if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1921 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "uid_t" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_uid_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_uid_t=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_type_uid_t" 1>&6
+if test $ac_cv_type_uid_t = no; then
+ cat >> confdefs.h <<\EOF
+#define uid_t int
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define gid_t int
+EOF
+
+fi
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1950: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1955 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1963: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ ac_cv_header_stdc=yes
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1980 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1998 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+ :
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2019 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:2030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ :
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+ cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+echo $ac_n "checking for BOOL""... $ac_c" 1>&6
+echo "configure:2054: checking for BOOL" >&5
+if eval "test \"`echo '$''{'ac_cv_type_BOOL'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2059 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])BOOL[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_BOOL=yes
+else
+ rm -rf conftest*
+ ac_cv_type_BOOL=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_BOOL" 1>&6
+if test $ac_cv_type_BOOL = no; then
+ cat >> confdefs.h <<\EOF
+#define BOOL int
+EOF
+
+fi
+
+
+if test "$install_runidn" = yes ; then
+ echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
+echo "configure:2089: checking for socket in -lsocket" >&5
+ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lsocket $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2097 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char socket();
+
+int main() {
+socket()
+; return 0; }
+EOF
+if { (eval echo configure:2108: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lsocket $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ echo $ac_n "checking for inet_addr in -lnsl""... $ac_c" 1>&6
+echo "configure:2136: checking for inet_addr in -lnsl" >&5
+ac_lib_var=`echo nsl'_'inet_addr | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lnsl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2144 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char inet_addr();
+
+int main() {
+inet_addr()
+; return 0; }
+EOF
+if { (eval echo configure:2155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lnsl $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:2183: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2191 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:2202: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+
+ LIBS="-ldl $LIBS"
+ LIBDL="-ldl"
+ cat >> confdefs.h <<\EOF
+#define HAVE_LIBDL 1
+EOF
+
+
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+for ac_func in vsnprintf setvbuf setlocale nl_langinfo memmove bcopy setenv \
+ unsetenv
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2236: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2241 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+if test "$install_runidn" = yes ; then
+ for ac_func in gethostbyname gethostbyname2 gethostbyaddr
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2292: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2297 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2320: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ for ac_func in gethostbyname_r gethostbyname2_r gethostbyaddr_r
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2347: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2352 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2375: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ find_gethost_r=yes
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ for ac_func in getipnodebyname getipnodebyaddr freehostent
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2402: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2407 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ for ac_func in getaddrinfo freeaddrinfo getnameinfo
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2457: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2462 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2485: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ for ac_func in dlopen dlsym
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2512: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2517 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2540: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+fi
+
+if test "$install_runidn" = yes ; then
+ echo $ac_n "checking flavor of gethostbyaddr""... $ac_c" 1>&6
+echo "configure:2568: checking flavor of gethostbyaddr" >&5
+if eval "test \"`echo '$''{'ac_cv_flavor_gethostbyaddr'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_flavor_gethostbyaddr=unknown
+ if test "$cross_compiling" = yes; then
+ ac_cv_flavor_gethostbyaddr=unknown
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2577 "configure"
+#include "confdefs.h"
+
+ #include <stddef.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
+ struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type) {
+ return NULL;
+ }
+ int main() {
+ (void)gethostbyaddr(NULL, 0, 0);
+ return 0;
+ }
+
+EOF
+if { (eval echo configure:2593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_flavor_gethostbyaddr=glibc2_2
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -fr conftest*
+fi
+
+ if test "$cross_compiling" = yes; then
+ ac_cv_flavor_gethostbyaddr=unknown
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2607 "configure"
+#include "confdefs.h"
+
+ #include <stddef.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
+ struct hostent *gethostbyaddr(const char *addr, size_t len, int type) {
+ return NULL;
+ }
+ int main() {
+ (void)gethostbyaddr(NULL, 0, 0);
+ return 0;
+ }
+
+EOF
+if { (eval echo configure:2623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_flavor_gethostbyaddr=glibc
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -fr conftest*
+fi
+
+ if test "$cross_compiling" = yes; then
+ ac_cv_flavor_gethostbyaddr=unknown
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2637 "configure"
+#include "confdefs.h"
+
+ #include <stddef.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
+ struct hostent *gethostbyaddr(const char *addr, int len, int type) {
+ return NULL;
+ }
+ int main() {
+ (void)gethostbyaddr(NULL, 0, 0);
+ return 0;
+ }
+
+EOF
+if { (eval echo configure:2653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_flavor_gethostbyaddr=traditional
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -fr conftest*
+fi
+
+ if test "$ac_cv_func_gethostbyaddr" = no ; then
+ ac_cv_flavor_gethostbyaddr=none
+ fi
+fi
+
+echo "$ac_t""$ac_cv_flavor_gethostbyaddr" 1>&6
+
+ case "$ac_cv_flavor_gethostbyaddr" in
+ glibc2_2)
+ ac_cv_type_ghba_addr_t='const void *'
+ ac_cv_type_ghba_addrlen_t='socklen_t'
+ ;;
+ glibc)
+ ac_cv_type_ghba_addr_t='const char *'
+ ac_cv_type_ghba_addrlen_t='size_t'
+ ;;
+ traditional | none)
+ ac_cv_type_ghba_addr_t='const char *'
+ ac_cv_type_ghba_addrlen_t='int'
+ ;;
+ *)
+ { echo "configure: error: can't build runidn, since parameter type list of gethostbyaddr() is unknown to configure." 1>&2; exit 1; }
+ ;;
+ esac
+ cat >> confdefs.h <<EOF
+#define GHBA_ADDR_T $ac_cv_type_ghba_addr_t
+EOF
+
+ cat >> confdefs.h <<EOF
+#define GHBA_ADDRLEN_T $ac_cv_type_ghba_addrlen_t
+EOF
+
+
+ echo $ac_n "checking flavor of getnameinfo""... $ac_c" 1>&6
+echo "configure:2697: checking flavor of getnameinfo" >&5
+if eval "test \"`echo '$''{'ac_cv_flavor_getnameinfo'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_flavor_getnameinfo=unknown
+ if test "$cross_compiling" = yes; then
+ ac_cv_flavor_getnameinfo=unknown
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2706 "configure"
+#include "confdefs.h"
+
+ #include <stddef.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
+ int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
+ socklen_t hostlen, char *serv, socklen_t servlen,
+ unsigned int flags) {
+ return NULL;
+ }
+ int main() {
+ (void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0);
+ return 0;
+ }
+
+EOF
+if { (eval echo configure:2724: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_flavor_getnameinfo=glibc2_2_2
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -fr conftest*
+fi
+
+ if test "$cross_compiling" = yes; then
+ ac_cv_flavor_getnameinfo=unknown
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2738 "configure"
+#include "confdefs.h"
+
+ #include <stddef.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
+ int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
+ socklen_t hostlen, char *serv, socklen_t servlen,
+ int flags) {
+ return NULL;
+ }
+ int main() {
+ (void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0);
+ return 0;
+ }
+
+EOF
+if { (eval echo configure:2756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_flavor_getnameinfo=rfc2553bis_03
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -fr conftest*
+fi
+
+ if test "$cross_compiling" = yes; then
+ ac_cv_flavor_getnameinfo=unknown
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2770 "configure"
+#include "confdefs.h"
+
+ #include <stddef.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
+ int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
+ size_t hostlen, char *serv, size_t servlen, int flags) {
+ return NULL;
+ }
+ int main() {
+ (void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0);
+ return 0;
+ }
+
+EOF
+if { (eval echo configure:2787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_flavor_getnameinfo=rfc2553
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -fr conftest*
+fi
+
+ if test "$cross_compiling" = yes; then
+ ac_cv_flavor_getnameinfo=unknown
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2801 "configure"
+#include "confdefs.h"
+
+ #include <stddef.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
+ int getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
+ size_t hostlen, char *serv, size_t servlen, int flags) {
+ return NULL;
+ }
+ int main() {
+ (void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0);
+ return 0;
+ }
+
+EOF
+if { (eval echo configure:2818: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_flavor_getnameinfo=rfc2133
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -fr conftest*
+fi
+
+ if test "$ac_cv_func_getnameinfo" = no ; then
+ ac_cv_flavor_getnameinfo=none
+ fi
+fi
+
+echo "$ac_t""$ac_cv_flavor_getnameinfo" 1>&6
+
+ case "$ac_cv_flavor_getnameinfo" in
+ glibc2_2_2)
+ ac_cv_type_gni_salen_t='socklen_t'
+ ac_cv_type_gni_hostlen_t='socklen_t'
+ ac_cv_type_gni_servlen_t='socklen_t'
+ ac_cv_type_gni_flags_t='unsigned int'
+ ;;
+ rfc2553bis_03)
+ ac_cv_type_gni_salen_t='socklen_t'
+ ac_cv_type_gni_hostlen_t='socklen_t'
+ ac_cv_type_gni_servlen_t='socklen_t'
+ ac_cv_type_gni_flags_t='int'
+ ;;
+ rfc2553)
+ ac_cv_type_gni_salen_t='socklen_t'
+ ac_cv_type_gni_hostlen_t='size_t'
+ ac_cv_type_gni_servlen_t='size_t'
+ ac_cv_type_gni_flags_t='int'
+ ;;
+ rfc2133 | none)
+ ac_cv_type_gni_salen_t='size_t'
+ ac_cv_type_gni_hostlen_t='size_t'
+ ac_cv_type_gni_servlen_t='size_t'
+ ac_cv_type_gni_flags_t='int'
+ ;;
+ *)
+ { echo "configure: error: can't build runidn, since parameter type list of getnameinfo() is unknown to configure." 1>&2; exit 1; }
+ esac
+ cat >> confdefs.h <<EOF
+#define GNI_SALEN_T $ac_cv_type_gni_salen_t
+EOF
+
+ cat >> confdefs.h <<EOF
+#define GNI_HOSTLEN_T $ac_cv_type_gni_hostlen_t
+EOF
+
+ cat >> confdefs.h <<EOF
+#define GNI_SERVLEN_T $ac_cv_type_gni_servlen_t
+EOF
+
+ cat >> confdefs.h <<EOF
+#define GNI_FLAGS_T $ac_cv_type_gni_flags_t
+EOF
+
+fi
+
+if test "$find_gethost_r" = yes; then
+ echo $ac_n "checking flavor of gethostbyname_r""... $ac_c" 1>&6
+echo "configure:2883: checking flavor of gethostbyname_r" >&5
+if eval "test \"`echo '$''{'ac_cv_flavor_gethost_r'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_flavor_gethost_r=sun
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2891 "configure"
+#include "confdefs.h"
+
+#include <stddef.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <stdio.h>
+int main()
+{
+ int err = 0;
+ struct hostent hebuf, *hp;
+ char buf[10];
+ /* Try resolving a invalid name using glibc flavor. */
+ (void)gethostbyname_r("@#!", &hebuf, buf, sizeof(buf), &hp, &err);
+ if (err != 0)
+ return 0; /* glibc flavor */
+ else
+ return 1; /* Sun flavor */
+}
+
+EOF
+if { (eval echo configure:2913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_flavor_gethost_r=glibc
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_flavor_gethost_r=sun
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_flavor_gethost_r" 1>&6
+ if test "$ac_cv_flavor_gethost_r" = "glibc"; then
+ cat >> confdefs.h <<\EOF
+#define GETHOST_R_GLIBC_FLAVOR 1
+EOF
+
+ fi
+fi
+
+
+echo $ac_n "checking for libc shared object""... $ac_c" 1>&6
+echo "configure:2938: checking for libc shared object" >&5
+shobj_name=libc
+shobj_path=
+case "$host" in
+*-hpux*)
+ SOEXT=sl
+ ;;
+*)
+ SOEXT=so
+ ;;
+esac
+for shobj_libdir in /lib /usr/lib; do
+ if test -f $shobj_libdir/$shobj_name.$SOEXT; then
+ shobj_path=$shobj_libdir/$shobj_name.$SOEXT
+ else
+ shobj_path=`ls -r $shobj_libdir/$shobj_name.$SOEXT* 2>/dev/null | head -1`
+ if test "$shobj_path" != "" -a -f "$shobj_path"; then
+ :
+ else
+ shobj_path=
+ fi
+ fi
+ if test "$shobj_path" != ""; then
+ echo "$ac_t""$shobj_path" 1>&6
+ shobj_pathsymbol=SOPATH_`echo $shobj_name | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $shobj_pathsymbol "$shobj_path"
+EOF
+
+ break
+ fi
+done
+if test "$shobj_path" = ""; then
+ echo "$ac_t""no" 1>&6
+fi
+
+if test "$install_runidn" = yes ; then
+
+echo $ac_n "checking for libnsl shared object""... $ac_c" 1>&6
+echo "configure:2977: checking for libnsl shared object" >&5
+shobj_name=libnsl
+shobj_path=
+case "$host" in
+*-hpux*)
+ SOEXT=sl
+ ;;
+*)
+ SOEXT=so
+ ;;
+esac
+for shobj_libdir in /lib /usr/lib; do
+ if test -f $shobj_libdir/$shobj_name.$SOEXT; then
+ shobj_path=$shobj_libdir/$shobj_name.$SOEXT
+ else
+ shobj_path=`ls -r $shobj_libdir/$shobj_name.$SOEXT* 2>/dev/null | head -1`
+ if test "$shobj_path" != "" -a -f "$shobj_path"; then
+ :
+ else
+ shobj_path=
+ fi
+ fi
+ if test "$shobj_path" != ""; then
+ echo "$ac_t""$shobj_path" 1>&6
+ shobj_pathsymbol=SOPATH_`echo $shobj_name | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $shobj_pathsymbol "$shobj_path"
+EOF
+
+ break
+ fi
+done
+if test "$shobj_path" = ""; then
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+if test "$liteonly" != yes ; then
+ echo $ac_n "checking for iconv""... $ac_c" 1>&6
+echo "configure:3017: checking for iconv" >&5
+ saved_CPPFLAGS=$CPPFLAGS
+ saved_LIBS=$LIBS
+ CPPFLAGS="$CPPFLAGS $ICONVINC"
+ LIBS="$LIBS $ICONVLIB"
+ cat > conftest.$ac_ext <<EOF
+#line 3023 "configure"
+#include "confdefs.h"
+
+ #include <iconv.h>
+
+int main() {
+
+ iconv_t i;
+ i = iconv_open("ISO-8859-1", "UTF-8");
+
+; return 0; }
+EOF
+if { (eval echo configure:3035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ iconv_try_link=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ iconv_try_link=no
+fi
+rm -f conftest*
+ LIBS=$saved_LIBS
+ CPPFLAGS=$saved_CPPFLAGS
+ echo "$ac_t""$iconv_try_link" 1>&6
+ if test "$iconv_try_link" = no ; then
+ { echo "configure: error: iconv function not available" 1>&2; exit 1; }
+ fi
+fi
+
+if test "$liteonly" != yes ; then
+ echo $ac_n "checking for codeset name $UTF8_NAME""... $ac_c" 1>&6
+echo "configure:3055: checking for codeset name $UTF8_NAME" >&5
+ saved_CPPFLAGS=$CPPFLAGS
+ saved_LIBS=$LIBS
+ CPPFLAGS="$CPPFLAGS $ICONVINC"
+ LIBS="$LIBS $ICONVLIB"
+ if test "$cross_compiling" = yes; then
+ utf8_name_valid=unknown
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3064 "configure"
+#include "confdefs.h"
+
+ #include <stddef.h>
+ #include <stdlib.h>
+ #include <iconv.h>
+ #define UTF8_NAME "$UTF8_NAME"
+ #define ICONV_FAIL ((iconv_t)(-1))
+ /* Check if the codeset name UTF8_NAME is valid by performing iconv_open(). */
+ int main() {
+ int i;
+ /* list of codeset names likely to exist */
+ static char *codeset[] = {
+ "ASCII", "ISO-8859-1", "ISO8859-1", "iso8859_1", "8859-1",
+ "Shift_JIS", "SJIS", "sjis", NULL,
+ };
+
+ /* First try null conversion. */
+ if (iconv_open(UTF8_NAME, UTF8_NAME) != ICONV_FAIL) return 0;
+
+ /* Unfortunately, above check fails on certain systems, such as Solaris. */
+ for (i = 0; codeset[i] != NULL; i++) {
+ if (iconv_open(UTF8_NAME, codeset[i]) != ICONV_FAIL) return 0;
+ }
+ return 1;
+ }
+
+EOF
+if { (eval echo configure:3092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ utf8_name_valid=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ utf8_name_valid=no
+fi
+rm -fr conftest*
+fi
+
+ LIBS=$saved_LIBS
+ CPPFLAGS=$saved_CPPFLAGS
+ echo "$ac_t""$utf8_name_valid" 1>&6
+fi
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "Makefile
+ include/Makefile
+ include/idn/Makefile
+ include/mdn/Makefile
+ lib/Makefile
+ man/Makefile
+ tools/Makefile
+ tools/idnconv/Makefile
+ tools/runidn/Makefile
+ tools/runidn/runidn
+ map/Makefile
+ lib/tests/Makefile
+ include/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@COMPAT_TRUE@%$COMPAT_TRUE%g
+s%@COMPAT_FALSE@%$COMPAT_FALSE%g
+s%@UTF8_NAME@%$UTF8_NAME%g
+s%@LITEONLY_TRUE@%$LITEONLY_TRUE%g
+s%@LITEONLY_FALSE@%$LITEONLY_FALSE%g
+s%@RUNIDN_TRUE@%$RUNIDN_TRUE%g
+s%@RUNIDN_FALSE@%$RUNIDN_FALSE%g
+s%@ICONVINC@%$ICONVINC%g
+s%@ICONVLIB@%$ICONVLIB%g
+s%@ICONVSOFILE@%$ICONVSOFILE%g
+s%@PRELOAD_VAR@%$PRELOAD_VAR%g
+s%@PRELOAD_SEP@%$PRELOAD_SEP%g
+s%@PRELOAD_LAST@%$PRELOAD_LAST%g
+s%@CC@%$CC%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@RANLIB@%$RANLIB%g
+s%@LN_S@%$LN_S%g
+s%@LIBTOOL@%$LIBTOOL%g
+s%@PERL@%$PERL%g
+s%@CPP@%$CPP%g
+s%@LIBDL@%$LIBDL%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile
+ include/Makefile
+ include/idn/Makefile
+ include/mdn/Makefile
+ lib/Makefile
+ man/Makefile
+ tools/Makefile
+ tools/idnconv/Makefile
+ tools/runidn/Makefile
+ tools/runidn/runidn
+ map/Makefile
+ lib/tests/Makefile
+"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ [/$]*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='\([ ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+ CONFIG_HEADERS="include/config.h"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ echo creating $ac_file
+
+ rm -f conftest.frag conftest.in conftest.out
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h. And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+ ac_lines=`grep -c . conftest.vals`
+ # grep -c gives empty output for an empty file on some AIX systems.
+ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+ # Write a limited-size here document to conftest.frag.
+ echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+ echo 'CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+ rm -f conftest.vals
+ mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+ rm -f conftest.frag conftest.h
+ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
+ cat conftest.in >> conftest.h
+ rm -f conftest.in
+ if cmp -s $ac_file conftest.h 2>/dev/null; then
+ echo "$ac_file is unchanged"
+ rm -f conftest.h
+ else
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ fi
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
diff --git a/contrib/idn/idnkit-1.0-src/configure.in b/contrib/idn/idnkit-1.0-src/configure.in
new file mode 100644
index 0000000..97a954e
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/configure.in
@@ -0,0 +1,711 @@
+dnl $Id: configure.in,v 1.1.1.1 2003/06/04 00:25:25 marka Exp $
+dnl Process this file with autoconf to produce a configure script.
+dnl
+dnl Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+dnl
+dnl By using this file, you agree to the terms and conditions set forth bellow.
+dnl
+dnl LICENSE TERMS AND CONDITIONS
+dnl
+dnl The following License Terms and Conditions apply, unless a different
+dnl license is obtained from Japan Network Information Center ("JPNIC"),
+dnl a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+dnl Chiyoda-ku, Tokyo 101-0047, Japan.
+dnl
+dnl 1. Use, Modification and Redistribution (including distribution of any
+dnl modified or derived work) in source and/or binary forms is permitted
+dnl under this License Terms and Conditions.
+dnl
+dnl 2. Redistribution of source code must retain the copyright notices as they
+dnl appear in each source code file, this License Terms and Conditions.
+dnl
+dnl 3. Redistribution in binary form must reproduce the Copyright Notice,
+dnl this License Terms and Conditions, in the documentation and/or other
+dnl materials provided with the distribution. For the purposes of binary
+dnl distribution the "Copyright Notice" refers to the following language:
+dnl "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+dnl
+dnl 4. The name of JPNIC may not be used to endorse or promote products
+dnl derived from this Software without specific prior written approval of
+dnl JPNIC.
+dnl
+dnl 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+dnl "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+dnl PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+dnl CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+dnl SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+dnl BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+dnl WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+dnl OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+dnl ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+AC_INIT(include/idn/converter.h)
+
+AC_CANONICAL_HOST
+
+debug=no
+AC_ARG_ENABLE(debug,
+[ --enable-debug enable debug codes [default=no]],
+ debug=$enableval)
+case "$debug" in
+yes)
+ CFLAGS="$CFLAGS -DDEBUG"
+ ;;
+esac
+
+mdnkit_compat=no
+COMPAT_TRUE="#"
+COMPAT_FALSE=
+AC_ARG_ENABLE(mdnkit-compat,
+[ --enable-mdnkit-compat enable mDNkit compatibility mode [default=no]],
+ mdnkit_compat=$enableval)
+case "$mdnkit_compat" in
+yes)
+ COMPAT_TRUE=
+ COMPAT_FALSE="#"
+ AC_DEFINE(ENABLE_MDNKIT_COMPAT, 1,
+ [Define if --enable-mdnkit-compat is specified])
+ ;;
+no)
+ ;;
+*)
+ AC_MSG_ERROR([You must specify yes or no to --enable-runidn option.])
+ ;;
+esac
+AC_SUBST(COMPAT_TRUE)
+AC_SUBST(COMPAT_FALSE)
+
+extraace=no
+AC_ARG_ENABLE(extra-ace,
+[ --enable-extra-ace enable additional ACE converters. [default=no]],
+ extraace=$enableval)
+case "$extraace" in
+no)
+ ;;
+yes)
+ AC_DEFINE(IDN_EXTRA_ACE, 1,
+ [Define if you want additional ACE converters compiled in.])
+ ;;
+*)
+ AC_MSG_ERROR([You must specify yes or no to --enable-extra-ace option.])
+ ;;
+esac
+
+UTF8_NAME=no
+AC_ARG_WITH(utf8,
+[ --with-utf8=NAME codeset name for UTF-8 encoding [UTF-8]],
+ UTF8_NAME=$withval)
+case "$UTF8_NAME" in
+no)
+ UTF8_NAME=UTF-8
+ ;;
+yes)
+ AC_MSG_ERROR([You must specify NAME to --with-utf8 option.])
+ ;;
+*)
+ AC_DEFINE_UNQUOTED(IDN_UTF8_ENCODING_NAME, "$UTF8_NAME",
+ [Define if your iconv() does not accept "UTF-8" as the codeset name for utf-8.])
+ ;;
+esac
+AC_SUBST(UTF8_NAME)
+
+liteonly=no
+LITEONLY_TRUE="#"
+LITEONLY_FALSE=
+AC_ARG_ENABLE(liteonly,
+[ --enable-liteonly compile and install lite library only [default=no]],
+ liteonly=$enableval)
+case "$liteonly" in
+no)
+ ;;
+yes)
+ if test "$install_runidn" = yes ; then
+ AC_MSG_ERROR([you can't set value \"yes\" to --enable-runidn and --enable-liteonly simultaneously, because runidn requires iconv support of generic libidnkit.])
+ fi
+ LITEONLY_TRUE=
+ LITEONLY_FALSE="#"
+ ;;
+*)
+ AC_MSG_ERROR([You must specify yes or no to --enable-liteonly option.])
+ ;;
+esac
+AC_SUBST(LITEONLY_TRUE)
+AC_SUBST(LITEONLY_FALSE)
+
+install_runidn=no
+RUNIDN_TRUE="#"
+RUNIDN_FALSE=
+AC_ARG_ENABLE(runidn,
+[ --enable-runidn compile and install runidn [default=no]],
+ install_runidn=$enableval)
+case "$install_runidn" in
+no)
+ ;;
+yes)
+ if test "$liteonly" = yes ; then
+ AC_MSG_ERROR([you can't set value \"yes\" to --enable-runidn and --enable-liteonly simultaneously, because runidn requires iconv support of generic libidnkit.])
+ fi
+ RUNIDN_TRUE=
+ RUNIDN_FALSE="#"
+ ;;
+*)
+ AC_MSG_ERROR([You must specify yes or no to --enable-runidn option.])
+ ;;
+esac
+AC_SUBST(RUNIDN_TRUE)
+AC_SUBST(RUNIDN_FALSE)
+
+ICONVINC=
+ICONVLIB=
+
+libiconv=unspec
+AC_ARG_WITH(libiconv,
+[ --with-libiconv=IPREFIX GNU libiconv are installed in IPREFIX [PREFIX]],
+ libiconv=$withval)
+case "$libiconv" in
+unspec)
+ ;;
+no)
+ ICONVINC=
+ ICONVLIB=
+ ;;
+yes)
+ if test "$liteonly" = yes ; then
+ AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
+ fi
+ if test X$prefix = XNONE ; then
+ libiconv=$ac_default_prefix
+ else
+ libiconv=$prefix
+ fi
+ ICONVINC="-I$libiconv/include"
+ ICONVLIB="-L$libiconv/lib -R$libiconv/lib -liconv"
+ ;;
+*)
+ if test "$liteonly" = yes ; then
+ AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
+ fi
+ ICONVINC="-I$libiconv/include"
+ ICONVLIB="-L$libiconv/lib -R$libiconv/lib -liconv"
+ ;;
+esac
+
+iconv_include=unspec
+AC_ARG_WITH(iconv-include,
+[ --with-iconv-include=DIR iconv include files are in DIR []],
+ iconv_include=$withval)
+case "$iconv_include" in
+unspec)
+ ;;
+no)
+ ICONVINC=
+ ;;
+yes)
+ if test "$liteonly" = yes ; then
+ AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
+ fi
+ AC_MSG_WARN([You must supply DIR to --with-iconv-include option.
+ Ignored.])
+ ICONVINC=
+ ;;
+*)
+ if test "$liteonly" = yes ; then
+ AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
+ fi
+ ICONVINC="-I$iconv_include"
+ ;;
+esac
+
+if test "X$ICONVINC" != X ; then
+ iconv_include="`echo X$ICONVINC | sed -e 's/^X-I//'`"
+ if test ! -f "$iconv_include/iconv.h" ; then
+ AC_MSG_ERROR([iconv.h doesn't exist in $iconv_include])
+ fi
+fi
+
+AC_SUBST(ICONVINC)
+
+iconv=unspec
+AC_ARG_WITH(iconv,
+[ --with-iconv=LIB special library for iconv []],
+ iconv=$withval)
+case "$iconv" in
+unspec)
+ ;;
+no)
+ ICONVLIB=
+ ;;
+yes)
+ if test "$liteonly" = yes ; then
+ AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
+ fi
+ AC_MSG_WARN([You must supply LIB to --with-iconv option.
+ -liconv is assumed.])
+ ICONVLIB=-liconv
+ ;;
+*)
+ if test "$liteonly" = yes ; then
+ AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
+ fi
+ ICONVLIB=$iconv
+ ;;
+esac
+AC_SUBST(ICONVLIB)
+
+AC_ARG_WITH(iconv-sofile,
+[ --with-iconv-sofile=PATH shared library file for libiconv []],
+ iconv_file=$withval, iconv_file=guess)
+ICONVSOFILE=
+case "$iconv_file" in
+no)
+ ICONVSOFILE=none
+ ;;
+yes)
+ if test "$liteonly" = yes ; then
+ AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
+ fi
+ AC_MSG_ERROR([You must supply PATH to --with-iconv-sofile option.])
+ ;;
+guess)
+ if test "$liteonly" != yes ; then
+ if test "$ICONVLIB" = ""; then
+ ICONVSOFILE=none
+ else
+ AC_MSG_CHECKING(pathname of iconv shared library)
+ ic_libdir=
+ ic_libname=
+ case "$host" in
+ *-hpux*)
+ SO=sl
+ ;;
+ *)
+ SO=so
+ ;;
+ esac
+ for arg in $ICONVLIB; do
+ case "$arg" in
+ -L*) ic_libdir="$ic_libdir `echo $arg | sed s/-L//`" ;;
+ -l*) ic_libname=`echo $arg | sed s/-l//` ;;
+ /*.$SO*) ICONVSOFILE=$arg ;;
+ esac
+ done
+ if test "$ICONVSOFILE" = ""; then
+ if test "$ic_libname" = ""; then
+ AC_MSG_RESULT(unknown)
+ AC_MSG_WARN([use --with-iconv-sofile for specifying iconv shared library file])
+ ICONVSOFILE=none
+ else
+ if test "$ic_libdir" = ""; then
+ # Standard (and semi-standard) library directories
+ ic_libdir="/lib /usr/lib /usr/local/lib"
+ fi
+ for dir in $ic_libdir; do
+ ICONVSOFILE=`ls -r $dir/lib$ic_libname.$SO* 2>/dev/null | head -1`
+ if test "$ICONVSOFILE" != ""; then
+ break
+ fi
+ done
+ if test "$ICONVSOFILE" != ""; then
+ AC_MSG_RESULT($ICONVSOFILE)
+ else
+ AC_MSG_RESULT(unknown)
+ AC_MSG_WARN([use --with-iconv-sofile for specifying iconv shared library file])
+ ICONVSOFILE=none
+ fi
+ fi
+ fi
+ fi
+ else
+ ICONVSOFILE=none
+ fi
+ ;;
+*)
+ if test "$liteonly" = yes ; then
+ AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
+ fi
+ ICONVSOFILE=$iconv_file
+ ;;
+esac
+AC_SUBST(ICONVSOFILE)
+
+dnl Figure out preload stuff.
+PRELOAD_VAR="LD_PRELOAD"
+PRELOAD_SEP=":"
+PRELOAD_LAST=""
+case "$host" in
+*-solaris*)
+ PRELOAD_SEP=" "
+ ;;
+*-linux*)
+ PRELOAD_SEP=" "
+ ;;
+*-osf*)
+ PRELOAD_VAR="_RLD_LIST"
+ PRELOAD_LAST=":DEFAULT"
+ ;;
+*-netbsd*)
+ if test -x /usr/bin/file -a -x /usr/bin/grep ; then
+ case "`/usr/bin/file /usr/bin/grep`" in
+ *ELF*)
+ PRELOAD_SEP=" "
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+AC_SUBST(PRELOAD_VAR)
+AC_SUBST(PRELOAD_SEP)
+AC_SUBST(PRELOAD_LAST)
+
+dnl Checks for standard tools.
+AC_PROG_CC
+AC_PROG_INSTALL
+AM_PROG_LIBTOOL
+
+AC_PATH_PROGS(PERL, perl, perl)
+
+dnl Checks for header files.
+AC_CHECK_HEADERS(unistd.h locale.h langinfo.h pwd.h)
+if test "$install_runidn" = yes ; then
+ AC_CHECK_HEADERS(dlfcn.h)
+fi
+
+saved_CPPFLAGS=$CPPFLAGS
+CPPFLAGS="$CPPFLAGS $ICONVINC"
+if test "$liteonly" != yes ; then
+ AC_CHECK_HEADER(iconv.h, , [AC_MSG_ERROR([iconv.h doesn't exist])])
+fi
+CPPFLAGS=$saved_CPPFLAGS
+
+dnl Checks for data types.
+AC_TYPE_UID_T
+dnl for dnsproxy.
+AC_CHECK_TYPE(BOOL, int)
+
+dnl Checks for libraries.
+if test "$install_runidn" = yes ; then
+ AC_CHECK_LIB(socket, socket)
+ AC_CHECK_LIB(nsl, inet_addr)
+ AC_CHECK_LIB(dl, dlopen, [
+ LIBS="-ldl $LIBS"
+ LIBDL="-ldl"
+ AC_DEFINE(HAVE_LIBDL, 1, [Define if you have the dl library (-ldl).])
+ AC_SUBST(LIBDL)
+ ])
+fi
+
+dnl Checks for library functions.
+AC_CHECK_FUNCS(vsnprintf setvbuf setlocale nl_langinfo memmove bcopy setenv \
+ unsetenv)
+if test "$install_runidn" = yes ; then
+ AC_CHECK_FUNCS(gethostbyname gethostbyname2 gethostbyaddr)
+ AC_CHECK_FUNCS(gethostbyname_r gethostbyname2_r gethostbyaddr_r, find_gethost_r=yes)
+ AC_CHECK_FUNCS(getipnodebyname getipnodebyaddr freehostent)
+ AC_CHECK_FUNCS(getaddrinfo freeaddrinfo getnameinfo)
+ AC_CHECK_FUNCS(dlopen dlsym)
+fi
+
+if test "$install_runidn" = yes ; then
+dnl Checks the flavor of gethostbyaddr* functions.
+ AC_CACHE_CHECK(flavor of gethostbyaddr, ac_cv_flavor_gethostbyaddr,
+ [ac_cv_flavor_gethostbyaddr=unknown
+ AC_TRY_RUN(
+ [
+ #include <stddef.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
+ struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type) {
+ return NULL;
+ }
+ int main() {
+ (void)gethostbyaddr(NULL, 0, 0);
+ return 0;
+ }
+ ], ac_cv_flavor_gethostbyaddr=glibc2_2,,
+ ac_cv_flavor_gethostbyaddr=unknown)
+ AC_TRY_RUN(
+ [
+ #include <stddef.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
+ struct hostent *gethostbyaddr(const char *addr, size_t len, int type) {
+ return NULL;
+ }
+ int main() {
+ (void)gethostbyaddr(NULL, 0, 0);
+ return 0;
+ }
+ ], ac_cv_flavor_gethostbyaddr=glibc,,
+ ac_cv_flavor_gethostbyaddr=unknown)
+ AC_TRY_RUN(
+ [
+ #include <stddef.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
+ struct hostent *gethostbyaddr(const char *addr, int len, int type) {
+ return NULL;
+ }
+ int main() {
+ (void)gethostbyaddr(NULL, 0, 0);
+ return 0;
+ }
+ ], ac_cv_flavor_gethostbyaddr=traditional,,
+ ac_cv_flavor_gethostbyaddr=unknown)
+ if test "$ac_cv_func_gethostbyaddr" = no ; then
+ ac_cv_flavor_gethostbyaddr=none
+ fi])
+
+ case "$ac_cv_flavor_gethostbyaddr" in
+ glibc2_2)
+ ac_cv_type_ghba_addr_t='const void *'
+ ac_cv_type_ghba_addrlen_t='socklen_t'
+ ;;
+ glibc)
+ ac_cv_type_ghba_addr_t='const char *'
+ ac_cv_type_ghba_addrlen_t='size_t'
+ ;;
+ traditional | none)
+ ac_cv_type_ghba_addr_t='const char *'
+ ac_cv_type_ghba_addrlen_t='int'
+ ;;
+ *)
+ AC_MSG_ERROR([can't build runidn, since parameter type list of gethostbyaddr() is unknown to configure.])
+ ;;
+ esac
+ AC_DEFINE_UNQUOTED(GHBA_ADDR_T, $ac_cv_type_ghba_addr_t,
+ [Define as the type of the 1st argument of gethostbyaddr.])
+ AC_DEFINE_UNQUOTED(GHBA_ADDRLEN_T, $ac_cv_type_ghba_addrlen_t,
+ [Define as the type of the 2nd argument of gethostbyaddr.])
+
+dnl Checks the flavor of getnameinfo functions.
+ AC_CACHE_CHECK(flavor of getnameinfo, ac_cv_flavor_getnameinfo,
+ [ac_cv_flavor_getnameinfo=unknown
+ AC_TRY_RUN(
+ [
+ #include <stddef.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
+ int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
+ socklen_t hostlen, char *serv, socklen_t servlen,
+ unsigned int flags) {
+ return NULL;
+ }
+ int main() {
+ (void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0);
+ return 0;
+ }
+ ], ac_cv_flavor_getnameinfo=glibc2_2_2,,
+ ac_cv_flavor_getnameinfo=unknown)
+ AC_TRY_RUN(
+ [
+ #include <stddef.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
+ int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
+ socklen_t hostlen, char *serv, socklen_t servlen,
+ int flags) {
+ return NULL;
+ }
+ int main() {
+ (void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0);
+ return 0;
+ }
+ ], ac_cv_flavor_getnameinfo=rfc2553bis_03,,
+ ac_cv_flavor_getnameinfo=unknown)
+ AC_TRY_RUN(
+ [
+ #include <stddef.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
+ int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
+ size_t hostlen, char *serv, size_t servlen, int flags) {
+ return NULL;
+ }
+ int main() {
+ (void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0);
+ return 0;
+ }
+ ], ac_cv_flavor_getnameinfo=rfc2553,,
+ ac_cv_flavor_getnameinfo=unknown)
+ AC_TRY_RUN(
+ [
+ #include <stddef.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
+ int getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
+ size_t hostlen, char *serv, size_t servlen, int flags) {
+ return NULL;
+ }
+ int main() {
+ (void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0);
+ return 0;
+ }
+ ], ac_cv_flavor_getnameinfo=rfc2133,,
+ ac_cv_flavor_getnameinfo=unknown)
+ if test "$ac_cv_func_getnameinfo" = no ; then
+ ac_cv_flavor_getnameinfo=none
+ fi])
+
+ case "$ac_cv_flavor_getnameinfo" in
+ glibc2_2_2)
+ ac_cv_type_gni_salen_t='socklen_t'
+ ac_cv_type_gni_hostlen_t='socklen_t'
+ ac_cv_type_gni_servlen_t='socklen_t'
+ ac_cv_type_gni_flags_t='unsigned int'
+ ;;
+ rfc2553bis_03)
+ ac_cv_type_gni_salen_t='socklen_t'
+ ac_cv_type_gni_hostlen_t='socklen_t'
+ ac_cv_type_gni_servlen_t='socklen_t'
+ ac_cv_type_gni_flags_t='int'
+ ;;
+ rfc2553)
+ ac_cv_type_gni_salen_t='socklen_t'
+ ac_cv_type_gni_hostlen_t='size_t'
+ ac_cv_type_gni_servlen_t='size_t'
+ ac_cv_type_gni_flags_t='int'
+ ;;
+ rfc2133 | none)
+ ac_cv_type_gni_salen_t='size_t'
+ ac_cv_type_gni_hostlen_t='size_t'
+ ac_cv_type_gni_servlen_t='size_t'
+ ac_cv_type_gni_flags_t='int'
+ ;;
+ *)
+ AC_MSG_ERROR([can't build runidn, since parameter type list of getnameinfo() is unknown to configure.])
+ esac
+ AC_DEFINE_UNQUOTED(GNI_SALEN_T, $ac_cv_type_gni_salen_t,
+ [Define as the type of the 2nd argument of getnameinfo.])
+ AC_DEFINE_UNQUOTED(GNI_HOSTLEN_T, $ac_cv_type_gni_hostlen_t,
+ [Define as the type of the 4th argument of getnameinfo.])
+ AC_DEFINE_UNQUOTED(GNI_SERVLEN_T, $ac_cv_type_gni_servlen_t,
+ [Define as the type of the 6th argument of getnameinfo.])
+ AC_DEFINE_UNQUOTED(GNI_FLAGS_T, $ac_cv_type_gni_flags_t,
+ [Define as the type of the 7th argument of getnameinfo.])
+fi
+
+dnl resume here.
+dnl Checks the flavor of gethost*_r functions.
+if test "$find_gethost_r" = yes; then
+ AC_CACHE_CHECK(flavor of gethostbyname_r, ac_cv_flavor_gethost_r,
+ [AC_TRY_RUN(
+changequote(<<, >>)dnl
+<<
+#include <stddef.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <stdio.h>
+int main()
+{
+ int err = 0;
+ struct hostent hebuf, *hp;
+ char buf[10];
+ /* Try resolving a invalid name using glibc flavor. */
+ (void)gethostbyname_r("@#!", &hebuf, buf, sizeof(buf), &hp, &err);
+ if (err != 0)
+ return 0; /* glibc flavor */
+ else
+ return 1; /* Sun flavor */
+}
+>>,
+changequote([, ])dnl
+ ac_cv_flavor_gethost_r=glibc,
+ ac_cv_flavor_gethost_r=sun,
+ ac_cv_flavor_gethost_r=sun)])
+ if test "$ac_cv_flavor_gethost_r" = "glibc"; then
+ AC_DEFINE(GETHOST_R_GLIBC_FLAVOR, 1,
+ [Define if the prototype of gethost*_r is glibc flavor.])
+ fi
+fi
+
+dnl Find system shared object paths.
+AC_FIND_SYSTEM_SHOBJ(libc)
+if test "$install_runidn" = yes ; then
+ AC_FIND_SYSTEM_SHOBJ(libnsl)
+fi
+
+dnl Checks for iconv library.
+if test "$liteonly" != yes ; then
+ AC_MSG_CHECKING(for iconv)
+ saved_CPPFLAGS=$CPPFLAGS
+ saved_LIBS=$LIBS
+ CPPFLAGS="$CPPFLAGS $ICONVINC"
+ LIBS="$LIBS $ICONVLIB"
+ AC_TRY_LINK([
+ #include <iconv.h>
+ ], [
+ iconv_t i;
+ i = iconv_open("ISO-8859-1", "UTF-8");
+ ], [iconv_try_link=yes], [iconv_try_link=no])
+ LIBS=$saved_LIBS
+ CPPFLAGS=$saved_CPPFLAGS
+ AC_MSG_RESULT($iconv_try_link)
+ if test "$iconv_try_link" = no ; then
+ AC_MSG_ERROR(iconv function not available)
+ fi
+fi
+
+dnl Check for codeset name for UTF-8.
+if test "$liteonly" != yes ; then
+ AC_MSG_CHECKING([for codeset name $UTF8_NAME])
+ saved_CPPFLAGS=$CPPFLAGS
+ saved_LIBS=$LIBS
+ CPPFLAGS="$CPPFLAGS $ICONVINC"
+ LIBS="$LIBS $ICONVLIB"
+ AC_TRY_RUN([
+ #include <stddef.h>
+ #include <stdlib.h>
+ #include <iconv.h>
+ #define UTF8_NAME "$UTF8_NAME"
+ #define ICONV_FAIL ((iconv_t)(-1))
+ /* Check if the codeset name UTF8_NAME is valid by performing iconv_open(). */
+ int main() {
+ int i;
+ /* list of codeset names likely to exist */
+ static char *codeset[] = {
+ "ASCII", "ISO-8859-1", "ISO8859-1", "iso8859_1", "8859-1",
+ "Shift_JIS", "SJIS", "sjis", NULL,
+ };
+
+ /* First try null conversion. */
+ if (iconv_open(UTF8_NAME, UTF8_NAME) != ICONV_FAIL) return 0;
+
+ /* Unfortunately, above check fails on certain systems, such as Solaris. */
+ for (i = 0; codeset[i] != NULL; i++) {
+ if (iconv_open(UTF8_NAME, codeset[i]) != ICONV_FAIL) return 0;
+ }
+ return 1;
+ }
+ ], utf8_name_valid=yes, utf8_name_valid=no, utf8_name_valid=unknown)
+ LIBS=$saved_LIBS
+ CPPFLAGS=$saved_CPPFLAGS
+ AC_MSG_RESULT($utf8_name_valid)
+fi
+
+dnl Output.
+AC_CONFIG_HEADER(include/config.h)
+AC_OUTPUT(
+ Makefile
+ include/Makefile
+ include/idn/Makefile
+ include/mdn/Makefile
+ lib/Makefile
+ man/Makefile
+ tools/Makefile
+ tools/idnconv/Makefile
+ tools/runidn/Makefile
+ tools/runidn/runidn
+ map/Makefile
+ lib/tests/Makefile
+)
diff --git a/contrib/idn/idnkit-1.0-src/include/Makefile.in b/contrib/idn/idnkit-1.0-src/include/Makefile.in
new file mode 100644
index 0000000..cf931a3
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/Makefile.in
@@ -0,0 +1,65 @@
+# $Id: Makefile.in,v 1.1.1.1 2003/06/04 00:25:33 marka Exp $
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+SHELL = @SHELL@
+
+SUBDIRS = idn mdn
+
+all: all-subdirs
+install: install-subdirs
+clean: clean-subdirs
+distclean: distclean-localdir distclean-subdirs
+check test: test-subdirs
+
+all-subdirs install-subdirs clean-subdirs distclean-subdirs test-subdirs:
+ @target=`echo $@ | sed 's/-subdirs$$//'`; \
+ for d in $(SUBDIRS); do \
+ (cd $$d; $(MAKE) DESTDIR=$(DESTDIR) $$target); \
+ done
+
+distclean-localdir:
+ rm -f config.h Makefile
diff --git a/contrib/idn/idnkit-1.0-src/include/config.h.in b/contrib/idn/idnkit-1.0-src/include/config.h.in
new file mode 100644
index 0000000..304ec30
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/config.h.in
@@ -0,0 +1,181 @@
+/* include/config.h.in. Generated automatically from configure.in by autoheader. */
+/* $Id: config.h.in,v 1.1.1.1 2003/06/04 00:25:34 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef gid_t
+
+/* Define if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef uid_t
+
+/* Define as an appropriate type (ex. int) if your system doesn't have. */
+#undef BOOL
+
+/* Define if you have the bcopy function. */
+#undef HAVE_BCOPY
+
+/* Define if you have the dlopen function. */
+#undef HAVE_DLOPEN
+
+/* Define if you have the dlsym function. */
+#undef HAVE_DLSYM
+
+/* Define if you have the freeaddrinfo function. */
+#undef HAVE_FREEADDRINFO
+
+/* Define if you have the freehostent function. */
+#undef HAVE_FREEHOSTENT
+
+/* Define if you have the getaddrinfo function. */
+#undef HAVE_GETADDRINFO
+
+/* Define if you have the gethostbyaddr function. */
+#undef HAVE_GETHOSTBYADDR
+
+/* Define if you have the gethostbyaddr_r function. */
+#undef HAVE_GETHOSTBYADDR_R
+
+/* Define if you have the gethostbyname function. */
+#undef HAVE_GETHOSTBYNAME
+
+/* Define if you have the gethostbyname2 function. */
+#undef HAVE_GETHOSTBYNAME2
+
+/* Define if you have the gethostbyname2_r function. */
+#undef HAVE_GETHOSTBYNAME2_R
+
+/* Define if you have the gethostbyname_r function. */
+#undef HAVE_GETHOSTBYNAME_R
+
+/* Define if you have the getipnodebyaddr function. */
+#undef HAVE_GETIPNODEBYADDR
+
+/* Define if you have the getipnodebyname function. */
+#undef HAVE_GETIPNODEBYNAME
+
+/* Define if you have the getnameinfo function. */
+#undef HAVE_GETNAMEINFO
+
+/* Define if you have the memmove function. */
+#undef HAVE_MEMMOVE
+
+/* Define if you have the nl_langinfo function. */
+#undef HAVE_NL_LANGINFO
+
+/* Define if you have the setenv function. */
+#undef HAVE_SETENV
+
+/* Define if you have the setlocale function. */
+#undef HAVE_SETLOCALE
+
+/* Define if you have the setvbuf function. */
+#undef HAVE_SETVBUF
+
+/* Define if you have the unsetenv function. */
+#undef HAVE_UNSETENV
+
+/* Define if you have the vsnprintf function. */
+#undef HAVE_VSNPRINTF
+
+/* Define if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define if you have the <langinfo.h> header file. */
+#undef HAVE_LANGINFO_H
+
+/* Define if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
+
+/* Define if you have the <pwd.h> header file. */
+#undef HAVE_PWD_H
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the nsl library (-lnsl). */
+#undef HAVE_LIBNSL
+
+/* Define if you have the socket library (-lsocket). */
+#undef HAVE_LIBSOCKET
+
+/* Define if --enable-mdnkit-compat is specified */
+#undef ENABLE_MDNKIT_COMPAT
+
+/* Define if you want additional ACE converters compiled in. */
+#undef IDN_EXTRA_ACE
+
+/* Define if your iconv() does not accept UTF-8 as the codeset name for utf-8. */
+#undef IDN_UTF8_ENCODING_NAME
+
+/* Define if you have the dl library (-ldl). */
+#undef HAVE_LIBDL
+
+/* Define as the type of the 1st argument of gethostbyaddr. */
+#undef GHBA_ADDR_T
+
+/* Define as the type of the 2nd argument of gethostbyaddr. */
+#undef GHBA_ADDRLEN_T
+
+/* Define as the type of the 2nd argument of getnameinfo. */
+#undef GNI_SALEN_T
+
+/* Define as the type of the 4th argument of getnameinfo. */
+#undef GNI_HOSTLEN_T
+
+/* Define as the type of the 6th argument of getnameinfo. */
+#undef GNI_SERVLEN_T
+
+/* Define as the type of the 7th argument of getnameinfo. */
+#undef GNI_FLAGS_T
+
+/* Define if the prototype of gethost*_r is glibc flavor. */
+#undef GETHOST_R_GLIBC_FLAVOR
+
+/* Define as the pathname of the shared libc object if your system has one. */
+#undef SOPATH_LIBC
+
+/* Define as the pathname of the shared libnsl object if your system has one. */
+#undef SOPATH_LIBNSL
diff --git a/contrib/idn/idnkit-1.0-src/include/config.h.win b/contrib/idn/idnkit-1.0-src/include/config.h.win
new file mode 100644
index 0000000..3ed87df
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/config.h.win
@@ -0,0 +1,45 @@
+/* $Id: config.h.win,v 1.1.1.1 2003/06/04 00:25:34 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+/* for enabling RACE */
+#define IDN_EXTRA_ACE
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/Makefile.in b/contrib/idn/idnkit-1.0-src/include/idn/Makefile.in
new file mode 100644
index 0000000..b99cf8c
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/Makefile.in
@@ -0,0 +1,103 @@
+# $Id: Makefile.in,v 1.1.1.1 2003/06/04 00:25:34 marka Exp $
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+includedir = @includedir@
+idnincludedir = $(includedir)/idn
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
+SHELL = @SHELL@
+
+HDRS = \
+ api.h \
+ assert.h \
+ checker.h \
+ converter.h \
+ debug.h \
+ delimitermap.h \
+ export.h \
+ filechecker.h \
+ filemapper.h \
+ localencoding.h \
+ log.h \
+ logmacro.h \
+ mapper.h \
+ mapselector.h \
+ nameprep.h \
+ normalizer.h \
+ punycode.h \
+ race.h \
+ res.h \
+ resconf.h \
+ result.h \
+ strhash.h \
+ ucsmap.h \
+ ucsset.h \
+ unicode.h \
+ unormalize.h \
+ ucs4.h \
+ utf8.h \
+ util.h \
+ version.h
+
+all:
+
+install:
+ $(MKINSTALLDIRS) $(DESTDIR)$(idnincludedir)
+ for hdr in $(HDRS); do \
+ $(INSTALL_DATA) $(srcdir)/$$hdr $(DESTDIR)$(idnincludedir)/$$hdr; \
+ done
+
+clean:
+ rm -f *~
+
+distclean: clean
+ rm -f Makefile
+
+test check:
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/aliaslist.h b/contrib/idn/idnkit-1.0-src/include/idn/aliaslist.h
new file mode 100644
index 0000000..61c3fd5
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/aliaslist.h
@@ -0,0 +1,114 @@
+/* $Id: aliaslist.h,v 1.1.1.1 2003/06/04 00:25:34 marka Exp $ */
+/*
+ * Copyright (c) 2002 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_ALIASLIST_H
+#define IDN_ALIASLIST_H 1
+
+#include <idn/result.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct idn__aliaslist *idn__aliaslist_t;
+
+/*
+ * Create a list.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+extern idn_result_t
+idn__aliaslist_create(idn__aliaslist_t *listp);
+
+/*
+ * Delete a list created by 'idn__aliaslist_create'.
+ */
+extern void
+idn__aliaslist_destroy(idn__aliaslist_t list);
+
+/*
+ * Parse alias information file and set items to the list.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nofile -- no such file.
+ * idn_invalid_syntax -- file is malformed.
+ * idn_nomemory -- malloc failed.
+ */
+extern idn_result_t
+idn__aliaslist_aliasfile(idn__aliaslist_t list, const char *path);
+
+/*
+ * Add an item to the list.
+ *
+ * If top is 0, item is placed as the last item of the alias list.
+ * Otherwise, it is done as the first item.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+extern idn_result_t
+idn__aliaslist_additem(idn__aliaslist_t list,
+ const char *pattern, const char *encoding,
+ int first_item);
+
+/*
+ * Find the encoding name with the specified pattern by wildcard
+ * match.
+ *
+ * Returns:
+ * idn_success -- ok. found.
+ * idn_noentry -- not found.
+ */
+extern idn_result_t
+idn__aliaslist_find(idn__aliaslist_t list,
+ const char *pattern, char **encodingp);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_ALIASLIST_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/api.h b/contrib/idn/idnkit-1.0-src/include/idn/api.h
new file mode 100644
index 0000000..ca529f3
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/api.h
@@ -0,0 +1,298 @@
+/* $Id: api.h,v 1.1.1.1 2003/06/04 00:25:35 marka Exp $ */
+/*
+ * Copyright (c) 2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_API_H
+#define IDN_API_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <idn/export.h>
+#include <idn/result.h>
+#include <idn/res.h>
+
+/*
+ * Application Programming Interface for Internationalized Domain Name
+ * Handling. This module provides high-level APIs for ordinary applications.
+ * Low-level APIs are also available. See "res.h" for details.
+ */
+
+/*
+ * Enable or disable IDN conversion scheme.
+ *
+ * If on_off is 0, IDN conversion scheme is disabled. Otherwise, IDN
+ * conversion is enabled even when IDN_DISABLE is defined.
+ */
+IDN_EXPORT void
+idn_enable(int on_off);
+
+/*
+ * Set configuration file name.
+ * This function is for private use only.
+ *
+ * When idn_nameinit(1) is called, this module loads `file'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ * idn_failure -- idn_nameinit() has already been
+ * called.
+ */
+extern idn_result_t
+idn__setconffile(const char *file);
+
+/*
+ * Initialize this module, and load configuration from the default
+ * configuration file (idn.conf).
+ *
+ * The initialization will be done only once when this function is
+ * called first, while either loading of the configuration file or
+ * setting the defaults behavior without the configuration file will
+ * be done every time it is called.
+ *
+ * If load_file is 0, this will set the defaults behavior without the
+ * configuration file. Otherwise, loading of the configuration file
+ * occurs.
+ *
+ * If 'idn_encodename' or 'idn_decodename' is called without calling
+ * this function, implicit initialization without the configuration
+ * file will be done prior to encoding/decoding process.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nofile -- cannot open the configuration file.
+ * idn_invalid_syntax -- syntax error found in the file.
+ * idn_invalid_name -- there are invalid names (encoding,
+ * normalization etc.).
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_nameinit(int load_file);
+
+/*
+ * Encode internationalized domain name.
+ *
+ * The encoding process consists of the following 7 steps.
+ *
+ * 1. Local encoding to UTF-8 conversion
+ * Converts a domain name written with local encoding (e.g. ISO-
+ * 8859-1) to UTF-8.
+ * 2. Delimiter mapping,
+ * Maps certain characters to period (U+002E, FULL STOP).
+ * 3. Local mapping
+ * Apply character mappings according with the TLD of the domain
+ * name.
+ * 4. NAMEPREP
+ * Perform NAME preparation described in RFC3491.
+ * This step consists of the following 4 steps:
+ * 4.1. Mapping
+ * 4.2. Normalization
+ * 4.3. Prohibited character check
+ * 4.4. Unassigned check
+ * 5. ASCII range character check
+ * Checks if the domain name contains non-LDH ASCII character (not
+ * alpha-numeric or hypen), or it begins or end with hypen.
+ * 6. UTF-8 to IDN encoding conversion.
+ * Converts the domain name from UTF-8 to ACE (e.g. Punycode).
+ * 7. Length check
+ * Checks the length of each label.
+ *
+ * 'actions' specifies actions and options of the encoding procedure.
+ * Its value is a bitwise-or of the following flags:
+ *
+ * IDN_LOCALCONV -- perform local encoding to UTF-8 conversion (step 1)
+ * IDN_DELIMMAP -- perform delimiter mapping (step 2)
+ * IDN_LOCALMAP -- perform local mapping (step 3)
+ * IDN_MAP -- perform mapping (step 4.1)
+ * IDN_NORMALIZE -- perform normalization (step 4.2)
+ * IDN_PROHCHECK -- perform prohibited character check (step 4.3)
+ * IDN_UNASCHECK -- perform unassigned codepoint check (step 4.4)
+ * IDN_ASCCHECK -- perform ASCII range character check (step 5)
+ * IDN_IDNCONV -- perform UTF-8 to IDN encoding conversion (step 6)
+ * IDN_LENCHECK -- perform length check (step 7)
+ *
+ * Also the following flags are provided for convinience:
+ *
+ * IDN_ENCODE_QUERY -- On libidnkit, perform step 1..7, except for step
+ * 4.4 and 5.
+ * On libidnkitlite, perform step 2..7, except for
+ * step 4.4 and 5.
+ * IDN_ENCODE_STORED -- On libidnkit, perform step 1..7, except for step
+ * 5.
+ * On libidnkitlite, perform step 2..7, except for
+ * step 5.
+ * IDN_ENCODE_APP -- Same as IDN_ENCODE_QUERY.
+ * IDN_NAMEPREP -- perform NAMEPREP (step 4) without unassigned
+ * codepoint check (step 4.4).
+ *
+ * The following flag does not corresponding to a particular action,
+ * but an option of conversion process:
+ *
+ * IDN_UNDOIFERR -- If any step fails, the original input name is
+ * returned.
+ *
+ * Note that if no flags are specified, 'idn_encodename' does nothing
+ * fancy, just copies the given name verbatim.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_action -- invalid action flag specified.
+ * idn_invalid_encoding -- the given string has invalid/illegal
+ * byte sequence.
+ * idn_invalid_length -- invalid length of a label.
+ * idn_prohibited -- prohibited/unassigned code point found.
+ * idn_buffer_overflow -- 'tolen' is too small.
+ * idn_nomemory -- malloc failed.
+ *
+ * Also, if this function is called without calling 'idn_nameinit',
+ * the following error codes might be returned.
+ * idn_nofile -- cannot open the configuration file.
+ * idn_invalid_syntax -- syntax error found in the file.
+ * idn_invalid_name -- there are invalid names (encoding,
+ * normalization etc.).
+ */
+IDN_EXPORT idn_result_t
+idn_encodename(idn_action_t actions, const char *from, char *to, size_t tolen);
+
+/*
+ * Decode internationalized domain name.
+ *
+ * The decoding process consists of the following 5 steps.
+ *
+ * 1. delimiter mapping
+ * Maps certain characters to period (U+002E, FULL STOP).
+ * 2. NAMEPREP
+ * Perform NAME preparation described in RFC3491.
+ * This step consists of the following 4 steps:
+ * 2.1. Mapping
+ * 2.2. Normalization
+ * 2.3. Prohibited character check
+ * 2.4. Unassigned check
+ * 3. IDN encoding to UTF-8 conversion.
+ * Converts the domain name from ACE (e.g. Punycode) to UCS4.
+ * 4. Perform round-trip check.
+ * Encode the result of step 3, and then compare it with the result
+ * of the step 2. If they are different, the check is failed.
+ * 5. Convert UTF-8 to local encoding.
+ * If a character in the domain name cannot be converted to local
+ * encoding, the conversion is failed.
+ *
+ * 'actions' specifies actions of the decoding procedure.
+ * Its value is a bitwise-or of the following flags:
+ *
+ * IDN_DELIMMAP -- perform delimiter mapping (step 1)
+ * IDN_MAP -- perform mapping (step 2.1)
+ * IDN_NORMALIZE -- perform normalization (step 2.2)
+ * IDN_PROHCHECK -- perform prohibited character check (step 2.3)
+ * IDN_UNASCHECK -- perform unassigned codepoint check (step 2.4)
+ * IDN_IDNCONV -- perform IDN encoding to UTF-8 conversion (step 3)
+ * IDN_RTCHECK -- perform round-trip check (step 4)
+ * IDN_ASCCHECK -- perform ASCII range character check while
+ * round-trip check (step 4.1)
+ * IDN_LOCALCONV -- perform UTF-8 to local encoding conversion (step 5)
+ *
+ * Also the following flags are provided for the convenience:
+ *
+ * IDN_DECODE_QUERY -- On libidnkit, perform step 1..5, except for step
+ * 2.4 and 4.1.
+ * On libidnkitlite, perform step 1..3, except for
+ * step 2.4 and 4.1.
+ * IDN_DECODE_STORED -- On libidnkit, perform step 1..5, except for step
+ * 4.1.
+ * On libidnkitlite, perform step 1..3, except for
+ * step 4.1.
+ * IDN_DECODE_APP -- Same as IDN_DECODE_QUERY.
+ * IDN_NAMEPREP -- perform NAMEPREP (step 2) without unassigned
+ * codepoint check (step 2.4).
+ *
+ * If any step fails, the original input name is returned.
+ * 'actions' specifies what actions to take when decoding, and is
+ * a bitwise-or of the following flags:
+ *
+ * Note that if no flags are specified, 'idn_decodename' does nothing
+ * but copying the given name verbatim.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_action -- invalid action flag specified.
+ * idn_invalid_encoding -- the given string has invalid/illegal
+ * byte sequence.
+ * idn_buffer_overflow -- 'tolen' is too small.
+ * idn_invalid_length -- length of a label is not 1..63 characters.
+ * idn_nomemory -- malloc failed.
+ *
+ * Also, if this function is called without calling 'idn_nameinit',
+ * the following error codes might be returned.
+ * idn_nofile -- cannot open the configuration file.
+ * idn_invalid_syntax -- syntax error found in the file.
+ * idn_invalid_name -- there are invalid names (encoding,
+ * normalization etc.).
+ */
+IDN_EXPORT idn_result_t
+idn_decodename(idn_action_t actions, const char *from, char *to, size_t tolen);
+
+/*
+ * Decode internationalized domain name with auxiliary encoding
+ * support.
+ *
+ * This is another API for IDN string decode. The difference between
+ * two is whether the encoding conversion from auxiliary encoding to
+ * UTF-8 occurs prior to the actual decode process (read description
+ * of idn_res_decodename() above) or not.
+ *
+ * If auxencoding is NULL, from is treated as UTF-8 encoded string.
+ *
+ * Other arguments serve exactly same role as those of
+ * idn_res_decodename().
+ */
+idn_result_t
+idn_decodename2(idn_action_t actions, const char *from, char *to, size_t tolen,
+ const char *auxencoding);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_API_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/assert.h b/contrib/idn/idnkit-1.0-src/include/idn/assert.h
new file mode 100644
index 0000000..12d4dac
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/assert.h
@@ -0,0 +1,61 @@
+/* $Id: assert.h,v 1.1.1.1 2003/06/04 00:25:35 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_ASSERT_H
+#define IDN_ASSERT_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <assert.h>
+
+#ifndef DEBUG
+#define NDEBUG
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+# endif /* IDN_ASSERT_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/checker.h b/contrib/idn/idnkit-1.0-src/include/idn/checker.h
new file mode 100644
index 0000000..02af31b
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/checker.h
@@ -0,0 +1,171 @@
+/* $Id: checker.h,v 1.1.1.1 2003/06/04 00:25:36 marka Exp $ */
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_CHECKER_H
+#define IDN_CHECKER_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Character Checker.
+ *
+ * Perfom checking characters in the specified domain name.
+ */
+
+#include <idn/result.h>
+#include <idn/filechecker.h>
+#include <idn/nameprep.h>
+
+/*
+ * Schems name prefixes for the standard nameprep prohibit/unassigned
+ * checks.
+ *
+ * If you'd like to add the unassigned check scheme of "RFC3491"
+ * to a checker context, IDN_CHECKER_UNASSIGNED_PREFIX + "RFC3491"
+ * (i.e. "unassigned#RFC3491") is the scheme name passed to
+ * idn_checker_add().
+ */
+#define IDN_CHECKER_PROHIBIT_PREFIX "prohibit#"
+#define IDN_CHECKER_UNASSIGNED_PREFIX "unassigned#"
+#define IDN_CHECKER_BIDI_PREFIX "bidi#"
+
+/*
+ * Checker object type.
+ */
+typedef struct idn_checker *idn_checker_t;
+
+/*
+ * Initialize module. Must be called before any other calls of
+ * the functions of this module.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+extern idn_result_t
+idn_checker_initialize(void);
+
+/*
+ * Create a checker context.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+extern idn_result_t
+idn_checker_create(idn_checker_t *ctxp);
+
+/*
+ * Decrement reference count of the checker `ctx' created by
+ * 'idn_checker_create', if it is still refered by another object.
+ * Otherwise, release all the memory allocated to the checker.
+ */
+extern void
+idn_checker_destroy(idn_checker_t ctx);
+
+/*
+ * Increment reference count of the checker `ctx' created by
+ * 'idn_checker_create'.
+ */
+extern void
+idn_checker_incrref(idn_checker_t ctx);
+
+/*
+ * Add checking scheme `name' to the checker to `ctx'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_name -- the given name is not valid.
+ * idn_nomemory -- malloc failed.
+ */
+extern idn_result_t
+idn_checker_add(idn_checker_t ctx, const char *name);
+
+extern idn_result_t
+idn_checker_addall(idn_checker_t ctx, const char **names, int nnames);
+
+/*
+ * Check a domain name. All checking schemes regsitered in `ctx' are
+ * applied in the regisration order.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ * idn_buffer_overflow -- output buffer is too small.
+ */
+extern idn_result_t
+idn_checker_lookup(idn_checker_t ctx, const unsigned long *ucs4,
+ const unsigned long **found);
+
+/*
+ * Checking procedure type.
+ */
+typedef idn_result_t (*idn_checker_createproc_t)(const char *parameter,
+ void **ctxp);
+typedef void (*idn_checker_destroyproc_t)(void *ctx);
+typedef idn_result_t (*idn_checker_lookupproc_t)(void *ctx,
+ const unsigned long *ucs4,
+ const unsigned long **found);
+
+/*
+ * Register a new checking scheme.
+ *
+ * You can override the default normalization schemes, if you want.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+extern idn_result_t
+idn_checker_register(const char *prefix,
+ idn_checker_createproc_t create,
+ idn_checker_destroyproc_t destroy,
+ idn_checker_lookupproc_t lookup);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_CHECKER_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/converter.h b/contrib/idn/idnkit-1.0-src/include/idn/converter.h
new file mode 100644
index 0000000..03248f6
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/converter.h
@@ -0,0 +1,258 @@
+/* $Id: converter.h,v 1.1.1.1 2003/06/04 00:25:36 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_CONVERTER_H
+#define IDN_CONVERTER_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Codeset converter.
+ *
+ * This module provides conversions from some local codeset to UCS4
+ * and vice versa.
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+
+/*
+ * Converter context type (opaque).
+ */
+typedef struct idn_converter *idn_converter_t;
+
+/*
+ * Conversion flags.
+ */
+#define IDN_CONVERTER_DELAYEDOPEN 1
+#define IDN_CONVERTER_RTCHECK 2
+
+/*
+ * Encoding types.
+ */
+#define IDN_NONACE 0
+#define IDN_ACE_STRICTCASE 1
+#define IDN_ACE_LOOSECASE 2
+
+/*
+ * Initialize module. Must be called before any other calls of
+ * the functions of this module.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_converter_initialize(void);
+
+/*
+ * Create a conversion context.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_name -- specified codeset is not supported.
+ * idn_nomemory -- malloc failed.
+ * idn_failure -- other failure (unknown cause).
+ */
+IDN_EXPORT idn_result_t
+idn_converter_create(const char *name, idn_converter_t *ctxp,
+ int flags);
+
+/*
+ * Decrement reference count of the converter `ctx' created by
+ * 'idn_converter_create', if it is still refered by another object.
+ * Otherwise, release all the memory allocated to the converter.
+ */
+IDN_EXPORT void
+idn_converter_destroy(idn_converter_t ctx);
+
+/*
+ * Increment reference count of the converter `ctx' created by
+ * 'idn_converter_create'.
+ */
+IDN_EXPORT void
+idn_converter_incrref(idn_converter_t ctx);
+
+/*
+ * Convert between local codeset and UCS4. Note that each conversion
+ * is started with initial state.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_buffer_overflow -- output buffer is too small.
+ * idn_invalid_encoding -- the input string has invalid/illegal
+ * byte sequence.
+ * idn_invalid_name -- codeset is not supported (this error
+ * should happen only if 'delayedopen'
+ * flag was set when idn_converter_create
+ * was called)
+ * idn_failure -- other failure.
+ */
+IDN_EXPORT idn_result_t
+idn_converter_convfromucs4(idn_converter_t ctx,
+ const unsigned long *from, char *to, size_t tolen);
+
+IDN_EXPORT idn_result_t
+idn_converter_convtoucs4(idn_converter_t ctx,
+ const char *from, unsigned long *to, size_t tolen);
+
+/*
+ * Get the name of local codeset. The returned name may be different from
+ * the one specified to idn_converter_create, if the specified one was an
+ * alias.
+ *
+ * Returns:
+ * the local codeset name.
+ */
+IDN_EXPORT char *
+idn_converter_localencoding(idn_converter_t ctx);
+
+/*
+ * Return the encoding type of this local encoding.
+ *
+ * Returns:
+ * IDN_NONACE -- encoding is not ACE.
+ * IDN_ACE_STRICTCASE -- encoding is ACE.
+ * decoder of this ACE preserve letter case.
+ * IDN_ACE_LOOSECASE -- encoding type is ACE.
+ * decoder cannot preserve letter case.
+ */
+IDN_EXPORT int
+idn_converter_encodingtype(idn_converter_t ctx);
+
+/*
+ * Return if this local encoding is ACE (Ascii Compatible Encoding).
+ *
+ * Returns:
+ * 1 -- yes, it is ACE.
+ * 0 -- no.
+ */
+IDN_EXPORT int
+idn_converter_isasciicompatible(idn_converter_t ctx);
+
+/*
+ * Register an alias for a codeset name.
+ *
+ * If first_item is 0, alias pattern is placed as the last item of the
+ * alias list. Otherwise, it is done as the first item.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_converter_addalias(const char *alias_name, const char *real_name,
+ int first_item);
+
+/*
+ * Register aliases defined by the specified file.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nofile -- no such file.
+ * idn_invalid_syntax -- file is malformed.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_converter_aliasfile(const char *path);
+
+/*
+ * Unregister all the aliases.
+ */
+IDN_EXPORT idn_result_t
+idn_converter_resetalias(void);
+
+/*
+ * resolve real encoding name from alias information.
+ */
+IDN_EXPORT const char *
+idn_converter_getrealname(const char *name);
+
+
+/*
+ * New converter registration.
+ */
+
+/*
+ * Conversion operation functions.
+ */
+typedef idn_result_t (*idn_converter_openproc_t)(idn_converter_t ctx,
+ void **privdata);
+typedef idn_result_t (*idn_converter_closeproc_t)(idn_converter_t ctx,
+ void *privdata);
+typedef idn_result_t
+ (*idn_converter_convfromucs4proc_t)(idn_converter_t ctx,
+ void *privdata,
+ const unsigned long *from,
+ char *to, size_t tolen);
+typedef idn_result_t
+ (*idn_converter_convtoucs4proc_t)(idn_converter_t ctx,
+ void *privdata,
+ const char *from,
+ unsigned long *to,
+ size_t tolen);
+
+/*
+ * Register a new converter.
+ * 'encoding_type' is a value which idn_converter_encodingtype() returns.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_converter_register(const char *name,
+ idn_converter_openproc_t openfromucs4,
+ idn_converter_openproc_t opentoucs4,
+ idn_converter_convfromucs4proc_t convfromucs4,
+ idn_converter_convtoucs4proc_t convtoucs4,
+ idn_converter_closeproc_t close,
+ int encoding_type);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_CONVERTER_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/debug.h b/contrib/idn/idnkit-1.0-src/include/idn/debug.h
new file mode 100644
index 0000000..35bb403
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/debug.h
@@ -0,0 +1,69 @@
+/* $Id: debug.h,v 1.1.1.1 2003/06/04 00:25:36 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_DEBUG_H
+#define IDN_DEBUG_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Debug utility
+ */
+
+#include <idn/export.h>
+
+IDN_EXPORT char *idn__debug_hexstring(const char *s, int maxbytes);
+IDN_EXPORT char *idn__debug_xstring(const char *s, int maxbytes);
+IDN_EXPORT char *idn__debug_ucs4xstring(const unsigned long *s, int maxbytes);
+IDN_EXPORT char *idn__debug_utf16xstring(const unsigned short *s,
+ int maxbytes);
+IDN_EXPORT char *idn__debug_hexdata(const char *s, int length, int maxbytes);
+IDN_EXPORT void idn__debug_hexdump(const char *s, int maxbytes);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_DEBUG_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/delimitermap.h b/contrib/idn/idnkit-1.0-src/include/idn/delimitermap.h
new file mode 100644
index 0000000..9a2381d
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/delimitermap.h
@@ -0,0 +1,123 @@
+/* $Id: delimitermap.h,v 1.1.1.1 2003/06/04 00:25:37 marka Exp $ */
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_DELIMITERMAP_H
+#define IDN_DELIMITERMAP_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Mapper.
+ *
+ * Perfom mapping local delimiters to `.'.
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+
+/*
+ * Map object type.
+ */
+typedef struct idn_delimitermap *idn_delimitermap_t;
+
+/*
+ * Create a delimitermap context.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_delimitermap_create(idn_delimitermap_t *ctxp);
+
+/*
+ * Decrement reference count of the delimitermap `ctx' created by
+ * 'idn_delimitermap_create', if it is still refered by another object.
+ * Otherwise, release all the memory allocated to the delimitermap.
+ */
+IDN_EXPORT void
+idn_delimitermap_destroy(idn_delimitermap_t ctx);
+
+/*
+ * Increment reference count of the delimitermap `ctx' created by
+ * 'idn_delimitermap_create'.
+ */
+IDN_EXPORT void
+idn_delimitermap_incrref(idn_delimitermap_t ctx);
+
+/*
+ * Add a local delimiter.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ * idn_invalid_codepoint -- delimiter is not valid UCS4 character.
+ */
+IDN_EXPORT idn_result_t
+idn_delimitermap_add(idn_delimitermap_t ctx, unsigned long delimiter);
+
+IDN_EXPORT idn_result_t
+idn_delimitermap_addall(idn_delimitermap_t ctx, unsigned long *delimiters,
+ int ndelimiters);
+
+/*
+ * Map local delimiters in `from' to `.'.
+ *
+ * Note that if no delimiter is added to the context, the function copies
+ * the string.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_buffer_overflow -- output buffer is too small.
+ */
+IDN_EXPORT idn_result_t
+idn_delimitermap_map(idn_delimitermap_t ctx, const unsigned long *from,
+ unsigned long *to, size_t tolen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_DELIMITERMAP_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/export.h b/contrib/idn/idnkit-1.0-src/include/idn/export.h
new file mode 100644
index 0000000..cb9443c
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/export.h
@@ -0,0 +1,58 @@
+/* $Id: export.h,v 1.1.1.1 2003/06/04 00:25:37 marka Exp $ */
+/*
+ * Copyright (c) 2002 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_EXPORT_H
+#define IDN_EXPORT_H 1
+
+/*
+ * Macro for exporting functions.
+ *
+ * When creating a Windows DLL, define IDN_EXPORT something as
+ * "extern __declspec(dllexport)".
+ */
+
+#ifndef IDN_EXPORT
+#define IDN_EXPORT extern
+#endif
+
+# endif /* IDN_EXPORT_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/filechecker.h b/contrib/idn/idnkit-1.0-src/include/idn/filechecker.h
new file mode 100644
index 0000000..5904493
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/filechecker.h
@@ -0,0 +1,136 @@
+/* $Id: filechecker.h,v 1.1.1.1 2003/06/04 00:25:37 marka Exp $ */
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_FILECHECKER_H
+#define IDN_FILECHECKER_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Character checker -- check if there are any characters specified
+ * by a file in the given string.
+ */
+
+#include <idn/result.h>
+
+/*
+ * Check object type.
+ */
+typedef struct idn__filechecker *idn__filechecker_t;
+
+/*
+ * Read the contents of the given file and create a context for
+ * checking.
+ *
+ * 'file' is the pathname of the file, which specifies the set of
+ * characters to be checked. The file is a simple text file, and
+ * each line must be of the form either
+ * <code_point>
+ * or
+ * <code_point>-<code_point>
+ * (or comment, see below) where <code_point> is a UCS code point
+ * represented as hexadecimal string with optional prefix `U+'
+ * (ex. `0041' or `U+FEDC').
+ *
+ * The former specifies just one character (a code point, to be precise),
+ * while the latter specified a range of characters. In the case of
+ * a character range, the first code point (before hyphen) must not be
+ * greater than the second code point (after hyphen).
+ *
+ * Lines starting with `#' are comments.
+ *
+ * If file is read with no errors, the created context is stored in
+ * '*ctxp', and 'idn_success' is returned. Otherwise, the contents
+ * of '*ctxp' is undefined.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nofile -- cannot open the specified file.
+ * idn_nomemory -- malloc failed.
+ * idn_invalid_syntax -- file format is not valid.
+ */
+extern idn_result_t
+idn__filechecker_create(const char *file, idn__filechecker_t *ctxp);
+
+/*
+ * Release memory for the specified context.
+ */
+extern void
+idn__filechecker_destroy(idn__filechecker_t ctx);
+
+/*
+ * See if the given string contains any specified characters.
+ *
+ * Check if there is any characters pecified by the context 'ctx' in
+ * the UCS4 string 'str'. If there are none, NULL is stored in '*found'.
+ * Otherwise, the pointer to the first occurence of such character is
+ * stored in '*found'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ */
+extern idn_result_t
+idn__filechecker_lookup(idn__filechecker_t ctx, const unsigned long *str,
+ const unsigned long **found);
+
+/*
+ * The following functions are for internal use.
+ * They are used for this module to be add to the checker module.
+ */
+extern idn_result_t
+idn__filechecker_createproc(const char *parameter, void **ctxp);
+
+extern void
+idn__filechecker_destroyproc(void *ctxp);
+
+extern idn_result_t
+idn__filechecker_lookupproc(void *ctx, const unsigned long *str,
+ const unsigned long **found);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_FILECHECKER_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/filemapper.h b/contrib/idn/idnkit-1.0-src/include/idn/filemapper.h
new file mode 100644
index 0000000..f1fbc18
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/filemapper.h
@@ -0,0 +1,137 @@
+/* $Id: filemapper.h,v 1.1.1.1 2003/06/04 00:25:38 marka Exp $ */
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_FILEMAPPER_H
+#define IDN_FILEMAPPER_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Perform character mapping (substitution) according to a
+ * map file.
+ */
+
+#include <idn/result.h>
+
+/*
+ * Mapping object type.
+ */
+typedef struct idn__filemapper *idn__filemapper_t;
+
+/*
+ * Read the contents of the given map file and create a context for mapping.
+ *
+ * 'file' is the pathname of the file, which specifies the character
+ * mapping. The file is a simple text file, and each line specifies
+ * a mapping of a single character. The format of each line is
+ *
+ * <code_point>; [<code_point>..][;]
+ *
+ * where <code_point> is a UCS code point represented as a hexadecimal
+ * string with optional prefix `U+' (ex. `0041' or `U+FEDC').
+ * The code point before the first semicolon will be mapped to the
+ * sequence of code points separated by space characters after the
+ * first semicolon. The sequence may be empty, denoting wiping out
+ * the character.
+ *
+ * For example,
+ * U+0041; U+0061 -- maps 'A' to 'a'
+ * 20;; -- wipes out ' '
+ *
+ * Anything after the second semicolon is ignored. Also lines beginning
+ * with '#' are treated as comments.
+ *
+ * If there is no error, the created context is stored in '*ctxp'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nofile -- cannot open the specified file.
+ * idn_nomemory -- malloc failed.
+ * idn_invalid_syntax -- file format is not valid.
+ */
+extern idn_result_t
+idn__filemapper_create(const char *file, idn__filemapper_t *ctxp);
+
+/*
+ * Release memory for the given context.
+ */
+extern void
+idn__filemapper_destroy(idn__filemapper_t ctx);
+
+/*
+ * Perform character substitution.
+ *
+ * Each character in the string 'from' is examined and if it
+ * has a mapping, it is substituted to the corresponding
+ * character sequence. The substituted string is stored in 'to',
+ * whose length is specified by 'tolen'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_buffer_overflow -- result buffer is too small.
+ */
+extern idn_result_t
+idn__filemapper_map(idn__filemapper_t ctx, const unsigned long *from,
+ unsigned long *to, size_t tolen);
+
+/*
+ * The following functions are for internal use.
+ * They are used for this module to be add to the mapper module.
+ */
+extern idn_result_t
+idn__filemapper_createproc(const char *parameter, void **ctxp);
+
+extern void
+idn__filemapper_destroyproc(void *ctxp);
+
+extern idn_result_t
+idn__filemapper_mapproc(void *ctx, const unsigned long *from,
+ unsigned long *to, size_t tolen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_FILEMAPPER_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/localencoding.h b/contrib/idn/idnkit-1.0-src/include/idn/localencoding.h
new file mode 100644
index 0000000..86c2c32
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/localencoding.h
@@ -0,0 +1,79 @@
+/* $Id: localencoding.h,v 1.1.1.1 2003/06/04 00:25:38 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_LOCALENCODING_H
+#define IDN_LOCALENCODING_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Local codeset detection.
+ *
+ * Determine the local codeset (the codeset used by the current application),
+ * based on the locale information.
+ */
+
+#include <idn/export.h>
+
+#define IDN_LOCALCS_ENV "IDN_LOCAL_CODESET"
+
+/*
+ * Get the codeset name corresponding to the current locale,
+ * suitable for passing to 'idn_converter_create'.
+ *
+ * If the codeset cannot be determined, the locale name itself
+ * will be returned in the hope that codeset alias file translates it
+ * to the right name.
+ *
+ * If it cannot retrieve the current locale name, NULL will be
+ * returned.
+ */
+IDN_EXPORT const char *idn_localencoding_name(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_LOCALENCODING_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/log.h b/contrib/idn/idnkit-1.0-src/include/idn/log.h
new file mode 100644
index 0000000..c2d340c
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/log.h
@@ -0,0 +1,107 @@
+/* $Id: log.h,v 1.1.1.1 2003/06/04 00:25:38 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_LOG_H
+#define IDN_LOG_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * libidnkit logging facility.
+ */
+
+#include <idn/export.h>
+
+/*
+ * Log level definition.
+ */
+enum {
+ idn_log_level_fatal = 0,
+ idn_log_level_error = 1,
+ idn_log_level_warning = 2,
+ idn_log_level_info = 3,
+ idn_log_level_trace = 4,
+ idn_log_level_dump = 5
+};
+
+/*
+ * Log handler type.
+ */
+typedef void (*idn_log_proc_t)(int level, const char *msg);
+
+/*
+ * Log routines.
+ */
+IDN_EXPORT void idn_log_fatal(const char *fmt, ...);
+IDN_EXPORT void idn_log_error(const char *fmt, ...);
+IDN_EXPORT void idn_log_warning(const char *fmt, ...);
+IDN_EXPORT void idn_log_info(const char *fmt, ...);
+IDN_EXPORT void idn_log_trace(const char *fmt, ...);
+IDN_EXPORT void idn_log_dump(const char *fmt, ...);
+
+/*
+ * Set/get log level.
+ *
+ * If log level has not been explicitly defined by 'idn_log_setlevel',
+ * the default level is determined by the value of enrironment
+ * variable 'IDN_LOG_LEVEL'.
+ */
+IDN_EXPORT void idn_log_setlevel(int level);
+IDN_EXPORT int idn_log_getlevel(void);
+
+/*
+ * Set log handler.
+ *
+ * If no log handler is set, log goes to stderr by default.
+ * You can reset the handler to the default one by specifying
+ * NULL.
+ */
+IDN_EXPORT void idn_log_setproc(idn_log_proc_t proc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_LOG_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/logmacro.h b/contrib/idn/idnkit-1.0-src/include/idn/logmacro.h
new file mode 100644
index 0000000..bc55b6b
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/logmacro.h
@@ -0,0 +1,72 @@
+/* $Id: logmacro.h,v 1.1.1.1 2003/06/04 00:25:38 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_LOGMACRO_H
+#define IDN_LOGMACRO_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <idn/log.h>
+
+#define FATAL(x) idn_log_fatal x
+#define ERROR(x) idn_log_error x
+#define WARNING(x) idn_log_warning x
+#define INFO(x) LOG_AT_LEVEL(idn_log_level_info, idn_log_info, x)
+#define TRACE(x) LOG_AT_LEVEL(idn_log_level_trace, idn_log_trace, x)
+
+#ifdef DEBUG
+#define DUMP(x) LOG_AT_LEVEL(idn_log_level_dump, idn_log_dump, x)
+#else
+#define DUMP(x)
+#endif /* DEBUG */
+
+#define LOG_AT_LEVEL(lv, fun, x) do {if (LOGLEVEL >= (lv)) fun x; } while (0)
+#define LOGLEVEL idn_log_getlevel()
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_LOGMACRO_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/mapper.h b/contrib/idn/idnkit-1.0-src/include/idn/mapper.h
new file mode 100644
index 0000000..a9c55c3
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/mapper.h
@@ -0,0 +1,159 @@
+/* $Id: mapper.h,v 1.1.1.1 2003/06/04 00:25:38 marka Exp $ */
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_MAPPER_H
+#define IDN_MAPPER_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Mapper.
+ *
+ * Perfom mapping the specified domain name.
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+#include <idn/filemapper.h>
+#include <idn/nameprep.h>
+
+/*
+ * Map object type.
+ */
+typedef struct idn_mapper *idn_mapper_t;
+
+/*
+ * Initialize module. Must be called before any other calls of
+ * the functions of this module.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_mapper_initialize(void);
+
+/*
+ * Create a mapper context.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_mapper_create(idn_mapper_t *ctxp);
+
+/*
+ * Decrement reference count of the mapper `ctx' created by
+ * 'idn_mapper_create', if it is still refered by another object.
+ * Otherwise, release all the memory allocated to the mapper.
+ */
+IDN_EXPORT void
+idn_mapper_destroy(idn_mapper_t ctx);
+
+/*
+ * Increment reference count of the mapper `ctx' created by
+ * 'idn_mapper_create'.
+ */
+IDN_EXPORT void
+idn_mapper_incrref(idn_mapper_t ctx);
+
+/*
+ * Add mapping scheme `name' to the mapper to `ctx'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_name -- the given name is not valid.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_mapper_add(idn_mapper_t ctx, const char *name);
+
+IDN_EXPORT idn_result_t
+idn_mapper_addall(idn_mapper_t ctx, const char **names, int nnames);
+
+/*
+ * Map an UCS4 string. All mapping schemes regsitered in `ctx'
+ * are applied in the regisration order.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ * idn_buffer_overflow -- output buffer is too small.
+ */
+IDN_EXPORT idn_result_t
+idn_mapper_map(idn_mapper_t ctx, const unsigned long *from,
+ unsigned long *to, size_t tolen);
+
+/*
+ * Mapping procedure type.
+ */
+typedef idn_result_t (*idn_mapper_createproc_t)(const char *parameter,
+ void **ctxp);
+typedef void (*idn_mapper_destroyproc_t)(void *ctxp);
+typedef idn_result_t (*idn_mapper_mapproc_t)(void *ctx,
+ const unsigned long *from,
+ unsigned long *, size_t);
+
+/*
+ * Register a new mapping scheme.
+ *
+ * You can override the default normalization schemes, if you want.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_mapper_register(const char *prefix,
+ idn_mapper_createproc_t create,
+ idn_mapper_destroyproc_t destroy,
+ idn_mapper_mapproc_t map);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_MAPPER_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/mapselector.h b/contrib/idn/idnkit-1.0-src/include/idn/mapselector.h
new file mode 100644
index 0000000..a17aea6
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/mapselector.h
@@ -0,0 +1,165 @@
+/* $Id: mapselector.h,v 1.1.1.1 2003/06/04 00:25:39 marka Exp $ */
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_MAPSELECTOR_H
+#define IDN_MAPSELECTOR_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Map selector.
+ *
+ * Perfom mapping the specified domain name according with the TLD
+ * of the donmain name.
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+#include <idn/mapper.h>
+
+/*
+ * Special TLDs for map selection.
+ */
+#define IDN_MAPSELECTOR_NOTLD "-"
+#define IDN_MAPSELECTOR_DEFAULTTLD "."
+
+IDN_EXPORT const unsigned long *
+idn_mapselector_getnotld(void);
+
+IDN_EXPORT const unsigned long *
+idn_mapselector_getdefaulttld(void);
+
+/*
+ * Mapselector object type.
+ */
+typedef struct idn_mapselector *idn_mapselector_t;
+
+/*
+ * Initialize module. Must be called before any other calls of
+ * the functions of this module.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_mapselector_initialize(void);
+
+/*
+ * Create a mapselector context.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_mapselector_create(idn_mapselector_t *ctxp);
+
+/*
+ * Decrement reference count of the mapselector `ctx' created by
+ * 'idn_mapselector_create', if it is still refered by another object.
+ * Otherwise, release all the memory allocated to the mapselector.
+ */
+IDN_EXPORT void
+idn_mapselector_destroy(idn_mapselector_t ctx);
+
+/*
+ * Increment reference count of the mapselector `ctx' created by
+ * 'idn_mapselector_create'.
+ */
+IDN_EXPORT void
+idn_mapselector_incrref(idn_mapselector_t ctx);
+
+/*
+ * Return the mapper for `tld' registered in `ctx', or return NULL if
+ * mapper for `tld' is not registered.
+ */
+IDN_EXPORT idn_mapper_t
+idn_mapselector_mapper(idn_mapselector_t ctx, const char *tld);
+
+/*
+ * Add mapping scheme `name' to the mapper for `tld' to the mapselector
+ * context `ctx'. If no mapper for `TLD' has not been registered, the
+ * function creates a new mapper for `tld', and then adds the given mapping
+ * scheme to the mapper. Otherwise, it adds the scheme to the mapper for
+ * TLD registered in `ctx'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_name -- the given tld or name is not valid.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_mapselector_add(idn_mapselector_t ctx, const char *tld, const char *name);
+
+IDN_EXPORT idn_result_t
+idn_mapselector_addall(idn_mapselector_t ctx, const char *tld,
+ const char **names, int nnames);
+
+/*
+ * Map an UCS4 string with the mapper for TLD of the domain name.
+ * If there is no mapper suitable for the domain name, the function
+ * simply copies the doman name.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ * idn_buffer_overflow -- output buffer is too small.
+ * idn_invalid_name -- the given tld is not valid.
+ */
+IDN_EXPORT idn_result_t
+idn_mapselector_map(idn_mapselector_t ctx, const unsigned long *from,
+ const char *tld, unsigned long *to, size_t tolen);
+
+IDN_EXPORT idn_result_t
+idn_mapselector_map2(idn_mapselector_t ctx, const unsigned long *from,
+ const unsigned long *tld, unsigned long *to,
+ size_t tolen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_MAPSELECTOR_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/nameprep.h b/contrib/idn/idnkit-1.0-src/include/idn/nameprep.h
new file mode 100644
index 0000000..af7d943
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/nameprep.h
@@ -0,0 +1,185 @@
+/* $Id: nameprep.h,v 1.1.1.1 2003/06/04 00:25:39 marka Exp $ */
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_NAMEPREP_H
+#define IDN_NAMEPREP_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Perform NAMEPREP (mapping, prohibited/unassigned checking).
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+
+/*
+ * BIDI type codes.
+ */
+typedef enum {
+ idn_biditype_r_al,
+ idn_biditype_l,
+ idn_biditype_others
+} idn_biditype_t;
+
+/*
+ * A Handle for nameprep operations.
+ */
+typedef struct idn_nameprep *idn_nameprep_t;
+
+
+/*
+ * The latest version of nameprep.
+ */
+#define IDN_NAMEPREP_CURRENT "RFC3491"
+
+/*
+ * Create a handle for nameprep operations.
+ * The handle is stored in '*handlep', which is used other functions
+ * in this module.
+ * The version of the NAMEPREP specification can be specified with
+ * 'version' parameter. If 'version' is NULL, the latest version
+ * is used.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_notfound -- specified version not found.
+ */
+IDN_EXPORT idn_result_t
+idn_nameprep_create(const char *version, idn_nameprep_t *handlep);
+
+/*
+ * Close a handle, which was created by 'idn_nameprep_create'.
+ */
+IDN_EXPORT void
+idn_nameprep_destroy(idn_nameprep_t handle);
+
+/*
+ * Perform character mapping on an UCS4 string specified by 'from', and
+ * store the result into 'to', whose length is specified by 'tolen'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_buffer_overflow -- result buffer is too small.
+ */
+IDN_EXPORT idn_result_t
+idn_nameprep_map(idn_nameprep_t handle, const unsigned long *from,
+ unsigned long *to, size_t tolen);
+
+/*
+ * Check if an UCS4 string 'str' contains any prohibited characters specified
+ * by the draft. If found, the pointer to the first such character is stored
+ * into '*found'. Otherwise '*found' will be NULL.
+ *
+ * Returns:
+ * idn_success -- check has been done properly. (But this
+ * does not mean that no prohibited character
+ * was found. Check '*found' to see the
+ * result.)
+ */
+IDN_EXPORT idn_result_t
+idn_nameprep_isprohibited(idn_nameprep_t handle, const unsigned long *str,
+ const unsigned long **found);
+
+/*
+ * Check if an UCS4 string 'str' contains any unassigned characters specified
+ * by the draft. If found, the pointer to the first such character is stored
+ * into '*found'. Otherwise '*found' will be NULL.
+ *
+ * Returns:
+ * idn_success -- check has been done properly. (But this
+ * does not mean that no unassinged character
+ * was found. Check '*found' to see the
+ * result.)
+ */
+IDN_EXPORT idn_result_t
+idn_nameprep_isunassigned(idn_nameprep_t handle, const unsigned long *str,
+ const unsigned long **found);
+
+/*
+ * Check if an UCS4 string 'str' is valid string specified by ``bidi check''
+ * of the draft. If it is not valid, the pointer to the first invalid
+ * character is stored into '*found'. Otherwise '*found' will be NULL.
+ *
+ * Returns:
+ * idn_success -- check has been done properly. (But this
+ * does not mean that the string was valid.
+ * Check '*found' to see the result.)
+ */
+IDN_EXPORT idn_result_t
+idn_nameprep_isvalidbidi(idn_nameprep_t handle, const unsigned long *str,
+ const unsigned long **found);
+
+/*
+ * The following functions are for internal use.
+ * They are used for this module to be add to the checker and mapper modules.
+ */
+IDN_EXPORT idn_result_t
+idn_nameprep_createproc(const char *parameter, void **handlep);
+
+IDN_EXPORT void
+idn_nameprep_destroyproc(void *handle);
+
+IDN_EXPORT idn_result_t
+idn_nameprep_mapproc(void *handle, const unsigned long *from,
+ unsigned long *to, size_t tolen);
+
+IDN_EXPORT idn_result_t
+idn_nameprep_prohibitproc(void *handle, const unsigned long *str,
+ const unsigned long **found);
+
+IDN_EXPORT idn_result_t
+idn_nameprep_unassignedproc(void *handle, const unsigned long *str,
+ const unsigned long **found);
+
+IDN_EXPORT idn_result_t
+idn_nameprep_bidiproc(void *handle, const unsigned long *str,
+ const unsigned long **found);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_NAMEPREP_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/normalizer.h b/contrib/idn/idnkit-1.0-src/include/idn/normalizer.h
new file mode 100644
index 0000000..e7e39b4
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/normalizer.h
@@ -0,0 +1,155 @@
+/* $Id: normalizer.h,v 1.1.1.1 2003/06/04 00:25:40 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_NORMALIZER_H
+#define IDN_NORMALIZER_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Domain name normalizer.
+ *
+ * Perform normalization on the specified strings. String must be
+ * in UCS4 encoding.
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+
+/*
+ * Normalizer type (opaque).
+ */
+typedef struct idn_normalizer *idn_normalizer_t;
+
+/*
+ * Normalizer procedure type.
+ */
+typedef idn_result_t (*idn_normalizer_proc_t)(const unsigned long *from,
+ unsigned long *to, size_t tolen);
+
+/*
+ * Initialize this module.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_normalizer_initialize(void);
+
+/*
+ * Create a empty normalizer.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_normalizer_create(idn_normalizer_t *ctxp);
+
+/*
+ * Decrement reference count of the normalizer `ctx' created by
+ * 'idn_normalizer_create', if it is still refered by another object.
+ * Otherwise, release all the memory allocated to the normalizer.
+ */
+IDN_EXPORT void
+idn_normalizer_destroy(idn_normalizer_t ctx);
+
+/*
+ * Increment reference count of the normalizer `ctx' created by
+ * 'idn_normalizer_create'.
+ */
+IDN_EXPORT void
+idn_normalizer_incrref(idn_normalizer_t ctx);
+
+/*
+ * Add a normalization scheme to a normalizer.
+ *
+ * Multiple shemes can be added to a normalizer, and they will be
+ * applied in order.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_name -- unknown scheme was specified.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_normalizer_add(idn_normalizer_t ctx, const char *scheme_name);
+
+IDN_EXPORT idn_result_t
+idn_normalizer_addall(idn_normalizer_t ctx, const char **scheme_names,
+ int nschemes);
+
+/*
+ * Perform normalization(s) defined by a normalizer to the specified string,
+ * If the normalizer has two or more normalization schemes, they are
+ * applied in order.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_buffer_overflow -- output buffer is too small.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_normalizer_normalize(idn_normalizer_t ctx, const unsigned long *from,
+ unsigned long *to, size_t tolen);
+
+/*
+ * Register a new normalization scheme.
+ *
+ * You can override the default normalization schemes, if you want.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_normalizer_register(const char *scheme_name, idn_normalizer_proc_t proc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_NORMALIZER_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/punycode.h b/contrib/idn/idnkit-1.0-src/include/idn/punycode.h
new file mode 100644
index 0000000..5650a8e
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/punycode.h
@@ -0,0 +1,70 @@
+/* $Id: punycode.h,v 1.1.1.1 2003/06/04 00:25:40 marka Exp $ */
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_PUNYCODE_H
+#define IDN_PUNYCODE_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Punycode Converter.
+ */
+
+#include <idn/result.h>
+#include <idn/converter.h>
+
+extern idn_result_t
+idn__punycode_decode(idn_converter_t ctx, void *privdata,
+ const char *from, unsigned long *to, size_t tolen);
+
+extern idn_result_t
+idn__punycode_encode(idn_converter_t ctx, void *privdata,
+ const unsigned long *from, char *to, size_t tolen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_PUNYCODE_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/race.h b/contrib/idn/idnkit-1.0-src/include/idn/race.h
new file mode 100644
index 0000000..43a090b
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/race.h
@@ -0,0 +1,72 @@
+/* $Id: race.h,v 1.1.1.1 2003/06/04 00:25:40 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_RACE_H
+#define IDN_RACE_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * RACE Converter.
+ *
+ * See Internet Draft draft-ietf-idn-race-03.txt for details.
+ */
+
+#include <idn/result.h>
+#include <idn/converter.h>
+
+extern idn_result_t
+idn__race_encode(idn_converter_t ctx, void *privdata,
+ const unsigned long *from, char *to, size_t tolen);
+
+extern idn_result_t
+idn__race_decode(idn_converter_t ctx, void *privdata,
+ const char *from, unsigned long *to, size_t tolen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_RACE_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/res.h b/contrib/idn/idnkit-1.0-src/include/idn/res.h
new file mode 100644
index 0000000..ab7873d
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/res.h
@@ -0,0 +1,309 @@
+/* $Id: res.h,v 1.1.1.1 2003/06/04 00:25:41 marka Exp $ */
+/*
+ * Copyright (c) 2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_RES_H
+#define IDN_RES_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Resolver library support.
+ *
+ * All the functions provided by this module requires IDN resolver
+ * configuration context of type 'idn_resconf_t' as an argument.
+ * This context holds information described in the configuration file
+ * (idn.conf). See idn_resconf module for details.
+ *
+ * All functions also accept NULL as the context, but since
+ * no conversion/normalization will be done in this case, it is
+ * pretty useless.
+ */
+
+#include <idn/export.h>
+#include <idn/resconf.h>
+#include <idn/result.h>
+
+typedef unsigned long idn_action_t;
+
+/*
+ * Actions
+ */
+#define IDN_LOCALCONV 0x00000001 /* Local encoding <-> UTF-8 conversion */
+#define IDN_DELIMMAP 0x00000002 /* Delimiter mapping */
+#define IDN_LOCALMAP 0x00000004 /* Local mapping */
+#define IDN_MAP 0x00000008 /* NAMEPREP map */
+#define IDN_NORMALIZE 0x00000010 /* NAMEPREP normalize */
+#define IDN_PROHCHECK 0x00000020 /* NAMEPREP prohibited character check */
+#define IDN_UNASCHECK 0x00000040 /* Unassigned code point check */
+#define IDN_BIDICHECK 0x00000080 /* bidirectional string check */
+#define IDN_ASCCHECK 0x00000100 /* Non-LDH ASCII check */
+#define IDN_IDNCONV 0x00000200 /* UTF-8 <-> IDN encoding conversion */
+#define IDN_LENCHECK 0x00000400 /* Label length check */
+#define IDN_RTCHECK 0x00000800 /* Round trip check */
+#define IDN_UNDOIFERR 0x00001000 /* Option: undo if error occurs */
+
+#define IDN_ENCODE_QUERY 0x00002000 /* Encode query string */
+#define IDN_DECODE_QUERY 0x00004000 /* Decode query string */
+
+#define IDN_ENCODE_APP \
+(IDN_ENCODE_QUERY | IDN_ASCCHECK) /* Standard encode */
+#define IDN_DECODE_APP \
+(IDN_DECODE_QUERY | IDN_ASCCHECK) /* Standard decode */
+
+#define IDN_ENCODE_STORED \
+(IDN_ENCODE_QUERY | IDN_ASCCHECK | IDN_UNASCHECK) /* Encode query string */
+#define IDN_DECODE_STORED \
+(IDN_DECODE_QUERY | IDN_ASCCHECK | IDN_UNASCHECK) /* Decode query string */
+
+
+#define IDN_NAMEPREP \
+(IDN_MAP | IDN_NORMALIZE | IDN_PROHCHECK | IDN_BIDICHECK)
+
+/*
+ * Enable or disable IDN conversion scheme.
+ *
+ * If on_off is 0, IDN conversion scheme is disabled. Otherwise, IDN
+ * conversion is enabled even when IDN_DISABLE is defined.
+ */
+IDN_EXPORT void
+idn_res_enable(int on_off);
+
+/*
+ * Encode internationalized domain name.
+ *
+ * The encoding process consists of the following 7 steps.
+ *
+ * 1. Local encoding to UTF-8 conversion
+ * Converts a domain name written with local encoding (e.g. ISO-
+ * 8859-1) to UTF-8.
+ * 2. Delimiter mapping,
+ * Maps certain characters to period (U+002E, FULL STOP).
+ * 3. Local mapping
+ * Apply character mappings according with the TLD of the domain
+ * name.
+ * 4. NAMEPREP
+ * Perform NAME preparation described in RFC3491.
+ * This step consists of the following 4 steps:
+ * 4.1. Mapping
+ * 4.2. Normalization
+ * 4.3. Prohibited character check
+ * 4.4. Unassigned check
+ * 5. ASCII range character check
+ * Checks if the domain name contains non-LDH ASCII character (not
+ * alpha-numeric or hypen), or it begins or end with hypen.
+ * 6. UTF-8 to IDN encoding conversion.
+ * Converts the domain name from UTF-8 to ACE (e.g. Punycode).
+ * 7. Length check
+ * Checks the length of each label.
+ *
+ * 'actions' specifies actions and options of the encoding procedure.
+ * Its value is a bitwise-or of the following flags:
+ *
+ * IDN_LOCALCONV -- perform local encoding to UTF-8 conversion (step 1)
+ * IDN_DELIMMAP -- perform delimiter mapping (step 2)
+ * IDN_LOCALMAP -- perform local mapping (step 3)
+ * IDN_MAP -- perform mapping (step 4.1)
+ * IDN_NORMALIZE -- perform normalization (step 4.2)
+ * IDN_PROHCHECK -- perform prohibited character check (step 4.3)
+ * IDN_UNASCHECK -- perform unassigned codepoint check (step 4.4)
+ * IDN_ASCCHECK -- perform ASCII range character check (step 5)
+ * IDN_IDNCONV -- perform UTF-8 to IDN encoding conversion (step 6)
+ * IDN_LENCHECK -- perform length check (step 7)
+ *
+ * Also the following flags are provided for convinience:
+ *
+ * IDN_ENCODE_QUERY -- On libidnkit, perform step 1..7, except for step
+ * 4.4 and 5.
+ * On libidnkitlite, perform step 2..7, except for
+ * step 4.4 and 5.
+ * IDN_ENCODE_STORED -- On libidnkit, perform step 1..7, except for step
+ * 5.
+ * On libidnkitlite, perform step 2..7, except for
+ * step 5.
+ * IDN_ENCODE_APP -- Same as IDN_ENCODE_QUERY.
+ * IDN_NAMEPREP -- perform NAMEPREP (step 4) without unassigned
+ * codepoint check (step 4.4).
+ *
+ * The following flag does not corresponding to a particular action,
+ * but an option of conversion process:
+ *
+ * IDN_UNDOIFERR -- If any step fails, the original input name is
+ * returned.
+ *
+ * Note that if no flags are specified, 'idn_encodename' does nothing
+ * fancy, just copies the given name verbatim.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_action -- invalid action flag specified.
+ * idn_invalid_encoding -- the given string has invalid/illegal
+ * byte sequence.
+ * idn_invalid_length -- invalid length of a label.
+ * idn_prohibited -- prohibited/unassigned code point found.
+ * idn_buffer_overflow -- 'tolen' is too small.
+ * idn_nomemory -- malloc failed.
+ *
+ * Also, if this function is called without calling 'idn_nameinit',
+ * the following error codes might be returned.
+ * idn_nofile -- cannot open the configuration file.
+ * idn_invalid_syntax -- syntax error found in the file.
+ * idn_invalid_name -- there are invalid names (encoding,
+ * normalization etc.).
+ */
+IDN_EXPORT idn_result_t
+idn_res_encodename(idn_resconf_t ctx, idn_action_t actions, const char *from,
+ char *to, size_t tolen);
+
+/*
+ * Decode internationalized domain name.
+ *
+ * The decoding process consists of the following 5 steps.
+ *
+ * 1. delimiter mapping
+ * Maps certain characters to period (U+002E, FULL STOP).
+ * 2. NAMEPREP
+ * Perform NAME preparation described in RFC3491.
+ * This step consists of the following 4 steps:
+ * 2.1. Mapping
+ * 2.2. Normalization
+ * 2.3. Prohibited character check
+ * 2.4. Unassigned check
+ * 3. IDN encoding to UTF-8 conversion.
+ * Converts the domain name from ACE (e.g. Punycode) to UCS4.
+ * 4. Perform round-trip check.
+ * Encode the result of step 3, and then compare it with the result
+ * of the step 2. If they are different, the check is failed.
+ * 5. Convert UTF-8 to local encoding.
+ * If a character in the domain name cannot be converted to local
+ * encoding, the conversion is failed.
+ *
+ * 'actions' specifies actions of the decoding procedure.
+ * Its value is a bitwise-or of the following flags:
+ *
+ * IDN_DELIMMAP -- perform delimiter mapping (step 1)
+ * IDN_MAP -- perform mapping (step 2.1)
+ * IDN_NORMALIZE -- perform normalization (step 2.2)
+ * IDN_PROHCHECK -- perform prohibited character check (step 2.3)
+ * IDN_UNASCHECK -- perform unassigned codepoint check (step 2.4)
+ * IDN_IDNCONV -- perform IDN encoding to UTF-8 conversion (step 3)
+ * IDN_RTCHECK -- perform round-trip check (step 4)
+ * IDN_ASCCHECK -- perform ASCII range character check while
+ * round-trip check (step 4.1)
+ * IDN_LOCALCONV -- perform UTF-8 to local encoding conversion (step 5)
+ *
+ * Also the following flags are provided for the convenience:
+ *
+ * IDN_DECODE_QUERY -- On libidnkit, perform step 1..5, except for step
+ * 2.4 and 4.1.
+ * On libidnkitlite, perform step 1..3, except for
+ * step 2.4 and 4.1.
+ * IDN_DECODE_STORED -- On libidnkit, perform step 1..5, except for step
+ * 4.1.
+ * On libidnkitlite, perform step 1..3, except for
+ * step 4.1.
+ * IDN_DECODE_APP -- Same as IDN_DECODE_QUERY.
+ * IDN_NAMEPREP -- perform NAMEPREP (step 2) without unassigned
+ * codepoint check (step 2.4).
+ *
+ * If any step fails, the original input name is returned.
+ * 'actions' specifies what actions to take when decoding, and is
+ * a bitwise-or of the following flags:
+ *
+ * Note that if no flags are specified, 'idn_decodename' does nothing
+ * but copying the given name verbatim.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_action -- invalid action flag specified.
+ * idn_invalid_encoding -- the given string has invalid/illegal
+ * byte sequence.
+ * idn_buffer_overflow -- 'tolen' is too small.
+ * idn_invalid_action -- length of a label is not 1..63 characters.
+ * idn_nomemory -- malloc failed.
+ *
+ * Also, if this function is called without calling 'idn_nameinit',
+ * the following error codes might be returned.
+ * idn_nofile -- cannot open the configuration file.
+ * idn_invalid_syntax -- syntax error found in the file.
+ * idn_invalid_name -- there are invalid names (encoding,
+ * normalization etc.).
+ */
+IDN_EXPORT idn_result_t
+idn_res_decodename(idn_resconf_t ctx, idn_action_t actions, const char *from,
+ char *to, size_t tolen);
+
+/*
+ * Decode internationalized domain name with auxiliary encoding
+ * support.
+ *
+ * This is another API for IDN string decode. The difference between
+ * two is whether the encoding conversion from auxiliary encoding to
+ * UTF-8 occurs prior to the actual decode process (read description
+ * of idn_res_decodename() above) or not.
+ *
+ * If auxencoding is NULL, from is treated as UTF-8 encoded string.
+ *
+ * Other arguments serve exactly same role as those of
+ * idn_res_decodename().
+ */
+idn_result_t
+idn_res_decodename2(idn_resconf_t ctx, idn_action_t actions, const char *from,
+ char *to, size_t tolen, const char *auxencoding);
+
+/*
+ * Convert `actions' to a string, and then return the string.
+ * This function is for internal use only.
+ *
+ * Note that this function returns a pointer to static buffer.
+ */
+extern const char *
+idn__res_actionstostring(idn_action_t actions);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_RES_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/resconf.h b/contrib/idn/idnkit-1.0-src/include/idn/resconf.h
new file mode 100644
index 0000000..1aed8bd
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/resconf.h
@@ -0,0 +1,323 @@
+/* $Id: resconf.h,v 1.1.1.1 2003/06/04 00:25:41 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_RESCONF_H
+#define IDN_RESCONF_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * IDN resolver configuration.
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+#include <idn/converter.h>
+#include <idn/normalizer.h>
+#include <idn/checker.h>
+#include <idn/mapper.h>
+#include <idn/mapselector.h>
+#include <idn/delimitermap.h>
+
+/*
+ * Configuration type (opaque).
+ */
+typedef struct idn_resconf *idn_resconf_t;
+
+/*
+ * Initialize.
+ *
+ * Initialize this module and underlying ones. Must be called before
+ * any other functions of this module.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_resconf_initialize(void);
+
+/*
+ * Create a configuration context.
+ *
+ * Create an empty context and store it in '*ctxp'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_resconf_create(idn_resconf_t *ctxp);
+
+/*
+ * Destroy the configuration context.
+ *
+ * Destroy the configuration context created by 'idn_resconf_create',
+ * and release memory for it.
+ */
+IDN_EXPORT void
+idn_resconf_destroy(idn_resconf_t ctx);
+
+/*
+ * Increment reference count of the context created by 'idn_resconf_create'.
+ */
+IDN_EXPORT void
+idn_resconf_incrref(idn_resconf_t ctx);
+
+/*
+ * Set default configurations to resconf context.
+ *
+ * "default configurations" means current nameprep and IDN encoding
+ * which IDN standard document suggests.
+ *
+ * Warning: configurations set previously are removed.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_syntax -- syntax error found.
+ * idn_invalid_name -- invalid encoding/nomalization name is
+ * specified.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_resconf_setdefaults(idn_resconf_t ctx);
+
+/*
+ * Load configuration file.
+ *
+ * Parse a configuration file whose name is specified by 'file',
+ * store the result in 'ctx'. If 'file' is NULL, the default file is
+ * loaded.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nofile -- couldn't open specified file.
+ * idn_invalid_syntax -- syntax error found.
+ * idn_invalid_name -- invalid encoding/nomalization name is
+ * specified.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_resconf_loadfile(idn_resconf_t ctx, const char *file);
+
+/*
+ * Get the pathname of the default configuration file.
+ *
+ * Returns:
+ * the pathname of the default configuration file.
+ */
+IDN_EXPORT char *
+idn_resconf_defaultfile(void);
+
+/*
+ * Get an object of lower module that `ctx' holds.
+ */
+IDN_EXPORT idn_delimitermap_t
+idn_resconf_getdelimitermap(idn_resconf_t ctx);
+
+IDN_EXPORT idn_converter_t
+idn_resconf_getidnconverter(idn_resconf_t ctx);
+
+IDN_EXPORT idn_converter_t
+idn_resconf_getauxidnconverter(idn_resconf_t ctx);
+
+IDN_EXPORT idn_converter_t
+idn_resconf_getlocalconverter(idn_resconf_t ctx);
+
+IDN_EXPORT idn_mapselector_t
+idn_resconf_getlocalmapselector(idn_resconf_t ctx);
+
+IDN_EXPORT idn_mapper_t
+idn_resconf_getmapper(idn_resconf_t ctx);
+
+IDN_EXPORT idn_normalizer_t
+idn_resconf_getnormalizer(idn_resconf_t ctx);
+
+IDN_EXPORT idn_checker_t
+idn_resconf_getprohibitchecker(idn_resconf_t ctx);
+
+IDN_EXPORT idn_checker_t
+idn_resconf_getunassignedchecker(idn_resconf_t ctx);
+
+IDN_EXPORT idn_checker_t
+idn_resconf_getbidichecker(idn_resconf_t ctx);
+
+/*
+ * Set an object of lower module to `ctx'.
+ */
+IDN_EXPORT void
+idn_resconf_setdelimitermap(idn_resconf_t ctx,
+ idn_delimitermap_t delimiter_mapper);
+
+IDN_EXPORT void
+idn_resconf_setidnconverter(idn_resconf_t ctx,
+ idn_converter_t idn_coverter);
+
+IDN_EXPORT void
+idn_resconf_setauxidnconverter(idn_resconf_t ctx,
+ idn_converter_t aux_idn_coverter);
+
+IDN_EXPORT void
+idn_resconf_setlocalconverter(idn_resconf_t ctx,
+ idn_converter_t local_converter);
+
+IDN_EXPORT void
+idn_resconf_setlocalmapselector(idn_resconf_t ctx,
+ idn_mapselector_t map_selector);
+
+IDN_EXPORT void
+idn_resconf_setmapper(idn_resconf_t ctx, idn_mapper_t mapper);
+
+IDN_EXPORT void
+idn_resconf_setnormalizer(idn_resconf_t ctx, idn_normalizer_t normalizer);
+
+IDN_EXPORT void
+idn_resconf_setprohibitchecker(idn_resconf_t ctx,
+ idn_checker_t prohibit_checker);
+
+IDN_EXPORT void
+idn_resconf_setunassignedchecker(idn_resconf_t ctx,
+ idn_checker_t unassigned_checker);
+
+IDN_EXPORT void
+idn_resconf_setbidichecker(idn_resconf_t ctx,
+ idn_checker_t bidi_checker);
+
+/*
+ * Set name or add names to an object of lower module that `ctx' holds.
+ */
+IDN_EXPORT idn_result_t
+idn_resconf_setidnconvertername(idn_resconf_t ctx, const char *name,
+ int flags);
+
+IDN_EXPORT idn_result_t
+idn_resconf_setauxidnconvertername(idn_resconf_t ctx, const char *name,
+ int flags);
+
+IDN_EXPORT idn_result_t
+idn_resconf_addalldelimitermapucs(idn_resconf_t ctx, unsigned long *v, int nv);
+
+IDN_EXPORT idn_result_t
+idn_resconf_setlocalconvertername(idn_resconf_t ctx, const char *name,
+ int flags);
+
+IDN_EXPORT idn_result_t
+idn_resconf_addalllocalmapselectornames(idn_resconf_t ctx, const char *tld,
+ const char **names, int nnames);
+
+IDN_EXPORT idn_result_t
+idn_resconf_addallmappernames(idn_resconf_t ctx, const char **names,
+ int nnames);
+
+IDN_EXPORT idn_result_t
+idn_resconf_addallnormalizernames(idn_resconf_t ctx, const char **names,
+ int nnames);
+
+IDN_EXPORT idn_result_t
+idn_resconf_addallprohibitcheckernames(idn_resconf_t ctx, const char **names,
+ int nnames);
+
+IDN_EXPORT idn_result_t
+idn_resconf_addallunassignedcheckernames(idn_resconf_t ctx, const char **names,
+ int nnames);
+
+IDN_EXPORT idn_result_t
+idn_resconf_addallbidicheckernames(idn_resconf_t ctx, const char **names,
+ int nnames);
+
+IDN_EXPORT idn_result_t
+idn_resconf_setnameprepversion(idn_resconf_t ctx, const char *version);
+
+/*
+ * These macros are provided for backward compatibility to mDNkit 2.1
+ * and older.
+ */
+IDN_EXPORT void
+idn_resconf_setalternateconverter(idn_resconf_t ctx,
+ idn_converter_t alternate_converter);
+
+IDN_EXPORT idn_result_t
+idn_resconf_setalternateconvertername(idn_resconf_t ctx, const char *name,
+ int flags);
+
+IDN_EXPORT idn_converter_t
+idn_resconf_getalternateconverter(idn_resconf_t ctx);
+
+
+/*
+ * These macros are provided for backward compatibility to idnkit 1.x.
+ */
+#define idn_resconf_localconverter(ctx) \
+ idn_resconf_getlocalconverter(ctx)
+
+#define idn_resconf_idnconverter(ctx) \
+ idn_resconf_getidnconverter(ctx)
+
+#define idn_resconf_alternateconverter(ctx) \
+ idn_resconf_getalternateconverter(ctx)
+
+#define idn_resconf_normalizer(ctx) \
+ idn_resconf_getnormalizer(ctx)
+
+#define idn_resconf_mapper(ctx) \
+ idn_resconf_getmapper(ctx)
+
+#define idn_resconf_delimitermap(ctx) \
+ idn_resconf_getdelimitermap(ctx)
+
+#define idn_resconf_localmapselector(ctx) \
+ idn_resconf_getlocalmapselector(ctx)
+
+#define idn_resconf_prohibitchecker(ctx) \
+ idn_resconf_getprohibitchecker(ctx)
+
+#define idn_resconf_unassignedchecker(ctx) \
+ idn_resconf_getunassignedchecker(ctx)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_RESCONF_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/result.h b/contrib/idn/idnkit-1.0-src/include/idn/result.h
new file mode 100644
index 0000000..c044fcb
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/result.h
@@ -0,0 +1,86 @@
+/* $Id: result.h,v 1.1.1.1 2003/06/04 00:25:42 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_RESULT_H
+#define IDN_RESULT_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <idn/export.h>
+
+/*
+ * libidnkit result code.
+ */
+typedef enum {
+ idn_success,
+ idn_notfound,
+ idn_invalid_encoding,
+ idn_invalid_syntax,
+ idn_invalid_name,
+ idn_invalid_message,
+ idn_invalid_action,
+ idn_invalid_codepoint,
+ idn_invalid_length,
+ idn_buffer_overflow,
+ idn_noentry,
+ idn_nomemory,
+ idn_nofile,
+ idn_nomapping,
+ idn_context_required,
+ idn_prohibited,
+ idn_failure /* !!This must be the last one!! */
+} idn_result_t;
+
+/*
+ * Get the string description of a result code.
+ */
+IDN_EXPORT char *
+idn_result_tostring(idn_result_t result);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_RESULT_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/strhash.h b/contrib/idn/idnkit-1.0-src/include/idn/strhash.h
new file mode 100644
index 0000000..0a72a86
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/strhash.h
@@ -0,0 +1,123 @@
+/* $Id: strhash.h,v 1.1.1.1 2003/06/04 00:25:42 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_STRHASH_H
+#define IDN_STRHASH_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * String-keyed hash table
+ *
+ * Just a hash table. Nothing special. Number of hash buckets
+ * grows automatically.
+ */
+
+#include <idn/result.h>
+
+/*
+ * Hash table type, which is opaque.
+ */
+typedef struct idn__strhash *idn__strhash_t;
+
+/*
+ * Hash value free proc.
+ */
+typedef void (*idn__strhash_freeproc_t)(void *value);
+
+/*
+ * Create a hash table.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+extern idn_result_t
+idn__strhash_create(idn__strhash_t *hashp);
+
+/*
+ * Delete a hash table created by 'idn__strhash_create'.
+ * If 'proc' is not NULL, it is called for each value in the
+ * hash to release memory for them.
+ */
+extern void
+idn__strhash_destroy(idn__strhash_t hash, idn__strhash_freeproc_t proc);
+
+/*
+ * Register an item to the hash table. This function makes a
+ * private copy of the key string.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+extern idn_result_t
+idn__strhash_put(idn__strhash_t hash, const char *key, void *value);
+
+/*
+ * Find an item with the specified key.
+ *
+ * Returns:
+ * idn_success -- ok. found.
+ * idn_noentry -- not found.
+ */
+extern idn_result_t
+idn__strhash_get(idn__strhash_t hash, const char *key, void **valuep);
+
+/*
+ * Check if an item with the specified key exists.
+ *
+ * Returns:
+ * 1 -- yes.
+ * 0 -- no.
+ */
+extern int
+idn__strhash_exists(idn__strhash_t hash, const char *key);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_STRHASH_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/ucs4.h b/contrib/idn/idnkit-1.0-src/include/idn/ucs4.h
new file mode 100644
index 0000000..ceb1f53
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/ucs4.h
@@ -0,0 +1,103 @@
+/* $Id: ucs4.h,v 1.1.1.1 2003/06/04 00:25:42 marka Exp $ */
+/*
+ * Copyright (c) 2002 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_UCS4_H
+#define IDN_UCS4_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * UCS4 encoded string facility.
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+
+/*
+ * UCS4 to UTF-16 conversion and vice versa.
+ */
+IDN_EXPORT idn_result_t
+idn_ucs4_ucs4toutf16(const unsigned long *ucs4, unsigned short *utf16,
+ size_t tolen);
+
+IDN_EXPORT idn_result_t
+idn_ucs4_utf16toucs4(const unsigned short *utf16, unsigned long *ucs4,
+ size_t tolen);
+
+/*
+ * UCS4 to UTF-8 conversion and vice versa.
+ */
+IDN_EXPORT idn_result_t
+idn_ucs4_utf8toucs4(const char *utf8, unsigned long *ucs4, size_t tolen);
+
+IDN_EXPORT idn_result_t
+idn_ucs4_ucs4toutf8(const unsigned long *ucs4, char *utf8, size_t tolen);
+
+/*
+ * UCS4 version of string operation functions.
+ */
+IDN_EXPORT size_t
+idn_ucs4_strlen(const unsigned long *ucs4);
+
+IDN_EXPORT unsigned long *
+idn_ucs4_strcpy(unsigned long *to, const unsigned long *from);
+
+IDN_EXPORT unsigned long *
+idn_ucs4_strcat(unsigned long *to, const unsigned long *from);
+
+IDN_EXPORT int
+idn_ucs4_strcmp(const unsigned long *str1, const unsigned long *str2);
+
+IDN_EXPORT int
+idn_ucs4_strcasecmp(const unsigned long *str1, const unsigned long *str2);
+
+IDN_EXPORT unsigned long *
+idn_ucs4_strdup(const unsigned long *str);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_UCS4_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/ucsmap.h b/contrib/idn/idnkit-1.0-src/include/idn/ucsmap.h
new file mode 100644
index 0000000..67af523
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/ucsmap.h
@@ -0,0 +1,131 @@
+/* $Id: ucsmap.h,v 1.1.1.1 2003/06/04 00:25:42 marka Exp $ */
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_UCSMAP_H
+#define IDN_UCSMAP_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Perform UCS character mapping.
+ * This module support one-to-N mapping (N may be zero, one or more).
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+
+/*
+ * Mapper type (opaque).
+ */
+typedef struct idn_ucsmap *idn_ucsmap_t;
+
+/*
+ * Create an empty mapping. The reference count is set to 1.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_ucsmap_create(idn_ucsmap_t *ctxp);
+
+/*
+ * Decrement the reference count of the given set, and if it reaches zero,
+ * release all the memory allocated for it.
+ */
+IDN_EXPORT void
+idn_ucsmap_destroy(idn_ucsmap_t ctx);
+
+/*
+ * Increment the reference count of the given set by one, so that
+ * the map can be shared.
+ */
+IDN_EXPORT void
+idn_ucsmap_incrref(idn_ucsmap_t ctx);
+
+/*
+ * Add a mapping.
+ * 'ucs' is the character to be mapped, 'map' points an array of mapped
+ * characters of length 'maplen'. 'map' may be NULL if 'maplen' is zero,
+ * meaning one-to-none mapping.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ * idn_failure -- already fixed by 'idn_ucsmap_fix',
+ * or too large maplen.
+ */
+IDN_EXPORT idn_result_t
+idn_ucsmap_add(idn_ucsmap_t ctx, unsigned long ucs, unsigned long *map,
+ size_t maplen);
+
+/*
+ * Perform internal arrangement of the map for lookup.
+ * Once it is fixed, 'idn_ucsmap_add' cannot be permitted to the map.
+ */
+IDN_EXPORT void
+idn_ucsmap_fix(idn_ucsmap_t ctx);
+
+/*
+ * Find the mapping for the given character.
+ * 'idn_ucsmap_fix' must be performed before calling this function.
+ * Find the mapping for 'v' and store the result to 'to'. The length
+ * of the mapped sequence is stored in '*maplenp'. 'tolen' specifies
+ * the length allocated for 'to'.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomapping -- specified character has no mapping.
+ * idn_failure -- not fixed by 'idn_ucsmap_fix' yet.
+ */
+IDN_EXPORT idn_result_t
+idn_ucsmap_map(idn_ucsmap_t ctx, unsigned long v, unsigned long *to,
+ size_t tolen, size_t *maplenp);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_UCSMAP_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/ucsset.h b/contrib/idn/idnkit-1.0-src/include/idn/ucsset.h
new file mode 100644
index 0000000..c50a4d0
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/ucsset.h
@@ -0,0 +1,145 @@
+/* $Id: ucsset.h,v 1.1.1.1 2003/06/04 00:25:43 marka Exp $ */
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_UCSSET_H
+#define IDN_UCSSET_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * A 'set' of UCS codepoints.
+ */
+
+#include <idn/export.h>
+#include <idn/result.h>
+
+/*
+ * Type representing a set (opaque).
+ */
+typedef struct idn_ucsset *idn_ucsset_t;
+
+
+/*
+ * Create an empty set. The reference count is set to 1.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ */
+IDN_EXPORT idn_result_t
+idn_ucsset_create(idn_ucsset_t *ctxp);
+
+/*
+ * Decrement the reference count of the given set, and if it reaches zero,
+ * release all the memory allocated for it.
+ */
+IDN_EXPORT void
+idn_ucsset_destroy(idn_ucsset_t ctx);
+
+/*
+ * Increments the reference count by one.
+ */
+IDN_EXPORT void
+idn_ucsset_incrref(idn_ucsset_t ctx);
+
+/*
+ * Add a UCS code point to the set.
+ * The set must be in the building phase -- that is, before 'idn_ucsset_fix'
+ * is called for the set.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_code -- code point out of range.
+ * idn_nomemory -- malloc failed.
+ * idn_failure -- already fixed by 'idn_ucsset_fix'.
+ */
+IDN_EXPORT idn_result_t
+idn_ucsset_add(idn_ucsset_t ctx, unsigned long v);
+
+/*
+ * Add a range of code points (from 'from' to 'to', inclusive) to the set.
+ * 'from' must not be greater than 'to'.
+ * This function is similar to 'idn_ucsset_add' except that it accepts
+ * range of code points.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_code -- code point out of range, or the range
+ * specification is invalid.
+ * idn_nomemory -- malloc failed.
+ * idn_failure -- already fixed by 'idn_ucsset_fix'.
+ */
+IDN_EXPORT idn_result_t
+idn_ucsset_addrange(idn_ucsset_t ctx, unsigned long from, unsigned long to);
+
+/*
+ * Perform internal arrangement of the set for lookup.
+ * Before calling this function, a set is in 'building' phase, and code
+ * points can be added freely by 'idn_ucsset_add' or 'idn_ucsset_addrange'.
+ * But once it is fixed by this function, the set becomes immutable, and
+ * it shifts into 'lookup' phase.
+ */
+IDN_EXPORT void
+idn_ucsset_fix(idn_ucsset_t ctx);
+
+/*
+ * Find if the given code point is in the set.
+ * The set must be in the lookup phase -- in other words, 'idn_ucsset_fix'
+ * must be called for the set before calling this function.
+ * '*found' is set to 1 if the specified code point is in the set, 0 otherwise.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_invalid_code -- specified code point is out of range.
+ * idn_failure -- not fixed by 'idn_ucsset_fix' yet.
+ */
+IDN_EXPORT idn_result_t
+idn_ucsset_lookup(idn_ucsset_t ctx, unsigned long v, int *found);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_UCSSET_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/unicode.h b/contrib/idn/idnkit-1.0-src/include/idn/unicode.h
new file mode 100644
index 0000000..f9b5bb4
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/unicode.h
@@ -0,0 +1,164 @@
+/* $Id: unicode.h,v 1.1.1.1 2003/06/04 00:25:43 marka Exp $ */
+/*
+ * Copyright (c) 2000,2001 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_UNICODE_H
+#define IDN_UNICODE_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Unicode attributes retriever.
+ *
+ * All the information this module provides is based on UnicodeData.txt,
+ * CompositionExclusions-1.txt and SpecialCasing.txt, all of which can be
+ * obtained from unicode.org.
+ *
+ * Unicode characters are represented as 'unsigned long'.
+ */
+
+#include <idn/result.h>
+
+/*
+ * A Handle for Unicode versions.
+ */
+typedef struct idn__unicode_ops *idn__unicode_version_t;
+
+/*
+ * Context information for case conversion.
+ */
+typedef enum {
+ idn__unicode_context_unknown,
+ idn__unicode_context_final,
+ idn__unicode_context_nonfinal
+} idn__unicode_context_t;
+
+/*
+ * Create a handle for a specific Unicode version.
+ * The version number (such as "3.0.1") is specified by 'version' parameter.
+ * If it is NULL, the latest version is used.
+ * The handle is stored in '*versionp', which is used various functions
+ * in this and unormalize modules.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_notfound -- specified version not found.
+ */
+extern idn_result_t
+idn__unicode_create(const char *version, idn__unicode_version_t *versionp);
+
+/*
+ * Close a handle which was created by 'idn__unicode_create'.
+ */
+extern void
+idn__unicode_destroy(idn__unicode_version_t version);
+
+/*
+ * Get canonical class.
+ *
+ * For characters out of unicode range (i.e. above 0xffff), 0 will
+ * be returned.
+ */
+extern int
+idn__unicode_canonicalclass(idn__unicode_version_t version, unsigned long c);
+
+/*
+ * Decompose a character.
+ *
+ * Decompose character given by 'c', and put the result into 'v',
+ * which can hold 'vlen' characters. The number of decomposed characters
+ * will be stored in '*decomp_lenp'.
+ *
+ * If 'compat' is true, compatibility decomposition is performed.
+ * Otherwise canonical decomposition is done.
+ *
+ * Since decomposition is done recursively, no further decomposition
+ * will be needed.
+ *
+ * Returns:
+ * idn_success -- ok, decomposed.
+ * idn_notfound -- no decomposition possible.
+ * idn_buffer_overflow -- 'vlen' is too small.
+ */
+extern idn_result_t
+idn__unicode_decompose(idn__unicode_version_t version,
+ int compat, unsigned long *v, size_t vlen,
+ unsigned long c, int *decomp_lenp);
+
+/*
+ * Perform canonical composition.
+ *
+ * Do canonical composition to the character sequence 'c1' and 'c2', put the
+ * result into '*compp'.
+ *
+ * Since Unicode Nomalization Froms requires only canonical composition,
+ * compatibility composition is not supported.
+ *
+ * Returns:
+ * idn_success -- ok, composed.
+ * idn_notfound -- no composition possible.
+ */
+extern idn_result_t
+idn__unicode_compose(idn__unicode_version_t version,
+ unsigned long c1, unsigned long c2, unsigned long *compp);
+
+/*
+ * Returns if there may be a canonical composition sequence which starts
+ * with the given character.
+ *
+ * Returns:
+ * 1 -- there may be a composition sequence
+ * (maybe not).
+ * 0 -- no, there is definitely no such sequences.
+ */
+extern int
+idn__unicode_iscompositecandidate(idn__unicode_version_t version,
+ unsigned long c);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_UNICODE_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/unormalize.h b/contrib/idn/idnkit-1.0-src/include/idn/unormalize.h
new file mode 100644
index 0000000..3d43270
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/unormalize.h
@@ -0,0 +1,86 @@
+/* $Id: unormalize.h,v 1.1.1.1 2003/06/04 00:25:44 marka Exp $ */
+/*
+ * Copyright (c) 2000,2001 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_UNORMALIZE_H
+#define IDN_UNORMALIZE_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Unicode Normalizations.
+ *
+ * Perform 4 normalizations defined by 'Unicode Normalization Forms'
+ * (http://www.unicode.org/unicode/reports/tr15)
+ *
+ * All of the functions use UCS4 encoding for input/output.
+ */
+
+#include <idn/result.h>
+#include <idn/unicode.h>
+
+/*
+ * Perform Unicode Normalication Form C and KC.
+ *
+ * They take NUL-terminated UCS4 encoded string 'from', perform
+ * the normalization specified by 'version', put the result
+ * (also a NUL-terminated UCS4 encoded string) to 'to', which must be
+ * able to hold at least 'tolen' bytes.
+ *
+ * Returns:
+ * idn_success -- ok.
+ * idn_nomemory -- malloc failed.
+ * idn_buffer_overflow -- 'tolen' is too small.
+ */
+extern idn_result_t
+idn__unormalize_formkc(idn__unicode_version_t version,
+ const unsigned long *from, unsigned long *to,
+ size_t tolen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_UNORMALIZE_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/utf8.h b/contrib/idn/idnkit-1.0-src/include/idn/utf8.h
new file mode 100644
index 0000000..ee5f589
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/utf8.h
@@ -0,0 +1,137 @@
+/* $Id: utf8.h,v 1.1.1.1 2003/06/04 00:25:44 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_UTF8_H
+#define IDN_UTF8_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * UTF-8 encoded string facility.
+ */
+
+#include <idn/export.h>
+
+/*
+ * Get the length of a character.
+ *
+ * Get the length (in bytes) of a character whose first byte is pointed
+ * by 's'. Since this function only looks one first byte to determine the
+ * length, it is possible some of the following bytes are invalid.
+ */
+IDN_EXPORT int
+idn_utf8_mblen(const char *s);
+
+/*
+ * Get one character.
+ *
+ * Get the first character of the string pointed by 's', and copy it
+ * to 'buf', whose length is 'len'. Returns the number of bytes copied,
+ * or zero if the encoding is invalid or len is too small.
+ *
+ * The area pointed by 'buf' must be large enough to store any UTF-8 encoded
+ * character.
+ *
+ * Note that the copied string is not NUL-terminated.
+ */
+IDN_EXPORT int
+idn_utf8_getmb(const char *s, size_t len, char *buf);
+
+/*
+ * Get one character in UCS-4.
+ *
+ * Similar to 'idn_utf8_getmb', except that the result is not in UTF-8
+ * encoding, but in UCS-4 format (plain 32bit integer value).
+ */
+IDN_EXPORT int
+idn_utf8_getwc(const char *s, size_t len, unsigned long *vp);
+
+/*
+ * Put one character.
+ *
+ * This function is an opposite of 'idn_utf8_getwc'. It takes a UCS-4
+ * value 'v', convert it to UTF-8 encoded sequence, and store it to 's',
+ * whose length is 'len'. It returns the number of bytes written, or
+ * zero 'v' is out of range or 'len' is too small.
+ */
+IDN_EXPORT int
+idn_utf8_putwc(char *s, size_t len, unsigned long v);
+
+/*
+ * Check the validity of UTF-8 encoded character.
+ *
+ * Check if the character pointed by 's' is a valid UTF-8 encoded
+ * character. Return the length of the character (in bytes) if it is valid,
+ * 0 otherwise.
+ */
+IDN_EXPORT int
+idn_utf8_isvalidchar(const char *s);
+
+/*
+ * Check the validity of UTF-8 encoded string.
+ *
+ * Check if the NUL-terminated string 's' is valid as a UTF-8 encoded
+ * string. Return 1 if it is valid, 0 otherwise.
+ */
+IDN_EXPORT int
+idn_utf8_isvalidstring(const char *s);
+
+/*
+ * Find first byte of a character.
+ *
+ * Find the first byte of a character 's' points to. 's' may point
+ * the 2nd or later byte of a character. 'known_top' is a pointer to
+ * a string which contains 's', and is known to be the first byte of
+ * a character. If it couldn't find the first byte between 'known_top'
+ * and 's', NULL will be returned.
+ */
+IDN_EXPORT char *
+idn_utf8_findfirstbyte(const char *s, const char *known_top);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_UTF8_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/util.h b/contrib/idn/idnkit-1.0-src/include/idn/util.h
new file mode 100644
index 0000000..cde34a6
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/util.h
@@ -0,0 +1,98 @@
+/* $Id: util.h,v 1.1.1.1 2003/06/04 00:25:44 marka Exp $ */
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_UTIL_H
+#define IDN_UTIL_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Utility functions.
+ */
+
+/*
+ * Check ACE prefix.
+ *
+ * These functions examine whether `str' begins with `prefix'.
+ * They disregard the case difference of ASCII letters ([A-Za-z]).
+ * They return 1 if `str' has the ACE prefix, 0 otherwise.
+ */
+extern int
+idn__util_asciihaveaceprefix(const char *str, const char *prefix);
+extern int
+idn__util_ucs4haveaceprefix(const unsigned long *str, const char *prefix);
+
+/*
+ * Check if all codepoints in the UCS4 string `str' are in the ASCII
+ * range (i.e. U+0000...U+007F).
+ *
+ * The function return 1 if it is, 0 otherwise.
+ */
+extern int
+idn__util_ucs4isasciirange(const unsigned long *str);
+
+/*
+ * Get registry information from the system. (Windows only)
+ */
+#ifdef WIN32
+/*
+ * registry top type.
+ */
+typedef enum {
+ idn__util_hkey_currentuser,
+ idn__util_hkey_localmachine
+} idn__util_hkey_t;
+
+extern int
+idn__util_getregistrystring(idn__util_hkey_t topkey, const char *name,
+ char *str, size_t length);
+#endif /* WIN32 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_UTIL_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/idn/version.h b/contrib/idn/idnkit-1.0-src/include/idn/version.h
new file mode 100644
index 0000000..c483311
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/idn/version.h
@@ -0,0 +1,70 @@
+/* $Id: version.h,v 1.1.1.1 2003/06/04 00:25:44 marka Exp $ */
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_VERSION_H
+#define IDN_VERSION_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <idn/export.h>
+
+/*
+ * Version number of this package.
+ */
+#define IDNKIT_VERSION "1.0"
+#define IDNKIT_MAJOR_VERSION 1
+#define IDNKIT_MINOR_VERSION 0
+
+/*
+ * Get the version of the library (libidnkit).
+ */
+IDN_EXPORT const char *
+idn_version_getstring(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_VERSION_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/mdn/Makefile.in b/contrib/idn/idnkit-1.0-src/include/mdn/Makefile.in
new file mode 100644
index 0000000..375db7e
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/mdn/Makefile.in
@@ -0,0 +1,83 @@
+# $Id: Makefile.in,v 1.1.1.1 2003/06/04 00:25:45 marka Exp $
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+includedir = @includedir@
+mdnincludedir = $(includedir)/mdn
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
+SHELL = @SHELL@
+
+HDRS = \
+ api.h \
+ log.h \
+ res.h \
+ resconf.h \
+ result.h \
+ utf8.h \
+ version.h
+
+all:
+
+@COMPAT_TRUE@install: all install-compat
+@COMPAT_FALSE@install:
+
+install-compat:
+ $(MKINSTALLDIRS) $(DESTDIR)$(mdnincludedir)
+ for hdr in $(HDRS); do \
+ $(INSTALL_DATA) $(srcdir)/$$hdr $(DESTDIR)$(mdnincludedir)/$$hdr; \
+ done
+
+clean:
+ rm -f *~
+
+distclean:
+ rm -f Makefile
+
+test check:
diff --git a/contrib/idn/idnkit-1.0-src/include/mdn/api.h b/contrib/idn/idnkit-1.0-src/include/mdn/api.h
new file mode 100644
index 0000000..5c8f7f3
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/mdn/api.h
@@ -0,0 +1,91 @@
+/* $Id: api.h,v 1.1.1.1 2003/06/04 00:25:45 marka Exp $ */
+/*
+ * Copyright (c) 2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef MDN_API_H
+#define MDN_API_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <mdn/result.h>
+#include <mdn/res.h>
+#include <idn/api.h>
+
+#define mdn_enable idn_enable
+
+extern idn_result_t
+mdn_nameinit(void);
+
+extern idn_result_t
+mdn_encodename(int actions, const char *from, char *to, size_t tolen);
+
+extern idn_result_t
+mdn_decodename(int actions, const char *from, char *to, size_t tolen);
+
+#define mdn_localtoutf8(from, to, tolen) \
+ mdn_encodename(IDN_LOCALCONV, from, to, len)
+#define mdn_delimitermap(from, to, tolen) \
+ mdn_encodename(IDN_DELIMMAP, from, to, len)
+#define mdn_localmap(from, to, tolen) \
+ mdn_encodename(IDN_LOCALMAP, from, to, len)
+#define mdn_nameprep(from, to, tolen) \
+ mdn_encodename(IDN_NAMEPREP, from, to, len)
+#define mdn_utf8toidn(from, to, tolen) \
+ mdn_encodename(IDN_IDNCONV, from, to, len)
+#define mdn_idntoutf8(from, to, tolen) \
+ mdn_decodename(IDN_IDNCONV, from, to, tolen)
+#define mdn_utf8tolocal(from, to, tolen) \
+ mdn_decodename(IDN_LOCALCONV, from, to, tolen)
+
+#define mdn_localtoidn(from, to, tolen) \
+ mdn_encodename(IDN_ENCODE_APP, from, to, tolen)
+#define mdn_idntolocal(from, to, tolen) \
+ mdn_decodename(IDN_DECODE_APP, from, to, tolen)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MDN_API_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/mdn/localencoding.h b/contrib/idn/idnkit-1.0-src/include/mdn/localencoding.h
new file mode 100644
index 0000000..e1e86f7
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/mdn/localencoding.h
@@ -0,0 +1,49 @@
+/* $Id: localencoding.h,v 1.1.1.1 2003/06/04 00:25:45 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef MDN_LOCALENCODING_H
+#define MDN_LOCALENCODING_H 1
+
+#define MDN_LOCALCS_ENV "MDN_LOCAL_CODESET"
+
+#endif /* MDN_LOCALENCODING_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/mdn/log.h b/contrib/idn/idnkit-1.0-src/include/mdn/log.h
new file mode 100644
index 0000000..002c410
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/mdn/log.h
@@ -0,0 +1,92 @@
+/* $Id: log.h,v 1.1.1.1 2003/06/04 00:25:45 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef MDN_LOG_H
+#define MDN_LOG_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <idn/log.h>
+
+#define mdn_log_proc_t \
+ idn_log_proc_t
+
+#define mdn_log_level_fatal \
+ idn_log_level_fatal
+#define mdn_log_level_error \
+ idn_log_level_error
+#define mdn_log_level_warning \
+ idn_log_level_warning
+#define mdn_log_level_info \
+ idn_log_level_info
+#define mdn_log_level_trace \
+ idn_log_level_trace
+#define mdn_log_level_dump \
+ idn_log_level_dump
+
+#define mdn_log_fatal \
+ idn_log_fatal
+#define mdn_log_error \
+ idn_log_error
+#define mdn_log_warning \
+ idn_log_warning
+#define mdn_log_info \
+ idn_log_info
+#define mdn_log_trace \
+ idn_log_trace
+#define mdn_log_dump \
+ idn_log_dump
+#define mdn_log_setlevel \
+ idn_log_setlevel
+#define mdn_log_getlevel \
+ idn_log_getlevel
+#define mdn_log_setproc \
+ idn_log_setproc
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MDN_LOG_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/mdn/res.h b/contrib/idn/idnkit-1.0-src/include/mdn/res.h
new file mode 100644
index 0000000..a1c0c20
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/mdn/res.h
@@ -0,0 +1,121 @@
+/* $Id: res.h,v 1.1.1.1 2003/06/04 00:25:45 marka Exp $ */
+/*
+ * Copyright (c) 2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef MDN_RES_H
+#define MDN_RES_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <mdn/resconf.h>
+#include <mdn/result.h>
+#include <idn/res.h>
+
+#define MDN_LOCALCONV \
+ IDN_LOCALCONV
+#define MDN_DELIMMAP \
+ IDN_DELIMMAP
+#define MDN_LOCALMAP \
+ IDN_LOCALMAP
+#define MDN_MAP \
+ IDN_MAP
+#define MDN_NORMALIZE \
+ IDN_NORMALIZE
+#define MDN_PROHCHECK \
+ IDN_PROHCHECK
+#define MDN_UNASCHECK \
+ IDN_UNASCHECK
+#define MDN_ASCCHECK \
+ IDN_ASCCHECK
+#define MDN_IDNCONV \
+ IDN_IDNCONV
+#define MDN_LENCHECK \
+ IDN_LENCHECK
+#define MDN_RTCHECK \
+ IDN_RTCHECK
+#define MDN_UNDOIFERR \
+ IDN_UNDOIFERR
+#define MDN_ENCODE_APP \
+ IDN_ENCODE_APP
+#define MDN_DECODE_APP \
+ IDN_DECODE_APP
+#define MDN_NAMEPREP \
+ IDN_NAMEPREP
+
+#define mdn_res_enable \
+ idn_res_enable
+#define mdn_res_encodename \
+ idn_res_encodename
+#define mdn_res_decodename \
+ idn_res_decodename
+#define mdn_res_actiontostring \
+ idn_res_actiontostring
+
+#define mdn_res_localtoutf8 \
+ idn_res_localtoutf8
+#define mdn_res_delimitermap \
+ idn_res_delimitermap
+#define mdn_res_localmap \
+ idn_res_localmap
+#define mdn_res_nameprep \
+ idn_res_nameprep
+#define mdn_res_utf8toidn \
+ idn_res_utf8toidn
+#define mdn_res_idntoutf8 \
+ idn_res_idntoutf8
+#define mdn_res_utf8tolocal \
+ idn_res_utf8tolocal
+#define mdn_res_nameprepcheck \
+ idn_res_nameprepcheck
+#define mdn_res_localtoidn \
+ idn_res_localtoidn
+#define mdn_res_idntolocal \
+ idn_res_idntolocal
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MDN_RES_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/mdn/resconf.h b/contrib/idn/idnkit-1.0-src/include/mdn/resconf.h
new file mode 100644
index 0000000..c98a8f5
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/mdn/resconf.h
@@ -0,0 +1,150 @@
+/* $Id: resconf.h,v 1.1.1.1 2003/06/04 00:25:46 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef MDN_RESCONF_H
+#define MDN_RESCONF_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <mdn/result.h>
+#include <idn/resconf.h>
+
+#define mdn_resconf_t \
+ idn_resconf_t
+
+#define mdn_resconf_initialize \
+ idn_resconf_initialize
+#define mdn_resconf_create \
+ idn_resconf_create
+#define mdn_resconf_destroy \
+ idn_resconf_destroy
+
+#define mdn_resconf_incrref \
+ idn_resconf_incrref
+#define mdn_resconf_loadfile \
+ idn_resconf_loadfile
+#define mdn_resconf_defaultfile \
+ idn_resconf_defaultfile
+#define mdn_resconf_getdelimitermap \
+ idn_resconf_getdelimitermap
+#define mdn_resconf_getidnconverter \
+ idn_resconf_getidnconverter
+#define mdn_resconf_getlocalconverter \
+ idn_resconf_getlocalconverter
+#define mdn_resconf_getlocalmapselector \
+ idn_resconf_getlocalmapselector
+#define mdn_resconf_getmapper \
+ idn_resconf_getmapper
+#define mdn_resconf_getnormalizer \
+ idn_resconf_getnormalizer
+#define mdn_resconf_getprohibitchecker \
+ idn_resconf_getprohibitchecker
+#define mdn_resconf_getunassignedchecker \
+ idn_resconf_getunassignedchecker
+#define mdn_resconf_setdelimitermap \
+ idn_resconf_setdelimitermap
+#define mdn_resconf_setidnconverter \
+ idn_resconf_setidnconverter
+#define mdn_resconf_setlocalconverter \
+ idn_resconf_setlocalconverter
+#define mdn_resconf_setlocalmapselector \
+ idn_resconf_setlocalmapselector
+#define mdn_resconf_setmapper \
+ idn_resconf_setmapper
+#define mdn_resconf_setnormalizer \
+ idn_resconf_setnormalizer
+#define mdn_resconf_setprohibitchecker \
+ idn_resconf_setprohibitchecker
+#define mdn_resconf_setunassignedchecker \
+ idn_resconf_setunassignedchecker
+#define mdn_resconf_setidnconvertername \
+ idn_resconf_setidnconvertername
+#define mdn_resconf_addalldelimitermapucs \
+ idn_resconf_addalldelimitermapucs
+#define mdn_resconf_setlocalconvertername \
+ idn_resconf_setlocalconvertername
+#define mdn_resconf_addalllocalmapselectornames \
+ idn_resconf_addalllocalmapselectornames
+#define mdn_resconf_addallmappernames \
+ idn_resconf_addallmappernames
+#define mdn_resconf_addallnormalizernames \
+ idn_resconf_addallnormalizernames
+#define mdn_resconf_addallprohibitcheckernames \
+ idn_resconf_addallprohibitcheckernames
+#define mdn_resconf_addallunassignedcheckernames \
+ idn_resconf_addallunassignedcheckernames
+#define mdn_resconf_setnameprepversion \
+ idn_resconf_setnameprepversion
+#define mdn_resconf_setalternateconverter \
+ idn_resconf_setalternateconverter
+#define mdn_resconf_setalternateconvertername \
+ idn_resconf_setalternateconvertername
+#define mdn_resconf_getalternateconverter \
+ idn_resconf_getalternateconverter
+
+#define mdn_resconf_localconverter \
+ idn_resconf_localconverter
+#define mdn_resconf_idnconverter \
+ idn_resconf_idnconverter
+#define mdn_resconf_alternateconverter \
+ idn_resconf_alternateconverter
+#define mdn_resconf_normalizer \
+ idn_resconf_normalizer
+#define mdn_resconf_mapper \
+ idn_resconf_mapper
+#define mdn_resconf_delimitermap \
+ idn_resconf_delimitermap
+#define mdn_resconf_localmapselector \
+ idn_resconf_localmapselector
+#define mdn_resconf_prohibitchecker \
+ idn_resconf_prohibitchecker
+#define mdn_resconf_unassignedchecker \
+ idn_resconf_unassignedchecker
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MDN_RESCONF_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/mdn/result.h b/contrib/idn/idnkit-1.0-src/include/mdn/result.h
new file mode 100644
index 0000000..ac47ff7
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/mdn/result.h
@@ -0,0 +1,97 @@
+/* $Id: result.h,v 1.1.1.1 2003/06/04 00:25:46 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef MDN_RESULT_H
+#define MDN_RESULT_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <idn/result.h>
+
+#define mdn_result_t \
+ idn_result_t
+
+#define mdn_success \
+ idn_success
+#define mdn_notfound \
+ idn_notfound
+#define mdn_invalid_encoding \
+ idn_invalid_encoding
+#define mdn_invalid_syntax \
+ idn_invalid_syntax
+#define mdn_invalid_name \
+ idn_invalid_name
+#define mdn_invalid_message \
+ idn_invalid_message
+#define mdn_invalid_action \
+ idn_invalid_action
+#define mdn_invalid_codepoint \
+ idn_invalid_codepoint
+#define mdn_invalid_length \
+ idn_invalid_length
+#define mdn_buffer_overflow \
+ idn_buffer_overflow
+#define mdn_noentry \
+ idn_noentry
+#define mdn_nomemory \
+ idn_nomemory
+#define mdn_nofile \
+ idn_nofile
+#define mdn_nomapping \
+ idn_nomapping
+#define mdn_context_required \
+ idn_context_required
+#define mdn_prohibited \
+ idn_prohibited
+#define mdn_failure \
+ idn_failure
+#define mdn_result_tostring \
+ idn_result_tostring
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MDN_RESULT_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/mdn/utf8.h b/contrib/idn/idnkit-1.0-src/include/mdn/utf8.h
new file mode 100644
index 0000000..7f5892d
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/mdn/utf8.h
@@ -0,0 +1,70 @@
+/* $Id: utf8.h,v 1.1.1.1 2003/06/04 00:25:46 marka Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef MDN_UTF8_H
+#define MDN_UTF8_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define mdn_utf8_mblen \
+ idn_utf8_mblen
+#define mdn_utf8_getmb \
+ idn_utf8_getmb
+#define mdn_utf8_getwc \
+ idn_utf8_getwc
+#define mdn_utf8_putwc \
+ idn_utf8_putwc
+#define mdn_utf8_isvalidchar \
+ idn_utf8_isvalidchar
+#define mdn_utf8_isvalidstring \
+ idn_utf8_isvalidstring
+#define mdn_utf8_findfirstbyte \
+ idn_utf8_findfirstbyte
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MDN_UTF8_H */
diff --git a/contrib/idn/idnkit-1.0-src/include/mdn/version.h b/contrib/idn/idnkit-1.0-src/include/mdn/version.h
new file mode 100644
index 0000000..2ae4526
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/include/mdn/version.h
@@ -0,0 +1,66 @@
+/* $Id: version.h,v 1.1.1.1 2003/06/04 00:25:46 marka Exp $ */
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef MDN_VERSION_H
+#define MDN_VERSION_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <idn/version.h>
+
+/*
+ * Version number of this package.
+ */
+#define MDNKIT_VERSION "idnkit " IDNKIT_VERSION
+#define MDNKIT_MAJOR_VERSION (IDNKIT_MAJOR_VERSION + 4)
+#define MDNKIT_MINOR_VERSION IDNKIT_MINOR_VERSION
+
+#define mdn_version_getstring idn_version_getstring
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MDN_VERSION_H */
diff --git a/contrib/idn/idnkit-1.0-src/install-sh b/contrib/idn/idnkit-1.0-src/install-sh
new file mode 100755
index 0000000..ebc6691
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/install-sh
@@ -0,0 +1,250 @@
+#! /bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/contrib/idn/idnkit-1.0-src/lib/Makefile.in b/contrib/idn/idnkit-1.0-src/lib/Makefile.in
new file mode 100644
index 0000000..e768730
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/Makefile.in
@@ -0,0 +1,309 @@
+# $Id: Makefile.in,v 1.2 2004/07/20 07:13:39 marka Exp $
+# Copyright (c) 2000, 2002 Japan Network Information Center.
+# All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+build = @build@
+
+LIB_CURRENT = 1
+LIB_REVISION = 2
+LIB_AGE = 0
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .to
+
+top_builddir = ..
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+libdir = @libdir@
+sysconfdir = @sysconfdir@
+datadir = @datadir@
+mapdir = $(datadir)/idnkit
+utf8_name = @UTF8_NAME@
+
+SUBDIRS = tests
+
+SHELL = @SHELL@
+CC = @CC@
+RANLIB = @RANLIB@
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
+LIBTOOL = @LIBTOOL@
+
+ICONVINC = @ICONVINC@
+ICONVLIB = @ICONVLIB@
+
+INCS = -I$(srcdir)/../include -I../include $(ICONVINC)
+DEFS = -DIDN_RESCONF_DIR="\"$(sysconfdir)\""
+
+CFLAGS = $(OPTS) $(INCS) $(DEFS) @CPPFLAGS@ @CFLAGS@
+LDFLAGS = @LDFLAGS@
+
+SRCS = \
+ aliaslist.c \
+ api.c \
+ checker.c \
+ converter.c \
+ debug.c \
+ delimitermap.c \
+ filechecker.c \
+ filemapper.c \
+ localencoding.c \
+ log.c \
+ mapper.c \
+ mapselector.c \
+ nameprep.c \
+ nameprep_template.c \
+ nameprepdata.c \
+ normalizer.c \
+ punycode.c \
+ race.c \
+ res.c \
+ resconf.c \
+ result.c \
+ strhash.c \
+ ucs4.c \
+ ucsmap.c \
+ ucsset.c \
+ unicode.c \
+ unicode_template.c \
+ unicodedata_320.c \
+ unormalize.c \
+ util.c \
+ utf8.c \
+ version.c
+
+OBJS = \
+ aliaslist.lo \
+ api.lo \
+ checker.lo \
+ converter.lo \
+ debug.lo \
+ delimitermap.lo \
+ filechecker.lo \
+ filemapper.lo \
+ localencoding.lo \
+ log.lo \
+ mapper.lo \
+ mapselector.lo \
+ nameprep.lo \
+ normalizer.lo \
+ punycode.lo \
+ race.lo \
+ res.lo \
+ resconf.lo \
+ result.lo \
+ strhash.lo \
+ ucs4.lo \
+ ucsmap.lo \
+ ucsset.lo \
+ unicode.lo \
+ unormalize.lo \
+ utf8.lo \
+ util.lo \
+ version.lo
+
+LIB = libidnkit
+TESTLIB = libidntest
+
+LITELIBCFLAGS = $(CFLAGS) -DWITHOUT_ICONV
+LITELIB_OBJS = \
+ apilite.lo \
+ converterlite.lo \
+ reslite.lo \
+ resconflite.lo \
+ aliaslist.lo \
+ checker.lo \
+ debug.lo \
+ delimitermap.lo \
+ filechecker.lo \
+ filemapper.lo \
+ log.lo \
+ mapper.lo \
+ mapselector.lo \
+ nameprep.lo \
+ normalizer.lo \
+ punycode.lo \
+ race.lo \
+ result.lo \
+ strhash.lo \
+ ucsmap.lo \
+ ucsset.lo \
+ unicode.lo \
+ unormalize.lo \
+ ucs4.lo \
+ utf8.lo \
+ util.lo \
+ version.lo
+
+LITELIB = libidnkitlite
+TESTLITELIB = libidntestlite
+
+SAMPLES = idn.conf.sample idnalias.conf.sample
+
+.c.lo:
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $<
+
+.c.to:
+ $(CC) -o $@ -DTEST $(CFLAGS) $(LDFLAGS) -c $<
+
+all: all-localdir all-subdirs
+@LITEONLY_TRUE@all-localdir: $(LITELIB).la $(SAMPLES)
+@LITEONLY_FALSE@all-localdir: $(LIB).la $(LITELIB).la $(SAMPLES)
+
+$(LIB).la: $(OBJS)
+ $(LIBTOOL) --mode=link $(LD) $(LDFLAGS) -o $@ \
+ -version-info $(LIB_CURRENT):$(LIB_REVISION):$(LIB_AGE) \
+ -rpath $(libdir) $(OBJS)
+
+$(TESTLIB).la: $(OBJS)
+ $(LIBTOOL) --mode=link $(LD) $(LDFLAGS) -o $@ \
+ -version-info $(LIB_CURRENT):$(LIB_REVISION):$(LIB_AGE) \
+ -rpath $(libdir) $(OBJS)
+
+apilite.lo: api.c
+ $(LIBTOOL) --mode=compile $(CC) $(LITELIBCFLAGS) -o $@ \
+ -c $(srcdir)/api.c
+converterlite.lo: converter.c
+ $(LIBTOOL) --mode=compile $(CC) $(LITELIBCFLAGS) -o $@ \
+ -c $(srcdir)/converter.c
+reslite.lo: res.c
+ $(LIBTOOL) --mode=compile $(CC) $(LITELIBCFLAGS) -o $@ \
+ -c $(srcdir)/res.c
+resconflite.lo: resconf.c
+ $(LIBTOOL) --mode=compile $(CC) $(LITELIBCFLAGS) -o $@ \
+ -c $(srcdir)/resconf.c
+
+$(LITELIB).la: $(LITELIB_OBJS)
+ $(LIBTOOL) --mode=link $(LD) $(LDFLAGS) -o $@ \
+ -version-info $(LIB_CURRENT):$(LIB_REVISION):$(LIB_AGE) \
+ -rpath $(libdir) $(LITELIB_OBJS)
+
+$(TESTLITELIB).la: $(LITELIB_OBJS)
+ $(LIBTOOL) --mode=link $(LD) $(LDFLAGS) -o $@ \
+ -version-info $(LIB_CURRENT):$(LIB_REVISION):$(LIB_AGE) \
+ -rpath $(libdir) $(LITELIB_OBJS)
+
+idn.conf.sample: idn.conf.sample.in
+ sed -e 's%[@]mapdir[@]%$(mapdir)%' \
+ < $(srcdir)/idn.conf.sample.in > $@
+
+idnalias.conf.sample: Makefile
+ $(SHELL) $(srcdir)/aliaslist.sh $(build) $(utf8_name) > $@
+
+install: install-localdir install-subdirs
+@LITEONLY_TRUE@install-localdir: all install-common
+@LITEONLY_FALSE@install-localdir: all install-common install-nolite
+
+install-common:
+ $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
+ $(LIBTOOL) $(INSTALL_DATA) $(LITELIB).la \
+ $(DESTDIR)$(libdir)/$(LITELIB).la
+ -[ -f $(DESTDIR)$(libdir)/$(LITELIB).a ] \
+ && $(RANLIB) $(DESTDIR)$(libdir)/$(LITELIB).a
+ $(MKINSTALLDIRS) $(DESTDIR)$(sysconfdir)
+ $(INSTALL_DATA) idn.conf.sample \
+ $(DESTDIR)$(sysconfdir)/idn.conf.sample
+ $(INSTALL_DATA) idnalias.conf.sample \
+ $(DESTDIR)$(sysconfdir)/idnalias.conf.sample
+ @if [ ! -f $(DESTDIR)$(sysconfdir)/idn.conf ]; then \
+ echo "** installing default idn.conf"; \
+ $(INSTALL_DATA) idn.conf.sample $(DESTDIR)$(sysconfdir)/idn.conf; \
+ fi
+ @if [ ! -f $(DESTDIR)$(sysconfdir)/idnalias.conf ]; then \
+ echo "** installing default idnalias.conf"; \
+ $(INSTALL_DATA) idnalias.conf.sample \
+ $(DESTDIR)$(sysconfdir)/idnalias.conf; \
+ fi
+
+install-nolite:
+ $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
+ $(LIBTOOL) $(INSTALL_DATA) $(LIB).la \
+ $(DESTDIR)$(libdir)/$(LIB).la
+ -[ -f $(DESTDIR)$(libdir)/$(LIB).a ] \
+ && $(RANLIB) $(DESTDIR)$(libdir)/$(LIB).a
+
+install-config:
+ @if [ -f $(DESTDIR)$(sysconfdir)/idn.conf ]; then \
+ echo "** backing up old idn.conf as idn.conf.old"; \
+ mv -f $(DESTDIR)$(sysconfdir)/idn.conf \
+ $(DESTDIR)$(sysconfdir)/idn.conf.old; \
+ fi
+ @echo "** installing default idn.conf forcibly"
+ $(INSTALL_DATA) idn.conf.sample $(DESTDIR)$(sysconfdir)/idn.conf
+ @if [ -f $(DESTDIR)$(sysconfdir)/idnalias.conf ]; then \
+ echo "** backing up old idnalias.conf as idnalias.conf.old"; \
+ mv -f $(DESTDIR)$(sysconfdir)/idnalias.conf \
+ $(DESTDIR)$(sysconfdir)/idnalias.conf.old; \
+ fi
+ @echo "** installing default idnalias.conf forcibly"
+ $(INSTALL_DATA) idnalias.conf.sample \
+ $(DESTDIR)$(sysconfdir)/idnalias.conf
+
+clean: clean-localdir clean-subdirs
+clean-localdir: force
+ rm -f *.o *.lo *.la *.a core *.core *~
+ rm -f *.to *_test.c *_test
+ rm -f idn.conf.sample idnalias.conf.sample
+ rm -fr .libs/
+
+distclean: distclean-localdir distclean-subdirs
+distclean-localdir: force clean-localdir
+ rm -f Makefile
+
+test check: test-localdir test-subdirs
+
+@LITEONLY_TRUE@test-localdir: $(TESTLITELIB).la $(SAMPLES)
+@LITEONLY_FALSE@test-localdir: $(TESTLIB).la $(TESTLITELIB).la $(SAMPLES)
+
+all-subdirs install-subdirs clean-subdirs distclean-subdirs test-subdirs:
+ @target=`echo $@ | sed 's/-subdirs$$//'`; \
+ for d in $(SUBDIRS) ; do \
+ (cd $$d; $(MAKE) DESTDIR=$(DESTDIR) $$target); \
+ done
+
+force:
diff --git a/contrib/idn/idnkit-1.0-src/lib/aliaslist.c b/contrib/idn/idnkit-1.0-src/lib/aliaslist.c
new file mode 100644
index 0000000..2b5dca0
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/aliaslist.c
@@ -0,0 +1,355 @@
+#ifndef lint
+static char *rcsid = "$Id: aliaslist.c,v 1.1.1.1 2003/06/04 00:25:47 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <idn/aliaslist.h>
+#include <idn/assert.h>
+#include <idn/logmacro.h>
+#include <idn/result.h>
+
+struct aliasitem {
+ char *pattern; /* name pattern */
+ char *encoding; /* MIME-preferred charset name */
+ struct aliasitem *next;
+};
+typedef struct aliasitem *aliasitem_t;
+
+struct idn__aliaslist {
+ aliasitem_t first_item; /* first item of the list */
+};
+
+static idn_result_t
+additem_to_top(idn__aliaslist_t list,
+ const char *pattern, const char *encoding);
+
+static idn_result_t
+additem_to_bottom(idn__aliaslist_t list,
+ const char *pattern, const char *encoding);
+
+static int match(const char *pattern, const char *str);
+
+static idn_result_t create_item(const char *pattern, const char *encoding,
+ aliasitem_t *itemp);
+
+#ifdef DEBUG
+static void dump_list(idn__aliaslist_t list);
+#endif
+
+idn_result_t
+idn__aliaslist_create(idn__aliaslist_t *listp) {
+ static int size = sizeof(struct idn__aliaslist);
+
+ TRACE(("idn__aliaslist_create()\n"));
+
+ assert(listp != NULL);
+
+ if ((*listp = malloc(size)) == NULL) {
+ return (idn_nomemory);
+ }
+ (*listp)->first_item = NULL;
+
+ return (idn_success);
+}
+
+void
+idn__aliaslist_destroy(idn__aliaslist_t list) {
+ aliasitem_t current;
+ aliasitem_t next;
+
+ TRACE(("idn__aliaslist_destroy()\n"));
+
+ assert(list != NULL);
+
+ current = list->first_item;
+ while (current != NULL) {
+ if (current->pattern != NULL) {
+ free(current->pattern);
+ }
+ if (current->encoding != NULL) {
+ free(current->encoding);
+ }
+ next = current->next;
+ free(current);
+ current = next;
+ }
+ free(list);
+}
+
+idn_result_t
+idn__aliaslist_aliasfile(idn__aliaslist_t list, const char *path) {
+ FILE *fp;
+ int line_no;
+ idn_result_t r = idn_success;
+ char line[200], alias[200], real[200];
+
+ assert(path != NULL);
+
+ TRACE(("idn__aliaslist_aliasfile(path=%s)\n", path));
+
+ if ((fp = fopen(path, "r")) == NULL) {
+ return (idn_nofile);
+ }
+ for (line_no = 1; fgets(line, sizeof(line), fp) != NULL; line_no++) {
+ unsigned char *p = (unsigned char *)line;
+
+ while (isascii(*p) && isspace(*p))
+ p++;
+ if (*p == '#' || *p == '\n')
+ continue;
+ if (sscanf((char *)p, "%s %s", alias, real) == 2) {
+ r = additem_to_bottom(list, alias, real);
+ if (r != idn_success)
+ break;
+ } else {
+ INFO(("idn__aliaslist_aliasfile: file %s has "
+ "invalid contents at line %d\n",
+ path, line_no));
+ r = idn_invalid_syntax;
+ break;
+ }
+ }
+ fclose(fp);
+
+#ifdef DEBUG
+ dump_list(list);
+#endif
+
+ return (r);
+}
+
+idn_result_t
+idn__aliaslist_additem(idn__aliaslist_t list,
+ const char *pattern, const char *encoding,
+ int first_item) {
+ if (first_item) {
+ return additem_to_top(list, pattern, encoding);
+ } else {
+ return additem_to_bottom(list, pattern, encoding);
+ }
+}
+
+static idn_result_t
+additem_to_top(idn__aliaslist_t list,
+ const char *pattern, const char *encoding) {
+ aliasitem_t new_item;
+ idn_result_t r;
+
+ TRACE(("additem_to_top()\n"));
+
+ assert(list != NULL);
+ assert(pattern != NULL);
+ assert(encoding != NULL);
+
+ if ((r = create_item(pattern, encoding, &new_item))
+ != idn_success) {
+ WARNING(("additem_to_top: malloc failed\n"));
+ return (r);
+ }
+
+ new_item->next = list->first_item;
+ list->first_item = new_item;
+
+#ifdef DEBUG
+ dump_list(list);
+#endif
+
+ return (idn_success);
+}
+
+static idn_result_t
+additem_to_bottom(idn__aliaslist_t list,
+ const char *pattern, const char *encoding) {
+ aliasitem_t new_item;
+ idn_result_t r;
+
+ TRACE(("additem_to_bottom()\n"));
+
+ assert(list != NULL);
+ assert(pattern != NULL);
+ assert(encoding != NULL);
+
+ r = create_item(pattern, encoding, &new_item);
+ if (r != idn_success) {
+ WARNING(("additem_to_bottom: malloc failed\n"));
+ return r;
+ }
+
+ if (list->first_item == NULL) {
+ list->first_item = new_item;
+ } else {
+ aliasitem_t cur_item = list->first_item;
+ for (;;) {
+ if (cur_item->next == NULL) {
+ break;
+ }
+ cur_item = cur_item->next;
+ }
+ cur_item->next = new_item;
+ }
+
+ return (idn_success);
+}
+
+idn_result_t
+idn__aliaslist_find(idn__aliaslist_t list,
+ const char *pattern, char **encodingp) {
+ aliasitem_t current;
+
+ TRACE(("idn__aliaslist_find()\n"));
+
+ assert(list != NULL);
+ assert(pattern != NULL);
+
+#ifdef DEBUG
+ DUMP(("target pattern: %s\n", pattern));
+#endif
+ current = list->first_item;
+ while (current != NULL) {
+#ifdef DEBUG
+ DUMP(("current pattern: %s, encoding: %s\n",
+ current->pattern, current->encoding));
+#endif
+ if (match(current->pattern, pattern)) {
+ *encodingp = current->encoding;
+ return (idn_success);
+ }
+ current = current->next;
+ }
+
+ TRACE(("idn__aliaslist_find(): not found\n"));
+ *encodingp = (char *)pattern;
+ return (idn_notfound);
+}
+
+/*
+ * Wild card matching function that supports only '*'.
+ */
+static int
+match(const char *pattern, const char *str) {
+ for (;;) {
+ int c;
+
+ switch (c = *pattern++) {
+ case '\0':
+ return (*str == '\0');
+ case '*':
+ while (!match(pattern, str)) {
+ if (*str == '\0')
+ return (0);
+ str++;
+ }
+ return (1);
+ break;
+ default:
+ if (*str++ != c)
+ return (0);
+ break;
+ }
+ }
+}
+
+/*
+ * List item creation.
+ * pattern and encoding must not be NULL.
+ */
+static idn_result_t
+create_item(const char *pattern, const char *encoding,
+ aliasitem_t *itemp) {
+ static size_t size = sizeof(struct aliasitem);
+
+ assert(pattern != NULL);
+ assert(encoding != NULL);
+
+ if ((*itemp = malloc(size)) == NULL)
+ return (idn_nomemory);
+
+ if (((*itemp)->pattern = malloc(strlen(pattern) + 1)) == NULL) {
+ free(*itemp);
+ *itemp = NULL;
+ return (idn_nomemory);
+ }
+
+ if (((*itemp)->encoding = malloc(strlen(encoding) + 1)) == NULL) {
+ free((*itemp)->pattern);
+ free(*itemp);
+ *itemp = NULL;
+ return (idn_nomemory);
+ }
+
+ (void)strcpy((*itemp)->pattern, pattern);
+ (void)strcpy((*itemp)->encoding, encoding);
+ (*itemp)->next = NULL;
+
+ return (idn_success);
+}
+
+#ifdef DEBUG
+static void
+dump_list(idn__aliaslist_t list) {
+ aliasitem_t item;
+ int i;
+
+ TRACE(("dump_list()\n"));
+ if (list == NULL) {
+ TRACE(("list is NULL\n"));
+ return;
+ }
+ item = list->first_item;
+ i = 0;
+ while (item != NULL) {
+ DUMP(("%d: %s\t%s\n", i, item->pattern, item->encoding));
+ item = item->next;
+ i++;
+ }
+}
+#endif
diff --git a/contrib/idn/idnkit-1.0-src/lib/aliaslist.sh b/contrib/idn/idnkit-1.0-src/lib/aliaslist.sh
new file mode 100644
index 0000000..47c3d4f
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/aliaslist.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# aliaslist.sh -- Generate `idnalias.conf.sample' file.
+#
+
+cpu_company_system="$1"
+utf8_name="$2"
+
+cat <<EOF
+*.ISO_8859-1 ISO-8859-1
+*.ISO_8859-2 ISO-8859-1
+*.SJIS Shift_JIS
+*.Shift_JIS Shift_JIS
+ja_JP.EUC EUC-JP
+ko_KR.EUC EUC-KR
+*.big5 Big5
+*.Big5 Big5
+*.KOI8-R KOI8-R
+*.GB2312 GB2312
+ja EUC-JP
+EOF
+
+case "$cpu_company_system" in
+*-*-hpux*)
+ echo "japanese Shift_JIS"
+ ;;
+*)
+ echo "japanese EUC-JP"
+esac
+
+if [ "x$utf8_name" != xUTF-8 ] ; then
+ echo "UTF-8 $utf8_name"
+fi
+
+exit 0
diff --git a/contrib/idn/idnkit-1.0-src/lib/api.c b/contrib/idn/idnkit-1.0-src/lib/api.c
new file mode 100644
index 0000000..ab1b6e0
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/api.c
@@ -0,0 +1,257 @@
+#ifndef lint
+static char *rcsid = "$Id: api.c,v 1.1.1.1 2003/06/04 00:25:48 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <string.h>
+#include <stdlib.h>
+
+#include <idn/result.h>
+#include <idn/assert.h>
+#include <idn/log.h>
+#include <idn/logmacro.h>
+#include <idn/resconf.h>
+#include <idn/api.h>
+#include <idn/debug.h>
+#include <idn/res.h>
+
+static int initialized;
+static idn_resconf_t default_conf;
+
+static char *conf_file;
+
+void
+idn_enable(int on_off) {
+ idn_res_enable(on_off);
+}
+
+idn_result_t
+idn__setconffile(const char *file) {
+ idn_result_t r;
+ char *s;
+
+ TRACE(("idn__setconffile(%s)\n", (file == NULL) ? "<null>" : file));
+
+ if (initialized) {
+ r = idn_failure;
+ goto ret;
+ }
+
+ if (file == NULL)
+ s = NULL;
+ else {
+ s = (char *)malloc(strlen(file) + 1);
+ if (s == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ strcpy(s, file);
+ }
+ free(conf_file);
+ conf_file = s;
+
+ r = idn_success;
+ret:
+ TRACE(("idn__setconffile(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_result_t
+idn_nameinit(int load_file) {
+ idn_result_t r;
+
+ TRACE(("idn_nameinit()\n"));
+
+ if (initialized) {
+ r = idn_success;
+ goto ret;
+ }
+
+ idn_resconf_initialize();
+
+ r = idn_resconf_create(&default_conf);
+ if (r != idn_success)
+ goto ret;
+
+ if (load_file)
+ r = idn_resconf_loadfile(default_conf, conf_file);
+ else
+ r = idn_resconf_setdefaults(default_conf);
+ if (r != idn_success)
+ goto ret;
+
+ initialized = 1;
+
+ret:
+ if (r != idn_success && default_conf != NULL) {
+ idn_resconf_destroy(default_conf);
+ default_conf = NULL;
+ }
+ TRACE(("idn_nameinit(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_result_t
+idn_encodename(idn_action_t actions, const char *from, char *to, size_t tolen) {
+ idn_result_t r;
+
+ assert(from != NULL && to != NULL);
+
+ TRACE(("idn_encodename(actions=%s, from=\"%s\")\n",
+ idn__res_actionstostring(actions),
+ idn__debug_xstring(from, 50)));
+
+ if (!initialized && ((r = idn_nameinit(0)) != idn_success))
+ goto ret;
+
+ r = idn_res_encodename(default_conf, actions, from, to, tolen);
+
+ret:
+ if (r == idn_success) {
+ TRACE(("idn_encodename(): success (to=\"%s\")\n",
+ idn__debug_xstring(to, 50)));
+ } else {
+ TRACE(("idn_encodename(): %s\n", idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+idn_result_t
+idn_decodename(idn_action_t actions, const char *from, char *to, size_t tolen) {
+ idn_result_t r;
+
+ assert(from != NULL && to != NULL);
+
+ TRACE(("idn_decodename(actions=%s, from=\"%s\", tolen=%d)\n",
+ idn__res_actionstostring(actions),
+ idn__debug_xstring(from, 50), (int)tolen));
+
+ if (!initialized && ((r = idn_nameinit(0)) != idn_success))
+ goto ret;
+
+ r = idn_res_decodename(default_conf, actions, from, to, tolen);
+
+ret:
+ if (r == idn_success) {
+ TRACE(("idn_decodename(): success (to=\"%s\")\n",
+ idn__debug_xstring(to, 50)));
+ } else {
+ TRACE(("idn_decodename(): %s\n", idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+idn_result_t
+idn_decodename2(idn_action_t actions, const char *from, char *to, size_t tolen,
+ const char *auxencoding) {
+ idn_result_t r;
+
+ assert(from != NULL && to != NULL);
+
+ TRACE(("idn_decodename2(actions=%s, from=\"%s\", tolen=%d)\n",
+ idn__res_actionstostring(actions),
+ idn__debug_xstring(from, 50), (int)tolen));
+
+ if (!initialized && ((r = idn_nameinit(0)) != idn_success))
+ goto ret;
+
+ r = idn_res_decodename2(default_conf, actions, from, to, tolen,
+ auxencoding);
+
+ret:
+ if (r == idn_success) {
+ TRACE(("idn_decodename2(): success (to=\"%s\")\n",
+ idn__debug_xstring(to, 50)));
+ } else {
+ TRACE(("idn_decodename2(): %s\n", idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+/*
+ * These functions are for backward compatibility.
+ */
+#ifdef ENABLE_MDNKIT_COMPAT
+
+idn_result_t
+mdn_nameinit(void) {
+ return idn_nameinit(1);
+}
+
+idn_result_t
+mdn_encodename(int actions, const char *from, char *to, size_t tolen) {
+ idn_result_t r;
+
+ assert(from != NULL && to != NULL);
+
+ TRACE(("mdn_encodename(actions=%s, from=\"%s\")\n",
+ idn__res_actionstostring(actions),
+ idn__debug_xstring(from, 50)));
+
+ if (!initialized && ((r = idn_nameinit(1)) != idn_success))
+ return (r);
+
+ return (idn_res_encodename(default_conf, actions, from, to, tolen));
+}
+
+idn_result_t
+mdn_decodename(int actions, const char *from, char *to, size_t tolen) {
+ idn_result_t r;
+
+ assert(from != NULL && to != NULL);
+
+ TRACE(("idn_decodename(actions=%s, from=\"%s\", tolen=%d)\n",
+ idn__res_actionstostring(actions),
+ idn__debug_xstring(from, 50), (int)tolen));
+
+ if (!initialized && ((r = idn_nameinit(1)) != idn_success))
+ return (r);
+
+ return (idn_res_decodename(default_conf, actions, from, to, tolen));
+}
+
+#endif /* ENABLE_MDNKIT_COMPAT */
diff --git a/contrib/idn/idnkit-1.0-src/lib/checker.c b/contrib/idn/idnkit-1.0-src/lib/checker.c
new file mode 100644
index 0000000..c1e8fdf
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/checker.c
@@ -0,0 +1,446 @@
+#ifndef lint
+static char *rcsid = "$Id: checker.c,v 1.1.1.1 2003/06/04 00:25:49 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <idn/result.h>
+#include <idn/assert.h>
+#include <idn/logmacro.h>
+#include <idn/checker.h>
+#include <idn/strhash.h>
+#include <idn/debug.h>
+
+/*
+ * Type for checking scheme.
+ */
+typedef struct {
+ char *prefix;
+ char *parameter;
+ idn_checker_createproc_t create;
+ idn_checker_destroyproc_t destroy;
+ idn_checker_lookupproc_t lookup;
+ void *context;
+} check_scheme_t;
+
+/*
+ * Standard checking schemes.
+ */
+static const check_scheme_t rfc3491_prohibit_scheme = {
+ "prohibit#RFC3491",
+ "RFC3491",
+ idn_nameprep_createproc,
+ idn_nameprep_destroyproc,
+ idn_nameprep_prohibitproc,
+ NULL,
+};
+
+static const check_scheme_t rfc3491_unasigned_scheme = {
+ "unassigned#RFC3491",
+ "RFC3491",
+ idn_nameprep_createproc,
+ idn_nameprep_destroyproc,
+ idn_nameprep_unassignedproc,
+ NULL,
+};
+
+static const check_scheme_t rfc3491_bidi_scheme = {
+ "bidi#RFC3491",
+ "RFC3491",
+ idn_nameprep_createproc,
+ idn_nameprep_destroyproc,
+ idn_nameprep_bidiproc,
+ NULL,
+};
+
+static const check_scheme_t filecheck_prohibit_scheme = {
+ "prohibit#fileset",
+ NULL,
+ idn__filechecker_createproc,
+ idn__filechecker_destroyproc,
+ idn__filechecker_lookupproc,
+ NULL,
+};
+
+static const check_scheme_t filecheck_unassigned_scheme = {
+ "unassigned#fileset",
+ NULL,
+ idn__filechecker_createproc,
+ idn__filechecker_destroyproc,
+ idn__filechecker_lookupproc,
+ NULL,
+};
+
+static const check_scheme_t *standard_check_schemes[] = {
+ &rfc3491_unasigned_scheme,
+ &rfc3491_prohibit_scheme,
+ &rfc3491_bidi_scheme,
+ &filecheck_prohibit_scheme,
+ &filecheck_unassigned_scheme,
+ NULL,
+};
+
+/*
+ * Hash table for checking schemes.
+ */
+static idn__strhash_t scheme_hash = NULL;
+
+/*
+ * Mapper object type.
+ */
+struct idn_checker {
+ int nschemes;
+ int scheme_size;
+ check_scheme_t *schemes;
+ int reference_count;
+};
+
+#define MAPPER_INITIAL_SCHEME_SIZE 1
+
+idn_result_t
+idn_checker_initialize(void) {
+ idn_result_t r;
+ check_scheme_t **scheme;
+
+ TRACE(("idn_checker_initialize()\n"));
+
+ if (scheme_hash != NULL) {
+ r = idn_success; /* already initialized */
+ goto ret;
+ }
+
+ r = idn__strhash_create(&scheme_hash);
+ if (r != idn_success) {
+ goto ret;
+ }
+
+ for (scheme = (check_scheme_t **)standard_check_schemes;
+ *scheme != NULL; scheme++) {
+ r = idn__strhash_put(scheme_hash, (*scheme)->prefix, *scheme);
+ if (r != idn_success)
+ goto ret;
+ }
+
+ r = idn_success;
+ret:
+ if (r != idn_success) {
+ if (scheme_hash != NULL) {
+ idn__strhash_destroy(scheme_hash, NULL);
+ scheme_hash = NULL;
+ }
+ }
+ TRACE(("idn_checker_initialize(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_result_t
+idn_checker_create(idn_checker_t *ctxp) {
+ idn_checker_t ctx = NULL;
+ idn_result_t r;
+
+ assert(scheme_hash != NULL);
+ assert(ctxp != NULL);
+
+ TRACE(("idn_checker_create()\n"));
+
+ ctx = (idn_checker_t) malloc(sizeof(struct idn_checker));
+ if (ctx == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+
+ ctx->schemes = (check_scheme_t *) malloc(sizeof(check_scheme_t)
+ * MAPPER_INITIAL_SCHEME_SIZE);
+ if (ctx->schemes == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+
+ ctx->nschemes = 0;
+ ctx->scheme_size = MAPPER_INITIAL_SCHEME_SIZE;
+ ctx->reference_count = 1;
+ *ctxp = ctx;
+ r = idn_success;
+ret:
+ if (r != idn_success) {
+ if (ctx != NULL)
+ free(ctx->schemes);
+ free(ctx);
+ }
+ TRACE(("idn_checker_create(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+void
+idn_checker_destroy(idn_checker_t ctx) {
+ int i;
+
+ assert(scheme_hash != NULL);
+ assert(ctx != NULL);
+
+ TRACE(("idn_checker_destroy()\n"));
+
+ ctx->reference_count--;
+ if (ctx->reference_count <= 0) {
+ TRACE(("idn_checker_destroy(): the object is destroyed\n"));
+ for (i = 0; i < ctx->nschemes; i++)
+ ctx->schemes[i].destroy(ctx->schemes[i].context);
+ free(ctx->schemes);
+ free(ctx);
+ } else {
+ TRACE(("idn_checker_destroy(): "
+ "update reference count (%d->%d)\n",
+ ctx->reference_count + 1, ctx->reference_count));
+ }
+}
+
+void
+idn_checker_incrref(idn_checker_t ctx) {
+ assert(ctx != NULL && scheme_hash != NULL);
+
+ TRACE(("idn_checker_incrref()\n"));
+ TRACE(("idn_checker_incrref: update reference count (%d->%d)\n",
+ ctx->reference_count, ctx->reference_count + 1));
+
+ ctx->reference_count++;
+}
+
+idn_result_t
+idn_checker_add(idn_checker_t ctx, const char *scheme_name) {
+ idn_result_t r;
+ check_scheme_t *scheme;
+ const char *scheme_prefix;
+ const char *scheme_parameter;
+ void *scheme_context = NULL;
+ char *buffer = NULL;
+
+ assert(scheme_hash != NULL);
+ assert(ctx != NULL);
+
+ TRACE(("idn_checker_add(scheme_name=%s)\n",
+ idn__debug_xstring(scheme_name, 50)));
+
+ /*
+ * Split `scheme_name' into `scheme_prefix' and `scheme_parameter'.
+ */
+ scheme_parameter = strchr(scheme_name, ':');
+ if (scheme_parameter == NULL) {
+ scheme_prefix = scheme_name;
+ scheme_parameter = NULL;
+ } else {
+ ptrdiff_t scheme_prefixlen;
+
+ scheme_prefixlen = scheme_parameter - scheme_name;
+ buffer = (char *) malloc(scheme_prefixlen + 1);
+ if (buffer == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ memcpy(buffer, scheme_name, scheme_prefixlen);
+ *(buffer + scheme_prefixlen) = '\0';
+ scheme_prefix = buffer;
+ scheme_parameter++;
+ }
+
+ /*
+ * Find a scheme.
+ */
+ if (idn__strhash_get(scheme_hash, scheme_prefix, (void **)&scheme)
+ != idn_success) {
+ ERROR(("idn_checker_add(): invalid scheme \"%-.30s\"\n",
+ scheme_name));
+ r = idn_invalid_name;
+ goto ret;
+ }
+ if (scheme_parameter == NULL && scheme->parameter != NULL)
+ scheme_parameter = scheme->parameter;
+
+ /*
+ * Add the scheme.
+ */
+ assert(ctx->nschemes <= ctx->scheme_size);
+
+ if (ctx->nschemes == ctx->scheme_size) {
+ check_scheme_t *new_schemes;
+
+ new_schemes = (check_scheme_t *) realloc(ctx->schemes,
+ sizeof(check_scheme_t) * ctx->scheme_size * 2);
+ if (new_schemes == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ ctx->schemes = new_schemes;
+ ctx->scheme_size *= 2;
+ }
+
+ r = scheme->create(scheme_parameter, &scheme_context);
+ if (r != idn_success)
+ goto ret;
+
+ memcpy(ctx->schemes + ctx->nschemes, scheme, sizeof(check_scheme_t));
+ ctx->schemes[ctx->nschemes].context = scheme_context;
+ ctx->nschemes++;
+ r = idn_success;
+
+ret:
+ free(buffer);
+ if (r != idn_success)
+ free(scheme_context);
+ TRACE(("idn_checker_add(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_result_t
+idn_checker_addall(idn_checker_t ctx, const char **scheme_names,
+ int nschemes) {
+ idn_result_t r;
+ int i;
+
+ assert(scheme_hash != NULL);
+ assert(ctx != NULL && scheme_names != NULL);
+
+ TRACE(("idn_checker_addall(nschemes=%d)\n", nschemes));
+
+ for (i = 0; i < nschemes; i++) {
+ r = idn_checker_add(ctx, (const char *)*scheme_names);
+ if (r != idn_success)
+ goto ret;
+ scheme_names++;
+ }
+
+ r = idn_success;
+ret:
+ TRACE(("idn_checker_addall(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_result_t
+idn_checker_lookup(idn_checker_t ctx, const unsigned long *ucs4,
+ const unsigned long **found) {
+ idn_result_t r;
+ int i;
+
+ assert(scheme_hash != NULL);
+ assert(ctx != NULL && ucs4 != NULL && found != NULL);
+
+ TRACE(("idn_checker_lookup(ucs4=\"%s\")\n",
+ idn__debug_ucs4xstring(ucs4, 50)));
+
+ /*
+ * Lookup.
+ */
+ *found = NULL;
+
+ for (i = 0; i < ctx->nschemes; i++) {
+ TRACE(("idn_checker_lookup(): lookup %s\n",
+ ctx->schemes[i].prefix));
+
+ r = (ctx->schemes[i].lookup)(ctx->schemes[i].context, ucs4,
+ found);
+ if (r != idn_success)
+ goto ret;
+ if (*found != NULL)
+ break;
+ }
+
+ r = idn_success;
+ret:
+ if (*found == NULL) {
+ TRACE(("idn_checker_lookup(): %s (not found)\n",
+ idn_result_tostring(r)));
+ } else {
+ TRACE(("idn_checker_lookup(): %s (found \\x%04lx)\n",
+ idn_result_tostring(r), **found));
+ }
+ return (r);
+}
+
+idn_result_t
+idn_checker_register(const char *prefix,
+ idn_checker_createproc_t create,
+ idn_checker_destroyproc_t destroy,
+ idn_checker_lookupproc_t lookup) {
+ idn_result_t r;
+ check_scheme_t *scheme = NULL;
+
+ assert(scheme_hash != NULL);
+ assert(prefix != NULL && create != NULL && destroy != NULL &&
+ lookup != NULL);
+
+ TRACE(("idn_checker_register(prefix=%s)\n", prefix));
+
+ scheme = (check_scheme_t *) malloc(sizeof(check_scheme_t));
+ if (scheme == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+
+ scheme->prefix = (char *) malloc(strlen(prefix) + 1);
+ if (scheme->prefix == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+
+ strcpy(scheme->prefix, prefix);
+ scheme->parameter = NULL;
+ scheme->create = create;
+ scheme->destroy = destroy;
+ scheme->lookup = lookup;
+
+ r = idn__strhash_put(scheme_hash, prefix, scheme);
+ret:
+ if (r != idn_success) {
+ if (scheme != NULL)
+ free(scheme->prefix);
+ free(scheme);
+ }
+ TRACE(("idn_checker_register(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/converter.c b/contrib/idn/idnkit-1.0-src/lib/converter.c
new file mode 100644
index 0000000..faed44f
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/converter.c
@@ -0,0 +1,1244 @@
+#ifndef lint
+static char *rcsid = "$Id: converter.c,v 1.1.1.1 2003/06/04 00:25:51 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#ifndef WITHOUT_ICONV
+#include <iconv.h>
+#endif
+
+#include <idn/result.h>
+#include <idn/assert.h>
+#include <idn/logmacro.h>
+#include <idn/converter.h>
+#include <idn/aliaslist.h>
+#include <idn/strhash.h>
+#include <idn/debug.h>
+#include <idn/ucs4.h>
+#include <idn/punycode.h>
+#include <idn/race.h>
+#include <idn/util.h>
+
+#ifndef IDN_UTF8_ENCODING_NAME
+#define IDN_UTF8_ENCODING_NAME "UTF-8" /* by IANA */
+#endif
+#ifndef IDN_RACE_ENCODING_NAME
+#define IDN_RACE_ENCODING_NAME "RACE"
+#endif
+#ifndef IDN_AMCACEZ_ENCODING_NAME
+#define IDN_AMCACEZ_ENCODING_NAME "AMC-ACE-Z"
+#endif
+#ifndef IDN_PUNYCODE_ENCODING_NAME
+#define IDN_PUNYCODE_ENCODING_NAME "Punycode"
+#endif
+
+#define MAX_RECURSE 20
+
+#ifdef WIN32
+
+#define IDNKEY_IDNKIT "Software\\JPNIC\\IDN"
+#define IDNVAL_ALIASFILE "AliasFile"
+
+#else /* WIN32 */
+
+#ifndef IDN_RESCONF_DIR
+#define IDN_RESCONF_DIR "/etc"
+#endif
+#define IDN_ALIAS_FILE IDN_RESCONF_DIR "/idnalias.conf"
+
+#endif /* WIN32 */
+
+typedef struct {
+ idn_converter_openproc_t openfromucs4;
+ idn_converter_openproc_t opentoucs4;
+ idn_converter_convfromucs4proc_t convfromucs4;
+ idn_converter_convtoucs4proc_t convtoucs4;
+ idn_converter_closeproc_t close;
+ int encoding_type;
+} converter_ops_t;
+
+struct idn_converter {
+ char *local_encoding_name;
+ converter_ops_t *ops;
+ int flags;
+ int opened_convfromucs4;
+ int opened_convtoucs4;
+ int reference_count;
+ void *private_data;
+};
+
+static idn__strhash_t encoding_name_hash;
+static idn__aliaslist_t encoding_alias_list;
+
+static idn_result_t register_standard_encoding(void);
+static idn_result_t roundtrip_check(idn_converter_t ctx,
+ const unsigned long *from,
+ const char *to);
+
+static idn_result_t
+ converter_none_open(idn_converter_t ctx, void **privdata);
+static idn_result_t
+ converter_none_close(idn_converter_t ctx, void *privdata);
+static idn_result_t
+ converter_none_convfromucs4(idn_converter_t ctx,
+ void *privdata,
+ const unsigned long *from,
+ char *to, size_t tolen);
+static idn_result_t
+ converter_none_convtoucs4(idn_converter_t ctx,
+ void *privdata, const char *from,
+ unsigned long *to, size_t tolen);
+
+#ifndef WITHOUT_ICONV
+static idn_result_t
+ converter_iconv_openfromucs4(idn_converter_t ctx, void **privdata);
+static idn_result_t
+ converter_iconv_opentoucs4(idn_converter_t ctx, void **privdata);
+static idn_result_t
+ converter_iconv_close(idn_converter_t ctx, void *privdata);
+static idn_result_t
+ converter_iconv_convfromucs4(idn_converter_t ctx,
+ void *privdata,
+ const unsigned long *from,
+ char *to, size_t tolen);
+static idn_result_t
+ converter_iconv_convtoucs4(idn_converter_t ctx,
+ void *privdata,
+ const char *from,
+ unsigned long *to, size_t tolen);
+
+static idn_result_t
+iconv_initialize_privdata(void **privdata);
+static void
+iconv_finalize_privdata(void *privdata);
+
+static char * get_system_aliasfile(void);
+static int file_exist(const char *filename);
+
+#endif /* !WITHOUT_ICONV */
+
+#ifdef DEBUG
+static idn_result_t
+ converter_uescape_convfromucs4(idn_converter_t ctx,
+ void *privdata,
+ const unsigned long *from,
+ char *to, size_t tolen);
+static idn_result_t
+ converter_uescape_convtoucs4(idn_converter_t ctx,
+ void *privdata,
+ const char *from,
+ unsigned long *to,
+ size_t tolen);
+#endif /* DEBUG */
+
+static converter_ops_t none_converter_ops = {
+ converter_none_open,
+ converter_none_open,
+ converter_none_convfromucs4,
+ converter_none_convtoucs4,
+ converter_none_close,
+ IDN_NONACE,
+};
+
+#ifndef WITHOUT_ICONV
+static converter_ops_t iconv_converter_ops = {
+ converter_iconv_openfromucs4,
+ converter_iconv_opentoucs4,
+ converter_iconv_convfromucs4,
+ converter_iconv_convtoucs4,
+ converter_iconv_close,
+ IDN_NONACE,
+};
+#endif
+
+/*
+ * Initialize.
+ */
+
+idn_result_t
+idn_converter_initialize(void) {
+ idn_result_t r;
+ idn__strhash_t hash;
+ idn__aliaslist_t list;
+#ifndef WITHOUT_ICONV
+ const char *fname;
+#endif
+
+ TRACE(("idn_converter_initialize()\n"));
+
+ if (encoding_name_hash == NULL) {
+ if ((r = idn__strhash_create(&hash)) != idn_success)
+ goto ret;
+ encoding_name_hash = hash;
+ r = register_standard_encoding();
+ }
+ if (encoding_alias_list == NULL) {
+ if ((r = idn__aliaslist_create(&list)) != idn_success)
+ goto ret;
+ encoding_alias_list = list;
+#ifndef WITHOUT_ICONV
+ fname = get_system_aliasfile();
+ if (fname != NULL && file_exist(fname))
+ idn_converter_aliasfile(fname);
+#endif
+ }
+
+ r = idn_success;
+ret:
+ TRACE(("idn_converter_initialize(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+#ifndef WITHOUT_ICONV
+static char *
+get_system_aliasfile() {
+#ifdef WIN32
+ static char alias_path[500]; /* a good longer than MAX_PATH */
+
+ if (idn__util_getregistrystring(idn__util_hkey_localmachine,
+ IDNVAL_ALIASFILE,
+ alias_path, sizeof(alias_path))) {
+ return (alias_path);
+ } else {
+ return (NULL);
+ }
+#else
+ return (IDN_ALIAS_FILE);
+#endif
+}
+
+static int
+file_exist(const char *filename) {
+ FILE *fp;
+
+ if ((fp = fopen(filename, "r")) == NULL)
+ return (0);
+ fclose(fp);
+ return (1);
+}
+#endif
+
+idn_result_t
+idn_converter_create(const char *name, idn_converter_t *ctxp, int flags) {
+ const char *realname;
+ idn_converter_t ctx;
+ idn_result_t r;
+ void *v;
+
+ assert(name != NULL && ctxp != NULL);
+
+ TRACE(("idn_converter_create(%s)\n", name));
+
+ realname = idn_converter_getrealname(name);
+#ifdef DEBUG
+ if (strcmp(name, realname) != 0) {
+ TRACE(("idn_converter_create: realname=%s\n", realname));
+ }
+#endif
+
+ *ctxp = NULL;
+
+ /* Allocate memory for a converter context and the name. */
+ ctx = malloc(sizeof(struct idn_converter) + strlen(realname) + 1);
+ if (ctx == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+
+ ctx->local_encoding_name = (char *)(ctx + 1);
+ (void)strcpy(ctx->local_encoding_name, realname);
+ ctx->flags = flags;
+ ctx->reference_count = 1;
+ ctx->opened_convfromucs4 = 0;
+ ctx->opened_convtoucs4 = 0;
+ ctx->private_data = NULL;
+
+ assert(encoding_name_hash != NULL);
+
+ if (strcmp(realname, IDN_UTF8_ENCODING_NAME) == 0) {
+ /* No conversion needed */
+ ctx->ops = &none_converter_ops;
+ } else if ((r = idn__strhash_get(encoding_name_hash, realname, &v))
+ == idn_success) {
+ /* Special converter found */
+ ctx->ops = (converter_ops_t *)v;
+ } else {
+ /* General case */
+#ifdef WITHOUT_ICONV
+ free(ctx);
+ *ctxp = NULL;
+ r = idn_invalid_name;
+ goto ret;
+#else
+ ctx->ops = &iconv_converter_ops;
+#endif
+ }
+
+ if ((flags & IDN_CONVERTER_DELAYEDOPEN) == 0) {
+ r = (ctx->ops->openfromucs4)(ctx, &(ctx->private_data));
+ if (r != idn_success) {
+ WARNING(("idn_converter_create(): open failed "
+ "(ucs4->local)\n"));
+ free(ctx);
+ *ctxp = NULL;
+ goto ret;
+ }
+ ctx->opened_convfromucs4 = 1;
+
+ r = (*ctx->ops->opentoucs4)(ctx, &(ctx->private_data));
+ if (r != idn_success) {
+ WARNING(("idn_converter_create(): open failed "
+ "(local->ucs4)\n"));
+ free(ctx);
+ *ctxp = NULL;
+ goto ret;
+ }
+ ctx->opened_convtoucs4 = 1;
+ }
+
+ *ctxp = ctx;
+ r = idn_success;
+ret:
+ TRACE(("idn_converter_create(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+void
+idn_converter_destroy(idn_converter_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_converter_destroy(ctx=%s)\n", ctx->local_encoding_name));
+
+ ctx->reference_count--;
+ if (ctx->reference_count <= 0) {
+ TRACE(("idn_converter_destroy(): the object is destroyed\n"));
+ (void)(*ctx->ops->close)(ctx, ctx->private_data);
+ free(ctx);
+ } else {
+ TRACE(("idn_converter_destroy(): "
+ "update reference count (%d->%d)\n",
+ ctx->reference_count + 1, ctx->reference_count));
+ }
+}
+
+void
+idn_converter_incrref(idn_converter_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_converter_incrref(ctx=%s)\n", ctx->local_encoding_name));
+ TRACE(("idn_converter_incrref: update reference count (%d->%d)\n",
+ ctx->reference_count, ctx->reference_count + 1));
+
+ ctx->reference_count++;
+}
+
+char *
+idn_converter_localencoding(idn_converter_t ctx) {
+ assert(ctx != NULL);
+ TRACE(("idn_converter_localencoding(ctx=%s)\n",
+ ctx->local_encoding_name));
+ return (ctx->local_encoding_name);
+}
+
+int
+idn_converter_encodingtype(idn_converter_t ctx) {
+ int encoding_type;
+
+ assert(ctx != NULL);
+ TRACE(("idn_converter_encodingtype(ctx=%s)\n",
+ ctx->local_encoding_name));
+
+ encoding_type = ctx->ops->encoding_type;
+ TRACE(("idn_converter_encodingtype(): %d\n", encoding_type));
+ return (encoding_type);
+}
+
+int
+idn_converter_isasciicompatible(idn_converter_t ctx) {
+ int iscompat;
+
+ assert(ctx != NULL);
+ TRACE(("idn_converter_isasciicompatible(ctx=%s)\n",
+ ctx->local_encoding_name));
+
+ iscompat = (ctx->ops->encoding_type != IDN_NONACE);
+ TRACE(("idn_converter_isasciicompatible(): %d\n", iscompat));
+ return (iscompat);
+}
+
+idn_result_t
+idn_converter_convfromucs4(idn_converter_t ctx, const unsigned long *from,
+ char *to, size_t tolen) {
+ idn_result_t r;
+
+ assert(ctx != NULL && from != NULL && to != NULL);
+
+ TRACE(("idn_converter_convfromucs4(ctx=%s, from=\"%s\", tolen=%d)\n",
+ ctx->local_encoding_name, idn__debug_ucs4xstring(from, 50),
+ (int)tolen));
+
+ if (!ctx->opened_convfromucs4) {
+ r = (*ctx->ops->openfromucs4)(ctx, &(ctx->private_data));
+ if (r != idn_success)
+ goto ret;
+ ctx->opened_convfromucs4 = 1;
+ }
+
+ r = (*ctx->ops->convfromucs4)(ctx, ctx->private_data, from, to, tolen);
+ if (r != idn_success)
+ goto ret;
+ if ((ctx->flags & IDN_CONVERTER_RTCHECK) != 0) {
+ r = roundtrip_check(ctx, from, to);
+ if (r != idn_success)
+ goto ret;
+ }
+
+ r = idn_success;
+ret:
+ if (r == idn_success) {
+ TRACE(("idn_converter_convfromucs4(): success (to=\"%s\")\n",
+ idn__debug_xstring(to, 50)));
+ } else {
+ TRACE(("idn_converter_convfromucs4(): %s\n",
+ idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+idn_result_t
+idn_converter_convtoucs4(idn_converter_t ctx, const char *from,
+ unsigned long *to, size_t tolen) {
+ idn_result_t r;
+
+ assert(ctx != NULL && from != NULL && to != NULL);
+
+ TRACE(("idn_converter_convtoucs4(ctx=%s, from=\"%s\", tolen=%d)\n",
+ ctx->local_encoding_name, idn__debug_xstring(from, 50),
+ (int)tolen));
+
+ if (!ctx->opened_convtoucs4) {
+ r = (*ctx->ops->opentoucs4)(ctx, &(ctx->private_data));
+ if (r != idn_success)
+ goto ret;
+ ctx->opened_convtoucs4 = 1;
+ }
+
+ r = (*ctx->ops->convtoucs4)(ctx, ctx->private_data, from, to, tolen);
+ret:
+ if (r == idn_success) {
+ TRACE(("idn_converter_convtoucs4(): success (to=\"%s\")\n",
+ idn__debug_ucs4xstring(to, 50)));
+ } else {
+ TRACE(("idn_converter_convtoucs4(): %s\n",
+ idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+/*
+ * Encoding registration.
+ */
+
+idn_result_t
+idn_converter_register(const char *name,
+ idn_converter_openproc_t openfromucs4,
+ idn_converter_openproc_t opentoucs4,
+ idn_converter_convfromucs4proc_t convfromucs4,
+ idn_converter_convtoucs4proc_t convtoucs4,
+ idn_converter_closeproc_t close,
+ int encoding_type) {
+ converter_ops_t *ops;
+ idn_result_t r;
+
+ assert(name != NULL && convfromucs4 != NULL && convtoucs4 != NULL);
+
+ TRACE(("idn_converter_register(name=%s)\n", name));
+
+ if ((ops = malloc(sizeof(*ops))) == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+
+ if (openfromucs4 == NULL)
+ openfromucs4 = converter_none_open;
+ if (opentoucs4 == NULL)
+ opentoucs4 = converter_none_open;
+ if (close == NULL)
+ close = converter_none_close;
+
+ ops->openfromucs4 = openfromucs4;
+ ops->opentoucs4 = opentoucs4;
+ ops->convfromucs4 = convfromucs4;
+ ops->convtoucs4 = convtoucs4;
+ ops->close = close;
+ ops->encoding_type = encoding_type;
+
+ r = idn__strhash_put(encoding_name_hash, name, ops);
+ if (r != idn_success) {
+ free(ops);
+ goto ret;
+ }
+
+ r = idn_success;
+ret:
+ TRACE(("idn_converter_register(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+static idn_result_t
+register_standard_encoding(void) {
+ idn_result_t r;
+
+ r = idn_converter_register(IDN_PUNYCODE_ENCODING_NAME,
+ NULL,
+ NULL,
+ idn__punycode_encode,
+ idn__punycode_decode,
+ converter_none_close,
+ IDN_ACE_STRICTCASE);
+ if (r != idn_success)
+ return (r);
+
+#ifdef IDN_EXTRA_ACE
+ r = idn_converter_register(IDN_AMCACEZ_ENCODING_NAME,
+ NULL,
+ NULL,
+ idn__punycode_encode,
+ idn__punycode_decode,
+ converter_none_close,
+ IDN_ACE_STRICTCASE);
+ if (r != idn_success)
+ return (r);
+
+ r = idn_converter_register(IDN_RACE_ENCODING_NAME,
+ NULL,
+ NULL,
+ idn__race_encode,
+ idn__race_decode,
+ converter_none_close,
+ IDN_ACE_LOOSECASE);
+ if (r != idn_success)
+ return (r);
+#endif /* IDN_EXTRA_ACE */
+
+#ifdef DEBUG
+ /* This is convenient for debug. Not useful for other purposes. */
+ r = idn_converter_register("U-escape",
+ NULL,
+ NULL,
+ converter_uescape_convfromucs4,
+ converter_uescape_convtoucs4,
+ NULL,
+ IDN_NONACE);
+ if (r != idn_success)
+ return (r);
+#endif /* DEBUG */
+
+ return (r);
+}
+
+/*
+ * Encoding alias support.
+ */
+idn_result_t
+idn_converter_addalias(const char *alias_name, const char *real_name,
+ int first_item) {
+ idn_result_t r;
+
+ assert(alias_name != NULL && real_name != NULL);
+
+ TRACE(("idn_converter_addalias(alias_name=%s,real_name=%s)\n",
+ alias_name, real_name));
+
+ if (strlen(alias_name) == 0 || strlen(real_name) == 0) {
+ return idn_invalid_syntax;
+ }
+
+ if (strcmp(alias_name, real_name) == 0) {
+ r = idn_success;
+ goto ret;
+ }
+
+ if (encoding_alias_list == NULL) {
+ WARNING(("idn_converter_addalias(): the module is not "
+ "initialized\n"));
+ r = idn_failure;
+ goto ret;
+ }
+
+ r = idn__aliaslist_additem(encoding_alias_list, alias_name, real_name,
+ first_item);
+ret:
+ TRACE(("idn_converter_addalias(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_result_t
+idn_converter_aliasfile(const char *path) {
+ idn_result_t r;
+
+ assert(path != NULL);
+
+ TRACE(("idn_converter_aliasfile(path=%s)\n", path));
+
+ if (encoding_alias_list == NULL) {
+ WARNING(("idn_converter_aliasfile(): the module is not "
+ "initialized\n"));
+ return (idn_failure);
+ }
+
+ r = idn__aliaslist_aliasfile(encoding_alias_list, path);
+
+ TRACE(("idn_converter_aliasfile(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_result_t
+idn_converter_resetalias(void) {
+ idn__aliaslist_t list;
+ idn_result_t r;
+
+ TRACE(("idn_converter_resetalias()\n"));
+
+ if (encoding_alias_list == NULL) {
+ WARNING(("idn_converter_resetalias(): the module is not "
+ "initialized\n"));
+ return (idn_failure);
+ }
+
+ list = encoding_alias_list;
+ encoding_alias_list = NULL;
+ idn__aliaslist_destroy(list);
+ list = NULL;
+ r = idn__aliaslist_create(&list);
+ encoding_alias_list = list;
+
+ TRACE(("idn_converter_resetalias(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+const char *
+idn_converter_getrealname(const char *name) {
+ char *realname;
+ idn_result_t r;
+
+ TRACE(("idn_converter_getrealname()\n"));
+
+ assert(name != NULL);
+
+ if (encoding_alias_list == NULL) {
+ WARNING(("idn_converter_getrealname(): the module is not "
+ "initialized\n"));
+ return (name);
+ }
+
+ r = idn__aliaslist_find(encoding_alias_list, name, &realname);
+ if (r != idn_success) {
+ return (name);
+ }
+ return (realname);
+}
+
+/*
+ * Round trip check.
+ */
+
+static idn_result_t
+roundtrip_check(idn_converter_t ctx, const unsigned long *from, const char *to)
+{
+ /*
+ * One problem with iconv() convertion is that
+ * iconv() doesn't signal an error if the input
+ * string contains characters which are valid but
+ * do not have mapping to the output codeset.
+ * (the behavior of iconv() for that case is defined as
+ * `implementation dependent')
+ * One way to check this case is to perform round-trip
+ * conversion and see if it is same as the original string.
+ */
+ idn_result_t r;
+ unsigned long *back;
+ unsigned long backbuf[256];
+ size_t fromlen;
+ size_t backlen;
+
+ TRACE(("idn_converter_convert: round-trip checking (from=\"%s\")\n",
+ idn__debug_ucs4xstring(from, 50)));
+
+ /* Allocate enough buffer. */
+ fromlen = idn_ucs4_strlen(from) + 1;
+ if (fromlen * sizeof(*back) <= sizeof(backbuf)) {
+ backlen = sizeof(backbuf);
+ back = backbuf;
+ } else {
+ backlen = fromlen;
+ back = (unsigned long *)malloc(backlen * sizeof(*back));
+ if (back == NULL)
+ return (idn_nomemory);
+ }
+
+ /*
+ * Perform backward conversion.
+ */
+ r = idn_converter_convtoucs4(ctx, to, back, backlen);
+ switch (r) {
+ case idn_success:
+ if (memcmp(back, from, sizeof(*from) * fromlen) != 0)
+ r = idn_nomapping;
+ break;
+ case idn_invalid_encoding:
+ case idn_buffer_overflow:
+ r = idn_nomapping;
+ break;
+ default:
+ break;
+ }
+
+ if (back != backbuf)
+ free(back);
+
+ if (r != idn_success) {
+ TRACE(("round-trip check failed: %s\n",
+ idn_result_tostring(r)));
+ }
+
+ return (r);
+}
+
+/*
+ * Identity conversion (or, no conversion at all).
+ */
+
+static idn_result_t
+converter_none_open(idn_converter_t ctx, void **privdata) {
+ assert(ctx != NULL);
+
+ return (idn_success);
+}
+
+static idn_result_t
+converter_none_close(idn_converter_t ctx, void *privdata) {
+ assert(ctx != NULL);
+
+ return (idn_success);
+}
+
+static idn_result_t
+converter_none_convfromucs4(idn_converter_t ctx, void *privdata,
+ const unsigned long *from, char *to, size_t tolen) {
+ assert(ctx != NULL && from != NULL && to != NULL);
+
+ return idn_ucs4_ucs4toutf8(from, to, tolen);
+}
+
+static idn_result_t
+converter_none_convtoucs4(idn_converter_t ctx, void *privdata,
+ const char *from, unsigned long *to, size_t tolen) {
+ assert(ctx != NULL && from != NULL && to != NULL);
+
+ return idn_ucs4_utf8toucs4(from, to, tolen);
+}
+
+#ifndef WITHOUT_ICONV
+
+/*
+ * Conversion using iconv() interface.
+ */
+
+static idn_result_t
+converter_iconv_openfromucs4(idn_converter_t ctx, void **privdata) {
+ iconv_t *ictxp;
+ idn_result_t r;
+
+ assert(ctx != NULL);
+
+ r = iconv_initialize_privdata(privdata);
+ if (r != idn_success)
+ return (r);
+
+ ictxp = (iconv_t *)*privdata;
+ *ictxp = iconv_open(ctx->local_encoding_name, IDN_UTF8_ENCODING_NAME);
+ if (*ictxp == (iconv_t)(-1)) {
+ free(*privdata);
+ *privdata = NULL;
+ switch (errno) {
+ case ENOMEM:
+ return (idn_nomemory);
+ case EINVAL:
+ return (idn_invalid_name);
+ default:
+ WARNING(("iconv_open failed with errno %d\n", errno));
+ return (idn_failure);
+ }
+ }
+
+ return (idn_success);
+}
+
+static idn_result_t
+converter_iconv_opentoucs4(idn_converter_t ctx, void **privdata) {
+ iconv_t *ictxp;
+ idn_result_t r;
+
+ assert(ctx != NULL);
+
+ r = iconv_initialize_privdata(privdata);
+ if (r != idn_success)
+ return (r);
+
+ ictxp = (iconv_t *)*privdata + 1;
+ *ictxp = iconv_open(IDN_UTF8_ENCODING_NAME, ctx->local_encoding_name);
+ if (*ictxp == (iconv_t)(-1)) {
+ free(*privdata);
+ *privdata = NULL;
+ switch (errno) {
+ case ENOMEM:
+ return (idn_nomemory);
+ case EINVAL:
+ return (idn_invalid_name);
+ default:
+ WARNING(("iconv_open failed with errno %d\n", errno));
+ return (idn_failure);
+ }
+ }
+
+ return (idn_success);
+}
+
+static idn_result_t
+iconv_initialize_privdata(void **privdata) {
+ if (*privdata == NULL) {
+ *privdata = malloc(sizeof(iconv_t) * 2);
+ if (*privdata == NULL)
+ return (idn_nomemory);
+ *((iconv_t *)*privdata) = (iconv_t)(-1);
+ *((iconv_t *)*privdata + 1) = (iconv_t)(-1);
+ }
+
+ return (idn_success);
+}
+
+static void
+iconv_finalize_privdata(void *privdata) {
+ iconv_t *ictxp;
+
+ if (privdata != NULL) {
+ ictxp = (iconv_t *)privdata;
+ if (*ictxp != (iconv_t)(-1))
+ iconv_close(*ictxp);
+
+ ictxp++;
+ if (*ictxp != (iconv_t)(-1))
+ iconv_close(*ictxp);
+ free(privdata);
+ }
+}
+
+static idn_result_t
+converter_iconv_close(idn_converter_t ctx, void *privdata) {
+ assert(ctx != NULL);
+
+ iconv_finalize_privdata(privdata);
+
+ return (idn_success);
+}
+
+static idn_result_t
+converter_iconv_convfromucs4(idn_converter_t ctx, void *privdata,
+ const unsigned long *from, char *to,
+ size_t tolen) {
+ iconv_t ictx;
+ char *utf8 = NULL;
+ size_t utf8size = 256; /* large enough */
+ idn_result_t r;
+ size_t sz;
+ size_t inleft;
+ size_t outleft;
+ char *inbuf, *outbuf;
+
+ assert(ctx != NULL && from != NULL && to != NULL);
+
+ if (tolen <= 0) {
+ r = idn_buffer_overflow; /* need space for NUL */
+ goto ret;
+ }
+
+ /*
+ * UCS4 -> UTF-8 conversion.
+ */
+ utf8 = (char *)malloc(utf8size);
+ if (utf8 == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+
+try_again:
+ r = idn_ucs4_ucs4toutf8(from, utf8, utf8size);
+ if (r == idn_buffer_overflow) {
+ char *new_utf8;
+
+ utf8size *= 2;
+ new_utf8 = (char *)realloc(utf8, utf8size);
+ if (new_utf8 == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ utf8 = new_utf8;
+ goto try_again;
+ } else if (r != idn_success) {
+ goto ret;
+ }
+
+ ictx = ((iconv_t *)privdata)[0];
+
+ /*
+ * Reset internal state.
+ *
+ * The following code should work according to the SUSv2 spec,
+ * but causes segmentation fault with Solaris 2.6.
+ * So.. a work-around.
+ *
+ * (void)iconv(ictx, (const char **)NULL, (size_t *)NULL,
+ * (char **)NULL, (size_t *)NULL);
+ */
+ inleft = 0;
+ outbuf = NULL;
+ outleft = 0;
+ (void)iconv(ictx, (const char **)NULL, &inleft, &outbuf, &outleft);
+
+ inleft = strlen(utf8);
+ inbuf = utf8;
+ outleft = tolen - 1; /* reserve space for terminating NUL */
+ sz = iconv(ictx, (const char **)&inbuf, &inleft, &to, &outleft);
+
+ if (sz == (size_t)(-1) || inleft > 0) {
+ switch (errno) {
+ case EILSEQ:
+ case EINVAL:
+ /*
+ * We already checked the validity of the input
+ * string. So we assume a mapping error.
+ */
+ r = idn_nomapping;
+ goto ret;
+ case E2BIG:
+ r = idn_buffer_overflow;
+ goto ret;
+ default:
+ WARNING(("iconv failed with errno %d\n", errno));
+ r = idn_failure;
+ goto ret;
+ }
+ }
+
+ /*
+ * For UTF-8 -> local conversion, append a sequence of
+ * state reset.
+ */
+ inleft = 0;
+ sz = iconv(ictx, (const char **)NULL, &inleft, &to, &outleft);
+ if (sz == (size_t)(-1)) {
+ switch (errno) {
+ case EILSEQ:
+ case EINVAL:
+ r = idn_invalid_encoding;
+ goto ret;
+ case E2BIG:
+ r = idn_buffer_overflow;
+ goto ret;
+ default:
+ WARNING(("iconv failed with errno %d\n", errno));
+ r = idn_failure;
+ goto ret;
+ }
+ }
+ *to = '\0';
+ r = idn_success;
+
+ret:
+ free(utf8);
+ return (r);
+
+}
+
+static idn_result_t
+converter_iconv_convtoucs4(idn_converter_t ctx, void *privdata,
+ const char *from, unsigned long *to, size_t tolen) {
+ iconv_t ictx;
+ char *utf8 = NULL;
+ size_t utf8size = 256; /* large enough */
+ idn_result_t r;
+ size_t sz;
+ size_t inleft;
+ size_t outleft;
+ const char *from_ptr;
+ char *outbuf;
+
+ assert(ctx != NULL && from != NULL && to != NULL);
+
+ if (tolen <= 0) {
+ r = idn_buffer_overflow; /* need space for NUL */
+ goto ret;
+ }
+ ictx = ((iconv_t *)privdata)[1];
+ utf8 = (char *)malloc(utf8size);
+ if (utf8 == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+
+try_again:
+ /*
+ * Reset internal state.
+ */
+ inleft = 0;
+ outbuf = NULL;
+ outleft = 0;
+ (void)iconv(ictx, (const char **)NULL, &inleft, &outbuf, &outleft);
+
+ from_ptr = from;
+ inleft = strlen(from);
+ outbuf = utf8;
+ outleft = utf8size - 1; /* reserve space for terminating NUL */
+ sz = iconv(ictx, (const char **)&from_ptr, &inleft, &outbuf, &outleft);
+
+ if (sz == (size_t)(-1) || inleft > 0) {
+ char *new_utf8;
+
+ switch (errno) {
+ case EILSEQ:
+ case EINVAL:
+ /*
+ * We assume all the characters in the local
+ * codeset are included in UCS. This means mapping
+ * error is not possible, so the input string must
+ * have some problem.
+ */
+ r = idn_invalid_encoding;
+ goto ret;
+ case E2BIG:
+ utf8size *= 2;
+ new_utf8 = (char *)realloc(utf8, utf8size);
+ if (new_utf8 == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ utf8 = new_utf8;
+ goto try_again;
+ default:
+ WARNING(("iconv failed with errno %d\n", errno));
+ r = idn_failure;
+ goto ret;
+ }
+ }
+ *outbuf = '\0';
+
+ /*
+ * UTF-8 -> UCS4 conversion.
+ */
+ r = idn_ucs4_utf8toucs4(utf8, to, tolen);
+
+ret:
+ free(utf8);
+ return (r);
+}
+
+#endif /* !WITHOUT_ICONV */
+
+#ifdef DEBUG
+/*
+ * Conversion to/from unicode escape string.
+ * Arbitrary UCS-4 character can be specified by a special sequence
+ * \u{XXXXXX}
+ * where XXXXX denotes any hexadecimal string up to FFFFFFFF.
+ * This is designed for debugging.
+ */
+
+static idn_result_t
+converter_uescape_convfromucs4(idn_converter_t ctx, void *privdata,
+ const unsigned long *from, char *to,
+ size_t tolen) {
+ idn_result_t r;
+ unsigned long v;
+
+ while (*from != '\0') {
+ v = *from++;
+
+ if (v <= 0x7f) {
+ if (tolen < 1) {
+ r = idn_buffer_overflow;
+ goto failure;
+ }
+ *to++ = v;
+ tolen--;
+ } else if (v <= 0xffffffff) {
+ char tmp[20];
+ int len;
+
+ (void)sprintf(tmp, "\\u{%lx}", v);
+ len = strlen(tmp);
+ if (tolen < len) {
+ r = idn_buffer_overflow;
+ goto failure;
+ }
+ (void)memcpy(to, tmp, len);
+ to += len;
+ tolen -= len;
+ } else {
+ r = idn_invalid_encoding;
+ goto failure;
+ }
+ }
+
+ if (tolen <= 0) {
+ r = idn_buffer_overflow;
+ goto failure;
+ }
+ *to = '\0';
+
+ return (idn_success);
+
+failure:
+ if (r != idn_buffer_overflow) {
+ WARNING(("idn_uescape_convfromucs4(): %s\n",
+ idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+static idn_result_t
+converter_uescape_convtoucs4(idn_converter_t ctx, void *privdata,
+ const char *from, unsigned long *to, size_t tolen)
+{
+ idn_result_t r;
+ size_t fromlen = strlen(from);
+
+ while (*from != '\0') {
+ if (tolen <= 0) {
+ r = idn_buffer_overflow;
+ goto failure;
+ }
+ if (strncmp(from, "\\u{", 3) == 0 ||
+ strncmp(from, "\\U{", 3) == 0) {
+ size_t ullen;
+ unsigned long v;
+ char *end;
+
+ v = strtoul(from + 3, &end, 16);
+ ullen = end - (from + 3);
+ if (*end == '}' && ullen > 1 && ullen < 8) {
+ *to = v;
+ from = end + 1;
+ fromlen -= ullen;
+ } else {
+ *to = '\\';
+ from++;
+ fromlen--;
+ }
+ } else {
+ int c = *(unsigned char *)from;
+ size_t width;
+ char buf[8];
+
+ if (c < 0x80)
+ width = 1;
+ else if (c < 0xc0)
+ width = 0;
+ else if (c < 0xe0)
+ width = 2;
+ else if (c < 0xf0)
+ width = 3;
+ else if (c < 0xf8)
+ width = 4;
+ else if (c < 0xfc)
+ width = 5;
+ else if (c < 0xfe)
+ width = 6;
+ else
+ width = 0;
+ if (width == 0 || width > fromlen) {
+ r = idn_invalid_encoding;
+ goto failure;
+ }
+
+ memcpy(buf, from, width);
+ buf[width] = '\0';
+ r = idn_ucs4_utf8toucs4(buf, to, tolen);
+ if (r != idn_success) {
+ r = idn_invalid_encoding;
+ goto failure;
+ }
+ from += width;
+ fromlen -= width;
+ }
+ to++;
+ tolen--;
+ }
+
+ if (tolen <= 0) {
+ r = idn_buffer_overflow;
+ goto failure;
+ }
+ *to = '\0';
+
+ return (idn_success);
+
+failure:
+ if (r != idn_buffer_overflow) {
+ WARNING(("idn_uescape_convtoucs4(): %s\n",
+ idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+#endif
diff --git a/contrib/idn/idnkit-1.0-src/lib/debug.c b/contrib/idn/idnkit-1.0-src/lib/debug.c
new file mode 100644
index 0000000..07eba0a
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/debug.c
@@ -0,0 +1,267 @@
+#ifndef lint
+static char *rcsid = "$Id: debug.c,v 1.1.1.1 2003/06/04 00:25:51 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <idn/debug.h>
+
+static char *hex = "0123456789abcdef";
+
+#define STRING_MAXBYTES 200
+#define STRING_NBUFS 4
+static char bufs[STRING_NBUFS][STRING_MAXBYTES + 16]; /* +16 for margin */
+static int bufno = 0;
+
+char *
+idn__debug_hexstring(const char *s, int maxbytes) {
+ char *buf = bufs[bufno];
+ char *p;
+ int i;
+
+ if (maxbytes > STRING_MAXBYTES)
+ maxbytes = STRING_MAXBYTES;
+
+ for (i = 0, p = buf; i < maxbytes; i += 3, s++) {
+ int c = *(unsigned char *)s;
+
+ if (c == '\0')
+ break;
+ *p++ = hex[c >> 4];
+ *p++ = hex[c & 15];
+ *p++ = ' ';
+ }
+
+ if (i >= maxbytes)
+ strcpy(p, "...");
+ else
+ *p = '\0';
+
+ bufno = (bufno + 1) % STRING_NBUFS;
+ return (buf);
+}
+
+char *
+idn__debug_xstring(const char *s, int maxbytes) {
+ char *buf = bufs[bufno];
+ char *p;
+ int i;
+
+ if (maxbytes > STRING_MAXBYTES)
+ maxbytes = STRING_MAXBYTES;
+
+ i = 0;
+ p = buf;
+ while (i < maxbytes) {
+ int c = *(unsigned char *)s;
+
+ if (c == '\0') {
+ break;
+ } else if (0x20 <= c && c <= 0x7e) {
+ *p++ = c;
+ i++;
+ } else {
+ *p++ = '\\';
+ *p++ = 'x';
+ *p++ = hex[c >> 4];
+ *p++ = hex[c & 15];
+ i += 4;
+ }
+ s++;
+ }
+
+ if (i >= maxbytes)
+ strcpy(p, "...");
+ else
+ *p = '\0';
+
+ bufno = (bufno + 1) % STRING_NBUFS;
+ return (buf);
+}
+
+char *
+idn__debug_ucs4xstring(const unsigned long *s, int maxbytes) {
+ char *buf = bufs[bufno];
+ char *p;
+ int i;
+
+ if (maxbytes > STRING_MAXBYTES)
+ maxbytes = STRING_MAXBYTES;
+
+ i = 0;
+ p = buf;
+ while (i < maxbytes) {
+ if (*s == '\0') {
+ break;
+ } else if (0x20 <= *s && *s <= 0x7e) {
+ *p++ = *s;
+ i++;
+ } else {
+ *p++ = '\\';
+ *p++ = 'x';
+ i += 2;
+ if (*s >= 0x1000000UL) {
+ *p++ = hex[(*s >> 28) & 0x0f];
+ *p++ = hex[(*s >> 24) & 0x0f];
+ i += 2;
+ }
+ if (*s >= 0x10000UL) {
+ *p++ = hex[(*s >> 20) & 0x0f];
+ *p++ = hex[(*s >> 16) & 0x0f];
+ i += 2;
+ }
+ if (*s >= 0x100UL) {
+ *p++ = hex[(*s >> 12) & 0x0f];
+ *p++ = hex[(*s >> 8) & 0x0f];
+ i += 2;
+ }
+ *p++ = hex[(*s >> 4) & 0x0f];
+ *p++ = hex[ *s & 0x0f];
+ i += 2;
+ }
+ s++;
+ }
+
+ if (i >= maxbytes)
+ strcpy(p, "...");
+ else
+ *p = '\0';
+
+ bufno = (bufno + 1) % STRING_NBUFS;
+ return (buf);
+}
+
+char *
+idn__debug_utf16xstring(const unsigned short *s, int maxbytes) {
+ char *buf = bufs[bufno];
+ char *p;
+ int i;
+
+ if (maxbytes > STRING_MAXBYTES)
+ maxbytes = STRING_MAXBYTES;
+
+ i = 0;
+ p = buf;
+ while (i < maxbytes) {
+ if (*s == '\0') {
+ break;
+ } else if (0x20 <= *s && *s <= 0x7e) {
+ *p++ = *s;
+ i++;
+ } else {
+ *p++ = '\\';
+ *p++ = 'x';
+ *p++ = hex[(*s >> 12) & 0x0f];
+ *p++ = hex[(*s >> 8) & 0x0f];
+ *p++ = hex[(*s >> 4) & 0x0f];
+ *p++ = hex[ *s & 0x0f];
+ i += 6;
+ }
+ s++;
+ }
+
+ if (i >= maxbytes)
+ strcpy(p, "...");
+ else
+ *p = '\0';
+
+ bufno = (bufno + 1) % STRING_NBUFS;
+ return (buf);
+}
+
+char *
+idn__debug_hexdata(const char *s, int length, int maxbytes) {
+ char *buf = bufs[bufno];
+ char *p;
+ int i;
+
+ if (maxbytes > STRING_MAXBYTES)
+ maxbytes = STRING_MAXBYTES;
+
+ i = 0;
+ p = buf;
+ while (length > 0 && i < maxbytes) {
+ int c = *(const unsigned char *)s;
+
+ *p++ = hex[c >> 4];
+ *p++ = hex[c & 15];
+ *p++ = ' ';
+ i += 3;
+ length--;
+ s++;
+ }
+
+ if (i >= maxbytes)
+ strcpy(p, "...");
+ else
+ *p = '\0';
+
+ bufno = (bufno + 1) % STRING_NBUFS;
+ return (buf);
+}
+
+void
+idn__debug_hexdump(const char *s, int length) {
+ int i;
+ const unsigned char *p = (const unsigned char *)s;
+
+ i = 0;
+ while (length-- > 0) {
+ if (i % 16 == 0) {
+ if (i > 0)
+ fprintf(stderr, "\n");
+ fprintf(stderr, "%4x:", i);
+ }
+ fprintf(stderr, " %02x", p[i]);
+ i++;
+ }
+ fprintf(stderr, "\n");
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/delimitermap.c b/contrib/idn/idnkit-1.0-src/lib/delimitermap.c
new file mode 100644
index 0000000..6f470a8
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/delimitermap.c
@@ -0,0 +1,268 @@
+#ifndef lint
+static char *rcsid = "$Id: delimitermap.c,v 1.1.1.1 2003/06/04 00:25:52 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <idn/result.h>
+#include <idn/assert.h>
+#include <idn/logmacro.h>
+#include <idn/delimitermap.h>
+#include <idn/util.h>
+#include <idn/debug.h>
+#include <idn/ucs4.h>
+
+/*
+ * Mapper object type.
+ */
+struct idn_delimitermap {
+ int ndelimiters;
+ int delimiter_size;
+ unsigned long *delimiters;
+ int reference_count;
+};
+
+#define DELIMITERMAP_INITIAL_DELIMITER_SIZE 4
+#define UNICODE_MAX 0x10ffff
+#define IS_SURROGATE_HIGH(v) (0xd800 <= (v) && (v) <= 0xdbff)
+#define IS_SURROGATE_LOW(v) (0xdc00 <= (v) && (v) <= 0xdfff)
+
+idn_result_t
+idn_delimitermap_create(idn_delimitermap_t *ctxp) {
+ idn_delimitermap_t ctx = NULL;
+ idn_result_t r;
+
+ assert(ctxp != NULL);
+ TRACE(("idn_delimitermap_create()\n"));
+
+ ctx = (idn_delimitermap_t) malloc(sizeof(struct idn_delimitermap));
+ if (ctx == NULL) {
+ WARNING(("idn_mapper_create: malloc failed\n"));
+ r = idn_nomemory;
+ goto ret;
+ }
+
+ ctx->delimiters = (unsigned long *) malloc(sizeof(unsigned long)
+ * DELIMITERMAP_INITIAL_DELIMITER_SIZE);
+ if (ctx->delimiters == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ ctx->ndelimiters = 0;
+ ctx->delimiter_size = DELIMITERMAP_INITIAL_DELIMITER_SIZE;
+ ctx->reference_count = 1;
+ *ctxp = ctx;
+ r = idn_success;
+
+ret:
+ if (r != idn_success)
+ free(ctx);
+ TRACE(("idn_delimitermap_create(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+void
+idn_delimitermap_destroy(idn_delimitermap_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_delimitermap_destroy()\n"));
+
+ ctx->reference_count--;
+ if (ctx->reference_count <= 0) {
+ TRACE(("idn_mapper_destroy(): the object is destroyed\n"));
+ free(ctx->delimiters);
+ free(ctx);
+ } else {
+ TRACE(("idn_delimitermap_destroy(): "
+ "update reference count (%d->%d)\n",
+ ctx->reference_count + 1, ctx->reference_count));
+ }
+}
+
+void
+idn_delimitermap_incrref(idn_delimitermap_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_delimitermap_incrref()\n"));
+ TRACE(("idn_delimitermap_incrref: update reference count (%d->%d)\n",
+ ctx->reference_count, ctx->reference_count + 1));
+
+ ctx->reference_count++;
+}
+
+idn_result_t
+idn_delimitermap_add(idn_delimitermap_t ctx, unsigned long delimiter) {
+ idn_result_t r;
+
+ assert(ctx != NULL && ctx->ndelimiters <= ctx->delimiter_size);
+ TRACE(("idn_delimitermap_add(delimiter=\\x%04lx)\n", delimiter));
+
+ if (delimiter == 0 || delimiter > UNICODE_MAX ||
+ IS_SURROGATE_HIGH(delimiter) || IS_SURROGATE_LOW(delimiter)) {
+ r = idn_invalid_codepoint;
+ goto ret;
+ }
+
+ if (ctx->ndelimiters == ctx->delimiter_size) {
+ unsigned long *new_delimiters;
+
+ new_delimiters = (unsigned long *) realloc(ctx->delimiters,
+ sizeof(unsigned long) * ctx->delimiter_size * 2);
+ if (new_delimiters == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ ctx->delimiters = new_delimiters;
+ ctx->delimiter_size *= 2;
+ }
+
+ ctx->delimiters[ctx->ndelimiters] = delimiter;
+ ctx->ndelimiters++;
+ r = idn_success;
+
+ret:
+ TRACE(("idn_delimitermap_add(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_result_t
+idn_delimitermap_addall(idn_delimitermap_t ctx, unsigned long *delimiters,
+ int ndelimiters) {
+ idn_result_t r;
+ int i;
+
+ assert(ctx != NULL && delimiters != NULL);
+
+ TRACE(("idn_delimitermap_addall(ndelimiters=%d)\n", ndelimiters));
+
+ for (i = 0; i < ndelimiters; i++) {
+ r = idn_delimitermap_add(ctx, *delimiters);
+ if (r != idn_success)
+ goto ret;
+ delimiters++;
+ }
+
+ r = idn_success;
+ret:
+ TRACE(("idn_delimitermap_addall(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_result_t
+idn_delimitermap_map(idn_delimitermap_t ctx, const unsigned long *from,
+ unsigned long *to, size_t tolen) {
+
+ /* default delimiters (label separators) from IDNA specification */
+ static const unsigned long default_delimiters[] =
+ { 0x002e, /* full stop */
+ 0x3002, /* ideographic full stop */
+ 0xff0e, /* fullwidth full stop */
+ 0xff61, /* halfwidth ideographic full stop */
+ 0x0000 };
+
+ unsigned long *to_org = to;
+ idn_result_t r;
+ int i, j;
+ int found;
+
+ assert(ctx != NULL && from != NULL && to != NULL);
+
+ TRACE(("idn_delimitermap_map(from=\"%s\", tolen=%d)\n",
+ idn__debug_ucs4xstring(from, 50), (int)tolen));
+
+ /*
+ * Map.
+ */
+ while (*from != '\0') {
+ found = 0;
+ if (tolen < 1) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ for (j = 0; default_delimiters[j] != 0x0000; j++) {
+ if (default_delimiters[j] == *from) {
+ found = 1;
+ break;
+ }
+ }
+ if (!found) {
+ for (i = 0; i < ctx->ndelimiters; i++) {
+ if (ctx->delimiters[i] == *from) {
+ found = 1;
+ break;
+ }
+ }
+ }
+ if (found)
+ *to = '.';
+ else
+ *to = *from;
+ from++;
+ to++;
+ tolen--;
+ }
+
+ if (tolen < 1) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ *to = '\0';
+ r = idn_success;
+
+ret:
+ if (r == idn_success) {
+ TRACE(("idn_delimitermap_map(): success (to=\"%s\")\n",
+ idn__debug_ucs4xstring(to_org, 50)));
+ } else {
+ TRACE(("idn_delimitermap_map(): %s\n",
+ idn_result_tostring(r)));
+ }
+ return (r);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/filechecker.c b/contrib/idn/idnkit-1.0-src/lib/filechecker.c
new file mode 100644
index 0000000..64330bb
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/filechecker.c
@@ -0,0 +1,261 @@
+#ifndef lint
+static char *rcsid = "$Id: filechecker.c,v 1.1.1.1 2003/06/04 00:25:52 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <idn/result.h>
+#include <idn/assert.h>
+#include <idn/log.h>
+#include <idn/logmacro.h>
+#include <idn/ucsset.h>
+#include <idn/filechecker.h>
+#include <idn/debug.h>
+
+#define SUPPORT_VERSIONING
+
+struct idn__filechecker {
+ idn_ucsset_t set;
+};
+
+static idn_result_t read_file(const char *file, FILE *fp,
+ idn_ucsset_t set);
+static int get_range(char *s, unsigned long *ucs1,
+ unsigned long *ucs2);
+static char *get_ucs(char *p, unsigned long *vp);
+
+
+idn_result_t
+idn__filechecker_create(const char *file, idn__filechecker_t *ctxp) {
+ FILE *fp;
+ idn__filechecker_t ctx;
+ idn_result_t r;
+
+ assert(file != NULL && ctxp != NULL);
+
+ TRACE(("idn__filechecker_create(file=\"%-.100s\")\n", file));
+
+ if ((fp = fopen(file, "r")) == NULL) {
+ WARNING(("idn__filechecker_create: cannot open %-.100s\n",
+ file));
+ return (idn_nofile);
+ }
+
+ if ((ctx = malloc(sizeof(struct idn__filechecker))) == NULL)
+ return (idn_nomemory);
+
+ if ((r = idn_ucsset_create(&ctx->set)) != idn_success) {
+ free(ctx);
+ return (r);
+ }
+
+ r = read_file(file, fp, ctx->set);
+ fclose(fp);
+
+ if (r == idn_success) {
+ idn_ucsset_fix(ctx->set);
+ *ctxp = ctx;
+ } else {
+ idn_ucsset_destroy(ctx->set);
+ free(ctx);
+ }
+ return (r);
+}
+
+void
+idn__filechecker_destroy(idn__filechecker_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn__filechecker_destroy()\n"));
+
+ idn_ucsset_destroy(ctx->set);
+ free(ctx);
+}
+
+idn_result_t
+idn__filechecker_lookup(idn__filechecker_t ctx, const unsigned long *str,
+ const unsigned long **found) {
+ idn_result_t r = idn_success;
+
+ assert(ctx != NULL && str != NULL);
+
+ TRACE(("idn__filechecker_lookup(str=\"%s\")\n",
+ idn__debug_ucs4xstring(str, 50)));
+
+ while (*str != '\0') {
+ int exists;
+
+ r = idn_ucsset_lookup(ctx->set, *str, &exists);
+
+ if (r != idn_success) {
+ return (r);
+ } else if (exists) {
+ /* Found. */
+ *found = str;
+ return (idn_success);
+ }
+ str++;
+ }
+ *found = NULL;
+ return (idn_success);
+}
+
+static idn_result_t
+read_file(const char *file, FILE *fp, idn_ucsset_t set) {
+ char line[256];
+ idn_result_t r;
+ int lineno = 0;
+
+ while (fgets(line, sizeof(line), fp) != NULL) {
+ char *p = line;
+ unsigned long ucs1, ucs2;
+
+ lineno++;
+ while (isspace((unsigned char)*p))
+ p++;
+ if (*p == '\0' || *p == '#')
+ continue;
+
+#ifdef SUPPORT_VERSIONING
+ /* Skip version tag. */
+ if (lineno == 1 && strncmp("version=", line, 8) == 0)
+ continue;
+#endif
+ if (!get_range(p, &ucs1, &ucs2)) {
+ WARNING(("syntax error in file \"%-.100s\" line %d: "
+ "%-.100s", file, lineno, line));
+ return (idn_invalid_syntax);
+ }
+ if ((r = idn_ucsset_addrange(set, ucs1, ucs2)) != idn_success)
+ return (r);
+ }
+ return (idn_success);
+}
+
+static int
+get_range(char *s, unsigned long *ucs1, unsigned long *ucs2) {
+ if ((s = get_ucs(s, ucs1)) == NULL)
+ return (0);
+ *ucs2 = *ucs1;
+
+ switch (s[0]) {
+ case '\0':
+ case '\n':
+ case '#':
+ case ';':
+ return (1);
+ case '-':
+ break;
+ default:
+ return (0);
+ }
+
+ if ((s = get_ucs(s + 1, ucs2)) == NULL)
+ return (0);
+
+ if (*ucs1 > *ucs2) {
+ INFO(("idn__filechecker_create: invalid range spec "
+ "U+%X-U+%X\n", *ucs1, *ucs2));
+ return (0);
+ }
+
+ switch (s[0]) {
+ case '\0':
+ case '\n':
+ case '#':
+ case ';':
+ return (1);
+ default:
+ return (0);
+ }
+}
+
+
+static char *
+get_ucs(char *p, unsigned long *vp) {
+ char *end;
+
+ /* Skip leading space */
+ while (isspace((unsigned char)*p))
+ p++;
+
+ /* Skip optional 'U+' */
+ if (strncmp(p, "U+", 2) == 0)
+ p += 2;
+
+ *vp = strtoul(p, &end, 16);
+ if (end == p) {
+ INFO(("idn__filechecker_create: UCS code point expected\n"));
+ return (NULL);
+ }
+ p = end;
+
+ /* Skip trailing space */
+ while (isspace((unsigned char)*p))
+ p++;
+ return p;
+}
+
+idn_result_t
+idn__filechecker_createproc(const char *parameter, void **ctxp) {
+ return idn__filechecker_create(parameter, (idn__filechecker_t *)ctxp);
+}
+
+void
+idn__filechecker_destroyproc(void *ctxp) {
+ idn__filechecker_destroy((idn__filechecker_t)ctxp);
+}
+
+idn_result_t
+idn__filechecker_lookupproc(void *ctx, const unsigned long *str,
+ const unsigned long **found) {
+ return idn__filechecker_lookup((idn__filechecker_t)ctx, str, found);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/filemapper.c b/contrib/idn/idnkit-1.0-src/lib/filemapper.c
new file mode 100644
index 0000000..970b942
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/filemapper.c
@@ -0,0 +1,347 @@
+#ifndef lint
+static char *rcsid = "$Id: filemapper.c,v 1.1.1.1 2003/06/04 00:25:53 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <idn/result.h>
+#include <idn/assert.h>
+#include <idn/log.h>
+#include <idn/logmacro.h>
+#include <idn/debug.h>
+#include <idn/ucs4.h>
+#include <idn/ucsmap.h>
+#include <idn/filemapper.h>
+
+#define SUPPORT_VERSIONING
+
+#define UCSBUF_LOCAL_SIZE 20
+
+typedef struct ucsbuf {
+ unsigned long *ucs;
+ size_t size;
+ size_t len;
+ unsigned long local[UCSBUF_LOCAL_SIZE];
+} ucsbuf_t;
+
+struct idn__filemapper {
+ idn_ucsmap_t map;
+};
+
+static void ucsbuf_init(ucsbuf_t *b);
+static idn_result_t ucsbuf_grow(ucsbuf_t *b);
+static idn_result_t ucsbuf_append(ucsbuf_t *b, unsigned long v);
+static void ucsbuf_free(ucsbuf_t *b);
+static idn_result_t read_file(const char *file, FILE *fp,
+ idn_ucsmap_t map);
+static idn_result_t get_map(char *p, ucsbuf_t *b);
+static char *get_ucs(char *p, unsigned long *vp);
+
+
+idn_result_t
+idn__filemapper_create(const char *file, idn__filemapper_t *ctxp) {
+ FILE *fp;
+ idn__filemapper_t ctx;
+ idn_result_t r;
+
+ assert(file != NULL && ctxp != NULL);
+
+ TRACE(("idn__filemapper_create(file=\"%-.100s\")\n", file));
+
+ if ((fp = fopen(file, "r")) == NULL) {
+ WARNING(("idn__filemapper_create: cannot open %-.100s\n",
+ file));
+ return (idn_nofile);
+ }
+ if ((ctx = malloc(sizeof(struct idn__filemapper))) == NULL)
+ return (idn_nomemory);
+
+ if ((r = idn_ucsmap_create(&ctx->map)) != idn_success) {
+ free(ctx);
+ return (r);
+ }
+
+ r = read_file(file, fp, ctx->map);
+ fclose(fp);
+
+ if (r == idn_success) {
+ idn_ucsmap_fix(ctx->map);
+ *ctxp = ctx;
+ } else {
+ idn_ucsmap_destroy(ctx->map);
+ free(ctx);
+ }
+ return (r);
+}
+
+void
+idn__filemapper_destroy(idn__filemapper_t ctx) {
+
+ assert(ctx != NULL);
+
+ TRACE(("idn__filemapper_destroy()\n"));
+
+ idn_ucsmap_destroy(ctx->map);
+ free(ctx);
+}
+
+idn_result_t
+idn__filemapper_map(idn__filemapper_t ctx, const unsigned long *from,
+ unsigned long *to, size_t tolen)
+{
+ idn_result_t r = idn_success;
+ ucsbuf_t ub;
+
+ assert(ctx != NULL && from != NULL && to != NULL);
+
+ TRACE(("idn__filemapper_map(from=\"%s\")\n",
+ idn__debug_ucs4xstring(from, 50)));
+
+ /* Initialize temporary buffer. */
+ ucsbuf_init(&ub);
+
+ while (*from != '\0') {
+ /* Try mapping. */
+ r = idn_ucsmap_map(ctx->map, *from, ub.ucs, ub.size, &ub.len);
+ switch (r) {
+ case idn_buffer_overflow:
+ /* Temporary buffer too small. Enlarge and retry. */
+ if ((r = ucsbuf_grow(&ub)) != idn_success)
+ break;
+ continue;
+ case idn_nomapping:
+ /* There is no mapping. */
+ r = idn_success;
+ /* fallthrough */
+ case idn_success:
+ if (tolen < ub.len) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ memcpy(to, ub.ucs, sizeof(*to) * ub.len);
+ to += ub.len;
+ tolen -= ub.len;
+ break;
+ default:
+ goto ret;
+ }
+ from++;
+ }
+
+ ret:
+ ucsbuf_free(&ub);
+
+ if (r == idn_success) {
+ /* Terminate with NUL. */
+ if (tolen == 0)
+ return (idn_buffer_overflow);
+ *to = '\0';
+ }
+
+ return (r);
+}
+
+static void
+ucsbuf_init(ucsbuf_t *b) {
+ b->ucs = b->local;
+ b->size = UCSBUF_LOCAL_SIZE;
+ b->len = 0;
+}
+
+static idn_result_t
+ucsbuf_grow(ucsbuf_t *b) {
+ unsigned long *newbuf;
+
+ b->size *= 2;
+ if (b->ucs == b->local) {
+ b->ucs = malloc(sizeof(unsigned long) * b->size);
+ if (b->ucs == NULL)
+ return (idn_nomemory);
+ memcpy(b->ucs, b->local, sizeof(b->local));
+ } else {
+ newbuf = realloc(b->ucs, sizeof(unsigned long) * b->size);
+ if (newbuf == NULL)
+ return (idn_nomemory);
+ b->ucs = newbuf;
+ }
+ return (idn_success);
+}
+
+static idn_result_t
+ucsbuf_append(ucsbuf_t *b, unsigned long v) {
+ idn_result_t r;
+
+ if (b->len + 1 > b->size) {
+ r = ucsbuf_grow(b);
+ if (r != idn_success)
+ return (r);
+ }
+ b->ucs[b->len++] = v;
+ return (idn_success);
+}
+
+static void
+ucsbuf_free(ucsbuf_t *b) {
+ if (b->ucs != b->local && b->ucs != NULL)
+ free(b->ucs);
+}
+
+static idn_result_t
+read_file(const char *file, FILE *fp, idn_ucsmap_t map) {
+ char line[1024];
+ ucsbuf_t ub;
+ idn_result_t r = idn_success;
+ int lineno = 0;
+
+ ucsbuf_init(&ub);
+
+ while (fgets(line, sizeof(line), fp) != NULL) {
+ char *p = line;
+
+ lineno++;
+ while (isspace((unsigned char)*p))
+ p++;
+ if (*p == '\0' || *p == '#')
+ continue;
+#ifdef SUPPORT_VERSIONING
+ /* Skip version tag. */
+ if (lineno == 1 && strncmp("version=", line, 8) == 0)
+ continue;
+#endif
+ again:
+ ub.len = 0;
+ r = get_map(p, &ub);
+ switch (r) {
+ case idn_success:
+ r = idn_ucsmap_add(map, ub.ucs[0],
+ &ub.ucs[1], ub.len - 1);
+ break;
+ case idn_buffer_overflow:
+ if ((r = ucsbuf_grow(&ub)) != idn_success)
+ break;
+ goto again;
+ case idn_invalid_syntax:
+ WARNING(("syntax error in file \"%-.100s\" line %d: "
+ "%-.100s", file, lineno, line));
+ /* fall through */
+ default:
+ ucsbuf_free(&ub);
+ return (r);
+ }
+ }
+ ucsbuf_free(&ub);
+ return (r);
+}
+
+static idn_result_t
+get_map(char *p, ucsbuf_t *b) {
+ unsigned long v;
+ idn_result_t r = idn_success;
+
+ for (;;) {
+ if ((p = get_ucs(p, &v)) == NULL)
+ return (idn_invalid_syntax);
+ if ((r = ucsbuf_append(b, v)) != idn_success)
+ return (r);
+ if (b->len == 1) {
+ if (*p != ';')
+ return (idn_invalid_syntax);
+ p++;
+ while (isspace((unsigned char)*p))
+ p++;
+ }
+
+ if (*p == ';' || *p == '#' || *p == '\0')
+ return (r);
+ }
+ return (r);
+}
+
+static char *
+get_ucs(char *p, unsigned long *vp) {
+ char *end;
+
+ /* Skip leading space */
+ while (isspace((unsigned char)*p))
+ p++;
+
+ /* Skip optional 'U+' */
+ if (strncmp(p, "U+", 2) == 0)
+ p += 2;
+
+ *vp = strtoul(p, &end, 16);
+ if (end == p) {
+ INFO(("idn__filemapper_create: UCS code point expected\n"));
+ return (NULL);
+ }
+ p = end;
+
+ /* Skip trailing space */
+ while (isspace((unsigned char)*p))
+ p++;
+ return p;
+}
+
+idn_result_t
+idn__filemapper_createproc(const char *parameter, void **ctxp) {
+ return idn__filemapper_create(parameter, (idn__filemapper_t *)ctxp);
+}
+
+void
+idn__filemapper_destroyproc(void *ctxp) {
+ idn__filemapper_destroy((idn__filemapper_t)ctxp);
+}
+
+idn_result_t
+idn__filemapper_mapproc(void *ctx, const unsigned long *from,
+ unsigned long *to, size_t tolen) {
+ return idn__filemapper_map((idn__filemapper_t)ctx, from, to, tolen);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/idn.conf.sample.in b/contrib/idn/idnkit-1.0-src/lib/idn.conf.sample.in
new file mode 100644
index 0000000..ac771a8
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/idn.conf.sample.in
@@ -0,0 +1,61 @@
+# $Id: idn.conf.sample.in,v 1.1.1.1 2003/06/04 00:26:45 marka Exp $
+#
+# Sample file for idnkit configuration file (idn.conf).
+#
+
+#
+# `idn-encoding' entry specifies the encoding name used as the encoding
+# of multilingualized names by resolvers and DNS servers. Currently, the
+# following encodings are available:
+#
+# Punycode
+# UTF-8
+# <codeset names your iconv_open() accepts>
+#
+# If you enabled extra ace feature, following IDN encoding can be used.
+#
+# AMC-ACE-Z (old name of Punycode)
+# RACE
+#
+# syntax)
+# idn-encoding <encoding>
+#
+idn-encoding Punycode
+
+#
+# `nameprep' entry specifies the version of NAMEPREP.
+# idnkit currently supports the following version:
+#
+# RFC3491 -- name preparation scheme described in the
+# RFC3491
+#
+# syntax)
+# nameprep <nameprep version>
+#
+nameprep RFC3491
+
+#
+# `local-map' entry specifies TLD (top level domain) based local mapping
+# schemes, which is performed before NAMEPREP. Available schemes are:
+#
+# <nameprep version> -- nameprep version
+# filemap:<pathname> -- read mapping rules from a file
+#
+# syntax)
+# local-map <tld> <scheme> ...
+#
+# If the TLD of the domain name matches <tld>, local mapping specified
+# by <scheme> is performed on the name. Otherwise no mapping are
+# performed. Multiple schemes can be specified; they are applied in
+# turn.
+#
+# There are two special <tld>s for specifying a default mapping rule
+# and a mapping rule for local names (domain names containing no
+# dots). If <tld> is `.', its schemes are applied to domain names
+# whose TLD does not match any TLDs specified in local-map entries.
+# If <tld> is `-', its schemes are applied to domain names which
+# contain no dots.
+#
+#local-map - filemap:/some/where/local.map
+#local-map . filemap:/some/where/default.map
+local-map .jp filemap:@mapdir@/jp.map
diff --git a/contrib/idn/idnkit-1.0-src/lib/localencoding.c b/contrib/idn/idnkit-1.0-src/lib/localencoding.c
new file mode 100644
index 0000000..ae937ea
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/localencoding.c
@@ -0,0 +1,123 @@
+#ifndef lint
+static char *rcsid = "$Id: localencoding.c,v 1.1.1.1 2003/06/04 00:25:53 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#ifdef WIN32
+#include <windows.h>
+#endif
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+#ifdef HAVE_LANGINFO_H
+#include <langinfo.h>
+#endif
+
+#include <idn/logmacro.h>
+#include <idn/localencoding.h>
+#include <idn/debug.h>
+
+#ifdef ENABLE_MDNKIT_COMPAT
+#include <mdn/localencoding.h>
+#endif
+
+const char *
+idn_localencoding_name(void) {
+ char *name;
+
+ TRACE(("idn_localencoding_name()\n"));
+
+ if ((name = getenv(IDN_LOCALCS_ENV)) != NULL) {
+ TRACE(("local encoding=\"%-.30s\"\n",
+ name == NULL ? "<null>" : name));
+ return (name);
+ }
+#ifdef ENABLE_MDNKIT_COMPAT
+ if ((name = getenv(MDN_LOCALCS_ENV)) != NULL) {
+ TRACE(("local encoding=\"%-.30s\"\n",
+ name == NULL ? "<null>" : name));
+ return (name);
+ }
+#endif
+
+#ifdef WIN32
+ {
+ static char cp_str[40]; /* enough */
+ (void)sprintf(cp_str, "CP%u", GetACP());
+ TRACE(("local encoding(codepage)=\"%-.30s\"\n", cp_str));
+ return (cp_str);
+ }
+#else /* WIN32 */
+#ifdef HAVE_LIBCHARSET
+ name = locale_charset();
+ TRACE(("local encoding=\"%-.30s\"\n",
+ name == NULL ? "<null>" : name));
+ return (name);
+#endif
+
+#if defined(HAVE_NL_LANGINFO) && defined(CODESET)
+ if ((name = nl_langinfo(CODESET)) != NULL) {
+ TRACE(("local encoding=\"%-.30s\"\n",
+ name == NULL ? "<null>" : name));
+ return (name);
+ }
+#endif
+ (void)(
+#ifdef HAVE_SETLOCALE
+ (name = setlocale(LC_CTYPE, NULL)) ||
+#endif
+ (name = getenv("LC_ALL")) ||
+ (name = getenv("LC_CTYPE")) ||
+ (name = getenv("LANG")));
+ TRACE(("local encoding=\"%-.30s\"\n", name == NULL ? "<null>" : name));
+ return (name);
+#endif /* WIN32 */
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/log.c b/contrib/idn/idnkit-1.0-src/lib/log.c
new file mode 100644
index 0000000..92ba9c9
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/log.c
@@ -0,0 +1,215 @@
+#ifndef lint
+static char *rcsid = "$Id: log.c,v 1.1.1.1 2003/06/04 00:25:53 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <idn/log.h>
+
+#define LOGLEVEL_ENV "IDN_LOG_LEVEL"
+
+#ifdef DEBUG
+#define DEFAULT_LOG_LEVEL idn_log_level_info
+#else
+#define DEFAULT_LOG_LEVEL idn_log_level_error
+#endif
+
+static int log_level = -1;
+static idn_log_proc_t log_proc;
+
+static void initialize(void);
+static void log(int level, const char *fmt, va_list args);
+static void log_to_stderr(int level, const char *buf);
+
+void
+idn_log_fatal(const char *fmt, ...) {
+ va_list args;
+
+ va_start(args, fmt);
+ log(idn_log_level_fatal, fmt, args);
+ va_end(args);
+ exit(1);
+}
+
+void
+idn_log_error(const char *fmt, ...) {
+ va_list args;
+
+ va_start(args, fmt);
+ log(idn_log_level_error, fmt, args);
+ va_end(args);
+}
+
+void
+idn_log_warning(const char *fmt, ...) {
+ va_list args;
+
+ va_start(args, fmt);
+ log(idn_log_level_warning, fmt, args);
+ va_end(args);
+}
+
+void
+idn_log_info(const char *fmt, ...) {
+ va_list args;
+
+ va_start(args, fmt);
+ log(idn_log_level_info, fmt, args);
+ va_end(args);
+}
+
+void
+idn_log_trace(const char *fmt, ...) {
+ va_list args;
+
+ va_start(args, fmt);
+ log(idn_log_level_trace, fmt, args);
+ va_end(args);
+}
+
+void
+idn_log_dump(const char *fmt, ...) {
+ va_list args;
+
+ va_start(args, fmt);
+ log(idn_log_level_dump, fmt, args);
+ va_end(args);
+}
+
+void
+idn_log_setlevel(int level) {
+ if (level >= 0)
+ log_level = level;
+}
+
+int
+idn_log_getlevel(void) {
+ if (log_level < 0)
+ initialize();
+ return log_level;
+}
+
+void
+idn_log_setproc(idn_log_proc_t proc) {
+ if (proc == NULL)
+ log_proc = log_to_stderr;
+ else
+ log_proc = proc;
+}
+
+static void
+initialize(void) {
+ char *s;
+
+ if (log_level < 0) {
+ if ((s = getenv(LOGLEVEL_ENV)) != NULL) {
+ int level = atoi(s);
+ if (level >= 0)
+ log_level = level;
+ }
+ if (log_level < 0)
+ log_level = DEFAULT_LOG_LEVEL;
+ }
+
+ if (log_proc == NULL)
+ log_proc = log_to_stderr;
+}
+
+static void
+log(int level, const char *fmt, va_list args) {
+ char buf[1024];
+
+ initialize();
+
+ if (log_level < level)
+ return;
+
+#if HAVE_VSNPRINTF
+ (void)vsnprintf(buf, sizeof(buf), fmt, args);
+#else
+ /* Let's hope 1024 is enough.. */
+ (void)vsprintf(buf, fmt, args);
+#endif
+ (*log_proc)(level, buf);
+}
+
+static void
+log_to_stderr(int level, const char *buf) {
+ char *title;
+ char tmp[20];
+
+ switch (level) {
+ case idn_log_level_fatal:
+ title = "FATAL";
+ break;
+ case idn_log_level_error:
+ title = "ERROR";
+ break;
+ case idn_log_level_warning:
+ title = "WARNING";
+ break;
+ case idn_log_level_info:
+ title = "INFO";
+ break;
+ case idn_log_level_trace:
+ title = "TRACE";
+ break;
+ case idn_log_level_dump:
+ title = "DUMP";
+ break;
+ default:
+ (void)sprintf(tmp, "LEVEL%d", level);
+ title = tmp;
+ break;
+ }
+ fprintf(stderr, "%u: [%s] %s", (unsigned int)getpid(), title, buf);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/make.wnt b/contrib/idn/idnkit-1.0-src/lib/make.wnt
new file mode 100644
index 0000000..9d80dcf
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/make.wnt
@@ -0,0 +1,279 @@
+# $Id: make.wnt,v 1.1.1.1 2003/06/04 00:25:54 marka Exp $
+# Makefile for MDN library, manually configured for WIN-NT (VC5.0)
+#
+# Copyright (c) 2000,2002 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+!include <ntwin32.mak>
+
+INCDIR = ..\include
+ICONVDIR = ..\win
+LIBS = $(ICONVDIR)\iconv.lib
+LIBS_LITE =
+SYSLIBS = $(conlibsdll)
+
+#
+# Files to build MDN library
+#
+
+HDRS_LITE = \
+ $(INCDIR)\config.h \
+ $(INCDIR)\idn\aliaslist.h \
+ $(INCDIR)\idn\api.h \
+ $(INCDIR)\idn\assert.h \
+ $(INCDIR)\idn\checker.h \
+ $(INCDIR)\idn\converter.h \
+ $(INCDIR)\idn\debug.h \
+ $(INCDIR)\idn\delimitermap.h \
+ $(INCDIR)\idn\export.h \
+ $(INCDIR)\idn\filechecker.h \
+ $(INCDIR)\idn\filemapper.h \
+ $(INCDIR)\idn\localencoding.h \
+ $(INCDIR)\idn\log.h \
+ $(INCDIR)\idn\logmacro.h \
+ $(INCDIR)\idn\mapper.h \
+ $(INCDIR)\idn\mapselector.h \
+ $(INCDIR)\idn\nameprep.h \
+ $(INCDIR)\idn\normalizer.h \
+ $(INCDIR)\idn\punycode.h \
+ $(INCDIR)\idn\race.h \
+ $(INCDIR)\idn\res.h \
+ $(INCDIR)\idn\resconf.h \
+ $(INCDIR)\idn\result.h \
+ $(INCDIR)\idn\strhash.h \
+ $(INCDIR)\idn\ucs4.h \
+ $(INCDIR)\idn\ucsmap.h \
+ $(INCDIR)\idn\ucsset.h \
+ $(INCDIR)\idn\unicode.h \
+ $(INCDIR)\idn\unormalize.h \
+ $(INCDIR)\idn\utf8.h \
+ $(INCDIR)\idn\util.h \
+ $(INCDIR)\idn\version.h
+
+HDRS = $(ICONVDIR)\iconv.h \
+ $(HDRS_LITE)
+
+SRCS = aliaslist.c api.c checker.c \
+ converter.c debug.c delimitermap.c \
+ filechecker.c filemapper.c \
+ localencoding.c log.c mapper.c \
+ mapselector.c nameprep.c nameprep_template.c \
+ nameprepdata.c normalizer.c punycode.c race.c \
+ res.c resconf.c result.c \
+ strhash.c ucs4.c ucsmap.c \
+ ucsset.c unicode.c unicode_template.c \
+ unicodedata_320.c unormalize.c \
+ utf8.c util.c version.c
+
+OBJS = aliaslist.obj api.obj checker.obj \
+ converter.obj debug.obj delimitermap.obj \
+ filechecker.obj filemapper.obj \
+ localencoding.obj log.obj mapper.obj \
+ mapselector.obj nameprep.obj \
+ normalizer.obj punycode.obj race.obj \
+ res.obj resconf.obj result.obj \
+ strhash.obj ucs4.obj ucsmap.obj \
+ ucsset.obj unicode.obj \
+ unormalize.obj \
+ utf8.obj util.obj version.obj
+
+OBJS_LITE = \
+ aliaslist_l.obj api_l.obj checker_l.obj \
+ converter_l.obj debug_l.obj delimitermap_l.obj \
+ filechecker_l.obj filemapper_l.obj \
+ localencoding_l.obj log_l.obj mapper_l.obj \
+ mapselector_l.obj nameprep_l.obj \
+ normalizer_l.obj punycode_l.obj race_l.obj \
+ res_l.obj resconf_l.obj result_l.obj \
+ strhash_l.obj ucs4_l.obj ucsmap_l.obj \
+ ucsset_l.obj unicode_l.obj \
+ unormalize_l.obj \
+ utf8_l.obj util_l.obj version_l.obj
+
+
+#DBG = -DDEBUG
+
+#
+# Target to build
+#
+
+TARGETS = idnkit.dll idnkitlite.dll
+
+all: $(TARGETS)
+
+idnkit.dll: $(OBJS)
+ -del idnkit.dll
+ $(link) /out:"idnkit.dll" /implib:"idnkit.lib" $(dlllflags) $(OBJS) $(LIBS) $(SYSLIBS)
+
+idnkitlite.dll: $(OBJS_LITE)
+ -del idnkitlite.dll
+ $(link) /out:"idnkitlite.dll" /implib:"idnkitlite.lib" $(dlllflags) $(OBJS_LITE) $(LIBS_LITE) $(SYSLIBS)
+
+install:
+
+clean:
+ -del *.obj
+ -del *.lib
+ -del *.dll
+ -del *.exp
+
+#
+# Dependencies
+#
+
+EXP = -DIDN_EXPORT="extern __declspec(dllexport)"
+CCARGS = $(cflags) $(cvarsdll) -I$(INCDIR) -I$(ICONVDIR) $(EXP) $(DBG)
+CCARGS_LITE = $(cflags) $(cvarsdll) -I$(INCDIR) -DWITHOUT_ICONV $(EXP) $(DBG)
+
+aliaslist.obj: aliaslist.c $(HDRS)
+ $(cc) $(CCARGS) /Foaliaslist.obj aliaslist.c
+api.obj: api.c $(HDRS)
+ $(cc) $(CCARGS) /Foapi.obj api.c
+checker.obj: checker.c $(HDRS)
+ $(cc) $(CCARGS) /Fochecker.obj checker.c
+converter.obj: converter.c $(HDRS)
+ $(cc) $(CCARGS) /Foconverter.obj converter.c
+debug.obj: debug.c $(HDRS)
+ $(cc) $(CCARGS) /Fodebug.obj debug.c
+delimitermap.obj: delimitermap.c $(HDRS)
+ $(cc) $(CCARGS) /Fodelimitermap.obj delimitermap.c
+filechecker.obj: filechecker.c $(HDRS)
+ $(cc) $(CCARGS) /Fofilechecker.obj filechecker.c
+filemapper.obj: filemapper.c $(HDRS)
+ $(cc) $(CCARGS) /Fofilemapper.obj filemapper.c
+localencoding.obj: localencoding.c $(HDRS)
+ $(cc) $(CCARGS) /Folocalencoding.obj localencoding.c
+log.obj: log.c $(HDRS)
+ $(cc) $(CCARGS) /Folog.obj log.c
+mapper.obj: mapper.c $(HDRS)
+ $(cc) $(CCARGS) /Fomapper.obj mapper.c
+mapselector.obj: mapselector.c $(HDRS)
+ $(cc) $(CCARGS) /Fomapselector.obj mapselector.c
+nameprep.obj: nameprep.c nameprepdata.c nameprep_template.c $(HDRS)
+ $(cc) $(CCARGS) /Fonameprep.obj nameprep.c
+normalizer.obj: normalizer.c $(HDRS)
+ $(cc) $(CCARGS) /Fonormalizer.obj normalizer.c
+punycode.obj: punycode.c $(HDRS)
+ $(cc) $(CCARGS) /Fopunycode.obj punycode.c
+race.obj: race.c $(HDRS)
+ $(cc) $(CCARGS) /Forace.obj race.c
+res.obj: res.c $(HDRS)
+ $(cc) $(CCARGS) /Fores.obj res.c
+resconf.obj: resconf.c $(HDRS)
+ $(cc) $(CCARGS) /Foresconf.obj resconf.c
+result.obj: result.c $(HDRS)
+ $(cc) $(CCARGS) /Foresult.obj result.c
+strhash.obj: strhash.c $(HDRS)
+ $(cc) $(CCARGS) /Fostrhash.obj strhash.c
+ucs4.obj: ucs4.c $(HDRS)
+ $(cc) $(CCARGS) /Foucs4.obj ucs4.c
+ucsmap.obj: ucsmap.c $(HDRS)
+ $(cc) $(CCARGS) /Foucsmap.obj ucsmap.c
+ucsset.obj: ucsset.c $(HDRS)
+ $(cc) $(CCARGS) /Foucsset.obj ucsset.c
+unicode.obj: unicode.c unicodedata_320.c unicode_template.c $(HDRS)
+ $(cc) $(CCARGS) /Founicode.obj unicode.c
+unormalize.obj: unormalize.c $(HDRS)
+ $(cc) $(CCARGS) /Founormalize.obj unormalize.c
+utf8.obj: utf8.c $(HDRS)
+ $(cc) $(CCARGS) /Foutf8.obj utf8.c
+util.obj: util.c $(HDRS)
+ $(cc) $(CCARGS) /Foutil.obj util.c
+version.obj: version.c $(HDRS)
+ $(cc) $(CCARGS) /Foversion.obj version.c
+
+aliaslist_l.obj: aliaslist.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Foaliaslist_l.obj aliaslist.c
+api_l.obj: api.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Foapi_l.obj api.c
+checker_l.obj: checker.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Fochecker_l.obj checker.c
+converter_l.obj: converter.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Foconverter_l.obj converter.c
+debug_l.obj: debug.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Fodebug_l.obj debug.c
+delimitermap_l.obj: delimitermap.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Fodelimitermap_l.obj delimitermap.c
+dude_l.obj: dude.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Fodude_l.obj dude.c
+filechecker_l.obj: filechecker.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Fofilechecker_l.obj filechecker.c
+filemapper_l.obj: filemapper.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Fofilemapper_l.obj filemapper.c
+localencoding_l.obj: localencoding.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Folocalencoding_l.obj localencoding.c
+log_l.obj: log.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Folog_l.obj log.c
+mapper_l.obj: mapper.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Fomapper_l.obj mapper.c
+mapselector_l.obj: mapselector.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Fomapselector_l.obj mapselector.c
+nameprep_l.obj: nameprep.c nameprepdata.c nameprep_template.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Fonameprep_l.obj nameprep.c
+normalizer_l.obj: normalizer.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Fonormalizer_l.obj normalizer.c
+punycode_l.obj: punycode.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Fopunycode_l.obj punycode.c
+race_l.obj: race.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Forace_l.obj race.c
+res_l.obj: res.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Fores_l.obj res.c
+resconf_l.obj: resconf.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Foresconf_l.obj resconf.c
+result_l.obj: result.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Foresult_l.obj result.c
+strhash_l.obj: strhash.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Fostrhash_l.obj strhash.c
+ucs4_l.obj: ucs4.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Foucs4_l.obj ucs4.c
+ucsmap_l.obj: ucsmap.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Foucsmap_l.obj ucsmap.c
+ucsset_l.obj: ucsset.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Foucsset_l.obj ucsset.c
+unicode_l.obj: unicode.c unicodedata_320.c unicode_template.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Founicode_l.obj unicode.c
+unormalize_l.obj: unormalize.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Founormalize_l.obj unormalize.c
+utf8_l.obj: utf8.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Foutf8_l.obj utf8.c
+util_l.obj: util.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Foutil_l.obj util.c
+version_l.obj: version.c $(HDRS_LITE)
+ $(cc) $(CCARGS_LITE) /Foversion_l.obj version.c
diff --git a/contrib/idn/idnkit-1.0-src/lib/mapper.c b/contrib/idn/idnkit-1.0-src/lib/mapper.c
new file mode 100644
index 0000000..008f027
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/mapper.c
@@ -0,0 +1,482 @@
+#ifndef lint
+static char *rcsid = "$Id: mapper.c,v 1.1.1.1 2003/06/04 00:25:55 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <idn/result.h>
+#include <idn/assert.h>
+#include <idn/logmacro.h>
+#include <idn/mapper.h>
+#include <idn/strhash.h>
+#include <idn/debug.h>
+#include <idn/util.h>
+#include <idn/ucs4.h>
+
+/*
+ * Type for mapping scheme.
+ */
+typedef struct {
+ char *prefix;
+ char *parameter;
+ idn_mapper_createproc_t create;
+ idn_mapper_destroyproc_t destroy;
+ idn_mapper_mapproc_t map;
+ void *context;
+} map_scheme_t;
+
+/*
+ * Standard mapping schemes.
+ */
+static const map_scheme_t nameprep_scheme = {
+ "RFC3491",
+ NULL,
+ idn_nameprep_createproc,
+ idn_nameprep_destroyproc,
+ idn_nameprep_mapproc,
+ NULL,
+};
+
+static const map_scheme_t filemap_scheme = {
+ "filemap",
+ "",
+ idn__filemapper_createproc,
+ idn__filemapper_destroyproc,
+ idn__filemapper_mapproc,
+ NULL,
+};
+
+static const map_scheme_t *standard_map_schemes[] = {
+ &nameprep_scheme,
+ &filemap_scheme,
+ NULL,
+};
+
+/*
+ * Hash table for mapping schemes.
+ */
+static idn__strhash_t scheme_hash = NULL;
+
+/*
+ * Mapper object type.
+ */
+struct idn_mapper {
+ int nschemes;
+ int scheme_size;
+ map_scheme_t *schemes;
+ int reference_count;
+};
+
+#define MAPPER_INITIAL_SCHEME_SIZE 1
+
+idn_result_t
+idn_mapper_initialize(void) {
+ idn_result_t r;
+ map_scheme_t **scheme;
+
+ TRACE(("idn_mapper_initialize()\n"));
+
+ if (scheme_hash != NULL) {
+ r = idn_success; /* already initialized */
+ goto ret;
+ }
+
+ r = idn__strhash_create(&scheme_hash);
+ if (r != idn_success)
+ goto ret;
+
+ for (scheme = (map_scheme_t **)standard_map_schemes;
+ *scheme != NULL; scheme++) {
+ r = idn__strhash_put(scheme_hash, (*scheme)->prefix, *scheme);
+ if (r != idn_success)
+ goto ret;
+ }
+
+ r = idn_success;
+ret:
+ if (r != idn_success && scheme_hash != NULL) {
+ idn__strhash_destroy(scheme_hash, NULL);
+ scheme_hash = NULL;
+ }
+ TRACE(("idn_mapper_initialize(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_result_t
+idn_mapper_create(idn_mapper_t *ctxp) {
+ idn_mapper_t ctx = NULL;
+ idn_result_t r;
+
+ assert(scheme_hash != NULL);
+ assert(ctxp != NULL);
+
+ TRACE(("idn_mapper_create()\n"));
+
+ ctx = (idn_mapper_t) malloc(sizeof(struct idn_mapper));
+ if (ctx == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+
+ ctx->schemes = (map_scheme_t *) malloc(sizeof(map_scheme_t)
+ * MAPPER_INITIAL_SCHEME_SIZE);
+ if (ctx->schemes == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+
+ ctx->nschemes = 0;
+ ctx->scheme_size = MAPPER_INITIAL_SCHEME_SIZE;
+ ctx->reference_count = 1;
+ *ctxp = ctx;
+ r = idn_success;
+
+ret:
+ if (r != idn_success) {
+ if (ctx != NULL)
+ free(ctx->schemes);
+ free(ctx);
+ }
+ TRACE(("idn_mapper_create(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+void
+idn_mapper_destroy(idn_mapper_t ctx) {
+ int i;
+
+ assert(scheme_hash != NULL);
+ assert(ctx != NULL);
+
+ TRACE(("idn_mapper_destroy()\n"));
+
+ ctx->reference_count--;
+ if (ctx->reference_count <= 0) {
+ TRACE(("idn_mapper_destroy(): the object is destroyed\n"));
+ for (i = 0; i < ctx->nschemes; i++)
+ ctx->schemes[i].destroy(ctx->schemes[i].context);
+ free(ctx->schemes);
+ free(ctx);
+ } else {
+ TRACE(("idn_mapper_destroy(): "
+ "update reference count (%d->%d)\n",
+ ctx->reference_count + 1, ctx->reference_count));
+ }
+}
+
+void
+idn_mapper_incrref(idn_mapper_t ctx) {
+ assert(ctx != NULL && scheme_hash != NULL);
+
+ TRACE(("idn_mapper_incrref()\n"));
+ TRACE(("idn_mapper_incrref: update reference count (%d->%d)\n",
+ ctx->reference_count, ctx->reference_count + 1));
+
+ ctx->reference_count++;
+}
+
+idn_result_t
+idn_mapper_add(idn_mapper_t ctx, const char *scheme_name) {
+ idn_result_t r;
+ map_scheme_t *scheme;
+ const char *scheme_prefix;
+ const char *scheme_parameter;
+ void *scheme_context = NULL;
+ char static_buffer[128]; /* large enough */
+ char *buffer = static_buffer;
+
+ assert(scheme_hash != NULL);
+ assert(ctx != NULL);
+
+ TRACE(("idn_mapper_add(scheme_name=%s)\n",
+ idn__debug_xstring(scheme_name, 50)));
+
+ /*
+ * Split `scheme_name' into `scheme_prefix' and `scheme_parameter'.
+ */
+ scheme_parameter = strchr(scheme_name, ':');
+ if (scheme_parameter == NULL) {
+ scheme_prefix = scheme_name;
+ } else {
+ ptrdiff_t scheme_prefixlen;
+
+ scheme_prefixlen = scheme_parameter - scheme_name;
+ if (scheme_prefixlen + 1 > sizeof(static_buffer)) {
+ buffer = (char *) malloc(scheme_prefixlen + 1);
+ if (buffer == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ }
+ memcpy(buffer, scheme_name, scheme_prefixlen);
+ *(buffer + scheme_prefixlen) = '\0';
+ scheme_prefix = buffer;
+ scheme_parameter++;
+ }
+
+ /*
+ * Find a scheme.
+ */
+ if (idn__strhash_get(scheme_hash, scheme_prefix, (void **)&scheme)
+ != idn_success) {
+ ERROR(("idn_mapper_add(): invalid scheme name \"%-.30s\"\n",
+ scheme_prefix));
+ r = idn_invalid_name;
+ goto ret;
+ }
+ if (scheme_parameter == NULL) {
+ if (scheme->parameter != NULL)
+ scheme_parameter = scheme->parameter;
+ else
+ scheme_parameter = scheme->prefix;
+ }
+
+ /*
+ * Add the scheme.
+ */
+ assert(ctx->nschemes <= ctx->scheme_size);
+
+ if (ctx->nschemes == ctx->scheme_size) {
+ map_scheme_t *new_schemes;
+
+ new_schemes = (map_scheme_t *) realloc(ctx->schemes,
+ sizeof(map_scheme_t) * ctx->scheme_size * 2);
+ if (new_schemes == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ ctx->schemes = new_schemes;
+ ctx->scheme_size *= 2;
+ }
+
+ r = scheme->create(scheme_parameter, &scheme_context);
+ if (r != idn_success)
+ goto ret;
+
+ memcpy(ctx->schemes + ctx->nschemes, scheme, sizeof(map_scheme_t));
+ ctx->schemes[ctx->nschemes].context = scheme_context;
+ ctx->nschemes++;
+ r = idn_success;
+ret:
+ if (r != idn_success)
+ free(scheme_context);
+ if (buffer != static_buffer)
+ free(buffer);
+ TRACE(("idn_mapper_add(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_result_t
+idn_mapper_addall(idn_mapper_t ctx, const char **scheme_names, int nschemes) {
+ idn_result_t r;
+ int i;
+
+ assert(scheme_hash != NULL);
+ assert(ctx != NULL && scheme_names != NULL);
+
+ TRACE(("idn_mapper_addall(nschemes=%d)\n", nschemes));
+
+ for (i = 0; i < nschemes; i++) {
+ r = idn_mapper_add(ctx, (const char *)*scheme_names);
+ if (r != idn_success)
+ goto ret;
+ scheme_names++;
+ }
+
+ r = idn_success;
+ret:
+ TRACE(("idn_mapper_addall(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_result_t
+idn_mapper_map(idn_mapper_t ctx, const unsigned long *from,
+ unsigned long *to, size_t tolen) {
+ idn_result_t r;
+ unsigned long *src, *dst;
+ unsigned long *buffers[2] = {NULL, NULL};
+ size_t buflen[2] = {0, 0};
+ size_t dstlen;
+ int idx;
+ int i;
+
+ assert(scheme_hash != NULL);
+ assert(ctx != NULL && from != NULL && to != NULL);
+
+ TRACE(("idn_mapper_map(from=\"%s\", tolen=%d)\n",
+ idn__debug_ucs4xstring(from, 50), (int)tolen));
+
+ if (ctx->nschemes <= 0) {
+ if (tolen < idn_ucs4_strlen(from) + 1) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ idn_ucs4_strcpy(to, from);
+ r = idn_success;
+ goto ret;
+ }
+
+ /*
+ * Map.
+ */
+ src = (void *)from;
+ dstlen = idn_ucs4_strlen(from) + 1;
+
+ i = 0;
+ while (i < ctx->nschemes) {
+ TRACE(("idn_mapper_map(): map %s\n", ctx->schemes[i].prefix));
+
+ /*
+ * Choose destination area to restore the result of a mapping.
+ */
+ if (i + 1 == ctx->nschemes) {
+ dst = to;
+ dstlen = tolen;
+
+ } else {
+ if (src == buffers[0])
+ idx = 1;
+ else
+ idx = 0;
+
+ if (buflen[idx] < dstlen) {
+ void *newbuf;
+
+ newbuf = realloc(buffers[idx],
+ sizeof(long) * dstlen);
+ if (newbuf == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ buffers[idx] = (unsigned long *)newbuf;
+ buflen[idx] = dstlen;
+ }
+
+ dst = buffers[idx];
+ dstlen = buflen[idx];
+ }
+
+ /*
+ * Perform i-th map scheme.
+ * If buffer size is not enough, we double it and try again.
+ */
+ r = (ctx->schemes[i].map)(ctx->schemes[i].context, src, dst,
+ dstlen);
+ if (r == idn_buffer_overflow && dst != to) {
+ dstlen *= 2;
+ continue;
+ }
+ if (r != idn_success)
+ goto ret;
+
+ src = dst;
+ i++;
+ }
+
+ r = idn_success;
+ret:
+ free(buffers[0]);
+ free(buffers[1]);
+ if (r == idn_success) {
+ TRACE(("idn_mapper_map(): success (to=\"%s\")\n",
+ idn__debug_ucs4xstring(to, 50)));
+ } else {
+ TRACE(("idn_mapper_map(): %s\n", idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+idn_result_t
+idn_mapper_register(const char *prefix,
+ idn_mapper_createproc_t create,
+ idn_mapper_destroyproc_t destroy,
+ idn_mapper_mapproc_t map) {
+ idn_result_t r;
+ map_scheme_t *scheme = NULL;
+
+ assert(scheme_hash != NULL);
+ assert(prefix != NULL && create != NULL && destroy != NULL &&
+ map != NULL);
+
+ TRACE(("idn_mapper_register(prefix=%s)\n", prefix));
+
+ scheme = (map_scheme_t *) malloc(sizeof(map_scheme_t));
+ if (scheme == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+
+ scheme->prefix = (char *) malloc(strlen(prefix) + 1);
+ if (scheme->prefix == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+
+ strcpy(scheme->prefix, prefix);
+ scheme->parameter = NULL;
+ scheme->create = create;
+ scheme->destroy = destroy;
+ scheme->map = map;
+
+ r = idn__strhash_put(scheme_hash, prefix, scheme);
+ if (r != idn_success)
+ goto ret;
+
+ r = idn_success;
+ret:
+ if (r != idn_success) {
+ if (scheme != NULL)
+ free(scheme->prefix);
+ free(scheme);
+ }
+
+ TRACE(("idn_mapper_register(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/mapselector.c b/contrib/idn/idnkit-1.0-src/lib/mapselector.c
new file mode 100644
index 0000000..0101b98
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/mapselector.c
@@ -0,0 +1,375 @@
+#ifndef lint
+static char *rcsid = "$Id: mapselector.c,v 1.1.1.1 2003/06/04 00:25:56 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <idn/assert.h>
+#include <idn/logmacro.h>
+#include <idn/result.h>
+#include <idn/mapselector.h>
+#include <idn/strhash.h>
+#include <idn/debug.h>
+#include <idn/util.h>
+#include <idn/ucs4.h>
+
+struct idn_mapselector {
+ idn__strhash_t maphash;
+ int reference_count;
+};
+
+/*
+ * Maximum length of a top level domain name. (e.g. `com', `jp', ...)
+ */
+#define MAPSELECTOR_MAX_TLD_LENGTH 63
+
+static void string_ascii_tolower(char *string);
+
+
+const unsigned long *
+idn_mapselector_getnotld(void) {
+ static const unsigned long notld[] = {0x002d, 0x0000}; /* "-" */
+ return (notld);
+}
+
+const unsigned long *
+idn_mapselector_getdefaulttld(void) {
+ const static unsigned long defaulttld[] = {0x002e, 0x0000}; /* "." */
+ return (defaulttld);
+}
+
+idn_result_t
+idn_mapselector_initialize(void) {
+ idn_result_t r;
+
+ TRACE(("idn_mapselector_initialize()\n"));
+
+ r = idn_mapper_initialize();
+
+ TRACE(("idn_mapselector_initialize(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_result_t
+idn_mapselector_create(idn_mapselector_t *ctxp) {
+ idn_mapselector_t ctx = NULL;
+ idn_result_t r;
+
+ assert(ctxp != NULL);
+ TRACE(("idn_mapselector_create()\n"));
+
+ ctx = (idn_mapselector_t)malloc(sizeof(struct idn_mapselector));
+ if (ctx == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+
+ ctx->maphash = NULL;
+ ctx->reference_count = 1;
+
+ r = idn__strhash_create(&(ctx->maphash));
+ if (r != idn_success)
+ goto ret;
+
+ *ctxp = ctx;
+ r = idn_success;
+
+ret:
+ if (r != idn_success) {
+ if (ctx != NULL)
+ free(ctx->maphash);
+ free(ctx);
+ }
+ TRACE(("idn_mapselector_create(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+void
+idn_mapselector_destroy(idn_mapselector_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_mapselector_destroy()\n"));
+
+ ctx->reference_count--;
+ if (ctx->reference_count <= 0) {
+ TRACE(("idn_mapselector_destroy(): "
+ "the object is destroyed\n"));
+ idn__strhash_destroy(ctx->maphash,
+ (idn__strhash_freeproc_t)&idn_mapper_destroy);
+ free(ctx);
+ } else {
+ TRACE(("idn_mapselector_destroy(): "
+ "update reference count (%d->%d)\n",
+ ctx->reference_count + 1, ctx->reference_count));
+ }
+}
+
+void
+idn_mapselector_incrref(idn_mapselector_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_mapselector_incrref()\n"));
+ TRACE(("idn_mapselector_incrref: update reference count (%d->%d)\n",
+ ctx->reference_count, ctx->reference_count + 1));
+
+ ctx->reference_count++;
+}
+
+idn_result_t
+idn_mapselector_add(idn_mapselector_t ctx, const char *tld, const char *name) {
+ idn_result_t r;
+ idn_mapper_t mapper;
+ char hash_key[MAPSELECTOR_MAX_TLD_LENGTH + 1];
+
+ assert(ctx != NULL && tld != NULL);
+
+ TRACE(("idn_mapselector_add(tld=%s, name=%s)\n", tld, name));
+
+ if (!(tld[0] == '.' && tld[1] == '\0')) {
+ if (tld[0] == '.')
+ tld++;
+ if (strchr(tld, '.') != NULL) {
+ ERROR(("idn_mapselector_add: "
+ "invalid TLD \"%-.100s\"\n", tld));
+ r = idn_invalid_name;
+ goto ret;
+ }
+ }
+ if (strlen(tld) > MAPSELECTOR_MAX_TLD_LENGTH) {
+ ERROR(("idn_mapselector_add: "
+ "too long TLD \"%-.100s\"\n", tld));
+ r = idn_invalid_name;
+ goto ret;
+ }
+ strcpy(hash_key, tld);
+ string_ascii_tolower(hash_key);
+
+ if (idn__strhash_get(ctx->maphash, hash_key, (void **)&mapper)
+ != idn_success) {
+ r = idn_mapper_create(&mapper);
+ if (r != idn_success)
+ goto ret;
+
+ r = idn__strhash_put(ctx->maphash, hash_key, mapper);
+ if (r != idn_success)
+ goto ret;
+ }
+
+ r = idn_mapper_add(mapper, name);
+ret:
+ TRACE(("idn_mapselector_add(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_result_t
+idn_mapselector_addall(idn_mapselector_t ctx, const char *tld,
+ const char **scheme_names, int nschemes) {
+ idn_result_t r;
+ int i;
+
+ assert(ctx != NULL && tld != NULL && scheme_names != NULL);
+
+ TRACE(("idn_mapselector_addall(tld=%s, nschemes=%d)\n",
+ tld, nschemes));
+
+ for (i = 0; i < nschemes; i++) {
+ r = idn_mapselector_add(ctx, tld, (const char *)*scheme_names);
+ if (r != idn_success)
+ goto ret;
+ scheme_names++;
+ }
+
+ r = idn_success;
+ret:
+ TRACE(("idn_mapselector_addall(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_mapper_t
+idn_mapselector_mapper(idn_mapselector_t ctx, const char *tld) {
+ idn_result_t r;
+ idn_mapper_t mapper;
+ char hash_key[MAPSELECTOR_MAX_TLD_LENGTH + 1];
+
+ assert(ctx != NULL && tld != NULL);
+
+ TRACE(("idn_mapselector_mapper(tld=%s)\n", tld));
+
+ if (!(tld[0] == '.' && tld[1] == '\0')) {
+ if (tld[0] == '.')
+ tld++;
+ if (strchr(tld, '.') != NULL)
+ return (NULL);
+ }
+ if (strlen(tld) > MAPSELECTOR_MAX_TLD_LENGTH)
+ return (NULL);
+ strcpy(hash_key, tld);
+ string_ascii_tolower(hash_key);
+
+ mapper = NULL;
+ r = idn__strhash_get(ctx->maphash, hash_key, (void **)&mapper);
+ if (r != idn_success)
+ return (NULL);
+
+ idn_mapper_incrref(mapper);
+
+ return (mapper);
+}
+
+idn_result_t
+idn_mapselector_map(idn_mapselector_t ctx, const unsigned long *from,
+ const char *tld, unsigned long *to, size_t tolen) {
+ idn_result_t r;
+ idn_mapper_t mapper = NULL;
+ char hash_key[MAPSELECTOR_MAX_TLD_LENGTH + 1];
+ size_t fromlen;
+
+ assert(ctx != NULL && from != NULL && to != NULL);
+
+ TRACE(("idn_mapselector_map(from=\"%s\", tld=\"%s\", tolen=%d)\n",
+ idn__debug_ucs4xstring(from, 50), idn__debug_xstring(tld, 50),
+ (int)tolen));
+
+ if (!(tld[0] == '.' && tld[1] == '\0')) {
+ if (tld[0] == '.')
+ tld++;
+ if (strchr(tld, '.') != NULL) {
+ r = idn_invalid_name;
+ goto ret;
+ }
+ }
+ if (strlen(tld) > MAPSELECTOR_MAX_TLD_LENGTH) {
+ r = idn_invalid_name;
+ goto ret;
+ }
+ strcpy(hash_key, tld);
+ string_ascii_tolower(hash_key);
+
+ fromlen = idn_ucs4_strlen(from);
+
+ /*
+ * Get mapper for the TLD.
+ */
+ if (idn__strhash_get(ctx->maphash, hash_key, (void **)&mapper)
+ != idn_success) {
+ strcpy(hash_key, IDN_MAPSELECTOR_DEFAULTTLD);
+ idn__strhash_get(ctx->maphash, hash_key, (void **)&mapper);
+ }
+
+ /*
+ * Map.
+ * If default mapper has not been registered, copy the string.
+ */
+ if (mapper == NULL) {
+ TRACE(("idn_mapselector_map(): no mapper\n"));
+ if (fromlen + 1 > tolen) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ memcpy(to, from, (fromlen + 1) * sizeof(*from));
+ } else {
+ TRACE(("idn_mapselector_map(): tld=%s\n", tld));
+ r = idn_mapper_map(mapper, from, to, tolen);
+ if (r != idn_success)
+ goto ret;
+ }
+
+ r = idn_success;
+ret:
+ if (r == idn_success) {
+ TRACE(("idn_mapselector_map(): succcess (to=\"%s\")\n",
+ idn__debug_ucs4xstring(to, 50)));
+ } else {
+ TRACE(("idn_mapselector_map(): %s\n", idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+idn_result_t
+idn_mapselector_map2(idn_mapselector_t ctx, const unsigned long *from,
+ const unsigned long *tld, unsigned long *to,
+ size_t tolen) {
+ char tld_utf8[MAPSELECTOR_MAX_TLD_LENGTH + 1];
+ idn_result_t r;
+
+ assert(ctx != NULL && from != NULL && to != NULL);
+
+ TRACE(("idn_mapselector_map2(from=\"%s\", tld=\"%s\")\n",
+ idn__debug_ucs4xstring(from, 50),
+ idn__debug_ucs4xstring(tld, 50)));
+
+ r = idn_ucs4_ucs4toutf8(tld, tld_utf8, sizeof(tld_utf8));
+ if (r == idn_buffer_overflow) {
+ r = idn_invalid_name;
+ goto ret;
+ } else if (r != idn_success) {
+ goto ret;
+ }
+
+ r = idn_mapselector_map(ctx, from, tld_utf8, to, tolen);
+ret:
+ if (r == idn_success) {
+ TRACE(("idn_mapselector_map2(): success (to=\"%s\")\n",
+ idn__debug_ucs4xstring(to, 50)));
+ } else {
+ TRACE(("idn_mapselector_map2(): %s\n", idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+static void
+string_ascii_tolower(char *string) {
+ unsigned char *p;
+
+ for (p = (unsigned char *) string; *p != '\0'; p++) {
+ if ('A' <= *p && *p <= 'Z')
+ *p = *p - 'A' + 'a';
+ }
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/nameprep.c b/contrib/idn/idnkit-1.0-src/lib/nameprep.c
new file mode 100644
index 0000000..bf08a0d
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/nameprep.c
@@ -0,0 +1,357 @@
+#ifndef lint
+static char *rcsid = "$Id: nameprep.c,v 1.1.1.1 2003/06/04 00:25:56 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <idn/result.h>
+#include <idn/assert.h>
+#include <idn/log.h>
+#include <idn/logmacro.h>
+#include <idn/debug.h>
+#include <idn/nameprep.h>
+
+#define UCS_MAX 0x7fffffff
+#define UNICODE_MAX 0x10ffff
+
+
+/*
+ * Load NAMEPREP compiled tables.
+ */
+#include "nameprepdata.c"
+
+/*
+ * Define mapping/checking functions for each version of the draft.
+ */
+
+#define VERSION rfc3491
+#include "nameprep_template.c"
+#undef VERSION
+
+typedef const char *(*nameprep_mapproc)(unsigned long v);
+typedef int (*nameprep_checkproc)(unsigned long v);
+typedef idn_biditype_t (*nameprep_biditypeproc)(unsigned long v);
+
+static struct idn_nameprep {
+ char *version;
+ nameprep_mapproc map_proc;
+ nameprep_checkproc prohibited_proc;
+ nameprep_checkproc unassigned_proc;
+ nameprep_biditypeproc biditype_proc;
+} nameprep_versions[] = {
+#define MAKE_NAMEPREP_HANDLE(version, id) \
+ { version, \
+ compose_sym2(nameprep_map_, id), \
+ compose_sym2(nameprep_prohibited_, id), \
+ compose_sym2(nameprep_unassigned_, id), \
+ compose_sym2(nameprep_biditype_, id), }
+ MAKE_NAMEPREP_HANDLE("RFC3491", rfc3491),
+ { NULL, NULL, NULL },
+};
+
+static idn_result_t idn_nameprep_check(nameprep_checkproc proc,
+ const unsigned long *str,
+ const unsigned long **found);
+
+idn_result_t
+idn_nameprep_create(const char *version, idn_nameprep_t *handlep) {
+ idn_nameprep_t handle;
+
+ assert(handlep != NULL);
+
+ TRACE(("idn_nameprep_create(version=%-.50s)\n",
+ version == NULL ? "<NULL>" : version));
+
+ if (version == NULL)
+ version = IDN_NAMEPREP_CURRENT;
+
+ /*
+ * Lookup table for the specified version. Since the number of
+ * versions won't be large (I don't want see draft-23 or such :-),
+ * simple linear search is OK.
+ */
+ for (handle = nameprep_versions; handle->version != NULL; handle++) {
+ if (strcmp(handle->version, version) == 0) {
+ *handlep = handle;
+ return (idn_success);
+ }
+ }
+ return (idn_notfound);
+}
+
+void
+idn_nameprep_destroy(idn_nameprep_t handle) {
+ assert(handle != NULL);
+
+ TRACE(("idn_nameprep_destroy()\n"));
+
+ /* Nothing to do. */
+}
+
+idn_result_t
+idn_nameprep_map(idn_nameprep_t handle, const unsigned long *from,
+ unsigned long *to, size_t tolen) {
+ assert(handle != NULL && from != NULL && to != NULL);
+
+ TRACE(("idn_nameprep_map(ctx=%s, from=\"%s\")\n",
+ handle->version, idn__debug_ucs4xstring(from, 50)));
+
+ while (*from != '\0') {
+ unsigned long v = *from;
+ const char *mapped;
+
+ if (v > UCS_MAX) {
+ /* This cannot happen, but just in case.. */
+ return (idn_invalid_codepoint);
+ } else if (v > UNICODE_MAX) {
+ /* No mapping is possible. */
+ mapped = NULL;
+ } else {
+ /* Try mapping. */
+ mapped = (*handle->map_proc)(v);
+ }
+
+ if (mapped == NULL) {
+ /* No mapping. Just copy verbatim. */
+ if (tolen < 1)
+ return (idn_buffer_overflow);
+ *to++ = v;
+ tolen--;
+ } else {
+ const unsigned char *mappeddata;
+ size_t mappedlen;
+
+ mappeddata = (const unsigned char *)mapped + 1;
+ mappedlen = *mapped;
+
+ if (tolen < (mappedlen + 3) / 4)
+ return (idn_buffer_overflow);
+ tolen -= (mappedlen + 3) / 4;
+ while (mappedlen >= 4) {
+ *to = *mappeddata++;
+ *to |= *mappeddata++ << 8;
+ *to |= *mappeddata++ << 16;
+ *to |= *mappeddata++ << 24;
+ mappedlen -= 4;
+ to++;
+ }
+ if (mappedlen > 0) {
+ *to = *mappeddata++;
+ *to |= (mappedlen >= 2) ?
+ *mappeddata++ << 8: 0;
+ *to |= (mappedlen >= 3) ?
+ *mappeddata++ << 16: 0;
+ to++;
+ }
+ }
+ from++;
+ }
+ if (tolen == 0)
+ return (idn_buffer_overflow);
+ *to = '\0';
+ return (idn_success);
+}
+
+idn_result_t
+idn_nameprep_isprohibited(idn_nameprep_t handle, const unsigned long *str,
+ const unsigned long **found) {
+ assert(handle != NULL && str != NULL && found != NULL);
+
+ TRACE(("idn_nameprep_isprohibited(ctx=%s, str=\"%s\")\n",
+ handle->version, idn__debug_ucs4xstring(str, 50)));
+
+ return (idn_nameprep_check(handle->prohibited_proc, str, found));
+}
+
+idn_result_t
+idn_nameprep_isunassigned(idn_nameprep_t handle, const unsigned long *str,
+ const unsigned long **found) {
+ assert(handle != NULL && str != NULL && found != NULL);
+
+ TRACE(("idn_nameprep_isunassigned(handle->version, str=\"%s\")\n",
+ handle->version, idn__debug_ucs4xstring(str, 50)));
+
+ return (idn_nameprep_check(handle->unassigned_proc, str, found));
+}
+
+static idn_result_t
+idn_nameprep_check(nameprep_checkproc proc, const unsigned long *str,
+ const unsigned long **found) {
+ unsigned long v;
+
+ while (*str != '\0') {
+ v = *str;
+
+ if (v > UCS_MAX) {
+ /* This cannot happen, but just in case.. */
+ return (idn_invalid_codepoint);
+ } else if (v > UNICODE_MAX) {
+ /* It is invalid.. */
+ *found = str;
+ return (idn_success);
+ } else if ((*proc)(v)) {
+ *found = str;
+ return (idn_success);
+ }
+ str++;
+ }
+ *found = NULL;
+ return (idn_success);
+}
+
+idn_result_t
+idn_nameprep_isvalidbidi(idn_nameprep_t handle, const unsigned long *str,
+ const unsigned long **found) {
+ unsigned long v;
+ idn_biditype_t first_char;
+ idn_biditype_t last_char;
+ int found_r_al;
+
+ assert(handle != NULL && str != NULL && found != NULL);
+
+ TRACE(("idn_nameprep_isvalidbidi(ctx=%s, str=\"%s\")\n",
+ handle->version, idn__debug_ucs4xstring(str, 50)));
+
+ if (*str == '\0') {
+ *found = NULL;
+ return (idn_success);
+ }
+
+ /*
+ * check first character's type and initialize variables.
+ */
+ found_r_al = 0;
+ if (*str > UCS_MAX) {
+ /* This cannot happen, but just in case.. */
+ return (idn_invalid_codepoint);
+ } else if (*str > UNICODE_MAX) {
+ /* It is invalid.. */
+ *found = str;
+ return (idn_success);
+ }
+ first_char = last_char = (*(handle->biditype_proc))(*str);
+ if (first_char == idn_biditype_r_al) {
+ found_r_al = 1;
+ }
+ str++;
+
+ /*
+ * see whether string is valid or not.
+ */
+ while (*str != '\0') {
+ v = *str;
+
+ if (v > UCS_MAX) {
+ /* This cannot happen, but just in case.. */
+ return (idn_invalid_codepoint);
+ } else if (v > UNICODE_MAX) {
+ /* It is invalid.. */
+ *found = str;
+ return (idn_success);
+ } else {
+ last_char = (*(handle->biditype_proc))(v);
+ if (found_r_al && last_char == idn_biditype_l) {
+ *found = str;
+ return (idn_success);
+ }
+ if (first_char != idn_biditype_r_al && last_char == idn_biditype_r_al) {
+ *found = str;
+ return (idn_success);
+ }
+ if (last_char == idn_biditype_r_al) {
+ found_r_al = 1;
+ }
+ }
+ str++;
+ }
+
+ if (found_r_al) {
+ if (last_char != idn_biditype_r_al) {
+ *found = str - 1;
+ return (idn_success);
+ }
+ }
+
+ *found = NULL;
+ return (idn_success);
+}
+
+idn_result_t
+idn_nameprep_createproc(const char *parameter, void **handlep) {
+ return idn_nameprep_create(parameter, (idn_nameprep_t *)handlep);
+}
+
+void
+idn_nameprep_destroyproc(void *handle) {
+ idn_nameprep_destroy((idn_nameprep_t)handle);
+}
+
+idn_result_t
+idn_nameprep_mapproc(void *handle, const unsigned long *from,
+ unsigned long *to, size_t tolen) {
+ return idn_nameprep_map((idn_nameprep_t)handle, from, to, tolen);
+}
+
+idn_result_t
+idn_nameprep_prohibitproc(void *handle, const unsigned long *str,
+ const unsigned long **found) {
+ return idn_nameprep_isprohibited((idn_nameprep_t)handle, str, found);
+}
+
+idn_result_t
+idn_nameprep_unassignedproc(void *handle, const unsigned long *str,
+ const unsigned long **found) {
+ return idn_nameprep_isunassigned((idn_nameprep_t)handle, str, found);
+}
+
+idn_result_t
+idn_nameprep_bidiproc(void *handle, const unsigned long *str,
+ const unsigned long **found) {
+ return idn_nameprep_isvalidbidi((idn_nameprep_t)handle, str, found);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/nameprep_template.c b/contrib/idn/idnkit-1.0-src/lib/nameprep_template.c
new file mode 100644
index 0000000..4003b16
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/nameprep_template.c
@@ -0,0 +1,137 @@
+/* $Id: nameprep_template.c,v 1.1.1.1 2003/06/04 00:25:57 marka Exp $ */
+
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+/*
+ * Include this file once for each version of NAMEPREP.
+ * VERSION should be defined to appropriate value before inclusion.
+ */
+
+#ifndef NAMEPREP_TEMPLATE_INIT
+#define NAMEPREP_TEMPLATE_INIT
+
+/* Symbol composition. */
+#define compose_sym2(a, b) compose_sym2X(a, b)
+#define compose_sym2X(a, b) a ## b
+#define compose_sym3(a, b, c) compose_sym3X(a, b, c)
+#define compose_sym3X(a, b, c) a ## b ## c
+
+/* Index calculation for multi-level index tables. */
+#define IDX0(type, v) IDX_0(v, BITS1(type), BITS2(type))
+#define IDX1(type, v) IDX_1(v, BITS1(type), BITS2(type))
+#define IDX2(type, v) IDX_2(v, BITS1(type), BITS2(type))
+
+#define IDX_0(v, bits1, bits2) ((v) >> ((bits1) + (bits2)))
+#define IDX_1(v, bits1, bits2) (((v) >> (bits2)) & ((1 << (bits1)) - 1))
+#define IDX_2(v, bits1, bits2) ((v) & ((1 << (bits2)) - 1))
+
+#define BITS1(type) type ## _BITS_1
+#define BITS2(type) type ## _BITS_2
+
+#endif /* NAMEPREP_TEMPLATE_INIT */
+
+static const char *
+compose_sym2(nameprep_map_, VERSION) (unsigned long v) {
+ int idx0 = IDX0(MAP, v);
+ int idx1 = IDX1(MAP, v);
+ int idx2 = IDX2(MAP, v);
+ int offset;
+
+#define IMAP compose_sym3(nameprep_, VERSION, _map_imap)
+#define TABLE compose_sym3(nameprep_, VERSION, _map_table)
+#define DATA compose_sym3(nameprep_, VERSION, _map_data)
+ offset = TABLE[IMAP[IMAP[idx0] + idx1]].tbl[idx2];
+ if (offset == 0)
+ return (NULL); /* no mapping */
+ return (const char *)(DATA + offset);
+#undef IMAP
+#undef TABLE
+#undef DATA
+}
+
+static int
+compose_sym2(nameprep_prohibited_, VERSION) (unsigned long v) {
+ int idx0 = IDX0(PROH, v);
+ int idx1 = IDX1(PROH, v);
+ int idx2 = IDX2(PROH, v);
+ const unsigned char *bm;
+
+#define IMAP compose_sym3(nameprep_, VERSION, _prohibited_imap)
+#define BITMAP compose_sym3(nameprep_, VERSION, _prohibited_bitmap)
+ bm = BITMAP[IMAP[IMAP[idx0] + idx1]].bm;
+ return (bm[idx2 / 8] & (1 << (idx2 % 8)));
+#undef IMAP
+#undef BITMAP
+}
+
+static int
+compose_sym2(nameprep_unassigned_, VERSION) (unsigned long v) {
+ int idx0 = IDX0(UNAS, v);
+ int idx1 = IDX1(UNAS, v);
+ int idx2 = IDX2(UNAS, v);
+ const unsigned char *bm;
+
+#define IMAP compose_sym3(nameprep_, VERSION, _unassigned_imap)
+#define BITMAP compose_sym3(nameprep_, VERSION, _unassigned_bitmap)
+ bm = BITMAP[IMAP[IMAP[idx0] + idx1]].bm;
+ return (bm[idx2 / 8] & (1 << (idx2 % 8)));
+#undef IMAP
+#undef BITMAP
+}
+
+static idn_biditype_t
+compose_sym2(nameprep_biditype_, VERSION) (unsigned long v) {
+ int idx0 = IDX0(BIDI, v);
+ int idx1 = IDX1(BIDI, v);
+ int idx2 = IDX2(BIDI, v);
+ int offset;
+
+#define IMAP compose_sym3(nameprep_, VERSION, _bidi_imap)
+#define TABLE compose_sym3(nameprep_, VERSION, _bidi_table)
+#define DATA compose_sym3(nameprep_, VERSION, _bidi_data)
+ offset = TABLE[IMAP[IMAP[idx0] + idx1]].tbl[idx2];
+ return DATA[offset];
+#undef IMAP
+#undef TABLE
+#undef DATA
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/nameprepdata.c b/contrib/idn/idnkit-1.0-src/lib/nameprepdata.c
new file mode 100644
index 0000000..35adb05
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/nameprepdata.c
@@ -0,0 +1,2546 @@
+/* $Id: nameprepdata.c,v 1.1.1.1 2003/06/04 00:26:05 marka Exp $ */
+/* $-Id: generate_nameprep_data.pl,v 1.9 2002/11/29 09:08:13 ishisone Exp -$ */
+/*
+ * Do not edit this file!
+ * This file is generated from NAMEPREP specification.
+ */
+
+#define MAP_BITS_0 9
+#define MAP_BITS_1 7
+#define MAP_BITS_2 5
+
+#define PROH_BITS_0 7
+#define PROH_BITS_1 7
+#define PROH_BITS_2 7
+
+#define UNAS_BITS_0 7
+#define UNAS_BITS_1 7
+#define UNAS_BITS_2 7
+
+#define BIDI_BITS_0 9
+#define BIDI_BITS_1 7
+#define BIDI_BITS_2 5
+
+static const unsigned short nameprep_rfc3491_map_imap[] = {
+ 272, 400, 528, 656, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 912,
+ 1040, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 1168, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 0, 0, 1, 0, 0, 2, 3, 0,
+ 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 0, 0, 0, 0, 0, 0,
+ 0, 0, 14, 15, 16, 17, 18, 19,
+ 20, 21, 0, 22, 23, 24, 25, 26,
+ 27, 28, 29, 0, 30, 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, 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, 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, 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, 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, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 31, 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, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 0, 0, 49, 0, 50, 0, 0,
+ 51, 52, 53, 54, 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, 55, 56, 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, 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, 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, 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, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 57, 58, 59, 60, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0,
+ 61, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 62, 0, 0, 0, 0, 0, 0, 63,
+ 0, 64, 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, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 65, 66, 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, 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, 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,
+ 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, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 67, 68, 69, 70, 71, 72, 73, 74,
+ 75, 76, 77, 78, 79, 67, 68, 69,
+ 70, 80, 81, 73, 74, 82, 83, 84,
+ 85, 86, 87, 88, 89, 90, 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,
+ 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, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+static const struct {
+ unsigned short tbl[32];
+} nameprep_rfc3491_map_table[] = {
+ {{
+ 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, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20,
+ 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42,
+ 44, 46, 48, 50, 52, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 54,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
+ 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99,
+ 101, 0, 103, 105, 107, 109, 111, 113, 115, 117,
+ }},
+ {{
+ 123, 0, 126, 0, 129, 0, 132, 0, 135, 0, 138,
+ 0, 141, 0, 144, 0, 147, 0, 150, 0, 153, 0,
+ 156, 0, 159, 0, 162, 0, 165, 0, 168, 0,
+ }},
+ {{
+ 171, 0, 174, 0, 177, 0, 180, 0, 183, 0, 186,
+ 0, 189, 0, 192, 0, 195, 0, 202, 0, 205, 0,
+ 208, 0, 0, 211, 0, 214, 0, 217, 0, 220,
+ }},
+ {{
+ 0, 223, 0, 226, 0, 229, 0, 232, 0, 235, 241,
+ 0, 244, 0, 247, 0, 250, 0, 253, 0, 256, 0,
+ 259, 0, 262, 0, 265, 0, 268, 0, 271, 0,
+ }},
+ {{
+ 274, 0, 277, 0, 280, 0, 283, 0, 286, 0, 289,
+ 0, 292, 0, 295, 0, 298, 0, 301, 0, 304, 0,
+ 307, 0, 310, 312, 0, 315, 0, 318, 0, 38,
+ }},
+ {{
+ 0, 321, 324, 0, 327, 0, 330, 333, 0, 336, 339,
+ 342, 0, 0, 345, 348, 351, 354, 0, 357, 360, 0,
+ 363, 366, 369, 0, 0, 0, 372, 375, 0, 378,
+ }},
+ {{
+ 381, 0, 384, 0, 387, 0, 390, 393, 0, 396, 0,
+ 0, 399, 0, 402, 405, 0, 408, 411, 414, 0, 417,
+ 0, 420, 423, 0, 0, 0, 426, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 429, 429, 0, 432, 432, 0, 435,
+ 435, 0, 438, 0, 441, 0, 444, 0, 447, 0, 450,
+ 0, 453, 0, 456, 0, 459, 0, 0, 462, 0,
+ }},
+ {{
+ 465, 0, 468, 0, 471, 0, 474, 0, 477, 0, 480,
+ 0, 483, 0, 486, 0, 489, 496, 496, 0, 499, 0,
+ 502, 505, 508, 0, 511, 0, 514, 0, 517, 0,
+ }},
+ {{
+ 520, 0, 523, 0, 526, 0, 529, 0, 532, 0, 535,
+ 0, 538, 0, 541, 0, 544, 0, 547, 0, 550, 0,
+ 553, 0, 556, 0, 559, 0, 562, 0, 565, 0,
+ }},
+ {{
+ 568, 0, 571, 0, 574, 0, 577, 0, 580, 0, 583,
+ 0, 586, 0, 589, 0, 592, 0, 595, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 598, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 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, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 601, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 608, 0, 611, 614, 617,
+ 0, 620, 0, 623, 626, 629, 640, 643, 646, 649, 652,
+ 655, 658, 661, 598, 664, 667, 54, 670, 673, 676,
+ }},
+ {{
+ 679, 682, 0, 685, 688, 691, 694, 697, 700, 703, 706,
+ 709, 0, 0, 0, 0, 712, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 685, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 643, 661, 691, 623, 709, 694,
+ 679, 0, 723, 0, 726, 0, 729, 0, 732, 0,
+ }},
+ {{
+ 735, 0, 738, 0, 741, 0, 744, 0, 747, 0, 750,
+ 0, 753, 0, 756, 0, 664, 682, 685, 0, 661, 652,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 759, 762, 765, 768, 771, 774, 777, 780, 783, 786, 789,
+ 792, 795, 798, 801, 804, 807, 810, 813, 816, 819, 822,
+ 825, 828, 831, 834, 837, 840, 843, 846, 849, 852,
+ }},
+ {{
+ 855, 858, 861, 864, 867, 870, 873, 876, 879, 882, 885,
+ 888, 891, 894, 897, 900, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 903, 0, 906, 0, 909, 0, 912, 0, 915, 0, 918,
+ 0, 921, 0, 924, 0, 927, 0, 930, 0, 933, 0,
+ 936, 0, 939, 0, 942, 0, 945, 0, 948, 0,
+ }},
+ {{
+ 951, 0, 0, 0, 0, 0, 0, 0, 0, 0, 954,
+ 0, 957, 0, 960, 0, 963, 0, 966, 0, 969, 0,
+ 972, 0, 975, 0, 978, 0, 981, 0, 984, 0,
+ }},
+ {{
+ 987, 0, 990, 0, 993, 0, 996, 0, 999, 0, 1002,
+ 0, 1005, 0, 1008, 0, 1011, 0, 1014, 0, 1017, 0,
+ 1020, 0, 1023, 0, 1026, 0, 1029, 0, 1032, 0,
+ }},
+ {{
+ 0, 1035, 0, 1038, 0, 1041, 0, 1044, 0, 1047, 0,
+ 1050, 0, 1053, 0, 0, 1056, 0, 1059, 0, 1062, 0,
+ 1065, 0, 1068, 0, 1071, 0, 1074, 0, 1077, 0,
+ }},
+ {{
+ 1080, 0, 1083, 0, 1086, 0, 1089, 0, 1092, 0, 1095,
+ 0, 1098, 0, 1101, 0, 1104, 0, 1107, 0, 1110, 0,
+ 0, 0, 1113, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1116, 0, 1119, 0, 1122, 0, 1125, 0, 1128, 0, 1131,
+ 0, 1134, 0, 1137, 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, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1140, 1143, 1146, 1149, 1152,
+ 1155, 1158, 1161, 1164, 1167, 1170, 1173, 1176, 1179, 1182,
+ }},
+ {{
+ 1185, 1188, 1191, 1194, 1197, 1200, 1203, 1206, 1209, 1212, 1215,
+ 1218, 1221, 1224, 1227, 1230, 1233, 1236, 1239, 1242, 1245, 1248,
+ 1251, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 1254, 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, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1261, 0, 1264, 0, 1267, 0, 1270, 0, 1273, 0, 1276,
+ 0, 1279, 0, 1282, 0, 1285, 0, 1288, 0, 1291, 0,
+ 1294, 0, 1297, 0, 1300, 0, 1303, 0, 1306, 0,
+ }},
+ {{
+ 1309, 0, 1312, 0, 1315, 0, 1318, 0, 1321, 0, 1324,
+ 0, 1327, 0, 1330, 0, 1333, 0, 1336, 0, 1339, 0,
+ 1342, 0, 1345, 0, 1348, 0, 1351, 0, 1354, 0,
+ }},
+ {{
+ 1357, 0, 1360, 0, 1363, 0, 1366, 0, 1369, 0, 1372,
+ 0, 1375, 0, 1378, 0, 1381, 0, 1384, 0, 1387, 0,
+ 1390, 0, 1393, 0, 1396, 0, 1399, 0, 1402, 0,
+ }},
+ {{
+ 1405, 0, 1408, 0, 1411, 0, 1414, 0, 1417, 0, 1420,
+ 0, 1423, 0, 1426, 0, 1429, 0, 1432, 0, 1435, 0,
+ 1438, 0, 1441, 0, 1444, 0, 1447, 0, 1450, 0,
+ }},
+ {{
+ 1453, 0, 1456, 0, 1459, 0, 1462, 0, 1465, 0, 1468,
+ 0, 1471, 0, 1474, 0, 1477, 0, 1480, 0, 1483, 0,
+ 1486, 1493, 1500, 1507, 1514, 1405, 0, 0, 0, 0,
+ }},
+ {{
+ 1521, 0, 1524, 0, 1527, 0, 1530, 0, 1533, 0, 1536,
+ 0, 1539, 0, 1542, 0, 1545, 0, 1548, 0, 1551, 0,
+ 1554, 0, 1557, 0, 1560, 0, 1563, 0, 1566, 0,
+ }},
+ {{
+ 1569, 0, 1572, 0, 1575, 0, 1578, 0, 1581, 0, 1584,
+ 0, 1587, 0, 1590, 0, 1593, 0, 1596, 0, 1599, 0,
+ 1602, 0, 1605, 0, 1608, 0, 1611, 0, 1614, 0,
+ }},
+ {{
+ 1617, 0, 1620, 0, 1623, 0, 1626, 0, 1629, 0, 1632,
+ 0, 1635, 0, 1638, 0, 1641, 0, 1644, 0, 1647, 0,
+ 1650, 0, 1653, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 1656, 1659, 1662,
+ 1665, 1668, 1671, 1674, 1677, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1680, 1683, 1686, 1689, 1692, 1695, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 1698, 1701, 1704,
+ 1707, 1710, 1713, 1716, 1719, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1722, 1725, 1728, 1731, 1734, 1737, 1740, 1743,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 1746, 1749, 1752,
+ 1755, 1758, 1761, 0, 0, 1764, 0, 1771, 0, 1782, 0,
+ 1793, 0, 0, 1804, 0, 1807, 0, 1810, 0, 1813,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 1816, 1819, 1822,
+ 1825, 1828, 1831, 1834, 1837, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1840, 1847, 1854, 1861, 1868, 1875, 1882, 1889, 1840, 1847, 1854,
+ 1861, 1868, 1875, 1882, 1889, 1896, 1903, 1910, 1917, 1924, 1931,
+ 1938, 1945, 1896, 1903, 1910, 1917, 1924, 1931, 1938, 1945,
+ }},
+ {{
+ 1952, 1959, 1966, 1973, 1980, 1987, 1994, 2001, 1952, 1959, 1966,
+ 1973, 1980, 1987, 1994, 2001, 0, 0, 2008, 2015, 2022, 0,
+ 2029, 2036, 2047, 2050, 2053, 2056, 2015, 0, 598, 0,
+ }},
+ {{
+ 0, 0, 2059, 2066, 2073, 0, 2080, 2087, 2098, 2101, 2104,
+ 2107, 2066, 0, 0, 0, 0, 0, 2110, 629, 0, 0,
+ 2121, 2128, 2139, 2142, 2145, 2148, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 2151, 712, 2162, 0, 2169, 2176, 2187, 2190, 2193,
+ 2196, 2199, 0, 0, 0, 0, 0, 2202, 2209, 2216, 0,
+ 2223, 2230, 2241, 2244, 2247, 2250, 2209, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1, 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, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 2253, 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, 6, 2259, 0, 0, 0, 351, 0, 2265, 0,
+ 16, 16, 16, 0, 0, 18, 18, 24, 0, 0, 28,
+ 2271, 0, 0, 32, 34, 36, 36, 36, 0, 0,
+ }},
+ {{
+ 2277, 2283, 2293, 0, 52, 0, 703, 0, 52, 0, 22,
+ 67, 4, 6, 0, 0, 10, 12, 0, 26, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 646, 679,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 8, 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,
+ }},
+ {{
+ 2299, 2302, 2305, 2308, 2311, 2314, 2317, 2320, 2323, 2326, 2329,
+ 2332, 2335, 2338, 2341, 2344, 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, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 2347, 2350, 2353, 2356, 2359, 2362, 2365, 2368, 2371, 2374,
+ }},
+ {{
+ 2377, 2380, 2383, 2386, 2389, 2392, 2395, 2398, 2401, 2404, 2407,
+ 2410, 2413, 2416, 2419, 2422, 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, 0,
+ 0, 0, 0, 0, 0, 0, 2425, 0, 2435, 0, 2441,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2447, 2453, 2459, 2465, 2471, 2477, 2483, 2489, 0, 0, 2495,
+ 2501, 2507, 0, 0, 0, 2513, 2519, 2529, 2539, 2549, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2447, 2559,
+ 2569, 2579, 0, 0, 0, 0, 0, 0, 0, 2589, 2595,
+ 2601, 2607, 2613, 2607, 2619, 2625, 2631, 2637, 2643, 2637,
+ }},
+ {{
+ 2649, 2656, 0, 2663, 0, 0, 2669, 2683, 2693, 2699, 0,
+ 2705, 0, 2711, 2717, 0, 0, 0, 0, 0, 0, 0,
+ 0, 2723, 0, 2729, 2739, 0, 2745, 2751, 0, 0,
+ }},
+ {{
+ 2757, 2763, 2769, 2775, 2785, 2795, 2795, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2801, 2808, 2815,
+ 2822, 2829, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 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, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ }},
+ {{
+ 0, 2836, 2839, 2842, 2845, 2848, 2851, 2854, 2857, 2860, 2863,
+ 2866, 2869, 2872, 2875, 2878, 2881, 2884, 2887, 2890, 2893, 2896,
+ 2899, 2902, 2905, 2908, 2911, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2914, 2918, 2922, 2926, 2930, 2934, 2938, 2942, 2946, 2950, 2954,
+ 2958, 2962, 2966, 2970, 2974, 2978, 2982, 2986, 2990, 2994, 2998,
+ 3002, 3006, 3010, 3014, 3018, 3022, 3026, 3030, 3034, 3038,
+ }},
+ {{
+ 3042, 3046, 3050, 3054, 3058, 3062, 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,
+ }},
+ {{
+ 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22,
+ 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44,
+ 46, 48, 50, 52, 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, 2, 4,
+ 6, 8, 10, 12, 14, 16, 18, 20, 22, 24,
+ }},
+ {{
+ 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46,
+ 48, 50, 52, 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, 2, 4, 6,
+ 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28,
+ 30, 32, 34, 36, 38, 40, 42, 44, 46, 48,
+ }},
+ {{
+ 50, 52, 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, 2, 0, 6, 8,
+ }},
+ {{
+ 0, 0, 14, 0, 0, 20, 22, 0, 0, 28, 30,
+ 32, 34, 0, 38, 40, 42, 44, 46, 48, 50, 52,
+ 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, 2, 4, 6, 8, 10, 12,
+ 14, 16, 18, 20, 22, 24, 26, 28, 30, 32,
+ }},
+ {{
+ 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 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, 2, 4, 0, 8, 10, 12, 14,
+ 0, 0, 20, 22, 24, 26, 28, 30, 32, 34, 0,
+ 38, 40, 42, 44, 46, 48, 50, 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, 0, 2, 4, 0, 8, 10, 12, 14, 0,
+ }},
+ {{
+ 18, 20, 22, 24, 26, 0, 30, 0, 0, 0, 38,
+ 40, 42, 44, 46, 48, 50, 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,
+ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20,
+ 22, 24, 26, 28, 30, 32, 34, 36, 38, 40,
+ }},
+ {{
+ 42, 44, 46, 48, 50, 52, 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,
+ }},
+ {{
+ 50, 52, 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, 2, 4, 6, 8,
+ }},
+ {{
+ 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30,
+ 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 640, 643, 646,
+ 649, 652, 655, 658, 661, 598, 664, 667, 54, 670, 673,
+ 676, 679, 682, 661, 685, 688, 691, 694, 697, 700,
+ }},
+ {{
+ 703, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 685, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 640, 643, 646, 649, 652, 655, 658, 661, 598,
+ 664, 667, 54, 670, 673, 676, 679, 682, 661, 685, 688,
+ 691, 694, 697, 700, 703, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 685, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 640, 643, 646, 649,
+ }},
+ {{
+ 652, 655, 658, 661, 598, 664, 667, 54, 670, 673, 676,
+ 679, 682, 661, 685, 688, 691, 694, 697, 700, 703, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 685, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 640, 643, 646, 649, 652, 655, 658, 661, 598, 664,
+ }},
+ {{
+ 667, 54, 670, 673, 676, 679, 682, 661, 685, 688, 691,
+ 694, 697, 700, 703, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 685, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 640, 643, 646, 649, 652, 655,
+ 658, 661, 598, 664, 667, 54, 670, 673, 676, 679,
+ }},
+ {{
+ 682, 661, 685, 688, 691, 694, 697, 700, 703, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 685, 0, 0, 0, 0,
+ }},
+};
+
+static const unsigned char nameprep_rfc3491_map_data[] = {
+ 0, 0, 1, 97, 1, 98, 1, 99, 1, 100, 1, 101,
+ 1, 102, 1, 103, 1, 104, 1, 105, 1, 106, 1, 107,
+ 1, 108, 1, 109, 1, 110, 1, 111, 1, 112, 1, 113,
+ 1, 114, 1, 115, 1, 116, 1, 117, 1, 118, 1, 119,
+ 1, 120, 1, 121, 1, 122, 2, 188, 3, 1, 224, 1,
+ 225, 1, 226, 1, 227, 1, 228, 1, 229, 1, 230, 1,
+ 231, 1, 232, 1, 233, 1, 234, 1, 235, 1, 236, 1,
+ 237, 1, 238, 1, 239, 1, 240, 1, 241, 1, 242, 1,
+ 243, 1, 244, 1, 245, 1, 246, 1, 248, 1, 249, 1,
+ 250, 1, 251, 1, 252, 1, 253, 1, 254, 5, 115, 0,
+ 0, 0, 115, 2, 1, 1, 2, 3, 1, 2, 5, 1,
+ 2, 7, 1, 2, 9, 1, 2, 11, 1, 2, 13, 1,
+ 2, 15, 1, 2, 17, 1, 2, 19, 1, 2, 21, 1,
+ 2, 23, 1, 2, 25, 1, 2, 27, 1, 2, 29, 1,
+ 2, 31, 1, 2, 33, 1, 2, 35, 1, 2, 37, 1,
+ 2, 39, 1, 2, 41, 1, 2, 43, 1, 2, 45, 1,
+ 2, 47, 1, 6, 105, 0, 0, 0, 7, 3, 2, 51,
+ 1, 2, 53, 1, 2, 55, 1, 2, 58, 1, 2, 60,
+ 1, 2, 62, 1, 2, 64, 1, 2, 66, 1, 2, 68,
+ 1, 2, 70, 1, 2, 72, 1, 5, 188, 2, 0, 0,
+ 110, 2, 75, 1, 2, 77, 1, 2, 79, 1, 2, 81,
+ 1, 2, 83, 1, 2, 85, 1, 2, 87, 1, 2, 89,
+ 1, 2, 91, 1, 2, 93, 1, 2, 95, 1, 2, 97,
+ 1, 2, 99, 1, 2, 101, 1, 2, 103, 1, 2, 105,
+ 1, 2, 107, 1, 2, 109, 1, 2, 111, 1, 2, 113,
+ 1, 2, 115, 1, 2, 117, 1, 2, 119, 1, 1, 255,
+ 2, 122, 1, 2, 124, 1, 2, 126, 1, 2, 83, 2,
+ 2, 131, 1, 2, 133, 1, 2, 84, 2, 2, 136, 1,
+ 2, 86, 2, 2, 87, 2, 2, 140, 1, 2, 221, 1,
+ 2, 89, 2, 2, 91, 2, 2, 146, 1, 2, 96, 2,
+ 2, 99, 2, 2, 105, 2, 2, 104, 2, 2, 153, 1,
+ 2, 111, 2, 2, 114, 2, 2, 117, 2, 2, 161, 1,
+ 2, 163, 1, 2, 165, 1, 2, 128, 2, 2, 168, 1,
+ 2, 131, 2, 2, 173, 1, 2, 136, 2, 2, 176, 1,
+ 2, 138, 2, 2, 139, 2, 2, 180, 1, 2, 182, 1,
+ 2, 146, 2, 2, 185, 1, 2, 189, 1, 2, 198, 1,
+ 2, 201, 1, 2, 204, 1, 2, 206, 1, 2, 208, 1,
+ 2, 210, 1, 2, 212, 1, 2, 214, 1, 2, 216, 1,
+ 2, 218, 1, 2, 220, 1, 2, 223, 1, 2, 225, 1,
+ 2, 227, 1, 2, 229, 1, 2, 231, 1, 2, 233, 1,
+ 2, 235, 1, 2, 237, 1, 2, 239, 1, 6, 106, 0,
+ 0, 0, 12, 3, 2, 243, 1, 2, 245, 1, 2, 149,
+ 1, 2, 191, 1, 2, 249, 1, 2, 251, 1, 2, 253,
+ 1, 2, 255, 1, 2, 1, 2, 2, 3, 2, 2, 5,
+ 2, 2, 7, 2, 2, 9, 2, 2, 11, 2, 2, 13,
+ 2, 2, 15, 2, 2, 17, 2, 2, 19, 2, 2, 21,
+ 2, 2, 23, 2, 2, 25, 2, 2, 27, 2, 2, 29,
+ 2, 2, 31, 2, 2, 158, 1, 2, 35, 2, 2, 37,
+ 2, 2, 39, 2, 2, 41, 2, 2, 43, 2, 2, 45,
+ 2, 2, 47, 2, 2, 49, 2, 2, 51, 2, 2, 185,
+ 3, 6, 32, 0, 0, 0, 185, 3, 2, 172, 3, 2,
+ 173, 3, 2, 174, 3, 2, 175, 3, 2, 204, 3, 2,
+ 205, 3, 2, 206, 3, 10, 185, 3, 0, 0, 8, 3,
+ 0, 0, 1, 3, 2, 177, 3, 2, 178, 3, 2, 179,
+ 3, 2, 180, 3, 2, 181, 3, 2, 182, 3, 2, 183,
+ 3, 2, 184, 3, 2, 186, 3, 2, 187, 3, 2, 189,
+ 3, 2, 190, 3, 2, 191, 3, 2, 192, 3, 2, 193,
+ 3, 2, 195, 3, 2, 196, 3, 2, 197, 3, 2, 198,
+ 3, 2, 199, 3, 2, 200, 3, 2, 201, 3, 2, 202,
+ 3, 2, 203, 3, 10, 197, 3, 0, 0, 8, 3, 0,
+ 0, 1, 3, 2, 217, 3, 2, 219, 3, 2, 221, 3,
+ 2, 223, 3, 2, 225, 3, 2, 227, 3, 2, 229, 3,
+ 2, 231, 3, 2, 233, 3, 2, 235, 3, 2, 237, 3,
+ 2, 239, 3, 2, 80, 4, 2, 81, 4, 2, 82, 4,
+ 2, 83, 4, 2, 84, 4, 2, 85, 4, 2, 86, 4,
+ 2, 87, 4, 2, 88, 4, 2, 89, 4, 2, 90, 4,
+ 2, 91, 4, 2, 92, 4, 2, 93, 4, 2, 94, 4,
+ 2, 95, 4, 2, 48, 4, 2, 49, 4, 2, 50, 4,
+ 2, 51, 4, 2, 52, 4, 2, 53, 4, 2, 54, 4,
+ 2, 55, 4, 2, 56, 4, 2, 57, 4, 2, 58, 4,
+ 2, 59, 4, 2, 60, 4, 2, 61, 4, 2, 62, 4,
+ 2, 63, 4, 2, 64, 4, 2, 65, 4, 2, 66, 4,
+ 2, 67, 4, 2, 68, 4, 2, 69, 4, 2, 70, 4,
+ 2, 71, 4, 2, 72, 4, 2, 73, 4, 2, 74, 4,
+ 2, 75, 4, 2, 76, 4, 2, 77, 4, 2, 78, 4,
+ 2, 79, 4, 2, 97, 4, 2, 99, 4, 2, 101, 4,
+ 2, 103, 4, 2, 105, 4, 2, 107, 4, 2, 109, 4,
+ 2, 111, 4, 2, 113, 4, 2, 115, 4, 2, 117, 4,
+ 2, 119, 4, 2, 121, 4, 2, 123, 4, 2, 125, 4,
+ 2, 127, 4, 2, 129, 4, 2, 139, 4, 2, 141, 4,
+ 2, 143, 4, 2, 145, 4, 2, 147, 4, 2, 149, 4,
+ 2, 151, 4, 2, 153, 4, 2, 155, 4, 2, 157, 4,
+ 2, 159, 4, 2, 161, 4, 2, 163, 4, 2, 165, 4,
+ 2, 167, 4, 2, 169, 4, 2, 171, 4, 2, 173, 4,
+ 2, 175, 4, 2, 177, 4, 2, 179, 4, 2, 181, 4,
+ 2, 183, 4, 2, 185, 4, 2, 187, 4, 2, 189, 4,
+ 2, 191, 4, 2, 194, 4, 2, 196, 4, 2, 198, 4,
+ 2, 200, 4, 2, 202, 4, 2, 204, 4, 2, 206, 4,
+ 2, 209, 4, 2, 211, 4, 2, 213, 4, 2, 215, 4,
+ 2, 217, 4, 2, 219, 4, 2, 221, 4, 2, 223, 4,
+ 2, 225, 4, 2, 227, 4, 2, 229, 4, 2, 231, 4,
+ 2, 233, 4, 2, 235, 4, 2, 237, 4, 2, 239, 4,
+ 2, 241, 4, 2, 243, 4, 2, 245, 4, 2, 249, 4,
+ 2, 1, 5, 2, 3, 5, 2, 5, 5, 2, 7, 5,
+ 2, 9, 5, 2, 11, 5, 2, 13, 5, 2, 15, 5,
+ 2, 97, 5, 2, 98, 5, 2, 99, 5, 2, 100, 5,
+ 2, 101, 5, 2, 102, 5, 2, 103, 5, 2, 104, 5,
+ 2, 105, 5, 2, 106, 5, 2, 107, 5, 2, 108, 5,
+ 2, 109, 5, 2, 110, 5, 2, 111, 5, 2, 112, 5,
+ 2, 113, 5, 2, 114, 5, 2, 115, 5, 2, 116, 5,
+ 2, 117, 5, 2, 118, 5, 2, 119, 5, 2, 120, 5,
+ 2, 121, 5, 2, 122, 5, 2, 123, 5, 2, 124, 5,
+ 2, 125, 5, 2, 126, 5, 2, 127, 5, 2, 128, 5,
+ 2, 129, 5, 2, 130, 5, 2, 131, 5, 2, 132, 5,
+ 2, 133, 5, 2, 134, 5, 6, 101, 5, 0, 0, 130,
+ 5, 2, 1, 30, 2, 3, 30, 2, 5, 30, 2, 7,
+ 30, 2, 9, 30, 2, 11, 30, 2, 13, 30, 2, 15,
+ 30, 2, 17, 30, 2, 19, 30, 2, 21, 30, 2, 23,
+ 30, 2, 25, 30, 2, 27, 30, 2, 29, 30, 2, 31,
+ 30, 2, 33, 30, 2, 35, 30, 2, 37, 30, 2, 39,
+ 30, 2, 41, 30, 2, 43, 30, 2, 45, 30, 2, 47,
+ 30, 2, 49, 30, 2, 51, 30, 2, 53, 30, 2, 55,
+ 30, 2, 57, 30, 2, 59, 30, 2, 61, 30, 2, 63,
+ 30, 2, 65, 30, 2, 67, 30, 2, 69, 30, 2, 71,
+ 30, 2, 73, 30, 2, 75, 30, 2, 77, 30, 2, 79,
+ 30, 2, 81, 30, 2, 83, 30, 2, 85, 30, 2, 87,
+ 30, 2, 89, 30, 2, 91, 30, 2, 93, 30, 2, 95,
+ 30, 2, 97, 30, 2, 99, 30, 2, 101, 30, 2, 103,
+ 30, 2, 105, 30, 2, 107, 30, 2, 109, 30, 2, 111,
+ 30, 2, 113, 30, 2, 115, 30, 2, 117, 30, 2, 119,
+ 30, 2, 121, 30, 2, 123, 30, 2, 125, 30, 2, 127,
+ 30, 2, 129, 30, 2, 131, 30, 2, 133, 30, 2, 135,
+ 30, 2, 137, 30, 2, 139, 30, 2, 141, 30, 2, 143,
+ 30, 2, 145, 30, 2, 147, 30, 2, 149, 30, 6, 104,
+ 0, 0, 0, 49, 3, 6, 116, 0, 0, 0, 8, 3,
+ 6, 119, 0, 0, 0, 10, 3, 6, 121, 0, 0, 0,
+ 10, 3, 6, 97, 0, 0, 0, 190, 2, 2, 161, 30,
+ 2, 163, 30, 2, 165, 30, 2, 167, 30, 2, 169, 30,
+ 2, 171, 30, 2, 173, 30, 2, 175, 30, 2, 177, 30,
+ 2, 179, 30, 2, 181, 30, 2, 183, 30, 2, 185, 30,
+ 2, 187, 30, 2, 189, 30, 2, 191, 30, 2, 193, 30,
+ 2, 195, 30, 2, 197, 30, 2, 199, 30, 2, 201, 30,
+ 2, 203, 30, 2, 205, 30, 2, 207, 30, 2, 209, 30,
+ 2, 211, 30, 2, 213, 30, 2, 215, 30, 2, 217, 30,
+ 2, 219, 30, 2, 221, 30, 2, 223, 30, 2, 225, 30,
+ 2, 227, 30, 2, 229, 30, 2, 231, 30, 2, 233, 30,
+ 2, 235, 30, 2, 237, 30, 2, 239, 30, 2, 241, 30,
+ 2, 243, 30, 2, 245, 30, 2, 247, 30, 2, 249, 30,
+ 2, 0, 31, 2, 1, 31, 2, 2, 31, 2, 3, 31,
+ 2, 4, 31, 2, 5, 31, 2, 6, 31, 2, 7, 31,
+ 2, 16, 31, 2, 17, 31, 2, 18, 31, 2, 19, 31,
+ 2, 20, 31, 2, 21, 31, 2, 32, 31, 2, 33, 31,
+ 2, 34, 31, 2, 35, 31, 2, 36, 31, 2, 37, 31,
+ 2, 38, 31, 2, 39, 31, 2, 48, 31, 2, 49, 31,
+ 2, 50, 31, 2, 51, 31, 2, 52, 31, 2, 53, 31,
+ 2, 54, 31, 2, 55, 31, 2, 64, 31, 2, 65, 31,
+ 2, 66, 31, 2, 67, 31, 2, 68, 31, 2, 69, 31,
+ 6, 197, 3, 0, 0, 19, 3, 10, 197, 3, 0, 0,
+ 19, 3, 0, 0, 0, 3, 10, 197, 3, 0, 0, 19,
+ 3, 0, 0, 1, 3, 10, 197, 3, 0, 0, 19, 3,
+ 0, 0, 66, 3, 2, 81, 31, 2, 83, 31, 2, 85,
+ 31, 2, 87, 31, 2, 96, 31, 2, 97, 31, 2, 98,
+ 31, 2, 99, 31, 2, 100, 31, 2, 101, 31, 2, 102,
+ 31, 2, 103, 31, 6, 0, 31, 0, 0, 185, 3, 6,
+ 1, 31, 0, 0, 185, 3, 6, 2, 31, 0, 0, 185,
+ 3, 6, 3, 31, 0, 0, 185, 3, 6, 4, 31, 0,
+ 0, 185, 3, 6, 5, 31, 0, 0, 185, 3, 6, 6,
+ 31, 0, 0, 185, 3, 6, 7, 31, 0, 0, 185, 3,
+ 6, 32, 31, 0, 0, 185, 3, 6, 33, 31, 0, 0,
+ 185, 3, 6, 34, 31, 0, 0, 185, 3, 6, 35, 31,
+ 0, 0, 185, 3, 6, 36, 31, 0, 0, 185, 3, 6,
+ 37, 31, 0, 0, 185, 3, 6, 38, 31, 0, 0, 185,
+ 3, 6, 39, 31, 0, 0, 185, 3, 6, 96, 31, 0,
+ 0, 185, 3, 6, 97, 31, 0, 0, 185, 3, 6, 98,
+ 31, 0, 0, 185, 3, 6, 99, 31, 0, 0, 185, 3,
+ 6, 100, 31, 0, 0, 185, 3, 6, 101, 31, 0, 0,
+ 185, 3, 6, 102, 31, 0, 0, 185, 3, 6, 103, 31,
+ 0, 0, 185, 3, 6, 112, 31, 0, 0, 185, 3, 6,
+ 177, 3, 0, 0, 185, 3, 6, 172, 3, 0, 0, 185,
+ 3, 6, 177, 3, 0, 0, 66, 3, 10, 177, 3, 0,
+ 0, 66, 3, 0, 0, 185, 3, 2, 176, 31, 2, 177,
+ 31, 2, 112, 31, 2, 113, 31, 6, 116, 31, 0, 0,
+ 185, 3, 6, 183, 3, 0, 0, 185, 3, 6, 174, 3,
+ 0, 0, 185, 3, 6, 183, 3, 0, 0, 66, 3, 10,
+ 183, 3, 0, 0, 66, 3, 0, 0, 185, 3, 2, 114,
+ 31, 2, 115, 31, 2, 116, 31, 2, 117, 31, 10, 185,
+ 3, 0, 0, 8, 3, 0, 0, 0, 3, 6, 185, 3,
+ 0, 0, 66, 3, 10, 185, 3, 0, 0, 8, 3, 0,
+ 0, 66, 3, 2, 208, 31, 2, 209, 31, 2, 118, 31,
+ 2, 119, 31, 10, 197, 3, 0, 0, 8, 3, 0, 0,
+ 0, 3, 6, 193, 3, 0, 0, 19, 3, 6, 197, 3,
+ 0, 0, 66, 3, 10, 197, 3, 0, 0, 8, 3, 0,
+ 0, 66, 3, 2, 224, 31, 2, 225, 31, 2, 122, 31,
+ 2, 123, 31, 2, 229, 31, 6, 124, 31, 0, 0, 185,
+ 3, 6, 201, 3, 0, 0, 185, 3, 6, 206, 3, 0,
+ 0, 185, 3, 6, 201, 3, 0, 0, 66, 3, 10, 201,
+ 3, 0, 0, 66, 3, 0, 0, 185, 3, 2, 120, 31,
+ 2, 121, 31, 2, 124, 31, 2, 125, 31, 5, 114, 0,
+ 0, 0, 115, 5, 176, 0, 0, 0, 99, 5, 176, 0,
+ 0, 0, 102, 5, 110, 0, 0, 0, 111, 5, 115, 0,
+ 0, 0, 109, 9, 116, 0, 0, 0, 101, 0, 0, 0,
+ 108, 5, 116, 0, 0, 0, 109, 2, 112, 33, 2, 113,
+ 33, 2, 114, 33, 2, 115, 33, 2, 116, 33, 2, 117,
+ 33, 2, 118, 33, 2, 119, 33, 2, 120, 33, 2, 121,
+ 33, 2, 122, 33, 2, 123, 33, 2, 124, 33, 2, 125,
+ 33, 2, 126, 33, 2, 127, 33, 2, 208, 36, 2, 209,
+ 36, 2, 210, 36, 2, 211, 36, 2, 212, 36, 2, 213,
+ 36, 2, 214, 36, 2, 215, 36, 2, 216, 36, 2, 217,
+ 36, 2, 218, 36, 2, 219, 36, 2, 220, 36, 2, 221,
+ 36, 2, 222, 36, 2, 223, 36, 2, 224, 36, 2, 225,
+ 36, 2, 226, 36, 2, 227, 36, 2, 228, 36, 2, 229,
+ 36, 2, 230, 36, 2, 231, 36, 2, 232, 36, 2, 233,
+ 36, 9, 104, 0, 0, 0, 112, 0, 0, 0, 97, 5,
+ 97, 0, 0, 0, 117, 5, 111, 0, 0, 0, 118, 5,
+ 112, 0, 0, 0, 97, 5, 110, 0, 0, 0, 97, 5,
+ 188, 3, 0, 0, 97, 5, 109, 0, 0, 0, 97, 5,
+ 107, 0, 0, 0, 97, 5, 107, 0, 0, 0, 98, 5,
+ 109, 0, 0, 0, 98, 5, 103, 0, 0, 0, 98, 5,
+ 112, 0, 0, 0, 102, 5, 110, 0, 0, 0, 102, 5,
+ 188, 3, 0, 0, 102, 5, 104, 0, 0, 0, 122, 9,
+ 107, 0, 0, 0, 104, 0, 0, 0, 122, 9, 109, 0,
+ 0, 0, 104, 0, 0, 0, 122, 9, 103, 0, 0, 0,
+ 104, 0, 0, 0, 122, 9, 116, 0, 0, 0, 104, 0,
+ 0, 0, 122, 9, 107, 0, 0, 0, 112, 0, 0, 0,
+ 97, 9, 109, 0, 0, 0, 112, 0, 0, 0, 97, 9,
+ 103, 0, 0, 0, 112, 0, 0, 0, 97, 5, 112, 0,
+ 0, 0, 118, 5, 110, 0, 0, 0, 118, 5, 188, 3,
+ 0, 0, 118, 5, 109, 0, 0, 0, 118, 5, 107, 0,
+ 0, 0, 118, 5, 112, 0, 0, 0, 119, 5, 110, 0,
+ 0, 0, 119, 5, 188, 3, 0, 0, 119, 5, 109, 0,
+ 0, 0, 119, 5, 107, 0, 0, 0, 119, 6, 107, 0,
+ 0, 0, 201, 3, 6, 109, 0, 0, 0, 201, 3, 5,
+ 98, 0, 0, 0, 113, 13, 99, 0, 0, 0, 21, 34,
+ 0, 0, 107, 0, 0, 0, 103, 9, 99, 0, 0, 0,
+ 111, 0, 0, 0, 46, 5, 100, 0, 0, 0, 98, 5,
+ 103, 0, 0, 0, 121, 5, 104, 0, 0, 0, 112, 5,
+ 107, 0, 0, 0, 107, 5, 107, 0, 0, 0, 109, 5,
+ 112, 0, 0, 0, 104, 9, 112, 0, 0, 0, 112, 0,
+ 0, 0, 109, 5, 112, 0, 0, 0, 114, 5, 115, 0,
+ 0, 0, 118, 5, 119, 0, 0, 0, 98, 5, 102, 0,
+ 0, 0, 102, 5, 102, 0, 0, 0, 105, 5, 102, 0,
+ 0, 0, 108, 9, 102, 0, 0, 0, 102, 0, 0, 0,
+ 105, 9, 102, 0, 0, 0, 102, 0, 0, 0, 108, 5,
+ 115, 0, 0, 0, 116, 6, 116, 5, 0, 0, 118, 5,
+ 6, 116, 5, 0, 0, 101, 5, 6, 116, 5, 0, 0,
+ 107, 5, 6, 126, 5, 0, 0, 118, 5, 6, 116, 5,
+ 0, 0, 109, 5, 2, 65, 255, 2, 66, 255, 2, 67,
+ 255, 2, 68, 255, 2, 69, 255, 2, 70, 255, 2, 71,
+ 255, 2, 72, 255, 2, 73, 255, 2, 74, 255, 2, 75,
+ 255, 2, 76, 255, 2, 77, 255, 2, 78, 255, 2, 79,
+ 255, 2, 80, 255, 2, 81, 255, 2, 82, 255, 2, 83,
+ 255, 2, 84, 255, 2, 85, 255, 2, 86, 255, 2, 87,
+ 255, 2, 88, 255, 2, 89, 255, 2, 90, 255, 3, 40,
+ 4, 1, 3, 41, 4, 1, 3, 42, 4, 1, 3, 43,
+ 4, 1, 3, 44, 4, 1, 3, 45, 4, 1, 3, 46,
+ 4, 1, 3, 47, 4, 1, 3, 48, 4, 1, 3, 49,
+ 4, 1, 3, 50, 4, 1, 3, 51, 4, 1, 3, 52,
+ 4, 1, 3, 53, 4, 1, 3, 54, 4, 1, 3, 55,
+ 4, 1, 3, 56, 4, 1, 3, 57, 4, 1, 3, 58,
+ 4, 1, 3, 59, 4, 1, 3, 60, 4, 1, 3, 61,
+ 4, 1, 3, 62, 4, 1, 3, 63, 4, 1, 3, 64,
+ 4, 1, 3, 65, 4, 1, 3, 66, 4, 1, 3, 67,
+ 4, 1, 3, 68, 4, 1, 3, 69, 4, 1, 3, 70,
+ 4, 1, 3, 71, 4, 1, 3, 72, 4, 1, 3, 73,
+ 4, 1, 3, 74, 4, 1, 3, 75, 4, 1, 3, 76,
+ 4, 1, 3, 77, 4, 1,
+};
+
+static const unsigned short nameprep_rfc3491_prohibited_imap[] = {
+ 68, 196, 196, 324, 196, 196, 196, 452,
+ 196, 196, 196, 580, 196, 196, 196, 580,
+ 196, 196, 196, 580, 196, 196, 196, 580,
+ 196, 196, 196, 580, 196, 196, 196, 580,
+ 196, 196, 196, 580, 196, 196, 196, 580,
+ 196, 196, 196, 580, 196, 196, 196, 580,
+ 196, 196, 196, 580, 196, 196, 196, 580,
+ 708, 196, 196, 580, 836, 836, 836, 836,
+ 836, 836, 836, 836, 0, 1, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 3, 4, 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, 0, 0, 0,
+ 0, 5, 0, 0, 6, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 7, 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, 0,
+ 0, 0, 0, 8, 5, 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, 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, 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, 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, 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, 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, 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, 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, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 10,
+ 0, 0, 0, 11, 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, 0, 0,
+ 0, 0, 0, 0, 0, 0, 12, 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, 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, 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, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 13, 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, 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,
+ 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, 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, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 13, 14, 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, 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, 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, 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, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9,
+};
+
+static const struct {
+ unsigned char bm[16];
+} nameprep_rfc3491_prohibited_bitmap[] = {
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 255,255,255,255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0,
+ }},
+ {{
+ 0,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 255,199, 0, 0, 0,255, 0, 0, 0, 0, 0,128, 14,252, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255, 15,
+ }},
+ {{
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,255, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,254,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,248, 7,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192,
+ }},
+ {{
+ 2, 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,
+ }},
+};
+
+static const unsigned short nameprep_rfc3491_unassigned_imap[] = {
+ 68, 196, 324, 452, 580, 708, 708, 836,
+ 964, 964, 1092, 1220, 708, 708, 708, 1348,
+ 708, 708, 708, 1348, 708, 708, 708, 1348,
+ 708, 708, 708, 1348, 708, 708, 708, 1348,
+ 708, 708, 708, 1348, 708, 708, 708, 1348,
+ 708, 708, 708, 1348, 708, 708, 708, 1348,
+ 708, 708, 708, 1348, 708, 708, 708, 1348,
+ 1476, 708, 708, 1348, 964, 964, 964, 964,
+ 964, 964, 964, 964, 0, 0, 0, 0,
+ 1, 2, 3, 4, 0, 5, 6, 7,
+ 8, 9, 10, 11, 12, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 28, 29, 30,
+ 31, 32, 33, 34, 35, 0, 0, 0,
+ 36, 37, 38, 39, 40, 41, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 0, 42, 43, 44, 45, 46, 47, 48,
+ 0, 0, 0, 49, 50, 51, 0, 0,
+ 52, 53, 54, 55, 0, 0, 0, 0,
+ 0, 0, 12, 12, 12, 12, 12, 12,
+ 12, 56, 0, 57, 58, 59, 60, 61,
+ 62, 63, 64, 65, 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, 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, 66,
+ 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, 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, 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, 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,
+ 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, 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, 0, 0, 0, 0,
+ 0, 0, 0, 67, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 68, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 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, 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,
+ 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, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 69, 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, 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,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 70, 12, 71, 72, 0, 0, 73, 74,
+ 75, 76, 35, 77, 12, 12, 12, 12,
+ 12, 12, 78, 12, 79, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 0, 80, 81, 82,
+ 12, 12, 12, 12, 83, 84, 85, 0,
+ 0, 86, 0, 87, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 88, 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, 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,
+ 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, 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, 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, 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,
+ 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, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 89, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 0, 0, 0, 0,
+ 90, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 88, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 88, 91, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12,
+};
+
+static const struct {
+ unsigned char bm[16];
+} nameprep_rfc3491_unassigned_bitmap[] = {
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 2, 0,240,255,255,255, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0,192, 0, 0, 0, 0, 0, 0, 0,128,255,255,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255, 0, 0,207,187,
+ }},
+ {{
+ 15, 40, 0, 0, 4, 0, 0, 0, 0,128, 0, 0, 0, 0,128,255,
+ }},
+ {{
+ 128, 0, 0, 0, 0, 0, 0, 0, 0,128, 0, 0, 0, 0,192,252,
+ }},
+ {{
+ 0, 0,255,255,255,255, 1, 0, 0, 0,128, 1, 1, 0, 0, 0,
+ }},
+ {{
+ 0,249, 1, 0, 4, 0, 0, 4,224,255, 0, 0, 0,248,224,255,
+ }},
+ {{
+ 255,239,255,119, 1, 0, 0,248, 0, 0,192,255, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192, 0,128,
+ }},
+ {{
+ 0, 64, 0, 0, 0,224, 0, 0, 0,248,255,255,255,255,255,255,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0,252,255,255,255,255,255,255,255,255,255,
+ }},
+ {{
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ }},
+ {{
+ 17, 0, 0, 0, 0, 0, 0, 12, 0,192,224, 0, 0, 0,254,255,
+ }},
+ {{
+ 17, 96, 6, 0, 0, 2, 58, 44, 96,198,127, 79, 48, 0, 0,248,
+ }},
+ {{
+ 27,120, 6, 0, 0, 2,146, 44,120,198,255,161, 63, 0,224,255,
+ }},
+ {{
+ 17, 80, 4, 0, 0, 2, 18, 12, 64,196,254,255, 62, 0,255,255,
+ }},
+ {{
+ 17, 96, 6, 0, 0, 2, 50, 12,112,198, 63, 79, 60, 0,254,255,
+ }},
+ {{
+ 19, 56,194, 41,231, 56, 64, 60, 56,194,127,255,127, 0,248,255,
+ }},
+ {{
+ 17, 32, 2, 0, 0, 2, 16, 60, 32,194,159,255, 60, 0,255,255,
+ }},
+ {{
+ 19, 32, 2, 0, 0, 2, 16, 60, 32,194,159,191, 60, 0,255,255,
+ }},
+ {{
+ 19, 32, 2, 0, 0, 2, 0, 60, 48,194,127,255, 60, 0,255,255,
+ }},
+ {{
+ 19, 0,128, 3, 0, 0, 4,208,128,123,160, 0,255,255,227,255,
+ }},
+ {{
+ 1, 0, 0, 0, 0, 0, 0,120, 0, 0, 0,240,255,255,255,255,
+ }},
+ {{
+ 105,218, 15, 1, 81, 19, 0,196,160,192, 0,204,255,255,255,255,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,248, 1, 0,
+ }},
+ {{
+ 0,240, 0, 1, 0, 0, 0, 32, 0, 96,255,255,255,255,255,255,
+ }},
+ {{
+ 0, 0, 0, 0, 4, 9, 56,252, 0, 0, 0,252,255,255,255,255,
+ }},
+ {{
+ 255,255,255,255, 0, 0, 0, 0,192,255, 0, 0, 0, 0, 0,246,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,124, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0,248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,252,
+ }},
+ {{
+ 128, 0, 0, 0, 0, 0, 0, 0,128,194,128,194, 0, 0, 0, 0,
+ }},
+ {{
+ 128,194, 0, 0, 0,128,194,128,194,128,128, 0, 0,128, 0, 0,
+ }},
+ {{
+ 0,128,194,128, 0, 0, 0, 0,128, 0, 0,248, 1, 0, 0,224,
+ }},
+ {{
+ 255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,224,255,
+ }},
+ {{
+ 1, 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, 0, 0, 0,128,255,
+ }},
+ {{
+ 0, 0, 0,224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,254,255,
+ }},
+ {{
+ 0, 32,224,255, 0, 0,128,255, 0, 0,240,255, 0, 32,242,255,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,224, 0,252,255,255,
+ }},
+ {{
+ 0,128, 0,252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,
+ }},
+ {{
+ 0, 0, 0, 0, 0,252,255,255,255,255,255,255,255,255,255,255,
+ }},
+ {{
+ 0, 0, 0,240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,252,
+ }},
+ {{
+ 0, 0,192,192, 0, 0, 0, 0,192,192, 0, 85, 0, 0, 0,192,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 32, 0, 32, 0, 48, 16, 0, 0, 35,128,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,120,127,240, 3, 12, 0,
+ }},
+ {{
+ 0,128,255,255, 0, 0,252,255,255,255, 0, 0, 0,248,255,255,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 24, 0,240, 7, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 240,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,128,255,255,255,255,255,255,
+ }},
+ {{
+ 0, 0, 0, 0,128,255,255,255, 0,248,255,255, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,
+ }},
+ {{
+ 0, 0, 48, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192,
+ }},
+ {{
+ 0,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ }},
+ {{
+ 33, 12, 0, 0, 0, 1, 0, 0, 0, 80,184,128, 1, 0, 0, 0,
+ }},
+ {{
+ 0, 0,224, 0, 0, 0, 1,128,255,255, 0, 0, 0,240, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,240,255,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192,255,255,255, 0,240,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0,128, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 31, 0, 0, 0, 0,224, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0,128, 0, 0, 0, 0, 0,255,255,255,255,255,255,255, 0, 0,
+ }},
+ {{
+ 0, 0, 0,224, 0, 0, 0, 0,240,255, 1, 0, 0, 0, 0,112,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,240, 0, 0, 0, 0, 0,128,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 7,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192, 0, 0, 0,128,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0,192,255,255,255,255,255,255,255,255,255,
+ }},
+ {{
+ 0, 0, 0, 0,192,255,255,255,255,255,255,255,255,255,255,255,
+ }},
+ {{
+ 0,224, 0, 0, 0, 0, 0, 0,128,255,255,255,255,255,255,255,
+ }},
+ {{
+ 0, 0, 0, 0,240,255,255,255,255,255,255,255,255,255,255,255,
+ }},
+ {{
+ 0, 0, 0, 0, 0,192, 0, 0, 0, 0, 0, 0, 0,248,255,255,
+ }},
+ {{
+ 128,255, 7, 31, 0, 0,128,160, 36, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0,252,255,255,255, 7, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,255,255, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 3, 0, 0, 0, 0, 0, 0,255, 0, 0, 0, 0, 0,224,
+ }},
+ {{
+ 0, 0,255,255,240,255, 0, 0,128, 1, 8, 0,128,240, 32, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0,128, 3, 3, 3,227,128,128,255, 1,
+ }},
+ {{
+ 0, 0, 0,128,240,255, 0, 0, 0,248,255,255,255,255,255,255,
+ }},
+ {{
+ 0, 0, 0, 0,192, 0, 0, 0, 0,192,255,255,255,255,255,255,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192,255,
+ }},
+ {{
+ 0, 0, 0, 0,128, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192,255,255,255,255,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 32,155, 33, 0, 20, 18, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 64, 24, 32, 32, 0, 0, 0,132,160, 3, 2, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0,240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 63,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,255,255,255,255,255,
+ }},
+ {{
+ 0, 0, 0,192,255,255,255,255,255,255,255,255,255,255,255,255,
+ }},
+ {{
+ 253,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+};
+
+static const unsigned short nameprep_rfc3491_bidi_imap[] = {
+ 272, 400, 528, 656, 784, 912, 912, 912,
+ 912, 1040, 1168, 912, 912, 1296, 912, 1424,
+ 1552, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1808, 1680, 1680,
+ 912, 912, 912, 912, 912, 912, 912, 912,
+ 912, 912, 1936, 1680, 1680, 1680, 1680, 2064,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
+ 912, 912, 912, 912, 912, 912, 912, 912,
+ 912, 912, 912, 912, 912, 912, 912, 2192,
+ 912, 912, 912, 912, 912, 912, 912, 912,
+ 912, 912, 912, 912, 912, 912, 912, 2192,
+ 0, 0, 1, 1, 0, 2, 3, 3,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 5, 6, 4, 4, 7, 8, 9,
+ 0, 0, 0, 10, 11, 12, 13, 14,
+ 4, 4, 4, 4, 15, 4, 13, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 29, 30, 31,
+ 32, 33, 0, 0, 29, 34, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 35, 36, 37, 38, 39, 40, 41, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50,
+ 39, 51, 41, 52, 53, 54, 55, 56,
+ 57, 58, 59, 60, 61, 62, 63, 60,
+ 61, 64, 65, 60, 66, 67, 68, 69,
+ 20, 70, 71, 0, 72, 73, 74, 0,
+ 75, 76, 77, 78, 79, 80, 81, 0,
+ 4, 82, 83, 0, 0, 4, 84, 85,
+ 4, 4, 86, 4, 4, 87, 4, 88,
+ 89, 4, 90, 4, 91, 92, 93, 13,
+ 92, 4, 94, 95, 0, 4, 4, 96,
+ 20, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 97, 1, 4, 4, 98,
+ 99, 100, 101, 102, 4, 103, 104, 105,
+ 106, 4, 4, 83, 4, 107, 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,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 4, 4, 4, 4, 108, 4, 4, 88,
+ 109, 4, 110, 111, 4, 112, 113, 114,
+ 115, 0, 0, 116, 0, 0, 0, 0,
+ 117, 118, 119, 4, 120, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 121, 4, 122, 123, 0, 0, 0,
+ 0, 0, 0, 0, 124, 4, 4, 105,
+ 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, 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, 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, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 125, 126, 20, 4, 127, 20, 4, 128,
+ 129, 130, 4, 4, 13, 83, 0, 6,
+ 131, 4, 120, 132, 4, 98, 133, 134,
+ 4, 4, 4, 135, 4, 4, 111, 134,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 14, 0, 0,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 136, 0, 0,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 137, 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, 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, 0, 0, 0, 0, 0, 0, 0,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 120, 0, 0,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 138, 4, 139, 0, 0, 0, 0,
+ 140, 141, 142, 29, 29, 143, 144, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 145, 146, 29, 147, 29, 148, 149,
+ 0, 0, 0, 150, 29, 29, 29, 151,
+ 0, 1, 1, 152, 4, 134, 153, 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,
+ 134, 154, 139, 0, 0, 0, 0, 0,
+ 4, 155, 156, 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, 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, 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, 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, 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, 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, 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, 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, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 4, 4, 4, 4, 4, 4, 4, 14,
+ 4, 157, 4, 158, 159, 160, 111, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 4, 4, 161, 4, 162, 163, 164, 4,
+ 165, 166, 167, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 168, 4, 4,
+ 4, 4, 4, 4, 4, 4, 105, 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, 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, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 97, 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, 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, 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, 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, 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, 0, 0, 0, 0, 0, 0, 0,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 111, 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, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 111,
+};
+
+static const struct {
+ unsigned char tbl[32];
+} nameprep_rfc3491_bidi_table[] = {
+ {{
+ 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, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 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, 0, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
+ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 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, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 2, 0, 2, 2, 2, 0, 2, 0, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 0, 0, 0, 0, 0, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 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, 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, 1, 0,
+ }},
+ {{
+ 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1,
+ 1, 1, 1, 1, 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, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1,
+ }},
+ {{
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2,
+ }},
+ {{
+ 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 2,
+ 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2,
+ 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2,
+ 0, 2, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2,
+ }},
+ {{
+ 2, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 2, 0, 2,
+ }},
+ {{
+ 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2,
+ 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2,
+ 0, 2, 2, 0, 2, 2, 0, 2, 2, 0, 0, 0, 0, 2, 2,
+ }},
+ {{
+ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 2, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0,
+ 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2,
+ 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2,
+ 0, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2,
+ }},
+ {{
+ 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 2, 0, 0, 0, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2,
+ 0, 2, 2, 0, 0, 2, 2, 2, 2, 0, 0, 0, 2, 2, 0,
+ }},
+ {{
+ 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 2, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2,
+ 0, 2, 2, 2, 2, 0, 0, 0, 2, 2, 0, 2, 0, 2, 2,
+ }},
+ {{
+ 0, 0, 0, 2, 2, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 2, 2,
+ 2, 2, 2, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 2, 2,
+ }},
+ {{
+ 0, 2, 2, 0, 0, 0, 2, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2,
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 2, 2, 2, 2, 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, 0,
+ }},
+ {{
+ 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2,
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 0, 0, 2, 2, 0, 2, 2, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2,
+ }},
+ {{
+ 2, 0, 0, 0, 0, 0, 2, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2,
+ 2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 2, 2, 0, 2, 0, 0, 2, 2, 0, 2, 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 0, 2, 2, 2, 0, 2, 0, 2, 0, 0, 2, 2, 0, 2, 2, 2, 2,
+ 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 0, 2, 0, 2, 0, 0, 0, 0, 0, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 2, 0, 0, 2, 2, 2, 2, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 0, 2, 2, 2, 2, 2, 0, 2, 2, 0, 2, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2,
+ }},
+ {{
+ 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2, 2, 2, 0, 0, 2,
+ 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2, 2, 2, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2, 2, 2, 0, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2,
+ 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0,
+ }},
+ {{
+ 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2,
+ 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2,
+ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 0, 2, 0, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0,
+ }},
+ {{
+ 0, 0, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2,
+ 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0,
+ 0, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 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, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
+ }},
+ {{
+ 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 0, 2, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 2, 0, 2, 0, 2, 0, 2, 2, 2, 2, 0, 2, 2,
+ 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 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, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 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, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0,
+ 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 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,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 1, 0, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0,
+ }},
+ {{
+ 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 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, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 0,
+ 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2,
+ }},
+ {{
+ 0, 0, 2, 0, 0, 2, 2, 0, 0, 2, 2, 2, 2, 0, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2, 2,
+ }},
+ {{
+ 2, 0, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2,
+ 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 0, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2,
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+};
+
+static const unsigned char nameprep_rfc3491_bidi_data[] = {
+ idn_biditype_others,
+ idn_biditype_r_al,
+ idn_biditype_l,
+};
+
diff --git a/contrib/idn/idnkit-1.0-src/lib/normalizer.c b/contrib/idn/idnkit-1.0-src/lib/normalizer.c
new file mode 100644
index 0000000..604a1e5
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/normalizer.c
@@ -0,0 +1,439 @@
+#ifndef lint
+static char *rcsid = "$Id: normalizer.c,v 1.1.1.1 2003/06/04 00:26:05 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <idn/assert.h>
+#include <idn/logmacro.h>
+#include <idn/result.h>
+#include <idn/normalizer.h>
+#include <idn/strhash.h>
+#include <idn/unormalize.h>
+#include <idn/unicode.h>
+#include <idn/ucs4.h>
+#include <idn/debug.h>
+#include <idn/util.h>
+
+#define MAX_LOCAL_SCHEME 3
+
+#define INITIALIZED (scheme_hash != NULL)
+
+typedef struct {
+ char *name;
+ idn_normalizer_proc_t proc;
+} normalize_scheme_t;
+
+struct idn_normalizer {
+ int nschemes;
+ int scheme_size;
+ normalize_scheme_t **schemes;
+ normalize_scheme_t *local_buf[MAX_LOCAL_SCHEME];
+ int reference_count;
+};
+
+static idn__strhash_t scheme_hash;
+
+static idn__unicode_version_t vcur = NULL;
+static idn__unicode_version_t v320 = NULL;
+#define INIT_VERSION(version, var) \
+ if (var == NULL) { \
+ idn_result_t r = idn__unicode_create(version, &var); \
+ if (r != idn_success) \
+ return (r); \
+ }
+
+static idn_result_t expand_schemes(idn_normalizer_t ctx);
+static idn_result_t register_standard_normalizers(void);
+static idn_result_t normalizer_formkc(const unsigned long *from,
+ unsigned long *to, size_t tolen);
+static idn_result_t normalizer_formkc_v320(const unsigned long *from,
+ unsigned long *to,
+ size_t tolen);
+
+static struct standard_normalizer {
+ char *name;
+ idn_normalizer_proc_t proc;
+} standard_normalizer[] = {
+ { "unicode-form-kc", normalizer_formkc },
+ { "unicode-form-kc/3.2.0", normalizer_formkc_v320 },
+ { "RFC3491", normalizer_formkc_v320 },
+ { NULL, NULL },
+};
+
+idn_result_t
+idn_normalizer_initialize(void) {
+ idn__strhash_t hash;
+ idn_result_t r;
+
+ TRACE(("idn_normalizer_initialize()\n"));
+
+ if (scheme_hash != NULL) {
+ r = idn_success; /* already initialized */
+ goto ret;
+ }
+
+ if ((r = idn__strhash_create(&hash)) != idn_success)
+ goto ret;
+ scheme_hash = hash;
+
+ /* Register standard normalizers */
+ r = register_standard_normalizers();
+ret:
+ TRACE(("idn_normalizer_initialize(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_result_t
+idn_normalizer_create(idn_normalizer_t *ctxp) {
+ idn_normalizer_t ctx;
+ idn_result_t r;
+
+ assert(ctxp != NULL);
+ TRACE(("idn_normalizer_create()\n"));
+
+ if ((ctx = malloc(sizeof(struct idn_normalizer))) == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+
+ ctx->nschemes = 0;
+ ctx->scheme_size = MAX_LOCAL_SCHEME;
+ ctx->schemes = ctx->local_buf;
+ ctx->reference_count = 1;
+ *ctxp = ctx;
+
+ r = idn_success;
+ret:
+ TRACE(("idn_normalizer_create(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+void
+idn_normalizer_destroy(idn_normalizer_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_normalizer_destroy()\n"));
+
+ ctx->reference_count--;
+ if (ctx->reference_count <= 0) {
+ TRACE(("idn_normalizer_destroy(): the object is destroyed\n"));
+ if (ctx->schemes != ctx->local_buf)
+ free(ctx->schemes);
+ free(ctx);
+ } else {
+ TRACE(("idn_normalizer_destroy(): "
+ "update reference count (%d->%d)\n",
+ ctx->reference_count + 1, ctx->reference_count));
+ }
+}
+
+void
+idn_normalizer_incrref(idn_normalizer_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_normalizer_incrref()\n"));
+ TRACE(("idn_normalizer_incrref: update reference count (%d->%d)\n",
+ ctx->reference_count, ctx->reference_count + 1));
+
+ ctx->reference_count++;
+}
+
+idn_result_t
+idn_normalizer_add(idn_normalizer_t ctx, const char *scheme_name) {
+ idn_result_t r;
+ void *v;
+ normalize_scheme_t *scheme;
+
+ assert(ctx != NULL && scheme_name != NULL);
+
+ TRACE(("idn_normalizer_add(scheme_name=%s)\n", scheme_name));
+
+ assert(INITIALIZED);
+
+ if (idn__strhash_get(scheme_hash, scheme_name, &v) != idn_success) {
+ ERROR(("idn_normalizer_add(): invalid scheme \"%-.30s\"\n",
+ scheme_name));
+ r = idn_invalid_name;
+ goto ret;
+ }
+
+ scheme = v;
+
+ assert(ctx->nschemes <= ctx->scheme_size);
+
+ if (ctx->nschemes == ctx->scheme_size &&
+ (r = expand_schemes(ctx)) != idn_success) {
+ goto ret;
+ }
+
+ ctx->schemes[ctx->nschemes++] = scheme;
+ r = idn_success;
+ret:
+ TRACE(("idn_normalizer_add(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_result_t
+idn_normalizer_addall(idn_normalizer_t ctx, const char **scheme_names,
+ int nschemes) {
+ idn_result_t r;
+ int i;
+
+ assert(ctx != NULL && scheme_names != NULL);
+
+ TRACE(("idn_normalizer_addall(nschemes=%d)\n", nschemes));
+
+ for (i = 0; i < nschemes; i++) {
+ r = idn_normalizer_add(ctx, (const char *)*scheme_names);
+ if (r != idn_success)
+ goto ret;
+ scheme_names++;
+ }
+
+ r = idn_success;
+ret:
+ TRACE(("idn_normalizer_addall(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_result_t
+idn_normalizer_normalize(idn_normalizer_t ctx, const unsigned long *from,
+ unsigned long *to, size_t tolen) {
+ idn_result_t r;
+ unsigned long *src, *dst;
+ unsigned long *buffers[2] = {NULL, NULL};
+ size_t buflen[2] = {0, 0};
+ size_t dstlen;
+ int idx;
+ int i;
+
+ assert(scheme_hash != NULL);
+ assert(ctx != NULL && from != NULL && to != NULL);
+
+ TRACE(("idn_normalizer_normalize(from=\"%s\", tolen=%d)\n",
+ idn__debug_ucs4xstring(from, 50), (int)tolen));
+
+ if (ctx->nschemes <= 0) {
+ if (tolen < idn_ucs4_strlen(from) + 1) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ idn_ucs4_strcpy(to, from);
+ r = idn_success;
+ goto ret;
+ }
+
+ /*
+ * Normalize.
+ */
+ src = (void *)from;
+ dstlen = idn_ucs4_strlen(from) + 1;
+
+ i = 0;
+ while (i < ctx->nschemes) {
+ TRACE(("idn_normalizer_normalize(): normalize %s\n",
+ ctx->schemes[i]->name));
+
+ /*
+ * Choose destination area to restore the result of a mapping.
+ */
+ if (i + 1 == ctx->nschemes) {
+ dst = to;
+ dstlen = tolen;
+ } else {
+ if (src == buffers[0])
+ idx = 1;
+ else
+ idx = 0;
+
+ if (buflen[idx] < dstlen) {
+ void *newbuf;
+
+ newbuf = realloc(buffers[idx],
+ sizeof(long) * dstlen);
+ if (newbuf == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ buffers[idx] = (unsigned long *)newbuf;
+ buflen[idx] = dstlen;
+ }
+
+ dst = buffers[idx];
+ dstlen = buflen[idx];
+ }
+
+ /*
+ * Perform i-th normalization scheme.
+ * If buffer size is not enough, we double it and try again.
+ */
+ r = (ctx->schemes[i]->proc)(src, dst, dstlen);
+ if (r == idn_buffer_overflow && dst != to) {
+ dstlen *= 2;
+ continue;
+ }
+ if (r != idn_success)
+ goto ret;
+
+ src = dst;
+ i++;
+ }
+
+ r = idn_success;
+ret:
+ free(buffers[0]);
+ free(buffers[1]);
+ if (r == idn_success) {
+ TRACE(("idn_normalizer_normalize(): success (to=\"%s\")\n",
+ idn__debug_ucs4xstring(to, 50)));
+ } else {
+ TRACE(("idn_normalizer_normalize(): %s\n",
+ idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+idn_result_t
+idn_normalizer_register(const char *scheme_name, idn_normalizer_proc_t proc) {
+ idn_result_t r;
+ normalize_scheme_t *scheme;
+
+ assert(scheme_name != NULL && proc != NULL);
+
+ TRACE(("idn_normalizer_register(scheme_name=%s)\n", scheme_name));
+
+ assert(INITIALIZED);
+
+ scheme = malloc(sizeof(*scheme) + strlen(scheme_name) + 1);
+ if (scheme == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ scheme->name = (char *)(scheme + 1);
+ (void)strcpy(scheme->name, scheme_name);
+ scheme->proc = proc;
+
+ r = idn__strhash_put(scheme_hash, scheme_name, scheme);
+ if (r != idn_success)
+ goto ret;
+
+ r = idn_success;
+ret:
+ TRACE(("idn_normalizer_register(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+static idn_result_t
+expand_schemes(idn_normalizer_t ctx) {
+ normalize_scheme_t **new_schemes;
+ int new_size = ctx->scheme_size * 2;
+
+ if (ctx->schemes == ctx->local_buf) {
+ new_schemes = malloc(sizeof(normalize_scheme_t) * new_size);
+ } else {
+ new_schemes = realloc(ctx->schemes,
+ sizeof(normalize_scheme_t) * new_size);
+ }
+ if (new_schemes == NULL)
+ return (idn_nomemory);
+
+ if (ctx->schemes == ctx->local_buf)
+ memcpy(new_schemes, ctx->local_buf, sizeof(ctx->local_buf));
+
+ ctx->schemes = new_schemes;
+ ctx->scheme_size = new_size;
+
+ return (idn_success);
+}
+
+static idn_result_t
+register_standard_normalizers(void) {
+ int i;
+ int failed = 0;
+
+ for (i = 0; standard_normalizer[i].name != NULL; i++) {
+ idn_result_t r;
+ r = idn_normalizer_register(standard_normalizer[i].name,
+ standard_normalizer[i].proc);
+ if (r != idn_success) {
+ WARNING(("idn_normalizer_initialize(): "
+ "failed to register \"%-.100s\"\n",
+ standard_normalizer[i].name));
+ failed++;
+ }
+ }
+ if (failed > 0)
+ return (idn_failure);
+ else
+ return (idn_success);
+}
+
+/*
+ * Unicode Normalization Forms -- latest version
+ */
+
+static idn_result_t
+normalizer_formkc(const unsigned long *from, unsigned long *to, size_t tolen) {
+ INIT_VERSION(NULL, vcur);
+ return (idn__unormalize_formkc(vcur, from, to, tolen));
+}
+
+/*
+ * Unicode Normalization Forms -- version 3.2.0
+ */
+
+static idn_result_t
+normalizer_formkc_v320(const unsigned long *from, unsigned long *to,
+ size_t tolen) {
+ INIT_VERSION("3.2.0", v320);
+ return (idn__unormalize_formkc(v320, from, to, tolen));
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/punycode.c b/contrib/idn/idnkit-1.0-src/lib/punycode.c
new file mode 100644
index 0000000..d803af5
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/punycode.c
@@ -0,0 +1,434 @@
+#ifndef lint
+static char *rcsid = "$Id: punycode.c,v 1.1.1.1 2003/06/04 00:26:06 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <idn/result.h>
+#include <idn/assert.h>
+#include <idn/logmacro.h>
+#include <idn/converter.h>
+#include <idn/ucs4.h>
+#include <idn/debug.h>
+#include <idn/punycode.h>
+#include <idn/util.h>
+
+/*
+ * Although draft-ietf-idn-punycode-00.txt doesn't specify the ACE
+ * signature, we have to choose one. In order to prevent the converted
+ * name from beginning with a hyphen, we should choose a prefix rather
+ * than a suffix.
+ */
+#ifndef IDN_PUNYCODE_PREFIX
+#define IDN_PUNYCODE_PREFIX "xn--"
+#endif
+
+#define INVALID_UCS 0x80000000
+#define MAX_UCS 0x10FFFF
+
+/*
+ * As the draft states, it is possible that `delta' may overflow during
+ * the encoding. The upper bound of 'delta' is:
+ * <# of chars. of input string> + <max. difference in code point> *
+ * <# of chars. of input string + 1>
+ * For this value not to be greater than 0xffffffff (since the calculation
+ * is done using unsigned long, which is at least 32bit long), the maxmum
+ * input string size is about 3850 characters, which is long enough for
+ * a domain label...
+ */
+#define PUNYCODE_MAXINPUT 3800
+
+/*
+ * Parameters.
+ */
+#define PUNYCODE_BASE 36
+#define PUNYCODE_TMIN 1
+#define PUNYCODE_TMAX 26
+#define PUNYCODE_SKEW 38
+#define PUNYCODE_DAMP 700
+#define PUNYCODE_INITIAL_BIAS 72
+#define PUNYCODE_INITIAL_N 0x80
+
+static int punycode_getwc(const char *s, size_t len,
+ int bias, unsigned long *vp);
+static int punycode_putwc(char *s, size_t len,
+ unsigned long delta, int bias);
+static int punycode_update_bias(unsigned long delta,
+ size_t npoints, int first);
+
+idn_result_t
+idn__punycode_decode(idn_converter_t ctx, void *privdata,
+ const char *from, unsigned long *to, size_t tolen) {
+ unsigned long *to_org = to;
+ unsigned long c, idx;
+ size_t prefixlen = strlen(IDN_PUNYCODE_PREFIX);
+ size_t fromlen;
+ size_t uidx, fidx, ucslen;
+ int first, bias;
+ idn_result_t r;
+
+ assert(ctx != NULL);
+
+ TRACE(("idn__punycode_decode(from=\"%s\", tolen=%d)\n",
+ idn__debug_xstring(from, 50), (int)tolen));
+
+ if (!idn__util_asciihaveaceprefix(from, IDN_PUNYCODE_PREFIX)) {
+ if (*from == '\0') {
+ r = idn_ucs4_utf8toucs4(from, to, tolen);
+ goto ret;
+ }
+ r = idn_invalid_encoding;
+ goto ret;
+ }
+ from += prefixlen;
+ fromlen = strlen(from);
+
+ /*
+ * Find the last delimiter, and copy the characters
+ * before it verbatim.
+ */
+ ucslen = 0;
+ for (fidx = fromlen; fidx > 0; fidx--) {
+ if (from[fidx - 1] == '-') {
+ if (tolen < fidx) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ for (uidx = 0; uidx < fidx - 1; uidx++) {
+ to[uidx] = from[uidx];
+ }
+ ucslen = uidx;
+ break;
+ }
+ }
+
+ first = 1;
+ bias = PUNYCODE_INITIAL_BIAS;
+ c = PUNYCODE_INITIAL_N;
+ idx = 0;
+ while (fidx < fromlen) {
+ int len;
+ unsigned long delta;
+ int i;
+
+ len = punycode_getwc(from + fidx, fromlen - fidx, bias, &delta);
+ if (len == 0) {
+ r = idn_invalid_encoding;
+ goto ret;
+ }
+ fidx += len;
+
+ bias = punycode_update_bias(delta, ucslen + 1, first);
+ first = 0;
+ idx += delta;
+ c += idx / (ucslen + 1);
+ uidx = idx % (ucslen + 1);
+
+ /* Insert 'c' at uidx. */
+ if (tolen-- <= 0) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ for (i = ucslen; i > uidx; i--)
+ to[i] = to[i - 1];
+ to[uidx] = c;
+
+ ucslen++;
+ idx = uidx + 1;
+ }
+
+ /* Terminate with NUL. */
+ if (tolen <= 0) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ to[ucslen] = '\0';
+ r = idn_success;
+
+ret:
+ if (r == idn_success) {
+ TRACE(("idn__punycode_decode(): succcess (to=\"%s\")\n",
+ idn__debug_ucs4xstring(to_org, 50)));
+ } else {
+ TRACE(("idn__punycode_decode(): %s\n", idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+idn_result_t
+idn__punycode_encode(idn_converter_t ctx, void *privdata,
+ const unsigned long *from, char *to, size_t tolen) {
+ char *to_org = to;
+ unsigned long cur_code, next_code, delta;
+ size_t prefixlen = strlen(IDN_PUNYCODE_PREFIX);
+ size_t fromlen;
+ size_t ucsdone;
+ size_t toidx;
+ int uidx, bias, first;
+ idn_result_t r;
+
+ assert(ctx != NULL);
+
+ TRACE(("idn__punycode_encode(from=\"%s\", tolen=%d)\n",
+ idn__debug_ucs4xstring(from, 50), (int)tolen));
+
+ if (*from == '\0') {
+ r = idn_ucs4_ucs4toutf8(from, to, tolen);
+ goto ret;
+ } else if (idn__util_ucs4haveaceprefix(from, IDN_PUNYCODE_PREFIX)) {
+ r = idn_prohibited;
+ goto ret;
+ }
+
+ if (tolen < prefixlen) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ memcpy(to, IDN_PUNYCODE_PREFIX, prefixlen);
+ to += prefixlen;
+ tolen -= prefixlen;
+
+ fromlen = idn_ucs4_strlen(from);
+
+ /*
+ * If the input string is too long (actually too long to be sane),
+ * return failure in order to prevent possible overflow.
+ */
+ if (fromlen > PUNYCODE_MAXINPUT) {
+ ERROR(("idn__punycode_encode(): "
+ "the input string is too long to convert Punycode\n",
+ idn__debug_ucs4xstring(from, 50)));
+ r = idn_failure;
+ goto ret;
+ }
+
+ ucsdone = 0; /* number of characters processed */
+ toidx = 0;
+
+ /*
+ * First, pick up basic code points and copy them to 'to'.
+ */
+ for (uidx = 0; uidx < fromlen; uidx++) {
+ if (from[uidx] < 0x80) {
+ if (toidx >= tolen) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ to[toidx++] = from[uidx];
+ ucsdone++;
+ }
+ }
+
+ /*
+ * If there are any basic code points, output a delimiter
+ * (hyphen-minus).
+ */
+ if (toidx > 0) {
+ if (toidx >= tolen) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ to[toidx++] = '-';
+ to += toidx;
+ tolen -= toidx;
+ }
+
+ /*
+ * Then encode non-basic characters.
+ */
+ first = 1;
+ cur_code = PUNYCODE_INITIAL_N;
+ bias = PUNYCODE_INITIAL_BIAS;
+ delta = 0;
+ while (ucsdone < fromlen) {
+ int limit = -1, rest;
+
+ /*
+ * Find the smallest code point equal to or greater
+ * than 'cur_code'. Also remember the index of the
+ * last occurence of the code point.
+ */
+ for (next_code = MAX_UCS, uidx = fromlen - 1;
+ uidx >= 0; uidx--) {
+ if (from[uidx] >= cur_code && from[uidx] < next_code) {
+ next_code = from[uidx];
+ limit = uidx;
+ }
+ }
+ /* There must be such code point. */
+ assert(limit >= 0);
+
+ delta += (next_code - cur_code) * (ucsdone + 1);
+ cur_code = next_code;
+
+ /*
+ * Scan the input string again, and encode characters
+ * whose code point is 'cur_code'. Use 'limit' to avoid
+ * unnecessary scan.
+ */
+ for (uidx = 0, rest = ucsdone; uidx <= limit; uidx++) {
+ if (from[uidx] < cur_code) {
+ delta++;
+ rest--;
+ } else if (from[uidx] == cur_code) {
+ int sz = punycode_putwc(to, tolen, delta, bias);
+ if (sz == 0) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ to += sz;
+ tolen -= sz;
+ ucsdone++;
+ bias = punycode_update_bias(delta, ucsdone,
+ first);
+ delta = 0;
+ first = 0;
+ }
+ }
+ delta += rest + 1;
+ cur_code++;
+ }
+
+ /*
+ * Terminate with NUL.
+ */
+ if (tolen <= 0) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ *to = '\0';
+ r = idn_success;
+
+ret:
+ if (r == idn_success) {
+ TRACE(("idn__punycode_encode(): succcess (to=\"%s\")\n",
+ idn__debug_xstring(to_org, 50)));
+ } else {
+ TRACE(("idn__punycode_encode(): %s\n", idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+static int
+punycode_getwc(const char *s, size_t len, int bias, unsigned long *vp) {
+ size_t orglen = len;
+ unsigned long v = 0, w = 1;
+ int k;
+
+ for (k = PUNYCODE_BASE - bias; len > 0; k += PUNYCODE_BASE) {
+ int c = *s++;
+ int t = (k < PUNYCODE_TMIN) ? PUNYCODE_TMIN :
+ (k > PUNYCODE_TMAX) ? PUNYCODE_TMAX : k;
+
+ len--;
+ if ('a' <= c && c <= 'z')
+ c = c - 'a';
+ else if ('A' <= c && c <= 'Z')
+ c = c - 'A';
+ else if ('0' <= c && c <= '9')
+ c = c - '0' + 26;
+ else
+ c = -1;
+
+ if (c < 0)
+ return (0); /* invalid character */
+
+ v += c * w;
+
+ if (c < t) {
+ *vp = v;
+ return (orglen - len);
+ }
+
+ w *= (PUNYCODE_BASE - t);
+ }
+
+ return (0); /* final character missing */
+}
+
+static int
+punycode_putwc(char *s, size_t len, unsigned long delta, int bias) {
+ const char *punycode_base36 = "abcdefghijklmnopqrstuvwxyz0123456789";
+ int k;
+ char *sorg = s;
+
+ for (k = PUNYCODE_BASE - bias; 1; k += PUNYCODE_BASE) {
+ int t = (k < PUNYCODE_TMIN) ? PUNYCODE_TMIN :
+ (k > PUNYCODE_TMAX) ? PUNYCODE_TMAX : k;
+
+ if (delta < t)
+ break;
+ if (len < 1)
+ return (0);
+ *s++ = punycode_base36[t + ((delta - t) % (PUNYCODE_BASE - t))];
+ len--;
+ delta = (delta - t) / (PUNYCODE_BASE - t);
+ }
+ if (len < 1)
+ return (0);
+ *s++ = punycode_base36[delta];
+ return (s - sorg);
+}
+
+static int
+punycode_update_bias(unsigned long delta, size_t npoints, int first) {
+ int k = 0;
+
+ delta /= first ? PUNYCODE_DAMP : 2;
+ delta += delta / npoints;
+
+ while (delta > ((PUNYCODE_BASE - PUNYCODE_TMIN) * PUNYCODE_TMAX) / 2) {
+ delta /= PUNYCODE_BASE - PUNYCODE_TMIN;
+ k++;
+ }
+ return (PUNYCODE_BASE * k +
+ (((PUNYCODE_BASE - PUNYCODE_TMIN + 1) * delta) /
+ (delta + PUNYCODE_SKEW)));
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/race.c b/contrib/idn/idnkit-1.0-src/lib/race.c
new file mode 100644
index 0000000..1b44a98
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/race.c
@@ -0,0 +1,427 @@
+#ifndef lint
+static char *rcsid = "$Id: race.c,v 1.1.1.1 2003/06/04 00:26:07 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000,2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <idn/result.h>
+#include <idn/assert.h>
+#include <idn/logmacro.h>
+#include <idn/converter.h>
+#include <idn/ucs4.h>
+#include <idn/debug.h>
+#include <idn/race.h>
+#include <idn/util.h>
+
+#ifndef IDN_RACE_PREFIX
+#define IDN_RACE_PREFIX "bq--"
+#endif
+#define RACE_2OCTET_MODE 0xd8
+#define RACE_ESCAPE 0xff
+#define RACE_ESCAPE_2ND 0x99
+
+#define RACE_BUF_SIZE 128 /* more than enough */
+
+/*
+ * Unicode surrogate pair.
+ */
+#define IS_SURROGATE_HIGH(v) (0xd800 <= (v) && (v) <= 0xdbff)
+#define IS_SURROGATE_LOW(v) (0xdc00 <= (v) && (v) <= 0xdfff)
+#define SURROGATE_HIGH(v) (SURROGATE_H_OFF + (((v) - 0x10000) >> 10))
+#define SURROGATE_LOW(v) (SURROGATE_L_OFF + ((v) & 0x3ff))
+#define SURROGATE_BASE 0x10000
+#define SURROGATE_H_OFF 0xd800
+#define SURROGATE_L_OFF 0xdc00
+#define COMBINE_SURROGATE(h, l) \
+ (SURROGATE_BASE + (((h)-SURROGATE_H_OFF)<<10) + ((l)-SURROGATE_L_OFF))
+
+/*
+ * Compression type.
+ */
+enum {
+ compress_one, /* all characters are in a single row */
+ compress_two, /* row 0 and another row */
+ compress_none /* nope */
+};
+
+static idn_result_t race_decode_decompress(const char *from,
+ unsigned short *buf,
+ size_t buflen);
+static idn_result_t race_compress_encode(const unsigned short *p,
+ int compress_mode,
+ char *to, size_t tolen);
+static int get_compress_mode(unsigned short *p);
+
+idn_result_t
+idn__race_decode(idn_converter_t ctx, void *privdata,
+ const char *from, unsigned long *to, size_t tolen) {
+ unsigned short *buf = NULL;
+ size_t prefixlen = strlen(IDN_RACE_PREFIX);
+ size_t fromlen;
+ size_t buflen;
+ idn_result_t r;
+
+ assert(ctx != NULL);
+
+ TRACE(("idn__race_decode(from=\"%s\", tolen=%d)\n",
+ idn__debug_xstring(from, 50), (int)tolen));
+
+ if (!idn__util_asciihaveaceprefix(from, IDN_RACE_PREFIX)) {
+ if (*from == '\0') {
+ r = idn_ucs4_utf8toucs4(from, to, tolen);
+ goto ret;
+ }
+ r = idn_invalid_encoding;
+ goto ret;
+ }
+ from += prefixlen;
+ fromlen = strlen(from);
+
+ /*
+ * Allocate sufficient buffer.
+ */
+ buflen = fromlen + 1;
+ buf = malloc(sizeof(*buf) * buflen);
+ if (buf == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+
+ /*
+ * Decode base32 and decompress.
+ */
+ r = race_decode_decompress(from, buf, buflen);
+ if (r != idn_success)
+ goto ret;
+
+ /*
+ * Now 'buf' points the decompressed string, which must contain
+ * UTF-16 characters.
+ */
+
+ /*
+ * Convert to UCS4.
+ */
+ r = idn_ucs4_utf16toucs4(buf, to, tolen);
+ if (r != idn_success)
+ goto ret;
+
+ret:
+ free(buf);
+ if (r == idn_success) {
+ TRACE(("idn__race_decode(): succcess (to=\"%s\")\n",
+ idn__debug_ucs4xstring(to, 50)));
+ } else {
+ TRACE(("idn__race_decode(): %s\n", idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+static idn_result_t
+race_decode_decompress(const char *from, unsigned short *buf, size_t buflen)
+{
+ unsigned short *p = buf;
+ unsigned int bitbuf = 0;
+ int bitlen = 0;
+ int i, j;
+ size_t len;
+
+ while (*from != '\0') {
+ int c = *from++;
+ int x;
+
+ if ('a' <= c && c <= 'z')
+ x = c - 'a';
+ else if ('A' <= c && c <= 'Z')
+ x = c - 'A';
+ else if ('2' <= c && c <= '7')
+ x = c - '2' + 26;
+ else
+ return (idn_invalid_encoding);
+
+ bitbuf = (bitbuf << 5) + x;
+ bitlen += 5;
+ if (bitlen >= 8) {
+ *p++ = (bitbuf >> (bitlen - 8)) & 0xff;
+ bitlen -= 8;
+ }
+ }
+ len = p - buf;
+
+ /*
+ * Now 'buf' holds the decoded string.
+ */
+
+ /*
+ * Decompress.
+ */
+ if (buf[0] == RACE_2OCTET_MODE) {
+ if ((len - 1) % 2 != 0)
+ return (idn_invalid_encoding);
+ for (i = 1, j = 0; i < len; i += 2, j++)
+ buf[j] = (buf[i] << 8) + buf[i + 1];
+ len = j;
+ } else {
+ unsigned short c = buf[0] << 8; /* higher octet */
+
+ for (i = 1, j = 0; i < len; j++) {
+ if (buf[i] == RACE_ESCAPE) {
+ if (i + 1 >= len)
+ return (idn_invalid_encoding);
+ else if (buf[i + 1] == RACE_ESCAPE_2ND)
+ buf[j] = c | 0xff;
+ else
+ buf[j] = buf[i + 1];
+ i += 2;
+
+ } else if (buf[i] == 0x99 && c == 0x00) {
+ /*
+ * The RACE specification says this is error.
+ */
+ return (idn_invalid_encoding);
+
+ } else {
+ buf[j] = c | buf[i++];
+ }
+ }
+ len = j;
+ }
+ buf[len] = '\0';
+
+ return (idn_success);
+}
+
+idn_result_t
+idn__race_encode(idn_converter_t ctx, void *privdata,
+ const unsigned long *from, char *to, size_t tolen) {
+ char *to_org = to;
+ unsigned short *p, *buf = NULL;
+ size_t prefixlen = strlen(IDN_RACE_PREFIX);
+ size_t buflen;
+ size_t fromlen;
+ idn_result_t r;
+ int compress_mode;
+
+ assert(ctx != NULL);
+
+ TRACE(("idn__race_encode(from=\"%s\", tolen=%d)\n",
+ idn__debug_ucs4xstring(from, 50), (int)tolen));
+
+ if (*from == '\0') {
+ r = idn_ucs4_ucs4toutf8(from, to, tolen);
+ goto ret;
+ } else if (idn__util_ucs4haveaceprefix(from, IDN_RACE_PREFIX)) {
+ r = idn_prohibited;
+ goto ret;
+ }
+
+ if (tolen < prefixlen) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ memcpy(to, IDN_RACE_PREFIX, prefixlen);
+ to += prefixlen;
+ tolen -= prefixlen;
+
+ fromlen = idn_ucs4_strlen(from);
+ buflen = fromlen * 2 + 2;
+
+ /*
+ * Convert to UTF-16.
+ * Preserve space for a character at the top of the buffer.
+ */
+ for (;;) {
+ unsigned short *new_buf;
+
+ new_buf = realloc(buf, sizeof(*buf) * buflen);
+ if (new_buf == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ buf = new_buf;
+
+ r = idn_ucs4_ucs4toutf16(from, buf + 1, buflen - 1);
+ if (r == idn_success)
+ break;
+ else if (r != idn_buffer_overflow)
+ goto ret;
+
+ buflen = fromlen * 2 + 2;
+ }
+ p = buf + 1;
+
+ /*
+ * Now 'p' contains UTF-16 encoded string.
+ */
+
+ /*
+ * Check U+0099.
+ * RACE doesn't permit U+0099 in an input string.
+ */
+ for (p = buf + 1; *p != '\0'; p++) {
+ if (*p == 0x0099) {
+ r = idn_invalid_encoding;
+ goto ret;
+ }
+ }
+
+ /*
+ * Compress, encode in base-32 and output.
+ */
+ compress_mode = get_compress_mode(buf + 1);
+ r = race_compress_encode(buf, compress_mode, to, tolen);
+
+ret:
+ free(buf);
+ if (r == idn_success) {
+ TRACE(("idn__race_encode(): succcess (to=\"%s\")\n",
+ idn__debug_xstring(to_org, 50)));
+ } else {
+ TRACE(("idn__race_encode(): %s\n", idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+static idn_result_t
+race_compress_encode(const unsigned short *p, int compress_mode,
+ char *to, size_t tolen)
+{
+ unsigned long bitbuf = *p++; /* bit stream buffer */
+ int bitlen = 8; /* # of bits in 'bitbuf' */
+
+ while (*p != '\0' || bitlen > 0) {
+ unsigned int c = *p;
+
+ if (c == '\0') {
+ /* End of data. Flush. */
+ bitbuf <<= (5 - bitlen);
+ bitlen = 5;
+ } else if (compress_mode == compress_none) {
+ /* Push 16 bit data. */
+ bitbuf = (bitbuf << 16) | c;
+ bitlen += 16;
+ p++;
+ } else {/* compress_mode == compress_one/compress_two */
+ /* Push 8 or 16 bit data. */
+ if (compress_mode == compress_two &&
+ (c & 0xff00) == 0) {
+ /* Upper octet is zero (and not U1). */
+ bitbuf = (bitbuf << 16) | 0xff00 | c;
+ bitlen += 16;
+ } else if ((c & 0xff) == 0xff) {
+ /* Lower octet is 0xff. */
+ bitbuf = (bitbuf << 16) |
+ (RACE_ESCAPE << 8) | RACE_ESCAPE_2ND;
+ bitlen += 16;
+ } else {
+ /* Just output lower octet. */
+ bitbuf = (bitbuf << 8) | (c & 0xff);
+ bitlen += 8;
+ }
+ p++;
+ }
+
+ /*
+ * Output bits in 'bitbuf' in 5-bit unit.
+ */
+ while (bitlen >= 5) {
+ int x;
+
+ /* Get top 5 bits. */
+ x = (bitbuf >> (bitlen - 5)) & 0x1f;
+ bitlen -= 5;
+
+ /* Encode. */
+ if (x < 26)
+ x += 'a';
+ else
+ x = (x - 26) + '2';
+
+ if (tolen < 1)
+ return (idn_buffer_overflow);
+
+ *to++ = x;
+ tolen--;
+ }
+ }
+
+ if (tolen <= 0)
+ return (idn_buffer_overflow);
+
+ *to = '\0';
+ return (idn_success);
+}
+
+static int
+get_compress_mode(unsigned short *p) {
+ int zero = 0;
+ unsigned int upper = 0;
+ unsigned short *modepos = p - 1;
+
+ while (*p != '\0') {
+ unsigned int hi = *p++ & 0xff00;
+
+ if (hi == 0) {
+ zero++;
+ } else if (hi == upper) {
+ ;
+ } else if (upper == 0) {
+ upper = hi;
+ } else {
+ *modepos = RACE_2OCTET_MODE;
+ return (compress_none);
+ }
+ }
+ *modepos = upper >> 8;
+ if (upper > 0 && zero > 0)
+ return (compress_two);
+ else
+ return (compress_one);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/res.c b/contrib/idn/idnkit-1.0-src/lib/res.c
new file mode 100644
index 0000000..cefd0c3
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/res.c
@@ -0,0 +1,1726 @@
+#ifndef lint
+static char *rcsid = "$Id: res.c,v 1.1.1.1 2003/06/04 00:26:10 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <idn/result.h>
+#include <idn/assert.h>
+#include <idn/logmacro.h>
+#include <idn/converter.h>
+#include <idn/normalizer.h>
+#include <idn/checker.h>
+#include <idn/mapper.h>
+#include <idn/mapselector.h>
+#include <idn/delimitermap.h>
+#include <idn/resconf.h>
+#include <idn/res.h>
+#include <idn/util.h>
+#include <idn/debug.h>
+#include <idn/ucs4.h>
+
+#ifndef IDN_UTF8_ENCODING_NAME
+#define IDN_UTF8_ENCODING_NAME "UTF-8" /* by IANA */
+#endif
+
+#ifndef WITHOUT_ICONV
+#define ENCODE_MASK \
+ (IDN_LOCALCONV | IDN_DELIMMAP | IDN_LOCALMAP | IDN_MAP | \
+ IDN_NORMALIZE | IDN_PROHCHECK | IDN_UNASCHECK | IDN_BIDICHECK | \
+ IDN_ASCCHECK | IDN_IDNCONV | IDN_LENCHECK | IDN_ENCODE_QUERY | \
+ IDN_UNDOIFERR)
+#define DECODE_MASK \
+ (IDN_DELIMMAP | IDN_MAP | IDN_NORMALIZE | IDN_PROHCHECK | \
+ IDN_UNASCHECK | IDN_BIDICHECK | IDN_IDNCONV | IDN_ASCCHECK | \
+ IDN_RTCHECK | IDN_LOCALCONV | IDN_DECODE_QUERY)
+#else
+#define ENCODE_MASK \
+ (IDN_DELIMMAP | IDN_LOCALMAP | IDN_MAP | IDN_NORMALIZE | \
+ IDN_PROHCHECK | IDN_UNASCHECK | IDN_BIDICHECK | IDN_ASCCHECK | \
+ IDN_IDNCONV | IDN_LENCHECK | IDN_ENCODE_QUERY | IDN_UNDOIFERR)
+#define DECODE_MASK \
+ (IDN_DELIMMAP | IDN_MAP | IDN_NORMALIZE | IDN_PROHCHECK | \
+ IDN_UNASCHECK | IDN_BIDICHECK | IDN_IDNCONV | IDN_ASCCHECK | \
+ IDN_RTCHECK | IDN_DECODE_QUERY)
+#endif
+
+#define MAX_LABEL_LENGTH 63
+
+/*
+ * label to convert.
+ */
+typedef struct labellist * labellist_t;
+struct labellist {
+ unsigned long *name;
+ size_t name_length;
+ unsigned long *undo_name;
+ labellist_t next;
+ labellist_t previous;
+ int dot_followed;
+};
+
+typedef idn_result_t (*res_insnproc_t)(idn_resconf_t ctx,
+ labellist_t label);
+
+static void idn_res_initialize(void);
+static idn_result_t copy_verbatim(const char *from, char *to,
+ size_t tolen);
+static idn_result_t labellist_create(const unsigned long *name,
+ labellist_t *labelp);
+static void labellist_destroy(labellist_t label);
+static idn_result_t labellist_setname(labellist_t label,
+ const unsigned long *name);
+static const unsigned long *
+ labellist_getname(labellist_t label);
+static const unsigned long *
+ labellist_gettldname(labellist_t label);
+static idn_result_t labellist_getnamelist(labellist_t label,
+ unsigned long *name,
+ size_t label_length);
+static void labellist_undo(labellist_t label);
+static labellist_t labellist_tail(labellist_t label);
+static labellist_t labellist_previous(labellist_t label);
+
+#ifndef WITHOUT_ICONV
+static idn_result_t label_localdecodecheck(idn_resconf_t ctx,
+ labellist_t label);
+#endif
+static idn_result_t label_idnencode_ace(idn_resconf_t ctx,
+ labellist_t label);
+static idn_result_t label_idndecode(idn_resconf_t ctx, labellist_t label);
+static idn_result_t label_localmap(idn_resconf_t ctx, labellist_t label);
+static idn_result_t label_map(idn_resconf_t ctx, labellist_t label);
+static idn_result_t label_normalize(idn_resconf_t ctx, labellist_t label);
+static idn_result_t label_prohcheck(idn_resconf_t ctx, labellist_t label);
+static idn_result_t label_unascheck(idn_resconf_t ctx, labellist_t label);
+static idn_result_t label_bidicheck(idn_resconf_t ctx, labellist_t label);
+static idn_result_t label_asccheck(idn_resconf_t ctx, labellist_t label);
+static idn_result_t label_lencheck_ace(idn_resconf_t ctx,
+ labellist_t label);
+static idn_result_t label_lencheck_nonace(idn_resconf_t ctx,
+ labellist_t label);
+static idn_result_t label_rtcheck(idn_resconf_t ctx, idn_action_t actions,
+ labellist_t label,
+ const unsigned long *original_name);
+
+static int initialized;
+static int enabled;
+
+void
+idn_res_enable(int on_off) {
+ if (!initialized) {
+ idn_res_initialize();
+ }
+
+ if (on_off == 0) {
+ enabled = 0;
+ } else {
+ enabled = 1;
+ }
+}
+
+static void
+idn_res_initialize(void) {
+ if (!initialized) {
+ char *value = getenv("IDN_DISABLE");
+
+ if (value == NULL) {
+ enabled = 1;
+ } else {
+ enabled = 0;
+ }
+ initialized = 1;
+ }
+}
+
+idn_result_t
+idn_res_encodename(idn_resconf_t ctx, idn_action_t actions, const char *from,
+ char *to, size_t tolen) {
+ idn_converter_t local_converter = NULL;
+ idn_converter_t idn_converter = NULL;
+ idn_delimitermap_t delimiter_mapper;
+ idn_result_t r;
+ labellist_t labels = NULL, l;
+ unsigned long *buffer = NULL;
+ size_t buffer_length;
+ int from_is_root;
+ int idn_is_ace;
+
+ assert(ctx != NULL && from != NULL && to != NULL);
+
+ TRACE(("idn_res_encodename(actions=%s, from=\"%s\", tolen=%d)\n",
+ idn__res_actionstostring(actions),
+ idn__debug_xstring(from, 50), (int)tolen));
+
+ if (actions & ~ENCODE_MASK) {
+ WARNING(("idn_res_encodename: invalid actions 0x%x\n",
+ actions));
+ r = idn_invalid_action;
+ goto ret;
+ }
+
+ if (!initialized)
+ idn_res_initialize();
+ if (!enabled || actions == 0) {
+ r = copy_verbatim(from, to, tolen);
+ goto ret;
+ } else if (tolen <= 0) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+
+ if (actions & IDN_ENCODE_QUERY) {
+#ifndef WITHOUT_ICONV
+ actions |= (IDN_LOCALCONV | IDN_DELIMMAP | IDN_LOCALMAP | \
+ IDN_MAP | IDN_NORMALIZE | IDN_PROHCHECK | \
+ IDN_BIDICHECK | IDN_IDNCONV | IDN_LENCHECK);
+#else
+ actions |= (IDN_DELIMMAP | IDN_LOCALMAP | IDN_MAP | \
+ IDN_NORMALIZE | IDN_PROHCHECK | IDN_BIDICHECK | \
+ IDN_IDNCONV | IDN_LENCHECK);
+#endif
+ }
+
+ /*
+ * Convert `from' to UCS4.
+ */
+ local_converter = idn_resconf_getlocalconverter(ctx);
+#ifndef WITHOUT_ICONV
+ if (local_converter == NULL) {
+ r = idn_invalid_name;
+ goto ret;
+ }
+#endif
+
+ idn_converter = idn_resconf_getidnconverter(ctx);
+ if (idn_converter != NULL &&
+ idn_converter_isasciicompatible(idn_converter))
+ idn_is_ace = 1;
+ else
+ idn_is_ace = 0;
+
+ buffer_length = tolen * 2;
+
+ for (;;) {
+ void *new_buffer;
+
+ new_buffer = realloc(buffer, sizeof(*buffer) * buffer_length);
+ if (new_buffer == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ buffer = (unsigned long *)new_buffer;
+
+ if (actions & IDN_LOCALCONV) {
+ r = idn_converter_convtoucs4(local_converter, from,
+ buffer, buffer_length);
+ } else {
+ r = idn_ucs4_utf8toucs4(from, buffer, buffer_length);
+ }
+ if (r == idn_success)
+ break;
+ else if (r != idn_buffer_overflow)
+ goto ret;
+
+ buffer_length *= 2;
+ }
+
+ if (*buffer == '\0') {
+ if (tolen <= 0) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ *to = '\0';
+ r = idn_success;
+ goto ret;
+ }
+
+ /*
+ * Delimiter map.
+ */
+ if (actions & IDN_DELIMMAP) {
+ TRACE(("res delimitermap(name=\"%s\")\n",
+ idn__debug_ucs4xstring(buffer, 50)));
+
+ delimiter_mapper = idn_resconf_getdelimitermap(ctx);
+ if (delimiter_mapper != NULL) {
+ r = idn_delimitermap_map(delimiter_mapper, buffer,
+ buffer, buffer_length);
+ idn_delimitermap_destroy(delimiter_mapper);
+ if (r != idn_success)
+ goto ret;
+ }
+ TRACE(("res delimitermap(): success (name=\"%s\")\n",
+ idn__debug_ucs4xstring(buffer, 50)));
+ }
+
+ from_is_root = (buffer[0] == '.' && buffer[1] == '\0');
+
+ /*
+ * Split the name into a list of labels.
+ */
+ r = labellist_create(buffer, &labels);
+ if (r != idn_success)
+ goto ret;
+
+ /*
+ * Perform conversions and tests.
+ */
+ for (l = labellist_tail(labels); l != NULL;
+ l = labellist_previous(l)) {
+
+ if (!idn__util_ucs4isasciirange(labellist_getname(l))) {
+ if (actions & IDN_LOCALMAP) {
+ r = label_localmap(ctx, l);
+ if (r != idn_success)
+ goto ret;
+ }
+ }
+
+ if (!idn__util_ucs4isasciirange(labellist_getname(l))) {
+ if (actions & IDN_MAP) {
+ r = label_map(ctx, l);
+ if (r != idn_success)
+ goto ret;
+ }
+ if (actions & IDN_NORMALIZE) {
+ r = label_normalize(ctx, l);
+ if (r != idn_success)
+ goto ret;
+ }
+ if (actions & IDN_PROHCHECK) {
+ r = label_prohcheck(ctx, l);
+ if (r == idn_prohibited &&
+ (actions & IDN_UNDOIFERR)) {
+ labellist_undo(l);
+ continue;
+ } else if (r != idn_success) {
+ goto ret;
+ }
+ }
+ if (actions & IDN_UNASCHECK) {
+ r = label_unascheck(ctx, l);
+ if (r == idn_prohibited &&
+ (actions & IDN_UNDOIFERR)) {
+ labellist_undo(l);
+ continue;
+ } else if (r != idn_success) {
+ goto ret;
+ }
+ }
+ if (actions & IDN_BIDICHECK) {
+ r = label_bidicheck(ctx, l);
+ if (r == idn_prohibited &&
+ (actions & IDN_UNDOIFERR)) {
+ labellist_undo(l);
+ continue;
+ } else if (r != idn_success) {
+ goto ret;
+ }
+ }
+ }
+
+ if (actions & IDN_ASCCHECK) {
+ r = label_asccheck(ctx, l);
+ if (r == idn_prohibited && (actions & IDN_UNDOIFERR)) {
+ labellist_undo(l);
+ continue;
+ } else if (r != idn_success) {
+ goto ret;
+ }
+ }
+
+ if (!idn__util_ucs4isasciirange(labellist_getname(l))) {
+ if ((actions & IDN_IDNCONV) && idn_is_ace) {
+ r = label_idnencode_ace(ctx, l);
+ if (r != idn_success)
+ goto ret;
+ }
+ }
+
+ if (!from_is_root && (actions & IDN_LENCHECK)) {
+ if (idn_is_ace)
+ r = label_lencheck_ace(ctx, l);
+ else
+ r = label_lencheck_nonace(ctx, l);
+ if (r == idn_invalid_length &&
+ (actions & IDN_UNDOIFERR)) {
+ labellist_undo(l);
+ continue;
+ } else if (r != idn_success) {
+ goto ret;
+ }
+ }
+ }
+
+ /*
+ * Concat a list of labels to a name.
+ */
+ for (;;) {
+ void *new_buffer;
+
+ new_buffer = realloc(buffer, sizeof(*buffer) * buffer_length);
+ if (new_buffer == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ buffer = (unsigned long *)new_buffer;
+
+ r = labellist_getnamelist(labels, buffer, buffer_length);
+ if (r == idn_success)
+ break;
+ else if (r != idn_buffer_overflow)
+ goto ret;
+
+ buffer_length *= 2;
+ }
+
+ if ((actions & IDN_IDNCONV) && idn_converter != NULL && !idn_is_ace) {
+ r = idn_converter_convfromucs4(idn_converter, buffer, to,
+ tolen);
+ } else {
+ r = idn_ucs4_ucs4toutf8(buffer, to, tolen);
+ }
+
+ret:
+ if (r == idn_success) {
+ TRACE(("idn_res_encodename(): success (to=\"%s\")\n",
+ idn__debug_xstring(to, 50)));
+ } else {
+ TRACE(("idn_res_encodename(): %s\n", idn_result_tostring(r)));
+ }
+ free(buffer);
+ if (local_converter != NULL)
+ idn_converter_destroy(local_converter);
+ if (idn_converter != NULL)
+ idn_converter_destroy(idn_converter);
+ if (labels != NULL)
+ labellist_destroy(labels);
+ return (r);
+}
+
+idn_result_t
+idn_res_decodename(idn_resconf_t ctx, idn_action_t actions, const char *from,
+ char *to, size_t tolen) {
+ idn_converter_t local_converter = NULL;
+ idn_converter_t idn_converter = NULL;
+ idn_delimitermap_t delimiter_mapper;
+ idn_result_t r;
+ labellist_t labels = NULL, l;
+ unsigned long *buffer = NULL;
+ unsigned long *saved_name = NULL;
+ size_t buffer_length;
+ int idn_is_ace;
+
+ assert(ctx != NULL && from != NULL && to != NULL);
+
+ TRACE(("idn_res_decodename(actions=%s, from=\"%s\", tolen=%d)\n",
+ idn__res_actionstostring(actions),
+ idn__debug_xstring(from, 50), (int)tolen));
+
+ if (actions & ~DECODE_MASK) {
+ WARNING(("idn_res_decodename: invalid actions 0x%x\n",
+ actions));
+ r = idn_invalid_action;
+ goto ret;
+ }
+
+ if (!initialized)
+ idn_res_initialize();
+ if (!enabled || actions == 0) {
+ r = copy_verbatim(from, to, tolen);
+ goto ret;
+ } else if (tolen <= 0) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+
+ if (actions & IDN_DECODE_QUERY) {
+#ifndef WITHOUT_ICONV
+ actions |= (IDN_DELIMMAP | IDN_MAP | IDN_NORMALIZE | \
+ IDN_PROHCHECK | IDN_BIDICHECK | IDN_IDNCONV | \
+ IDN_RTCHECK | IDN_LOCALCONV);
+#else
+ actions |= (IDN_DELIMMAP | IDN_MAP | IDN_NORMALIZE | \
+ IDN_PROHCHECK | IDN_BIDICHECK | IDN_IDNCONV | \
+ IDN_RTCHECK);
+#endif
+ }
+
+ /*
+ * Convert `from' to UCS4.
+ */
+ local_converter = idn_resconf_getlocalconverter(ctx);
+#ifndef WITHOUT_ICONV
+ if (local_converter == NULL) {
+ r = idn_invalid_name;
+ goto ret;
+ }
+#endif
+
+ idn_converter = idn_resconf_getidnconverter(ctx);
+ if (idn_converter != NULL &&
+ idn_converter_isasciicompatible(idn_converter))
+ idn_is_ace = 1;
+ else
+ idn_is_ace = 0;
+
+ buffer_length = tolen * 2;
+
+ TRACE(("res idndecode(name=\"%s\")\n", idn__debug_xstring(from, 50)));
+
+ for (;;) {
+ void *new_buffer;
+
+ new_buffer = realloc(buffer, sizeof(*buffer) * buffer_length);
+ if (new_buffer == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ buffer = (unsigned long *)new_buffer;
+
+ if ((actions & IDN_IDNCONV) &&
+ idn_converter != NULL && !idn_is_ace) {
+ r = idn_converter_convtoucs4(idn_converter, from,
+ buffer, buffer_length);
+ } else {
+ r = idn_ucs4_utf8toucs4(from, buffer, buffer_length);
+ }
+ if (r == idn_success)
+ break;
+ else if (r != idn_buffer_overflow)
+ goto ret;
+
+ buffer_length *= 2;
+ }
+
+ if (*buffer == '\0') {
+ if (tolen <= 0) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ *to = '\0';
+ r = idn_success;
+ goto ret;
+ }
+
+ /*
+ * Delimiter map.
+ */
+ if (actions & IDN_DELIMMAP) {
+ TRACE(("res delimitermap(name=\"%s\")\n",
+ idn__debug_ucs4xstring(buffer, 50)));
+
+ delimiter_mapper = idn_resconf_getdelimitermap(ctx);
+ if (delimiter_mapper != NULL) {
+ r = idn_delimitermap_map(delimiter_mapper, buffer,
+ buffer, buffer_length);
+ idn_delimitermap_destroy(delimiter_mapper);
+ if (r != idn_success)
+ goto ret;
+ }
+ TRACE(("res delimitermap(): success (name=\"%s\")\n",
+ idn__debug_ucs4xstring(buffer, 50)));
+ }
+
+ /*
+ * Split the name into a list of labels.
+ */
+ r = labellist_create(buffer, &labels);
+ if (r != idn_success)
+ goto ret;
+
+ /*
+ * Perform conversions and tests.
+ */
+ for (l = labellist_tail(labels); l != NULL;
+ l = labellist_previous(l)) {
+
+ free(saved_name);
+ saved_name = NULL;
+
+ if (!idn__util_ucs4isasciirange(labellist_getname(l))) {
+ if (actions & IDN_MAP) {
+ r = label_map(ctx, l);
+ if (r != idn_success)
+ goto ret;
+ }
+ if (actions & IDN_NORMALIZE) {
+ r = label_normalize(ctx, l);
+ if (r != idn_success)
+ goto ret;
+ }
+ if (actions & IDN_PROHCHECK) {
+ r = label_prohcheck(ctx, l);
+ if (r == idn_prohibited) {
+ labellist_undo(l);
+ continue;
+ } else if (r != idn_success) {
+ goto ret;
+ }
+ }
+ if (actions & IDN_UNASCHECK) {
+ r = label_unascheck(ctx, l);
+ if (r == idn_prohibited) {
+ labellist_undo(l);
+ continue;
+ } else if (r != idn_success) {
+ goto ret;
+ }
+ }
+ if (actions & IDN_BIDICHECK) {
+ r = label_bidicheck(ctx, l);
+ if (r == idn_prohibited) {
+ labellist_undo(l);
+ continue;
+ } else if (r != idn_success) {
+ goto ret;
+ }
+ }
+ }
+
+ if ((actions & IDN_IDNCONV) && idn_is_ace) {
+ saved_name = idn_ucs4_strdup(labellist_getname(l));
+ if (saved_name == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ r = label_idndecode(ctx, l);
+ if (r == idn_invalid_encoding) {
+ labellist_undo(l);
+ continue;
+ } else if (r != idn_success) {
+ goto ret;
+ }
+ }
+ if ((actions & IDN_RTCHECK) && saved_name != NULL) {
+ r = label_rtcheck(ctx, actions, l, saved_name);
+ if (r == idn_invalid_encoding) {
+ labellist_undo(l);
+ continue;
+ } else if (r != idn_success) {
+ goto ret;
+ }
+ }
+
+#ifndef WITHOUT_ICONV
+ if (actions & IDN_LOCALCONV) {
+ r = label_localdecodecheck(ctx, l);
+ if (r != idn_success)
+ goto ret;
+ }
+#endif
+ }
+
+ /*
+ * Concat a list of labels to a name.
+ */
+ for (;;) {
+ void *new_buffer;
+
+ new_buffer = realloc(buffer, sizeof(*buffer) * buffer_length);
+ if (new_buffer == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ buffer = (unsigned long *)new_buffer;
+
+ r = labellist_getnamelist(labels, buffer, buffer_length);
+ if (r == idn_success)
+ break;
+ else if (r != idn_buffer_overflow)
+ goto ret;
+
+ buffer_length *= 2;
+ }
+
+ if (actions & IDN_LOCALCONV) {
+ r = idn_converter_convfromucs4(local_converter, buffer, to,
+ tolen);
+ } else {
+ r = idn_ucs4_ucs4toutf8(buffer, to, tolen);
+ }
+
+ret:
+ if (r == idn_success) {
+ TRACE(("idn_res_decodename(): success (to=\"%s\")\n",
+ idn__debug_xstring(to, 50)));
+ } else {
+ TRACE(("idn_res_decodename(): %s\n", idn_result_tostring(r)));
+ }
+ free(saved_name);
+ free(buffer);
+ if (local_converter != NULL)
+ idn_converter_destroy(local_converter);
+ if (idn_converter != NULL)
+ idn_converter_destroy(idn_converter);
+ if (labels != NULL)
+ labellist_destroy(labels);
+ return (r);
+}
+
+idn_result_t
+idn_res_decodename2(idn_resconf_t ctx, idn_action_t actions, const char *from,
+ char *to, size_t tolen, const char *auxencoding) {
+#ifdef WITHOUT_ICONV
+ return idn_failure;
+
+#else /* WITHOUT_ICONV */
+ idn_result_t r;
+ idn_converter_t aux_converter = NULL;
+ unsigned long *buffer_ucs4 = NULL;
+ char *buffer_utf8 = NULL;
+ size_t buffer_length;
+
+ assert(ctx != NULL && from != NULL && to != NULL);
+
+ TRACE(("idn_res_decodename2(actions=%s, from=\"%s\", tolen=%d, "
+ "auxencoding=\"%s\")\n",
+ idn__res_actionstostring(actions),
+ idn__debug_xstring(from, 50), (int)tolen,
+ (auxencoding != NULL) ? auxencoding : "<null>"));
+
+ if (!initialized)
+ idn_res_initialize();
+ if (!enabled || actions == 0) {
+ r = copy_verbatim(from, to, tolen);
+ goto ret;
+ } else if (tolen <= 0) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+
+ if (auxencoding == NULL ||
+ strcmp(auxencoding, IDN_UTF8_ENCODING_NAME) == 0 ||
+ strcmp(auxencoding, "UTF-8") == 0) {
+ return idn_res_decodename(ctx, actions, from, to, tolen);
+ }
+
+ /*
+ * Convert `from' to UCS4.
+ */
+ r = idn_resconf_setauxidnconvertername(ctx, auxencoding,
+ IDN_CONVERTER_DELAYEDOPEN);
+ if (r != idn_success) {
+ goto ret;
+ }
+
+ aux_converter = idn_resconf_getauxidnconverter(ctx);
+ if (aux_converter == NULL) {
+ r = idn_failure;
+ goto ret;
+ }
+
+ buffer_length = tolen * 2;
+ for (;;) {
+ void *new_buffer;
+
+ new_buffer = realloc(buffer_ucs4,
+ sizeof(*buffer_ucs4) * buffer_length);
+ if (new_buffer == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ buffer_ucs4 = (unsigned long *)new_buffer;
+
+ r = idn_converter_convtoucs4(aux_converter, from,
+ buffer_ucs4,
+ buffer_length);
+ if (r == idn_success)
+ break;
+ else if (r != idn_buffer_overflow)
+ goto ret;
+
+ buffer_length *= 2;
+ }
+
+ if (*buffer_ucs4 == '\0') {
+ if (tolen <= 0) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ *to = '\0';
+ r = idn_success;
+ goto ret;
+ }
+
+ /*
+ * Convert `buffer_ucs4' to UTF-8.
+ */
+ buffer_length = tolen * 2;
+ for (;;) {
+ void *new_buffer;
+
+ new_buffer = realloc(buffer_utf8,
+ sizeof(*buffer_utf8) * buffer_length);
+ if (new_buffer == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ buffer_utf8 = (char *)new_buffer;
+ r = idn_ucs4_ucs4toutf8(buffer_ucs4, buffer_utf8,
+ buffer_length);
+
+ if (r == idn_success)
+ break;
+ else if (r != idn_buffer_overflow)
+ goto ret;
+
+ buffer_length *= 2;
+ }
+
+ if (*buffer_utf8 == '\0') {
+ if (tolen <= 0) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ *to = '\0';
+ r = idn_success;
+ goto ret;
+ }
+
+ r = idn_res_decodename(ctx, actions, buffer_utf8, to, tolen);
+
+ret:
+ if (r == idn_success) {
+ TRACE(("idn_res_decodename2(): success (to=\"%s\")\n",
+ idn__debug_xstring(to, 50)));
+ } else {
+ TRACE(("idn_res_decodename2(): %s\n", idn_result_tostring(r)));
+ }
+ free(buffer_ucs4);
+ free(buffer_utf8);
+ if (aux_converter != NULL)
+ idn_converter_destroy(aux_converter);
+
+ return (r);
+
+#endif /* WITHOUT_ICONV */
+}
+
+static idn_result_t
+copy_verbatim(const char *from, char *to, size_t tolen) {
+ size_t fromlen = strlen(from);
+
+ if (fromlen + 1 > tolen)
+ return (idn_buffer_overflow);
+ (void)memcpy(to, from, fromlen + 1);
+ return (idn_success);
+}
+
+static idn_result_t
+labellist_create(const unsigned long *name, labellist_t *labelp) {
+ size_t length, malloc_length;
+ labellist_t head_label = NULL;
+ labellist_t tail_label = NULL;
+ labellist_t new_label = NULL;
+ const unsigned long *endp = NULL;
+ idn_result_t r;
+
+ while (*name != '\0') {
+ for (endp = name; *endp != '.' && *endp != '\0'; endp++)
+ ; /* nothing to be done */
+ length = (endp - name) + 1;
+ malloc_length = length + 15; /* add 15 for margin */
+
+ new_label = (labellist_t)
+ malloc(sizeof(struct labellist));
+ if (new_label == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ if (head_label == NULL)
+ head_label = new_label;
+
+ new_label->name = NULL;
+ new_label->undo_name = NULL;
+ new_label->name_length = malloc_length;
+ new_label->next = NULL;
+ new_label->previous = NULL;
+ new_label->dot_followed = (*endp == '.');
+
+ new_label->name = (unsigned long *)
+ malloc(sizeof(long) * malloc_length);
+ if (new_label->name == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ memcpy(new_label->name, name, sizeof(long) * length);
+ *(new_label->name + length - 1) = '\0';
+
+ new_label->undo_name = (unsigned long *)
+ malloc(sizeof(long) * malloc_length);
+ if (new_label->undo_name == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ memcpy(new_label->undo_name, name, sizeof(long) * length);
+ *(new_label->undo_name + length - 1) = '\0';
+
+ if (tail_label != NULL) {
+ tail_label->next = new_label;
+ new_label->previous = tail_label;
+ }
+ tail_label = new_label;
+
+ if (*endp == '.')
+ name = endp + 1;
+ else
+ name = endp;
+ }
+
+ *labelp = head_label;
+ r = idn_success;
+
+ret:
+ if (r != idn_success) {
+ if (new_label != NULL) {
+ free(new_label->name);
+ free(new_label->undo_name);
+ free(new_label);
+ }
+ if (head_label != NULL)
+ labellist_destroy(head_label);
+ }
+ return (r);
+}
+
+
+static void
+labellist_destroy(labellist_t label) {
+ labellist_t l, l_next;
+
+ for (l = label; l != NULL; l = l_next) {
+ l_next = l->next;
+ free(l->name);
+ free(l->undo_name);
+ free(l);
+ }
+}
+
+static idn_result_t
+labellist_setname(labellist_t label, const unsigned long *name) {
+ unsigned long *new_name;
+ size_t length, new_length;
+
+ length = idn_ucs4_strlen(name) + 1;
+ new_length = length + 15; /* add 15 for margin */
+
+ if (label->name_length < new_length) {
+ new_name = (unsigned long *)
+ realloc(label->name, sizeof(long) * new_length);
+ if (new_name == NULL)
+ return (idn_nomemory);
+ label->name = new_name;
+ label->name_length = new_length;
+ }
+ memcpy(label->name, name, sizeof(long) * length);
+
+ return (idn_success);
+}
+
+static const unsigned long *
+labellist_getname(labellist_t label) {
+ return (label->name);
+}
+
+static const unsigned long *
+labellist_gettldname(labellist_t label) {
+ labellist_t l;
+
+ if (label->previous == NULL && label->next == NULL &&
+ !label->dot_followed)
+ return (idn_mapselector_getnotld());
+
+ for (l = label; l->next != NULL; l = l->next)
+ ; /* nothing to be done */
+
+ return (l->name);
+}
+
+static idn_result_t
+labellist_getnamelist(labellist_t label, unsigned long *name,
+ size_t name_length) {
+ static const unsigned long dot_string[] = {0x002e, 0x0000}; /* "." */
+ size_t length;
+ labellist_t l;
+
+ for (l = label, length = 0; l != NULL; l = l->next)
+ length += idn_ucs4_strlen(l->name) + 1; /* name + `.' */
+ length++; /* for NUL */
+
+ if (name_length < length)
+ return (idn_buffer_overflow);
+
+ *name = '\0';
+ for (l = label; l != NULL; l = l->next) {
+ idn_ucs4_strcat(name, l->name);
+ name += idn_ucs4_strlen(name);
+ if (l->dot_followed)
+ idn_ucs4_strcat(name, dot_string);
+ }
+ return (idn_success);
+}
+
+static void
+labellist_undo(labellist_t label) {
+ size_t length;
+
+ length = idn_ucs4_strlen(label->undo_name) + 1;
+ memcpy(label->name, label->undo_name, sizeof(long) * length);
+}
+
+static labellist_t
+labellist_tail(labellist_t label) {
+ labellist_t l;
+
+ if (label == NULL)
+ return (NULL);
+ for (l = label; l->next != NULL; l = l->next)
+ ; /* nothing to be done */
+ return (l);
+}
+
+static labellist_t
+labellist_previous(labellist_t label) {
+ return (label->previous);
+}
+
+#ifndef WITHOUT_ICONV
+
+static idn_result_t
+label_localdecodecheck(idn_resconf_t ctx, labellist_t label) {
+ idn_converter_t local_converter = NULL;
+ const unsigned long *from;
+ char *to = NULL;
+ size_t to_length;
+ idn_result_t r;
+
+ from = labellist_getname(label);
+ to_length = idn_ucs4_strlen(from) + 1 + 15; /* 15 for margin */
+ TRACE(("res ucs4tolocal_check(label=\"%s\")\n",
+ idn__debug_ucs4xstring(from, 50)));
+
+ local_converter = idn_resconf_getlocalconverter(ctx);
+ if (local_converter == NULL) {
+ r = idn_success;
+ goto ret;
+ }
+
+ for (;;) {
+ char *new_buffer;
+
+ new_buffer = (char *)realloc(to, to_length);
+ if (new_buffer == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ to = new_buffer;
+ r = idn_converter_convfromucs4(local_converter, from, to,
+ to_length);
+ if (r == idn_success)
+ break;
+ else if (r == idn_nomapping) {
+ r = label_idnencode_ace(ctx, label);
+ if (r != idn_success)
+ goto ret;
+ break;
+ } else if (r != idn_buffer_overflow) {
+ goto ret;
+ }
+ to_length *= 2;
+ }
+
+ r = idn_success;
+ret:
+ TRACE(("res ucs4tolocal_check(): %s\n", idn_result_tostring(r)));
+ if (local_converter != NULL)
+ idn_converter_destroy(local_converter);
+ free(to);
+ return (r);
+}
+
+#endif /* !WITHOUT_ICONV */
+
+static idn_result_t
+label_idndecode(idn_resconf_t ctx, labellist_t label) {
+ idn_converter_t idn_converter = NULL;
+ const unsigned long *from;
+ char *ascii_from = NULL;
+ unsigned long *to = NULL;
+ size_t from_length, to_length;
+ idn_result_t r;
+
+ from = labellist_getname(label);
+ from_length = idn_ucs4_strlen(from) + 1;
+ TRACE(("res idntoucs4(label=\"%s\")\n",
+ idn__debug_ucs4xstring(from, 50)));
+
+ idn_converter = idn_resconf_getidnconverter(ctx);
+ if (idn_converter == NULL) {
+ r = idn_success;
+ goto ret;
+ }
+
+ for (;;) {
+ char *new_buffer;
+
+ new_buffer = (char *) realloc(ascii_from, from_length);
+ if (new_buffer == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ ascii_from = new_buffer;
+ r = idn_ucs4_ucs4toutf8(from, ascii_from, from_length);
+ if (r == idn_success)
+ break;
+ else if (r != idn_buffer_overflow)
+ goto ret;
+ from_length *= 2;
+ }
+
+ to = NULL;
+ to_length = from_length;
+
+ for (;;) {
+ unsigned long *new_buffer;
+
+ new_buffer = (unsigned long *)
+ realloc(to, sizeof(long) * to_length);
+ if (new_buffer == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ to = new_buffer;
+ r = idn_converter_convtoucs4(idn_converter, ascii_from, to,
+ to_length);
+ if (r == idn_success)
+ break;
+ else if (r != idn_buffer_overflow)
+ goto ret;
+ to_length *= 2;
+ }
+
+ r = labellist_setname(label, to);
+ret:
+ if (r == idn_success) {
+ TRACE(("res idntoucs4(): success (label=\"%s\")\n",
+ idn__debug_ucs4xstring(labellist_getname(label),
+ 50)));
+ } else {
+ TRACE(("res idntoucs4(): %s\n", idn_result_tostring(r)));
+ }
+ if (idn_converter != NULL)
+ idn_converter_destroy(idn_converter);
+ free(to);
+ free(ascii_from);
+ return (r);
+}
+
+static idn_result_t
+label_idnencode_ace(idn_resconf_t ctx, labellist_t label) {
+ idn_converter_t idn_converter = NULL;
+ const unsigned long *from;
+ char *ascii_to = NULL;
+ unsigned long *to = NULL;
+ size_t to_length;
+ idn_result_t r;
+
+ from = labellist_getname(label);
+ TRACE(("res ucs4toidn(label=\"%s\")\n",
+ idn__debug_ucs4xstring(from, 50)));
+
+ idn_converter = idn_resconf_getidnconverter(ctx);
+ if (idn_converter == NULL) {
+ r = idn_success;
+ goto ret;
+ }
+
+ ascii_to = NULL;
+ to_length = idn_ucs4_strlen(from) * 4 + 16; /* add mergin */
+
+ for (;;) {
+ char *new_buffer;
+
+ new_buffer = (char *) realloc(ascii_to, to_length);
+ if (new_buffer == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ ascii_to = new_buffer;
+ r = idn_converter_convfromucs4(idn_converter, from, ascii_to,
+ to_length);
+ if (r == idn_success)
+ break;
+ else if (r != idn_buffer_overflow)
+ goto ret;
+ to_length *= 2;
+ }
+
+ for (;;) {
+ unsigned long *new_buffer;
+
+ new_buffer = (unsigned long *)
+ realloc(to, sizeof(long) * to_length);
+ if (new_buffer == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ to = new_buffer;
+ r = idn_ucs4_utf8toucs4(ascii_to, to, to_length);
+ if (r == idn_success)
+ break;
+ else if (r != idn_buffer_overflow)
+ goto ret;
+ to_length *= 2;
+ }
+
+ if (r != idn_success)
+ goto ret;
+
+ r = labellist_setname(label, to);
+ret:
+ if (r == idn_success) {
+ TRACE(("res ucs4toidn(): success (label=\"%s\")\n",
+ idn__debug_ucs4xstring(labellist_getname(label),
+ 50)));
+ } else {
+ TRACE(("res ucs4toidn(): %s\n", idn_result_tostring(r)));
+ }
+ if (idn_converter != NULL)
+ idn_converter_destroy(idn_converter);
+ free(to);
+ free(ascii_to);
+ return (r);
+}
+
+static idn_result_t
+label_localmap(idn_resconf_t ctx, labellist_t label) {
+ const unsigned long *from;
+ const unsigned long *tld;
+ unsigned long *to = NULL;
+ size_t to_length;
+ idn_mapselector_t local_mapper;
+ idn_result_t r;
+
+ from = labellist_getname(label);
+ tld = labellist_gettldname(label);
+ TRACE(("res localmap(label=\"%s\", tld=\"%s\")\n",
+ idn__debug_ucs4xstring(from, 50),
+ idn__debug_ucs4xstring(tld, 50)));
+
+ local_mapper = idn_resconf_getlocalmapselector(ctx);
+ if (local_mapper == NULL) {
+ r = idn_success;
+ goto ret;
+ }
+
+ if (tld == from)
+ tld = idn_mapselector_getdefaulttld();
+ to_length = idn_ucs4_strlen(from) + 1 + 15; /* 15 for margin */
+
+ for (;;) {
+ unsigned long *new_buffer;
+
+ new_buffer = (unsigned long *)
+ realloc(to, sizeof(long) * to_length);
+ if (new_buffer == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ to = new_buffer;
+ r = idn_mapselector_map2(local_mapper, from, tld, to,
+ to_length);
+ if (r == idn_success)
+ break;
+ else if (r != idn_buffer_overflow)
+ goto ret;
+ to_length *= 2;
+ }
+
+ r = labellist_setname(label, to);
+ret:
+ if (r == idn_success) {
+ TRACE(("res localmap(): success (label=\"%s\")\n",
+ idn__debug_ucs4xstring(labellist_getname(label),
+ 50)));
+ } else {
+ TRACE(("res localmap(): %s\n", idn_result_tostring(r)));
+ }
+ if (local_mapper != NULL)
+ idn_mapselector_destroy(local_mapper);
+ free(to);
+ return (r);
+}
+
+static idn_result_t
+label_map(idn_resconf_t ctx, labellist_t label) {
+ const unsigned long *from;
+ unsigned long *to = NULL;
+ size_t to_length;
+ idn_mapper_t mapper;
+ idn_result_t r;
+
+ from = labellist_getname(label);
+ TRACE(("res map(label=\"%s\")\n", idn__debug_ucs4xstring(from, 50)));
+
+ mapper = idn_resconf_getmapper(ctx);
+ if (mapper == NULL) {
+ r = idn_success;
+ goto ret;
+ }
+ to_length = idn_ucs4_strlen(from) + 1 + 15; /* 15 for margin */
+
+ for (;;) {
+ unsigned long *new_buffer;
+
+ new_buffer = (unsigned long *)
+ realloc(to, sizeof(long) * to_length);
+ if (new_buffer == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ to = new_buffer;
+ r = idn_mapper_map(mapper, from, to, to_length);
+ if (r == idn_success)
+ break;
+ else if (r != idn_buffer_overflow)
+ goto ret;
+ to_length *= 2;
+ }
+
+ r = labellist_setname(label, to);
+ret:
+ if (r == idn_success) {
+ TRACE(("res map(): success (label=\"%s\")\n",
+ idn__debug_ucs4xstring(labellist_getname(label),
+ 50)));
+ } else {
+ TRACE(("res map(): %s\n", idn_result_tostring(r)));
+ }
+ if (mapper != NULL)
+ idn_mapper_destroy(mapper);
+ free(to);
+ return (r);
+}
+
+static idn_result_t
+label_normalize(idn_resconf_t ctx, labellist_t label) {
+ const unsigned long *from;
+ unsigned long *to = NULL;
+ size_t to_length;
+ idn_normalizer_t normalizer;
+ idn_result_t r;
+
+ from = labellist_getname(label);
+ TRACE(("res normalzie(label=\"%s\")\n",
+ idn__debug_ucs4xstring(from, 50)));
+
+ normalizer = idn_resconf_getnormalizer(ctx);
+ if (normalizer == NULL) {
+ r = idn_success;
+ goto ret;
+ }
+ to_length = idn_ucs4_strlen(from) + 1 + 15; /* 15 for margin */
+
+ for (;;) {
+ unsigned long *new_buffer;
+
+ new_buffer = (unsigned long *)
+ realloc(to, sizeof(long) * to_length);
+ if (new_buffer == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ to = new_buffer;
+ r = idn_normalizer_normalize(normalizer, from, to, to_length);
+ if (r == idn_success)
+ break;
+ else if (r != idn_buffer_overflow)
+ goto ret;
+ to_length *= 2;
+ }
+
+ r = labellist_setname(label, to);
+ret:
+ if (r == idn_success) {
+ TRACE(("res normalize(): success (label=\"%s\")\n",
+ idn__debug_ucs4xstring(labellist_getname(label),
+ 50)));
+ } else {
+ TRACE(("res normalize(): %s\n", idn_result_tostring(r)));
+ }
+ if (normalizer != NULL)
+ idn_normalizer_destroy(normalizer);
+ free(to);
+ return (r);
+}
+
+static idn_result_t
+label_prohcheck(idn_resconf_t ctx, labellist_t label) {
+ const unsigned long *name, *found;
+ idn_checker_t prohibit_checker;
+ idn_result_t r;
+
+ name = labellist_getname(label);
+ TRACE(("res prohcheck(label=\"%s\")\n",
+ idn__debug_ucs4xstring(name, 50)));
+
+ prohibit_checker = idn_resconf_getprohibitchecker(ctx);
+ if (prohibit_checker == NULL) {
+ r = idn_success;
+ goto ret;
+ }
+
+ r = idn_checker_lookup(prohibit_checker, name, &found);
+ idn_checker_destroy(prohibit_checker);
+ if (r == idn_success && found != NULL)
+ r = idn_prohibited;
+
+ret:
+ TRACE(("res prohcheck(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+static idn_result_t
+label_unascheck(idn_resconf_t ctx, labellist_t label) {
+ const unsigned long *name, *found;
+ idn_checker_t unassigned_checker;
+ idn_result_t r;
+
+ name = labellist_getname(label);
+ TRACE(("res unascheck(label=\"%s\")\n",
+ idn__debug_ucs4xstring(name, 50)));
+
+ unassigned_checker = idn_resconf_getunassignedchecker(ctx);
+ if (unassigned_checker == NULL) {
+ r = idn_success;
+ goto ret;
+ }
+
+ r = idn_checker_lookup(unassigned_checker, name, &found);
+ idn_checker_destroy(unassigned_checker);
+ if (r == idn_success && found != NULL)
+ r = idn_prohibited;
+
+ret:
+ TRACE(("res unascheck(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+static idn_result_t
+label_bidicheck(idn_resconf_t ctx, labellist_t label) {
+ const unsigned long *name, *found;
+ idn_checker_t bidi_checker;
+ idn_result_t r;
+
+ name = labellist_getname(label);
+ TRACE(("res bidicheck(label=\"%s\")\n",
+ idn__debug_ucs4xstring(name, 50)));
+
+ bidi_checker = idn_resconf_getbidichecker(ctx);
+ if (bidi_checker == NULL) {
+ r = idn_success;
+ goto ret;
+ }
+
+ r = idn_checker_lookup(bidi_checker, name, &found);
+ idn_checker_destroy(bidi_checker);
+ if (r == idn_success && found != NULL)
+ r = idn_prohibited;
+
+ret:
+ TRACE(("res bidicheck(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+static idn_result_t
+label_asccheck(idn_resconf_t ctx, labellist_t label) {
+ const unsigned long *name, *n;
+ idn_result_t r;
+
+ name = labellist_getname(label);
+ TRACE(("res asccheck(label=\"%s\")\n",
+ idn__debug_ucs4xstring(name, 50)));
+
+ if (*name == '-') {
+ r = idn_prohibited;
+ goto ret;
+ }
+
+ for (n = name; *n != '\0'; n++) {
+ if (*n <= '\177') {
+ if ((*n < '0' || *n > '9') &&
+ (*n < 'A' || *n > 'Z') &&
+ (*n < 'a' || *n > 'z') &&
+ *n != '-') {
+ r = idn_prohibited;
+ goto ret;
+ }
+ }
+ }
+
+ if (n > name && *(n - 1) == '-') {
+ r = idn_prohibited;
+ goto ret;
+ }
+
+ r = idn_success;
+ret:
+ TRACE(("res asccheck(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+static idn_result_t
+label_lencheck_ace(idn_resconf_t ctx, labellist_t label) {
+ const unsigned long *name;
+ size_t name_length;
+ idn_result_t r;
+
+ name = labellist_getname(label);
+ name_length = idn_ucs4_strlen(name);
+ TRACE(("res lencheck(label=\"%s\")\n",
+ idn__debug_ucs4xstring(name, 50)));
+
+ if (name_length == 0 || name_length > MAX_LABEL_LENGTH) {
+ r = idn_invalid_length;
+ goto ret;
+ }
+
+ r = idn_success;
+ret:
+ TRACE(("res lencheck(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+static idn_result_t
+label_lencheck_nonace(idn_resconf_t ctx, labellist_t label) {
+ idn_converter_t idn_converter;
+ const unsigned long *from;
+ size_t to_length;
+ idn_result_t r;
+ char *buffer = NULL;
+ size_t buffer_length;
+
+ from = labellist_getname(label);
+ TRACE(("res lencheck(label=\"%s\")\n",
+ idn__debug_ucs4xstring(from, 50)));
+
+ buffer_length = idn_ucs4_strlen(from) * 4 + 16; /* 16 for margin */
+ idn_converter = idn_resconf_getidnconverter(ctx);
+
+ for (;;) {
+ void *new_buffer;
+
+ new_buffer = realloc(buffer, sizeof(*buffer) * buffer_length);
+ if (new_buffer == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+ buffer = (char *)new_buffer;
+
+ if (idn_converter != NULL) {
+ r = idn_converter_convfromucs4(idn_converter, from,
+ buffer, buffer_length);
+ } else {
+ r = idn_ucs4_ucs4toutf8(from, buffer, buffer_length);
+ }
+ if (r == idn_success)
+ break;
+ else if (r != idn_buffer_overflow)
+ goto ret;
+
+ buffer_length *= 2;
+ }
+
+ to_length = strlen(buffer);
+ if (to_length == 0 || to_length > MAX_LABEL_LENGTH) {
+ r = idn_invalid_length;
+ goto ret;
+ }
+
+ r = idn_success;
+ret:
+ TRACE(("res lencheck(): %s\n", idn_result_tostring(r)));
+ if (idn_converter != NULL)
+ idn_converter_destroy(idn_converter);
+ free(buffer);
+ return (r);
+}
+
+static idn_result_t
+label_rtcheck(idn_resconf_t ctx, idn_action_t actions, labellist_t label,
+ const unsigned long *original_name) {
+ labellist_t rt_label = NULL;
+ const unsigned long *rt_name;
+ const unsigned long *cur_name;
+ idn_result_t r;
+
+ cur_name = labellist_getname(label);
+ TRACE(("res rtcheck(label=\"%s\", org_label=\"%s\")\n",
+ idn__debug_ucs4xstring(cur_name, 50),
+ idn__debug_ucs4xstring(original_name, 50)));
+
+ r = labellist_create(cur_name, &rt_label);
+ if (r != idn_success)
+ goto ret;
+ if (rt_label == NULL) {
+ if (*original_name == '\0')
+ r = idn_success;
+ else
+ r = idn_invalid_encoding;
+ goto ret;
+ }
+
+ if (!idn__util_ucs4isasciirange(labellist_getname(rt_label))) {
+ r = label_map(ctx, rt_label);
+ if (r != idn_success)
+ goto ret;
+ r = label_normalize(ctx, rt_label);
+ if (r != idn_success)
+ goto ret;
+ r = label_prohcheck(ctx, rt_label);
+ if (r != idn_success)
+ goto ret;
+ if (actions & IDN_UNASCHECK) {
+ r = label_unascheck(ctx, rt_label);
+ if (r != idn_success)
+ goto ret;
+ }
+ r = label_bidicheck(ctx, rt_label);
+ if (r != idn_success)
+ goto ret;
+ }
+
+ if (actions & IDN_ASCCHECK) {
+ r = label_asccheck(ctx, rt_label);
+ if (r != idn_success)
+ goto ret;
+ }
+ if (!idn__util_ucs4isasciirange(labellist_getname(rt_label))) {
+ r = label_idnencode_ace(ctx, rt_label);
+ if (r != idn_success)
+ goto ret;
+ }
+ r = label_lencheck_ace(ctx, rt_label);
+ if (r != idn_success)
+ goto ret;
+ rt_name = labellist_getname(rt_label);
+
+ if (idn_ucs4_strcasecmp(rt_name, original_name) != 0) {
+ TRACE(("res rtcheck(): round trip failed, org =\"%s\", rt=\"%s\"\n",
+ idn__debug_ucs4xstring(original_name, 50),
+ idn__debug_ucs4xstring(rt_name, 50)));
+ r = idn_invalid_encoding;
+ goto ret;
+ }
+
+ r = idn_success;
+ret:
+ if (r != idn_nomemory && r != idn_success)
+ r = idn_invalid_encoding;
+ TRACE(("res rtcheck(): %s\n", idn_result_tostring(r)));
+ if (rt_label != NULL)
+ labellist_destroy(rt_label);
+ return (r);
+}
+
+const char *
+idn__res_actionstostring(idn_action_t actions) {
+ static char buf[100];
+
+ buf[0] = '\0';
+
+ if (actions == IDN_ENCODE_QUERY)
+ strcpy(buf, "encode-query");
+ else if (actions == IDN_DECODE_QUERY)
+ strcpy(buf, "decode-query");
+ else if (actions == IDN_ENCODE_APP)
+ strcpy(buf, "encode-app");
+ else if (actions == IDN_DECODE_APP)
+ strcpy(buf, "decode-app");
+ else if (actions == IDN_ENCODE_STORED)
+ strcpy(buf, "encode-stored");
+ else if (actions == IDN_DECODE_STORED)
+ strcpy(buf, "decode-stored");
+ else {
+ if (actions & IDN_LOCALCONV)
+ strcat(buf, "|localconv");
+ if (actions & IDN_DELIMMAP)
+ strcat(buf, "|delimmap");
+ if (actions & IDN_LOCALMAP)
+ strcat(buf, "|localmap");
+
+ if (actions & IDN_MAP)
+ strcat(buf, "|map");
+ if (actions & IDN_NORMALIZE)
+ strcat(buf, "|normalize");
+ if (actions & IDN_PROHCHECK)
+ strcat(buf, "|prohcheck");
+ if (actions & IDN_UNASCHECK)
+ strcat(buf, "|unascheck");
+ if (actions & IDN_BIDICHECK)
+ strcat(buf, "|bidicheck");
+
+ if (actions & IDN_IDNCONV)
+ strcat(buf, "|idnconv");
+ if (actions & IDN_ASCCHECK)
+ strcat(buf, "|asccheck");
+ if (actions & IDN_LENCHECK)
+ strcat(buf, "|lencheck");
+ if (actions & IDN_RTCHECK)
+ strcat(buf, "|rtcheck");
+ }
+
+ if (buf[0] == '|')
+ return (buf + 1);
+ else
+ return (buf);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/resconf.c b/contrib/idn/idnkit-1.0-src/lib/resconf.c
new file mode 100644
index 0000000..29bbeea
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/resconf.c
@@ -0,0 +1,1477 @@
+#ifndef lint
+static char *rcsid = "$Id: resconf.c,v 1.1.1.1 2003/06/04 00:26:12 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+
+#include <idn/result.h>
+#include <idn/assert.h>
+#include <idn/logmacro.h>
+#include <idn/converter.h>
+#include <idn/nameprep.h>
+#include <idn/normalizer.h>
+#include <idn/checker.h>
+#include <idn/mapper.h>
+#include <idn/mapselector.h>
+#include <idn/delimitermap.h>
+#include <idn/localencoding.h>
+#include <idn/resconf.h>
+#include <idn/debug.h>
+#include <idn/util.h>
+
+#ifdef WIN32
+#define MAX_PATH_SIZE 500 /* a good longer than MAX_PATH */
+#define IDNVAL_CONFFILE "ConfFile"
+#else /* WIN32 */
+
+#ifndef IDN_RESCONF_DIR
+#define IDN_RESCONF_DIR "/etc"
+#endif
+#define IDN_RESCONF_FILE IDN_RESCONF_DIR "/idn.conf"
+#define IDN_USER_RESCONF_FILE "/.idnrc"
+
+#endif /* WIN32 */
+
+#define MAX_CONF_LINE_LENGTH 255
+#define MAX_CONF_LINE_ARGS 63
+
+#define DEFAULT_CONF_NAMEPREP 0x0001
+#define DEFAULT_CONF_IDN_ENCODING 0x0010
+#define DEFAULT_CONF_ALL (DEFAULT_CONF_NAMEPREP | \
+ DEFAULT_CONF_IDN_ENCODING)
+
+#define IDN_ENCODING_CURRENT "Punycode"
+
+#ifdef ENABLE_MDNKIT_COMPAT
+#define MDN_RESCONF_FILE IDN_RESCONF_DIR "/mdn.conf"
+#endif
+
+struct idn_resconf {
+ int local_converter_is_static;
+ idn_converter_t local_converter;
+ idn_converter_t idn_converter;
+ idn_converter_t aux_idn_converter;
+ idn_normalizer_t normalizer;
+ idn_checker_t prohibit_checker;
+ idn_checker_t unassigned_checker;
+ idn_checker_t bidi_checker;
+ idn_mapper_t mapper;
+ idn_mapselector_t local_mapper;
+ idn_delimitermap_t delimiter_mapper;
+ int reference_count;
+};
+
+static int initialized;
+
+#ifndef WIN32
+static const char * userhomedir(void);
+#endif
+static idn_result_t open_userdefaultfile(FILE **fpp);
+static idn_result_t open_defaultfile(FILE **fpp);
+static idn_result_t parse_conf(idn_resconf_t ctx, FILE *fp);
+static idn_result_t parse_idn_encoding(idn_resconf_t ctx, char *args,
+ int lineno);
+static idn_result_t parse_local_map(idn_resconf_t ctx, char *args,
+ int lineno);
+static idn_result_t parse_nameprep(idn_resconf_t ctx, char *args,
+ int lineno);
+static int split_args(char *s, char **av, int max_ac);
+static void resetconf(idn_resconf_t ctx);
+#ifndef WITHOUT_ICONV
+static idn_result_t update_local_converter(idn_resconf_t ctx);
+#endif
+static idn_result_t setdefaults_body(idn_resconf_t ctx, int conf_mask);
+
+idn_result_t
+idn_resconf_initialize(void) {
+ idn_result_t r;
+
+ TRACE(("idn_resconf_initialize()\n"));
+
+ if (initialized) {
+ r = idn_success;
+ goto ret;
+ }
+
+ /*
+ * Initialize sub modules.
+ */
+ if ((r = idn_converter_initialize()) != idn_success)
+ goto ret;
+ if ((r = idn_normalizer_initialize()) != idn_success)
+ goto ret;
+ if ((r = idn_checker_initialize()) != idn_success)
+ goto ret;
+ if ((r = idn_mapselector_initialize()) != idn_success)
+ goto ret;
+ if ((r = idn_mapper_initialize()) != idn_success)
+ goto ret;
+
+ r = idn_success;
+ initialized = 1;
+ret:
+ TRACE(("idn_resconf_initialize(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+idn_result_t
+idn_resconf_create(idn_resconf_t *ctxp) {
+ idn_resconf_t ctx = NULL;
+ idn_result_t r;
+
+ assert(ctxp != NULL);
+
+ TRACE(("idn_resconf_create()\n"));
+
+ if (!initialized) {
+ r = idn_failure;
+ goto ret;
+ }
+ if ((ctx = malloc(sizeof(*ctx))) == NULL) {
+ r = idn_nomemory;
+ goto ret;
+ }
+
+ ctx->local_converter_is_static = 0;
+ ctx->local_converter = NULL;
+ ctx->idn_converter = NULL;
+ ctx->aux_idn_converter = NULL;
+ ctx->normalizer = NULL;
+ ctx->prohibit_checker = NULL;
+ ctx->unassigned_checker = NULL;
+ ctx->bidi_checker = NULL;
+ ctx->mapper = NULL;
+ ctx->local_mapper = NULL;
+ ctx->reference_count = 1;
+
+ r = idn_delimitermap_create(&ctx->delimiter_mapper);
+ if (r != idn_success)
+ goto ret;
+
+ *ctxp = ctx;
+ r = idn_success;
+ret:
+ TRACE(("idn_resconf_create(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+char *
+idn_resconf_defaultfile() {
+#ifdef WIN32
+ static char default_path[MAX_PATH_SIZE];
+
+ if (idn__util_getregistrystring(idn__util_hkey_localmachine,
+ IDNVAL_CONFFILE, default_path,
+ sizeof(default_path))) {
+ return (default_path);
+ } else {
+ return (NULL);
+ }
+#else
+ return (IDN_RESCONF_FILE);
+#endif
+}
+
+#ifndef WIN32
+static const char *
+userhomedir() {
+ uid_t uid;
+ struct passwd *pwd;
+
+ uid = getuid();
+ pwd = getpwuid(uid);
+ if (pwd == NULL) {
+ return (NULL);
+ }
+
+ return (pwd->pw_dir);
+}
+#endif
+
+static idn_result_t
+open_userdefaultfile(FILE **fpp) {
+#ifdef WIN32
+ char user_path[MAX_PATH_SIZE];
+
+ TRACE(("open_userdefaultfile()\n"));
+
+ if (idn__util_getregistrystring(idn__util_hkey_currentuser,
+ IDNVAL_CONFFILE, user_path,
+ sizeof(user_path)) == 0) {
+ return (idn_nofile);
+ }
+ *fpp = fopen(user_path, "r");
+ if (*fpp == NULL) {
+ return (idn_nofile);
+ }
+ return (idn_success);
+#else /* WIN32 */
+ const char *homedir;
+ char *file;
+ int len;
+
+ TRACE(("open_userdefaultfile()\n"));
+
+ homedir = userhomedir();
+ len = strlen(IDN_USER_RESCONF_FILE) + 1;
+ if (homedir != NULL) {
+ len += strlen(homedir);
+ } else {
+ return (idn_notfound);
+ }
+
+ file = (char *)malloc(sizeof(char) * len);
+ if (file == NULL) {
+ WARNING(("open_userdefaultfile(): malloc failed\n"));
+ return (idn_nomemory);
+ }
+
+ (void)strcpy(file, homedir);
+ strcat(file, IDN_USER_RESCONF_FILE);
+
+ *fpp = fopen(file, "r");
+ free(file);
+ if (*fpp == NULL) {
+ return (idn_nofile);
+ }
+
+ return (idn_success);
+#endif /* WIN32 */
+}
+
+static idn_result_t
+open_defaultfile(FILE **fpp) {
+ idn_result_t r;
+ const char *file;
+
+ r = open_userdefaultfile(fpp);
+ if (r == idn_nofile || r == idn_notfound) {
+ TRACE(("open_defaultfile: "
+ "cannot open user configuration file\n"));
+ file = idn_resconf_defaultfile();
+ *fpp = fopen(file, "r");
+#ifdef ENABLE_MDNKIT_COMPAT
+ if (*fpp == NULL)
+ *fpp = fopen(MDN_RESCONF_FILE, "r");
+#endif
+ if (*fpp == NULL) {
+ TRACE(("open_defaultfile: "
+ "cannot open system configuration file\n"));
+ return (idn_nofile);
+ }
+ } else if (r != idn_success) {
+ return (r);
+ }
+
+ return (idn_success);
+}
+
+idn_result_t
+idn_resconf_loadfile(idn_resconf_t ctx, const char *file) {
+ FILE *fp = NULL;
+ idn_result_t r;
+
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_loadfile(file=%s)\n",
+ file == NULL ? "<null>" : file));
+
+ resetconf(ctx);
+ r = idn_delimitermap_create(&ctx->delimiter_mapper);
+ if (r != idn_success) {
+ goto ret;
+ }
+
+ if (file == NULL) {
+ r = open_defaultfile(&fp);
+ if (r == idn_nofile || r == idn_notfound) {
+ r = setdefaults_body(ctx, 0);
+ goto ret;
+ } else if (r != idn_success) {
+ goto ret;
+ }
+ } else {
+ fp = fopen(file, "r");
+ if (fp == NULL) {
+ TRACE(("idn_resconf_loadfile: cannot open %-.40s\n",
+ file));
+ r = idn_nofile;
+ goto ret;
+ }
+ }
+
+ r = parse_conf(ctx, fp);
+ fclose(fp);
+
+ret:
+ TRACE(("idn_resconf_loadfile(): %s\n", idn_result_tostring(r)));
+ return (r);
+}
+
+void
+idn_resconf_destroy(idn_resconf_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_destroy()\n"));
+
+ ctx->reference_count--;
+ if (ctx->reference_count <= 0) {
+ resetconf(ctx);
+ free(ctx);
+ TRACE(("idn_resconf_destroy: the object is destroyed\n"));
+ } else {
+ TRACE(("idn_resconf_destroy(): "
+ "update reference count (%d->%d)\n",
+ ctx->reference_count + 1, ctx->reference_count));
+ }
+}
+
+void
+idn_resconf_incrref(idn_resconf_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_incrref()\n"));
+ TRACE(("idn_resconf_incrref: update reference count (%d->%d)\n",
+ ctx->reference_count, ctx->reference_count + 1));
+
+ ctx->reference_count++;
+}
+
+idn_converter_t
+idn_resconf_getalternateconverter(idn_resconf_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_getalternateconverter()\n"));
+
+ return (idn_resconf_getidnconverter(ctx));
+}
+
+idn_delimitermap_t
+idn_resconf_getdelimitermap(idn_resconf_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_getdelimitermap()\n"));
+
+ if (ctx->delimiter_mapper != NULL)
+ idn_delimitermap_incrref(ctx->delimiter_mapper);
+ return (ctx->delimiter_mapper);
+}
+
+idn_converter_t
+idn_resconf_getidnconverter(idn_resconf_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_getidnconverter()\n"));
+
+ if (ctx->idn_converter != NULL)
+ idn_converter_incrref(ctx->idn_converter);
+ return (ctx->idn_converter);
+}
+
+idn_converter_t
+idn_resconf_getauxidnconverter(idn_resconf_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_getauxidnconverter()\n"));
+
+ if (ctx->aux_idn_converter != NULL)
+ idn_converter_incrref(ctx->aux_idn_converter);
+ return (ctx->aux_idn_converter);
+}
+
+idn_converter_t
+idn_resconf_getlocalconverter(idn_resconf_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_getlocalconverter()\n"));
+
+#ifdef WITHOUT_ICONV
+ return NULL;
+
+#else /* WITHOUT_ICONV */
+ if (update_local_converter(ctx) != idn_success)
+ return (NULL);
+
+ idn_converter_incrref(ctx->local_converter);
+ return (ctx->local_converter);
+
+#endif /* WITHOUT_ICONV */
+}
+
+idn_mapselector_t
+idn_resconf_getlocalmapselector(idn_resconf_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_getlocalmapselector()\n"));
+
+ if (ctx->local_mapper != NULL)
+ idn_mapselector_incrref(ctx->local_mapper);
+ return (ctx->local_mapper);
+}
+
+idn_mapper_t
+idn_resconf_getmapper(idn_resconf_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_getmapper()\n"));
+
+ if (ctx->mapper != NULL)
+ idn_mapper_incrref(ctx->mapper);
+ return (ctx->mapper);
+}
+
+idn_normalizer_t
+idn_resconf_getnormalizer(idn_resconf_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_getnormalizer()\n"));
+
+ if (ctx->normalizer != NULL)
+ idn_normalizer_incrref(ctx->normalizer);
+ return (ctx->normalizer);
+}
+
+idn_checker_t
+idn_resconf_getprohibitchecker(idn_resconf_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_getprohibitchecker()\n"));
+
+ if (ctx->prohibit_checker != NULL)
+ idn_checker_incrref(ctx->prohibit_checker);
+ return (ctx->prohibit_checker);
+}
+
+idn_checker_t
+idn_resconf_getunassignedchecker(idn_resconf_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_getunassignedchecker()\n"));
+
+ if (ctx->unassigned_checker != NULL)
+ idn_checker_incrref(ctx->unassigned_checker);
+ return (ctx->unassigned_checker);
+}
+
+idn_checker_t
+idn_resconf_getbidichecker(idn_resconf_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_getbidichecker()\n"));
+
+ if (ctx->bidi_checker != NULL)
+ idn_checker_incrref(ctx->bidi_checker);
+ return (ctx->bidi_checker);
+}
+
+void
+idn_resconf_setalternateconverter(idn_resconf_t ctx,
+ idn_converter_t alternate_converter) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_setalternateconverter()\n"));
+}
+
+void
+idn_resconf_setdelimitermap(idn_resconf_t ctx,
+ idn_delimitermap_t delimiter_mapper) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_setdelimitermap()\n"));
+
+ if (ctx->delimiter_mapper != NULL)
+ idn_delimitermap_destroy(ctx->delimiter_mapper);
+ ctx->delimiter_mapper = delimiter_mapper;
+ if (delimiter_mapper != NULL)
+ idn_delimitermap_incrref(ctx->delimiter_mapper);
+}
+
+void
+idn_resconf_setidnconverter(idn_resconf_t ctx,
+ idn_converter_t idn_converter) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_setidnconverter()\n"));
+
+ if (ctx->idn_converter != NULL)
+ idn_converter_destroy(ctx->idn_converter);
+ ctx->idn_converter = idn_converter;
+ if (idn_converter != NULL)
+ idn_converter_incrref(ctx->idn_converter);
+}
+
+void
+idn_resconf_setauxidnconverter(idn_resconf_t ctx,
+ idn_converter_t aux_idn_converter) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_setauxidnconverter()\n"));
+
+ if (ctx->aux_idn_converter != NULL)
+ idn_converter_destroy(ctx->aux_idn_converter);
+ ctx->aux_idn_converter = aux_idn_converter;
+ if (aux_idn_converter != NULL)
+ idn_converter_incrref(ctx->aux_idn_converter);
+}
+
+void
+idn_resconf_setlocalconverter(idn_resconf_t ctx,
+ idn_converter_t local_converter) {
+#ifndef WITHOUT_ICONV
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_setlocalconverter()\n"));
+
+ if (ctx->local_converter != NULL) {
+ idn_converter_destroy(ctx->local_converter);
+ ctx->local_converter = NULL;
+ }
+
+ if (local_converter == NULL)
+ ctx->local_converter_is_static = 0;
+ else {
+ ctx->local_converter = local_converter;
+ idn_converter_incrref(local_converter);
+ ctx->local_converter_is_static = 1;
+ }
+#endif /* WITHOUT_ICONV */
+}
+
+void
+idn_resconf_setlocalmapselector(idn_resconf_t ctx,
+ idn_mapselector_t local_mapper) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_setlocalmapselector()\n"));
+
+ if (ctx->local_mapper != NULL)
+ idn_mapselector_destroy(ctx->local_mapper);
+ ctx->local_mapper = local_mapper;
+ if (local_mapper != NULL)
+ idn_mapselector_incrref(ctx->local_mapper);
+}
+
+void
+idn_resconf_setmapper(idn_resconf_t ctx, idn_mapper_t mapper) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_setmapper()\n"));
+
+ if (ctx->mapper != NULL)
+ idn_mapper_destroy(ctx->mapper);
+ ctx->mapper = mapper;
+ if (mapper != NULL)
+ idn_mapper_incrref(ctx->mapper);
+}
+
+void
+idn_resconf_setnormalizer(idn_resconf_t ctx, idn_normalizer_t normalizer) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_setnormalizer()\n"));
+
+ if (ctx->normalizer != NULL)
+ idn_normalizer_destroy(ctx->normalizer);
+ ctx->normalizer = normalizer;
+ if (normalizer != NULL)
+ idn_normalizer_incrref(ctx->normalizer);
+}
+
+void
+idn_resconf_setprohibitchecker(idn_resconf_t ctx,
+ idn_checker_t prohibit_checker) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_setprohibitchecker()\n"));
+
+ if (ctx->prohibit_checker != NULL)
+ idn_checker_destroy(ctx->prohibit_checker);
+ ctx->prohibit_checker = prohibit_checker;
+ if (prohibit_checker != NULL)
+ idn_checker_incrref(ctx->prohibit_checker);
+}
+
+void
+idn_resconf_setunassignedchecker(idn_resconf_t ctx,
+ idn_checker_t unassigned_checker) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_setunassignedchecker()\n"));
+
+ if (ctx->unassigned_checker != NULL)
+ idn_checker_destroy(ctx->unassigned_checker);
+ ctx->unassigned_checker = unassigned_checker;
+ if (unassigned_checker != NULL)
+ idn_checker_incrref(ctx->unassigned_checker);
+}
+
+void
+idn_resconf_setbidichecker(idn_resconf_t ctx,
+ idn_checker_t bidi_checker) {
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_setbidichecker()\n"));
+
+ if (ctx->bidi_checker != NULL)
+ idn_checker_destroy(ctx->bidi_checker);
+ ctx->bidi_checker = bidi_checker;
+ if (bidi_checker != NULL)
+ idn_checker_incrref(ctx->bidi_checker);
+}
+
+idn_result_t
+idn_resconf_setnameprepversion(idn_resconf_t ctx, const char *version)
+{
+ char prohibit_scheme_name[MAX_CONF_LINE_LENGTH + 1];
+ char unassigned_scheme_name[MAX_CONF_LINE_LENGTH + 1];
+ char bidi_scheme_name[MAX_CONF_LINE_LENGTH + 1];
+ idn_mapper_t mapper = NULL;
+ idn_normalizer_t normalizer = NULL;
+ idn_checker_t prohibit_checker = NULL;
+ idn_checker_t unassigned_checker = NULL;
+ idn_checker_t bidi_checker = NULL;
+ idn_result_t r;
+
+ assert(ctx != NULL && version != NULL);
+
+ TRACE(("idn_resconf_setnameprepversion()\n"));
+
+ /*
+ * Set canonical scheme names.
+ */
+ if (strlen(version) + strlen(IDN_CHECKER_PROHIBIT_PREFIX)
+ > MAX_CONF_LINE_LENGTH) {
+ r = idn_invalid_name;
+ goto failure;
+ }
+ sprintf(prohibit_scheme_name, "%s%s",
+ IDN_CHECKER_PROHIBIT_PREFIX, version);
+
+ if (strlen(version) + strlen(IDN_CHECKER_UNASSIGNED_PREFIX)
+ > MAX_CONF_LINE_LENGTH) {
+ r = idn_invalid_name;
+ goto failure;
+ }
+ sprintf(unassigned_scheme_name, "%s%s",
+ IDN_CHECKER_UNASSIGNED_PREFIX, version);
+
+ if (strlen(version) + strlen(IDN_CHECKER_BIDI_PREFIX)
+ > MAX_CONF_LINE_LENGTH) {
+ r = idn_invalid_name;
+ goto failure;
+ }
+ sprintf(bidi_scheme_name, "%s%s",
+ IDN_CHECKER_BIDI_PREFIX, version);
+
+ /*
+ * Create objects.
+ */
+ r = idn_mapper_create(&mapper);
+ if (r != idn_success)
+ goto failure;
+ r = idn_normalizer_create(&normalizer);
+ if (r != idn_success)
+ goto failure;
+ r = idn_checker_create(&prohibit_checker);
+ if (r != idn_success)
+ goto failure;
+ r = idn_checker_create(&unassigned_checker);
+ if (r != idn_success)
+ goto failure;
+ r = idn_checker_create(&bidi_checker);
+ if (r != idn_success)
+ goto failure;
+
+ r = idn_mapper_add(mapper, version);
+ if (r != idn_success)
+ goto failure;
+ r = idn_normalizer_add(normalizer, version);
+ if (r != idn_success)
+ goto failure;
+ r = idn_checker_add(prohibit_checker, prohibit_scheme_name);
+ if (r != idn_success)
+ goto failure;
+ r = idn_checker_add(unassigned_checker, unassigned_scheme_name);
+ if (r != idn_success)
+ goto failure;
+ r = idn_checker_add(bidi_checker, bidi_scheme_name);
+ if (r != idn_success)
+ goto failure;
+
+ /*
+ * Set the objects.
+ */
+ idn_resconf_setmapper(ctx, mapper);
+ idn_resconf_setnormalizer(ctx, normalizer);
+ idn_resconf_setprohibitchecker(ctx, prohibit_checker);
+ idn_resconf_setunassignedchecker(ctx, unassigned_checker);
+ idn_resconf_setbidichecker(ctx, bidi_checker);
+
+ /*
+ * Destroy the objects.
+ */
+ idn_mapper_destroy(mapper);
+ idn_normalizer_destroy(normalizer);
+ idn_checker_destroy(prohibit_checker);
+ idn_checker_destroy(unassigned_checker);
+ idn_checker_destroy(bidi_checker);
+
+ return (idn_success);
+
+failure:
+ if (mapper != NULL)
+ idn_mapper_destroy(mapper);
+ if (normalizer != NULL)
+ idn_normalizer_destroy(normalizer);
+ if (prohibit_checker != NULL)
+ idn_checker_destroy(prohibit_checker);
+ if (unassigned_checker != NULL)
+ idn_checker_destroy(unassigned_checker);
+ if (bidi_checker != NULL)
+ idn_checker_destroy(bidi_checker);
+
+ return (r);
+}
+
+idn_result_t
+idn_resconf_setalternateconvertername(idn_resconf_t ctx, const char *name,
+ int flags) {
+ assert(ctx != NULL && name != NULL);
+
+ TRACE(("idn_resconf_setalternateconvertername(name=%s, flags=%d)\n",
+ name, flags));
+
+ return (idn_success);
+}
+
+idn_result_t
+idn_resconf_setidnconvertername(idn_resconf_t ctx, const char *name,
+ int flags) {
+ idn_converter_t idn_converter;
+ idn_result_t r;
+
+ assert(ctx != NULL && name != NULL);
+
+ TRACE(("idn_resconf_setidnconvertername(name=%s, flags=%d)\n",
+ name, flags));
+
+ r = idn_converter_create(name, &idn_converter, flags);
+ if (r != idn_success)
+ return (r);
+
+ if (ctx->idn_converter != NULL)
+ idn_converter_destroy(ctx->idn_converter);
+ ctx->idn_converter = idn_converter;
+
+ return (idn_success);
+}
+
+idn_result_t
+idn_resconf_setauxidnconvertername(idn_resconf_t ctx, const char *name,
+ int flags) {
+ idn_converter_t aux_idn_converter;
+ const char *old_name;
+ idn_result_t r;
+
+ assert(ctx != NULL && name != NULL);
+
+ TRACE(("idn_resconf_setauxidnconvertername(name=%s, flags=%d)\n",
+ name, flags));
+
+ if (ctx->aux_idn_converter != NULL) {
+ old_name = idn_converter_localencoding(ctx->aux_idn_converter);
+ if (old_name != NULL && strcmp(old_name, name) == 0)
+ return (idn_success);
+ }
+
+ r = idn_converter_create(name, &aux_idn_converter, flags);
+ if (r != idn_success)
+ return (r);
+
+ if (ctx->aux_idn_converter != NULL)
+ idn_converter_destroy(ctx->aux_idn_converter);
+ ctx->aux_idn_converter = aux_idn_converter;
+
+ return (idn_success);
+}
+
+idn_result_t
+idn_resconf_setlocalconvertername(idn_resconf_t ctx, const char *name,
+ int flags) {
+#ifdef WITHOUT_ICONV
+ return idn_failure;
+
+#else /* WITHOUT_ICONV */
+ idn_converter_t local_converter;
+ idn_result_t r;
+
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_setlocalconvertername(name=%s, flags=%d)\n",
+ name == NULL ? "<null>" : name, flags));
+
+ if (ctx->local_converter != NULL) {
+ idn_converter_destroy(ctx->local_converter);
+ ctx->local_converter = NULL;
+ }
+ ctx->local_converter_is_static = 0;
+
+ if (name != NULL) {
+ r = idn_converter_create(name, &local_converter, flags);
+ if (r != idn_success)
+ return (r);
+ ctx->local_converter = local_converter;
+ ctx->local_converter_is_static = 1;
+ }
+
+ return (idn_success);
+
+#endif /* WITHOUT_ICONV */
+}
+
+idn_result_t
+idn_resconf_addalldelimitermapucs(idn_resconf_t ctx, unsigned long *v,
+ int nv) {
+ idn_result_t r;
+
+ TRACE(("idn_resconf_addalldelimitermapucs(nv=%d)\n", nv));
+
+ if (ctx->delimiter_mapper == NULL) {
+ r = idn_delimitermap_create(&(ctx->delimiter_mapper));
+ if (r != idn_success)
+ return (r);
+ }
+
+ r = idn_delimitermap_addall(ctx->delimiter_mapper, v, nv);
+ return (r);
+}
+
+idn_result_t
+idn_resconf_addalllocalmapselectornames(idn_resconf_t ctx, const char *tld,
+ const char **names, int nnames) {
+ idn_result_t r;
+
+ assert(ctx != NULL && names != NULL && tld != NULL);
+
+ TRACE(("idn_resconf_addalllocalmapselectorname(tld=%s, nnames=%d)\n",
+ tld, nnames));
+
+ if (ctx->local_mapper == NULL) {
+ r = idn_mapselector_create(&(ctx->local_mapper));
+ if (r != idn_success)
+ return (r);
+ }
+
+ r = idn_mapselector_addall(ctx->local_mapper, tld, names, nnames);
+ return (r);
+}
+
+idn_result_t
+idn_resconf_addallmappernames(idn_resconf_t ctx, const char **names,
+ int nnames) {
+ idn_result_t r;
+
+ assert(ctx != NULL && names != NULL);
+
+ TRACE(("idn_resconf_addallmappername()\n"));
+
+ if (ctx->mapper == NULL) {
+ r = idn_mapper_create(&(ctx->mapper));
+ if (r != idn_success)
+ return (r);
+ }
+
+ r = idn_mapper_addall(ctx->mapper, names, nnames);
+ return (r);
+}
+
+idn_result_t
+idn_resconf_addallnormalizernames(idn_resconf_t ctx, const char **names,
+ int nnames) {
+ idn_result_t r;
+
+ assert(ctx != NULL && names != NULL);
+
+ TRACE(("idn_resconf_addallnormalizername(nnames=%d)\n", nnames));
+
+ if (ctx->normalizer == NULL) {
+ r = idn_normalizer_create(&(ctx->normalizer));
+ if (r != idn_success)
+ return (r);
+ }
+
+ r = idn_normalizer_addall(ctx->normalizer, names, nnames);
+ return (r);
+}
+
+idn_result_t
+idn_resconf_addallprohibitcheckernames(idn_resconf_t ctx, const char **names,
+ int nnames) {
+ char long_name[MAX_CONF_LINE_LENGTH + 1];
+ idn_result_t r;
+ int i;
+
+ assert(ctx != NULL && names != NULL);
+
+ TRACE(("idn_resconf_addallprohibitcheckername(nnames=%d)\n", nnames));
+
+ if (ctx->prohibit_checker == NULL) {
+ r = idn_checker_create(&(ctx->prohibit_checker));
+ if (r != idn_success)
+ return (r);
+ }
+
+ for (i = 0; i < nnames; i++, names++) {
+ if (strlen(*names) + strlen(IDN_CHECKER_PROHIBIT_PREFIX)
+ > MAX_CONF_LINE_LENGTH) {
+ return (idn_invalid_name);
+ }
+ strcpy(long_name, IDN_CHECKER_PROHIBIT_PREFIX);
+ strcat(long_name, *names);
+
+ r = idn_checker_add(ctx->prohibit_checker, long_name);
+ if (r != idn_success)
+ return (r);
+ }
+
+ return (idn_success);
+}
+
+idn_result_t
+idn_resconf_addallunassignedcheckernames(idn_resconf_t ctx, const char **names,
+ int nnames) {
+ char long_name[MAX_CONF_LINE_LENGTH + 1];
+ idn_result_t r;
+ int i;
+
+ assert(ctx != NULL && names != NULL);
+
+ TRACE(("idn_resconf_addallunassignedcheckername(nnames=%d)\n",
+ nnames));
+
+ if (ctx->unassigned_checker == NULL) {
+ r = idn_checker_create(&(ctx->unassigned_checker));
+ if (r != idn_success)
+ return (r);
+ }
+
+ for (i = 0; i < nnames; i++, names++) {
+ if (strlen(*names) + strlen(IDN_CHECKER_UNASSIGNED_PREFIX)
+ > MAX_CONF_LINE_LENGTH) {
+ return (idn_invalid_name);
+ }
+ strcpy(long_name, IDN_CHECKER_UNASSIGNED_PREFIX);
+ strcat(long_name, *names);
+
+ r = idn_checker_add(ctx->unassigned_checker, long_name);
+ if (r != idn_success)
+ return (r);
+ }
+
+ return (idn_success);
+}
+
+idn_result_t
+idn_resconf_addallbidicheckernames(idn_resconf_t ctx, const char **names,
+ int nnames) {
+ char long_name[MAX_CONF_LINE_LENGTH + 1];
+ idn_result_t r;
+ int i;
+
+ assert(ctx != NULL && names != NULL);
+
+ TRACE(("idn_resconf_addallbidicheckername(nnames=%d)\n", nnames));
+
+ if (ctx->bidi_checker == NULL) {
+ r = idn_checker_create(&(ctx->bidi_checker));
+ if (r != idn_success)
+ return (r);
+ }
+
+ for (i = 0; i < nnames; i++, names++) {
+ if (strlen(*names) + strlen(IDN_CHECKER_BIDI_PREFIX)
+ > MAX_CONF_LINE_LENGTH) {
+ return (idn_invalid_name);
+ }
+ strcpy(long_name, IDN_CHECKER_BIDI_PREFIX);
+ strcat(long_name, *names);
+
+ r = idn_checker_add(ctx->bidi_checker, long_name);
+ if (r != idn_success)
+ return (r);
+ }
+
+ return (idn_success);
+}
+
+static idn_result_t
+parse_conf(idn_resconf_t ctx, FILE *fp) {
+ char line[MAX_CONF_LINE_LENGTH + 1];
+ int lineno = 0;
+ char *argv[3];
+ int argc;
+ idn_result_t r;
+ int conf_mask = 0;
+
+ TRACE(("parse_conf()\n"));
+
+ /*
+ * Parse config file. parsing of 'idn-encoding' line is
+ * postponed because 'alias-file' line must be processed
+ * before them.
+ */
+ while (fgets(line, sizeof(line), fp) != NULL) {
+ char *newline;
+
+ lineno++;
+ newline = strpbrk(line, "\r\n");
+ if (newline != NULL)
+ *newline = '\0';
+ else if (fgetc(fp) != EOF) {
+ ERROR(("libidnkit: too long line \"%-.30s\", "
+ "line %d\n", line, lineno));
+ return (idn_invalid_syntax);
+ }
+
+ argc = split_args(line, argv, 2);
+ if (argc == -1) {
+ ERROR(("libidnkit: syntax error, line %d\n", lineno));
+ return (idn_invalid_syntax);
+ } else if (argc == 0 || argv[0][0] == '#') {
+ continue;
+ } else if (argc == 1) {
+ ERROR(("libidnkit: syntax error, line %d\n", lineno));
+ return (idn_invalid_syntax);
+ }
+
+ if (strcmp(argv[0], "idn-encoding") == 0) {
+ if (conf_mask & DEFAULT_CONF_IDN_ENCODING) {
+ ERROR(("libidnkit: \"%s\" redefined, "
+ "line %d\n", argv[0], lineno));
+ r = idn_invalid_syntax;
+ } else {
+ conf_mask |= DEFAULT_CONF_IDN_ENCODING;
+ r = parse_idn_encoding(ctx, argv[1], lineno);
+ }
+ } else if (strcmp(argv[0], "local-map") == 0) {
+ r = parse_local_map(ctx, argv[1], lineno);
+
+ } else if (strcmp(argv[0], "nameprep") == 0) {
+ if (conf_mask & DEFAULT_CONF_NAMEPREP) {
+ ERROR(("libidnkit: \"%s\" redefined, "
+ "line %d\n", argv[0], lineno));
+ r = idn_invalid_syntax;
+ } else {
+ conf_mask |= DEFAULT_CONF_NAMEPREP;
+ r = parse_nameprep(ctx, argv[1], lineno);
+ }
+ } else if (strcmp(argv[0], "nameprep-map") == 0 ||
+ strcmp(argv[0], "nameprep-normalize") == 0 ||
+ strcmp(argv[0], "nameprep-prohibit") == 0 ||
+ strcmp(argv[0], "nameprep-unassigned") == 0 ||
+ strcmp(argv[0], "alias-file") == 0 ||
+ strcmp(argv[0], "encoding-alias-file") == 0 ||
+ strcmp(argv[0], "normalize") == 0 ||
+ strcmp(argv[0], "server-encoding") == 0 ||
+ strcmp(argv[0], "alternate-encoding") == 0 ||
+ strcmp(argv[0], "delimiter-map") == 0) {
+ WARNING(("libidnkit: obsolete command \"%s\", line %d "
+ "(ignored)\n", argv[0], lineno));
+ r = idn_success;
+ } else {
+ ERROR(("libidnkit: unknown command \"%-.30s\", "
+ "line %d\n", argv[0], lineno));
+ r = idn_invalid_syntax;
+ }
+ if (r != idn_success)
+ return (r);
+ }
+
+ lineno++;
+
+ if (conf_mask != DEFAULT_CONF_ALL) {
+ return setdefaults_body(ctx, conf_mask);
+ }
+
+ return (idn_success);
+}
+
+static idn_result_t
+parse_idn_encoding(idn_resconf_t ctx, char *args, int lineno) {
+ idn_result_t r;
+ char *argv[MAX_CONF_LINE_ARGS + 1];
+ int argc;
+
+ argc = split_args(args, argv, MAX_CONF_LINE_ARGS + 1);
+
+ if (argc != 1) {
+ ERROR(("libidnkit: wrong # of args for idn-encoding, "
+ "line %d\n", lineno));
+ return (idn_invalid_syntax);
+ }
+
+ r = idn_converter_create(argv[0], &ctx->idn_converter,
+ IDN_CONVERTER_DELAYEDOPEN |
+ IDN_CONVERTER_RTCHECK);
+ if (r != idn_success) {
+ ERROR(("libidnkit: cannot create idn converter, %s, "
+ "line %d\n", idn_result_tostring(r), lineno));
+ }
+
+ return (r);
+}
+
+static idn_result_t
+parse_local_map(idn_resconf_t ctx, char *args, int lineno) {
+ idn_result_t r;
+ char *argv[MAX_CONF_LINE_ARGS + 1];
+ int argc;
+ int i;
+
+ argc = split_args(args, argv, MAX_CONF_LINE_ARGS + 1);
+
+ if (argc < 2 || argc > MAX_CONF_LINE_ARGS) {
+ ERROR(("libidnkit: wrong # of args for local-map, line %d\n",
+ lineno));
+ return (idn_invalid_syntax);
+ }
+
+ if (ctx->local_mapper == NULL) {
+ r = idn_mapselector_create(&ctx->local_mapper);
+ if (r != idn_success) {
+ ERROR(("libidnkit: cannot create local mapper, %s, "
+ "line %d\n", idn_result_tostring(r), lineno));
+ return (r);
+ }
+ }
+
+ for (i = 1; i < argc; i++) {
+ r = idn_mapselector_add(ctx->local_mapper, argv[0], argv[i]);
+ if (r == idn_invalid_name) {
+ ERROR(("libidnkit: map scheme unavailable \"%-.30s\""
+ " or invalid TLD \"%-.30s\", line %d\n",
+ argv[i], argv[0], lineno));
+ return (r);
+ } else if (r != idn_success) {
+ return (r);
+ }
+ }
+
+ return (idn_success);
+}
+
+static idn_result_t
+parse_nameprep(idn_resconf_t ctx, char *args, int lineno) {
+ idn_result_t r;
+ char *argv[MAX_CONF_LINE_ARGS + 1];
+ char scheme_name[MAX_CONF_LINE_LENGTH + 1];
+ int argc;
+
+ argc = split_args(args, argv, MAX_CONF_LINE_ARGS + 1);
+
+ if (argc != 1) {
+ ERROR(("libidnkit: wrong # of args for nameprep, line %d\n",
+ lineno));
+ return (idn_invalid_syntax);
+ }
+
+ /*
+ * Set mapper.
+ */
+ r = idn_mapper_create(&ctx->mapper);
+ if (r != idn_success) {
+ ERROR(("libidnkit: cannot create mapper, %s, line %d\n",
+ idn_result_tostring(r), lineno));
+ return (r);
+ }
+
+ r = idn_mapper_add(ctx->mapper, argv[0]);
+ if (r == idn_invalid_name) {
+ ERROR(("libidnkit: map scheme unavailable \"%-.30s\", "
+ "line %d\n", argv[0], lineno));
+ return (r);
+ } else if (r != idn_success) {
+ return (r);
+ }
+
+ /*
+ * Set normalizer.
+ */
+ r = idn_normalizer_create(&ctx->normalizer);
+ if (r != idn_success) {
+ ERROR(("libidnkit: cannot create normalizer, %s, line %d\n",
+ idn_result_tostring(r), lineno));
+ return (r);
+ }
+
+ r = idn_normalizer_add(ctx->normalizer, argv[0]);
+ if (r == idn_invalid_name) {
+ ERROR(("libidnkit: unknown normalization scheme \"%-.30s\", "
+ "line %d\n", argv[0], lineno));
+ return (r);
+ } else if (r != idn_success) {
+ return (r);
+ }
+
+ /*
+ * Set prohibit checker.
+ */
+ r = idn_checker_create(&ctx->prohibit_checker);
+ if (r != idn_success) {
+ ERROR(("libidnkit: cannot create prohibit checker, %s, "
+ "line %d\n", idn_result_tostring(r), lineno));
+ return (r);
+ }
+
+ sprintf(scheme_name, "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, argv[0]);
+ r = idn_checker_add(ctx->prohibit_checker, scheme_name);
+ if (r == idn_invalid_name) {
+ ERROR(("libidnkit: unknown prohibit scheme \"%-.30s\", "
+ "line %d\n", argv[0], lineno));
+ return (r);
+ } else if (r != idn_success) {
+ return (r);
+ }
+
+ /*
+ * Set unassigned checker.
+ */
+ r = idn_checker_create(&ctx->unassigned_checker);
+ if (r != idn_success) {
+ ERROR(("libidnkit: cannot create unassigned checker, %s, "
+ "line %d\n", idn_result_tostring(r), lineno));
+ return (r);
+ }
+
+ sprintf(scheme_name, "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, argv[0]);
+ r = idn_checker_add(ctx->unassigned_checker, scheme_name);
+ if (r == idn_invalid_name) {
+ ERROR(("libidnkit: unknown unassigned scheme \"%-.30s\", "
+ "line %d\n", argv[0], lineno));
+ return (r);
+ } else if (r != idn_success) {
+ return (r);
+ }
+
+ /*
+ * Set bidi checker.
+ */
+ r = idn_checker_create(&ctx->bidi_checker);
+ if (r != idn_success) {
+ ERROR(("libidnkit: cannot create bidi checker, %s, line %d\n",
+ idn_result_tostring(r), lineno));
+ return (r);
+ }
+
+ sprintf(scheme_name, "%s%s", IDN_CHECKER_BIDI_PREFIX, argv[0]);
+ r = idn_checker_add(ctx->bidi_checker, scheme_name);
+ if (r == idn_invalid_name) {
+ ERROR(("libidnkit: unknown bidi scheme \"%-.30s\", "
+ "line %d\n", argv[0], lineno));
+ return (r);
+ } else if (r != idn_success) {
+ return (r);
+ }
+
+ return (idn_success);
+}
+
+static int
+split_args(char *s, char **av, int max_ac) {
+ int ac;
+ int i;
+
+ for (ac = 0; *s != '\0' && ac < max_ac; ac++) {
+ if (ac > 0)
+ *s++ = '\0';
+ while (isspace((unsigned char)*s))
+ s++;
+ if (*s == '\0')
+ break;
+ if (*s == '"' || *s == '\'') {
+ int qc = *s++;
+ av[ac] = s;
+ while (*s != qc) {
+ if (*s == '\0')
+ return (-1);
+ s++;
+ }
+ } else {
+ av[ac] = s;
+ while (*s != '\0' && !isspace((unsigned char)*s))
+ s++;
+ }
+ }
+
+ for (i = ac; i < max_ac; i++)
+ av[i] = NULL;
+
+ return (ac);
+}
+
+static void
+resetconf(idn_resconf_t ctx) {
+#ifndef WITHOUT_ICONV
+ idn_resconf_setlocalconverter(ctx, NULL);
+#endif
+ idn_resconf_setidnconverter(ctx, NULL);
+ idn_resconf_setauxidnconverter(ctx, NULL);
+ idn_resconf_setdelimitermap(ctx, NULL);
+ idn_resconf_setlocalmapselector(ctx, NULL);
+ idn_resconf_setmapper(ctx, NULL);
+ idn_resconf_setnormalizer(ctx, NULL);
+ idn_resconf_setprohibitchecker(ctx, NULL);
+ idn_resconf_setunassignedchecker(ctx, NULL);
+ idn_resconf_setbidichecker(ctx, NULL);
+}
+
+#ifndef WITHOUT_ICONV
+static idn_result_t
+update_local_converter(idn_resconf_t ctx) {
+ idn_result_t r;
+ const char *old_encoding;
+ const char *new_encoding;
+
+ /*
+ * We don't update local converter, if the converter is set
+ * by idn_resconf_setlocalconverter() or
+ * idn_resconf_setlocalconvertername().
+ */
+ if (ctx->local_converter_is_static)
+ return (idn_success);
+
+ /*
+ * Update the local converter if the local encoding is changed.
+ */
+ old_encoding = (ctx->local_converter != NULL) ?
+ idn_converter_localencoding(ctx->local_converter) :
+ NULL;
+ new_encoding = idn_localencoding_name();
+ if (new_encoding == NULL) {
+ ERROR(("cannot determine local codeset name\n"));
+ return (idn_notfound);
+ }
+
+ if (old_encoding != NULL &&
+ new_encoding != NULL &&
+ strcmp(old_encoding, new_encoding) == 0) {
+ return (idn_success);
+ }
+
+ if (ctx->local_converter != NULL) {
+ idn_converter_destroy(ctx->local_converter);
+ ctx->local_converter = NULL;
+ }
+
+ r = idn_converter_create(new_encoding,
+ &ctx->local_converter,
+ IDN_CONVERTER_RTCHECK);
+ return (r);
+}
+#endif
+
+idn_result_t
+idn_resconf_setdefaults(idn_resconf_t ctx)
+{
+ idn_result_t r;
+
+ assert(ctx != NULL);
+
+ TRACE(("idn_resconf_setdefaults()\n"));
+
+ resetconf(ctx);
+ r = idn_delimitermap_create(&ctx->delimiter_mapper);
+ if (r != idn_success) {
+ ERROR(("libidnkit: cannot create delimiter mapper, %s\n",
+ idn_result_tostring(r)));
+ return (r);
+ }
+
+ return setdefaults_body(ctx, 0);
+}
+
+static idn_result_t
+setdefaults_body(idn_resconf_t ctx, int conf_mask) {
+ idn_result_t r;
+
+ TRACE(("setdefaults_body()\n"));
+ assert(ctx != NULL);
+
+ if (!(conf_mask & DEFAULT_CONF_NAMEPREP)) {
+ TRACE(("set default nameprep\n"));
+ r = idn_resconf_setnameprepversion(ctx, IDN_NAMEPREP_CURRENT);
+ if (r != idn_success) {
+ return (r);
+ }
+ }
+ if (!(conf_mask & DEFAULT_CONF_IDN_ENCODING)) {
+ TRACE(("set default idn encoding\n"));
+ r = idn_converter_create(IDN_ENCODING_CURRENT,
+ &ctx->idn_converter,
+ IDN_CONVERTER_DELAYEDOPEN |
+ IDN_CONVERTER_RTCHECK);
+ if (r != idn_success) {
+ ERROR(("libidnkit: cannot create idn converter, %s\n",
+ idn_result_tostring(r)));
+ return (r);
+ }
+ }
+
+ return (idn_success);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/result.c b/contrib/idn/idnkit-1.0-src/lib/result.c
new file mode 100644
index 0000000..c5745a2
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/result.c
@@ -0,0 +1,76 @@
+#ifndef lint
+static char *rcsid = "$Id: result.c,v 1.1.1.1 2003/06/04 00:26:12 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+#include <idn/result.h>
+
+static char *result_string[] = {
+ "success",
+ "not found",
+ "invalid encoding found",
+ "syntax error",
+ "invalid name",
+ "invalid message",
+ "invalid action",
+ "invalid code point",
+ "label length reduced to 0 or exceeded 63 bytes",
+ "buffer overflow",
+ "no such entry",
+ "out of memory",
+ "no such file",
+ "no mapping to output codeset",
+ "context information required",
+ "prohibited character found",
+ "generic failure",
+};
+
+char *
+idn_result_tostring(idn_result_t result) {
+ if (result < 0 || result > idn_failure)
+ return ("unknown result code");
+
+ return (result_string[result]);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/strhash.c b/contrib/idn/idnkit-1.0-src/lib/strhash.c
new file mode 100644
index 0000000..1d2d03a
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/strhash.c
@@ -0,0 +1,283 @@
+#ifndef lint
+static char *rcsid = "$Id: strhash.c,v 1.1.1.1 2003/06/04 00:26:13 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <idn/assert.h>
+#include <idn/logmacro.h>
+#include <idn/result.h>
+#include <idn/strhash.h>
+
+/*
+ * Initially, the number of hash buckets is INITIAL_HASH_SIZE.
+ * As the more elements are put in the hash, the number of elements
+ * per bucket will exceed THRESHOLD eventually. When it happens,
+ * the number of buckets will be multiplied by FACTOR.
+ */
+#define INITIAL_HASH_SIZE 67
+#define FACTOR 7
+#define THRESHOLD 5
+
+#define HASH_MULT 31
+
+typedef struct strhash_entry {
+ struct strhash_entry *next;
+ unsigned long hash_value;
+ char *key;
+ void *value;
+} strhash_entry_t;
+
+struct idn__strhash {
+ int nbins;
+ int nelements;
+ strhash_entry_t **bins;
+};
+
+static unsigned long hash_value(const char *key);
+static strhash_entry_t *find_entry(strhash_entry_t *entry, const char *key,
+ unsigned long hash);
+static strhash_entry_t *new_entry(const char *key, void *value);
+static idn_result_t expand_bins(idn__strhash_t hash, int new_size);
+
+idn_result_t
+idn__strhash_create(idn__strhash_t *hashp) {
+ idn__strhash_t hash;
+ idn_result_t r;
+
+ TRACE(("idn__strhash_create()\n"));
+
+ assert(hashp != NULL);
+
+ *hashp = NULL;
+
+ if ((hash = malloc(sizeof(struct idn__strhash))) == NULL) {
+ WARNING(("idn__strhash_create: malloc failed (hash)\n"));
+ return (idn_nomemory);
+ }
+ hash->nbins = 0;
+ hash->nelements = 0;
+ hash->bins = NULL;
+ if ((r = expand_bins(hash, INITIAL_HASH_SIZE)) != idn_success) {
+ WARNING(("idn__strhash_create: malloc failed (bins)\n"));
+ free(hash);
+ return (r);
+ }
+
+ *hashp = hash;
+
+ return (idn_success);
+}
+
+void
+idn__strhash_destroy(idn__strhash_t hash, idn__strhash_freeproc_t proc) {
+ int i;
+
+ assert(hash != NULL && hash->bins != NULL);
+
+ for (i = 0; i < hash->nbins; i++) {
+ strhash_entry_t *bin = hash->bins[i];
+ strhash_entry_t *next;
+
+ while (bin != NULL) {
+ next = bin->next;
+ if (proc != NULL)
+ (*proc)(bin->value);
+ free(bin);
+ bin = next;
+ }
+ }
+ free(hash->bins);
+ free(hash);
+}
+
+idn_result_t
+idn__strhash_put(idn__strhash_t hash, const char *key, void *value) {
+ unsigned long h, h_index;
+ strhash_entry_t *entry;
+
+ assert(hash != NULL && key != NULL);
+
+ h = hash_value(key);
+ h_index = h % hash->nbins;
+
+ if ((entry = find_entry(hash->bins[h_index], key, h)) != NULL) {
+ /* Entry exists. Replace the value. */
+ entry->value = value;
+ } else {
+ /* Create new entry. */
+ if ((entry = new_entry(key, value)) == NULL) {
+ return (idn_nomemory);
+ }
+ /* Insert it to the list. */
+ entry->next = hash->bins[h_index];
+ hash->bins[h_index] = entry;
+ hash->nelements++;
+
+ if (hash->nelements > hash->nbins * THRESHOLD) {
+ idn_result_t r;
+ r = expand_bins(hash, hash->nbins * FACTOR);
+ if (r != idn_success) {
+ TRACE(("idn__strhash_put: hash table "
+ "expansion failed\n"));
+ }
+ }
+ }
+
+ return (idn_success);
+}
+
+idn_result_t
+idn__strhash_get(idn__strhash_t hash, const char *key, void **valuep) {
+ unsigned long h;
+ strhash_entry_t *entry;
+
+ assert(hash != NULL && key != NULL && valuep != NULL);
+
+ h = hash_value(key);
+ entry = find_entry(hash->bins[h % hash->nbins], key, h);
+ if (entry == NULL)
+ return (idn_noentry);
+
+ *valuep = entry->value;
+ return (idn_success);
+}
+
+int
+idn__strhash_exists(idn__strhash_t hash, const char *key) {
+ unsigned long h;
+
+ assert(hash != NULL && key != NULL);
+
+ h = hash_value(key);
+ return (find_entry(hash->bins[h % hash->nbins], key, h) != NULL);
+}
+
+static unsigned long
+hash_value(const char *key) {
+ unsigned long h = 0;
+ unsigned char *p = (unsigned char *)key;
+ int c;
+
+ while ((c = *p++) != '\0') {
+ h = h * HASH_MULT + c;
+ }
+ return (h);
+}
+
+static strhash_entry_t *
+find_entry(strhash_entry_t *entry, const char *key, unsigned long hash) {
+ assert(key != NULL);
+
+ while (entry != NULL) {
+ if (entry->hash_value == hash && strcmp(key, entry->key) == 0)
+ return (entry);
+ entry = entry->next;
+ }
+ return (NULL);
+}
+
+static strhash_entry_t *
+new_entry(const char *key, void *value) {
+ strhash_entry_t *entry;
+ int len;
+
+ assert(key != NULL);
+
+ len = strlen(key) + 1;
+ if ((entry = malloc(sizeof(strhash_entry_t) + len)) == NULL) {
+ return (NULL);
+ }
+ entry->next = NULL;
+ entry->hash_value = hash_value(key);
+ entry->key = (char *)(entry + 1);
+ (void)strcpy(entry->key, key);
+ entry->value = value;
+
+ return (entry);
+}
+
+static idn_result_t
+expand_bins(idn__strhash_t hash, int new_size) {
+ strhash_entry_t **old_bins, **new_bins;
+ int old_size;
+ int old_index, new_index;
+
+ new_bins = malloc(sizeof(strhash_entry_t *) * new_size);
+ if (new_bins == NULL)
+ return (idn_nomemory);
+
+ memset(new_bins, 0, sizeof(strhash_entry_t *) * new_size);
+
+ old_bins = hash->bins;
+ old_size = hash->nbins;
+ for (old_index = 0; old_index < old_size; old_index++) {
+ strhash_entry_t *entries = old_bins[old_index];
+
+ while (entries != NULL) {
+ strhash_entry_t *e = entries;
+
+ /* Remove the top element from the linked list. */
+ entries = entries->next;
+
+ /* ..and move to the new hash. */
+ new_index = e->hash_value % new_size;
+ e->next = new_bins[new_index];
+ new_bins[new_index] = e;
+ }
+ }
+
+ hash->nbins = new_size;
+ hash->bins = new_bins;
+
+ if (old_bins != NULL)
+ free(old_bins);
+
+ return (idn_success);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/Makefile.in b/contrib/idn/idnkit-1.0-src/lib/tests/Makefile.in
new file mode 100644
index 0000000..124ccec
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/Makefile.in
@@ -0,0 +1,304 @@
+# $Id: Makefile.in,v 1.2 2004/07/20 07:13:39 marka Exp $
+# Copyright (c) 2000, 2002 Japan Network Information Center.
+# All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+.SUFFIXES:
+.SUFFIXES: .tsy .c
+
+top_builddir = ../..
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+CC = @CC@
+SHELL = @SHELL@
+LIBTOOL = @LIBTOOL@
+
+ICONVINC = @ICONVINC@
+ICONVLIB = @ICONVLIB@
+IDNLIB = ../libidntest.la
+IDNLITELIB = ../libidntestlite.la
+
+INCS = -I. -I$(srcdir) -I$(srcdir)/../../include -I../../include $(ICONVINC)
+DEFS =
+
+CFLAGS = $(INCS) $(DEFS) @CPPFLAGS@ @CFLAGS@
+LDFLAGS = @LDFLAGS@
+TSYFLAGS =
+
+PERL = @PERL@
+
+COMMONSRCS = testsuite.c testutil.c setenv.c
+COMMONOBJS = testsuite.lo testutil.lo setenv.lo
+BUILTSRCS = api.c api-init1.c api-init2.c api-init3.c \
+ api-init4-1.c api-init4-2.c api-init4-3.c \
+ api-init5-1.c api-init5-2.c api-init5-3.c \
+ res.c resconf.c mapselector.c checker.c converter.c mapper.c \
+ normalizer.c delimitermap.c ucs4.c nameprep.c \
+ testconfig.h
+
+TESTS = api-test \
+ api-init1-test \
+ api-init2-test \
+ api-init3-test \
+ api-init4-1-test \
+ api-init4-2-test \
+ api-init4-3-test \
+ api-init5-1-test \
+ api-init5-2-test \
+ api-init5-3-test \
+ res-test \
+ resconf-test \
+ mapselector-test \
+ converter-test \
+ checker-test \
+ mapper-test \
+ normalizer-test \
+ delimitermap-test \
+ ucs4-test \
+ nameprep-test
+
+LITETESTS = apilite-test \
+ reslite-test \
+ resconflite-test \
+ converterlite-test
+
+.tsy.c:
+ rm -f $@ $@.tmp
+ $(PERL) $(srcdir)/testygen -o $@ $(TSYFLAGS) $<
+ $(PERL) $(srcdir)/utffilter $@ > $@.tmp
+ mv -f $@.tmp $@
+
+all:
+
+install:
+
+clean:
+ rm -f *.o *.lo *.tmp core *.core *~
+ rm -f $(TESTS) $(LITETESTS) $(BUILTSRCS)
+ rm -f test.conf testalias.conf test.map
+ rm -f iconvchk
+ rm -fr .libs/
+
+distclean: clean
+ rm -f Makefile
+
+@LITEONLY_TRUE@test check: test-lite
+@LITEONLY_FALSE@test check: test-nolite
+
+test-lite: $(LITETESTS)
+ @for i in $(LITETESTS); do \
+ echo "Run test program: $$i"; \
+ ./$$i; \
+ echo; \
+ done
+
+test-nolite: $(TESTS) $(LITETESTS) iconvchk
+ @./iconvchk
+ @for i in $(TESTS) $(LITETESTS); do \
+ echo "Run test program: $$i"; \
+ ./$$i; \
+ echo; \
+ done
+
+api-test: api.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ api.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+api.lo: api.c testconfig.h
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api.c
+
+apilite-test: apilite.lo $(IDNLITELIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ apilite.lo $(COMMONOBJS) $(IDNLITELIB)
+apilite.lo: api.c testconfig.h
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -DWITHOUT_ICONV -o $@ \
+ -c api.c
+
+api-init1-test: api-init1.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ api-init1.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+api-init1.lo: api-init1.c testconfig.h
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init1.c
+
+api-init2-test: api-init2.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ api-init2.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+api-init2.lo: api-init2.c testconfig.h
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init2.c
+
+api-init3-test: api-init3.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ api-init3.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+api-init3.lo: api-init3.c testconfig.h
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init3.c
+
+api-init4-1-test: api-init4-1.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ api-init4-1.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+api-init4-1.lo: api-init4-1.c testconfig.h
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init4-1.c
+
+api-init4-2-test: api-init4-2.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ api-init4-2.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+api-init4-2.lo: api-init4-2.c testconfig.h
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init4-2.c
+
+api-init4-3-test: api-init4-3.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ api-init4-3.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+api-init4-3.lo: api-init4-3.c testconfig.h
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init4-3.c
+
+api-init5-1-test: api-init5-1.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ api-init5-1.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+api-init5-1.lo: api-init5-1.c testconfig.h
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init5-1.c
+
+api-init5-2-test: api-init5-2.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ api-init5-2.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+api-init5-2.lo: api-init5-2.c testconfig.h
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init5-2.c
+
+api-init5-3-test: api-init5-3.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ api-init5-3.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+api-init5-3.lo: api-init5-3.c testconfig.h
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init5-3.c
+
+res-test: res.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ res.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+res.lo: res.c testconfig.h
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c res.c
+
+reslite-test: reslite.lo $(IDNLITELIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ reslite.lo $(COMMONOBJS) $(IDNLITELIB)
+reslite.lo: res.c testconfig.h
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -DWITHOUT_ICONV -o $@ \
+ -c res.c
+
+resconf-test: resconf.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ resconf.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+resconf.lo: resconf.c testconfig.h
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c resconf.c
+
+resconflite-test: resconflite.lo $(IDNLITELIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ resconflite.lo $(COMMONOBJS) $(IDNLITELIB)
+resconflite.lo: resconf.c testconfig.h
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -DWITHOUT_ICONV -o $@ \
+ -c resconf.c
+
+mapselector-test: mapselector.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ mapselector.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+mapselector.lo: mapselector.c
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c mapselector.c
+
+converter-test: converter.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ converter.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+converter.lo: converter.c
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c converter.c
+
+converterlite-test: converterlite.lo $(IDNLITELIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ converterlite.lo $(COMMONOBJS) $(IDNLITELIB)
+converterlite.lo: converter.c
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -DWITHOUT_ICONV -o $@ \
+ -c converter.c
+
+checker-test: checker.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ checker.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+checker.lo: checker.c
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c checker.c
+
+mapper-test: mapper.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ mapper.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+mapper.lo: mapper.c
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c mapper.c
+
+normalizer-test: normalizer.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ normalizer.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+normalizer.lo: normalizer.c
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c normalizer.c
+
+delimitermap-test: delimitermap.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ delimitermap.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+delimitermap.lo: delimitermap.c
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c delimitermap.c
+
+ucs4-test: ucs4.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ ucs4.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+ucs4.lo: ucs4.c
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c ucs4.c
+
+nameprep-test: nameprep.lo $(IDNLIB) $(COMMONOBJS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ nameprep.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
+nameprep.lo: nameprep.c
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c nameprep.c
+
+testsuite.lo: testsuite.c testsuite.h
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -o $@ -c $(srcdir)/testsuite.c
+testutil.lo: testutil.c testutil.h
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -o $@ -c $(srcdir)/testutil.c
+setenv.lo: setenv.c
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -o $@ -c $(srcdir)/setenv.c
+
+testconfig.h: ../../include/config.h
+ rm -f testconfig.h
+ sed -n -e '/HAVE_SETENV/p' -e '/HAVE_UNSETENV/p' \
+ ../../include/config.h > testconfig.h
+
+iconvchk: iconvchk.c codeset.h
+ $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ \
+ $(srcdir)/iconvchk.c $(IDNLIB) $(ICONVLIB)
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/api-init1.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/api-init1.tsy
new file mode 100644
index 0000000..202db15
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/api-init1.tsy
@@ -0,0 +1,113 @@
+#ifndef lint
+static char *rcsid = "$Id: api-init1.tsy,v 1.1.1.1 2003/06/04 00:26:46 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <idn/api.h>
+#include <idn/log.h>
+
+#include "codeset.h"
+#include "setenv.h"
+#include "testutil.h"
+
+#ifndef EUCJP_ENCODING_NAME
+#define EUCJP_ENCODING_NAME "eucJP"
+#endif
+
+#define CONF_FILENAME "test.conf"
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: init
+{
+ char to[256];
+ idn_result_t r;
+
+ setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
+ unsetenv("IDN_DISABLE");
+ create_conf_file(CONF_FILENAME, 0,
+ "idn-encoding UTF-8",
+ NULL);
+}
+
+//# TEARDOWN
+// group: init
+{
+ remove(CONF_FILENAME);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: nameinit(0)
+// group: init
+{
+ r = idn__setconffile(CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_nameinit(0);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_encodename(IDN_ENCODE_APP, "<U+3042>", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn--l8j");
+
+ r = idn_decodename(IDN_DECODE_APP, "xn--l8j", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "<U+3042>");
+
+ r = idn_decodename2(IDN_DECODE_APP, "xn--l8j", to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "<U+3042>");
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/api-init2.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/api-init2.tsy
new file mode 100644
index 0000000..e1561a4
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/api-init2.tsy
@@ -0,0 +1,113 @@
+#ifndef lint
+static char *rcsid = "$Id: api-init2.tsy,v 1.1.1.1 2003/06/04 00:26:47 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <idn/api.h>
+#include <idn/log.h>
+
+#include "codeset.h"
+#include "setenv.h"
+#include "testutil.h"
+
+#ifndef EUCJP_ENCODING_NAME
+#define EUCJP_ENCODING_NAME "eucJP"
+#endif
+
+#define CONF_FILENAME "test.conf"
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: init
+{
+ char to[256];
+ idn_result_t r;
+
+ setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
+ unsetenv("IDN_DISABLE");
+ create_conf_file(CONF_FILENAME, 0,
+ "idn-encoding UTF-8",
+ NULL);
+}
+
+//# TEARDOWN
+// group: init
+{
+ remove(CONF_FILENAME);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: nameinit(1)
+// group: init
+{
+ r = idn__setconffile(CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_nameinit(1);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_encodename(IDN_ENCODE_APP, "<U+3042>", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "<U+3042>");
+
+ r = idn_decodename(IDN_DECODE_APP, "xn--l8j", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn--l8j");
+
+ r = idn_decodename2(IDN_DECODE_APP, "xn--l8j", to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn--l8j");
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/api-init3.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/api-init3.tsy
new file mode 100644
index 0000000..9035cab
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/api-init3.tsy
@@ -0,0 +1,117 @@
+#ifndef lint
+static char *rcsid = "$Id: api-init3.tsy,v 1.1.1.1 2003/06/04 00:26:47 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <idn/api.h>
+#include <idn/log.h>
+
+#include "codeset.h"
+#include "setenv.h"
+#include "testutil.h"
+
+#ifndef EUCJP_ENCODING_NAME
+#define EUCJP_ENCODING_NAME "eucJP"
+#endif
+
+#define CONF_FILENAME "test.conf"
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: init
+{
+ char to[256];
+ idn_result_t r;
+
+ setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
+ unsetenv("IDN_DISABLE");
+ create_conf_file(CONF_FILENAME, 0,
+ "idn-encoding UTF-8",
+ NULL);
+}
+
+//# TEARDOWN
+// group: init
+{
+ remove(CONF_FILENAME);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: call nameinit() twice
+// group: init
+{
+ r = idn__setconffile(CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_nameinit(1);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_nameinit(0);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_encodename(IDN_ENCODE_APP, "<U+3042>", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "<U+3042>");
+
+ r = idn_decodename(IDN_DECODE_APP, "xn--l8j", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn--l8j");
+
+ r = idn_decodename2(IDN_DECODE_APP, "xn--l8j", to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn--l8j");
+
+ remove(CONF_FILENAME);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/api-init4-1.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/api-init4-1.tsy
new file mode 100644
index 0000000..585b581
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/api-init4-1.tsy
@@ -0,0 +1,96 @@
+#ifndef lint
+static char *rcsid = "$Id: api-init4-1.tsy,v 1.1.1.1 2003/06/04 00:26:47 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <idn/api.h>
+#include <idn/log.h>
+
+#include "setenv.h"
+#include "testutil.h"
+
+#define CONF_FILENAME "test.conf"
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: init
+{
+ char to[256];
+ idn_result_t r;
+
+ setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
+ unsetenv("IDN_DISABLE");
+ create_conf_file(CONF_FILENAME, 0,
+ "idn-encoding UTF-8",
+ NULL);
+}
+
+//# TEARDOWN
+// group: init
+{
+ remove(CONF_FILENAME);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: call encodename() without initialization
+// group: init
+{
+ r = idn__setconffile(CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_encodename(IDN_ENCODE_APP, "<U+3042>", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn--l8j");
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/api-init4-2.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/api-init4-2.tsy
new file mode 100644
index 0000000..fd0150b
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/api-init4-2.tsy
@@ -0,0 +1,96 @@
+#ifndef lint
+static char *rcsid = "$Id: api-init4-2.tsy,v 1.1.1.1 2003/06/04 00:26:47 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <idn/api.h>
+#include <idn/log.h>
+
+#include "setenv.h"
+#include "testutil.h"
+
+#define CONF_FILENAME "test.conf"
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: init
+{
+ char to[256];
+ idn_result_t r;
+
+ setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
+ unsetenv("IDN_DISABLE");
+ create_conf_file(CONF_FILENAME, 0,
+ "idn-encoding UTF-8",
+ NULL);
+}
+
+//# TEARDOWN
+// group: init
+{
+ remove(CONF_FILENAME);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: call decodename() without initialization
+// group: init
+{
+ r = idn__setconffile(CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_decodename(IDN_DECODE_APP, "xn--l8j", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "<U+3042>");
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/api-init4-3.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/api-init4-3.tsy
new file mode 100644
index 0000000..7da74b9
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/api-init4-3.tsy
@@ -0,0 +1,102 @@
+#ifndef lint
+static char *rcsid = "$Id: api-init4-3.tsy,v 1.1.1.1 2003/06/04 00:26:47 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <idn/api.h>
+#include <idn/log.h>
+
+#include "codeset.h"
+#include "setenv.h"
+#include "testutil.h"
+
+#ifndef EUCJP_ENCODING_NAME
+#define EUCJP_ENCODING_NAME "eucJP"
+#endif
+
+#define CONF_FILENAME "test.conf"
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: init
+{
+ char to[256];
+ idn_result_t r;
+
+ setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
+ unsetenv("IDN_DISABLE");
+ create_conf_file(CONF_FILENAME, 0,
+ "idn-encoding UTF-8",
+ NULL);
+}
+
+//# TEARDOWN
+// group: init
+{
+ remove(CONF_FILENAME);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: call decodename2() without initialization
+// group: init
+{
+ r = idn__setconffile(CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_decodename2(IDN_DECODE_APP, "xn--l8j", to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "<U+3042>");
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/api-init5-1.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/api-init5-1.tsy
new file mode 100644
index 0000000..5669502
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/api-init5-1.tsy
@@ -0,0 +1,102 @@
+#ifndef lint
+static char *rcsid = "$Id: api-init5-1.tsy,v 1.1.1.1 2003/06/04 00:26:48 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <idn/api.h>
+#include <idn/log.h>
+
+#include "setenv.h"
+#include "testutil.h"
+
+#define CONF_FILENAME "test.conf"
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: init
+{
+ char to[256];
+ idn_result_t r;
+
+ setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
+ unsetenv("IDN_DISABLE");
+ create_conf_file(CONF_FILENAME, 0,
+ "idn-encoding UTF-8",
+ NULL);
+}
+
+//# TEARDOWN
+// group: init
+{
+ remove(CONF_FILENAME);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: call encodename() and nameinit()
+// group: init
+{
+ r = idn__setconffile(CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_encodename(IDN_ENCODE_APP, "aaa", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_nameinit(1);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_encodename(IDN_ENCODE_APP, "<U+3042>", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn--l8j");
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/api-init5-2.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/api-init5-2.tsy
new file mode 100644
index 0000000..bf08862
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/api-init5-2.tsy
@@ -0,0 +1,102 @@
+#ifndef lint
+static char *rcsid = "$Id: api-init5-2.tsy,v 1.1.1.1 2003/06/04 00:26:48 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <idn/api.h>
+#include <idn/log.h>
+
+#include "setenv.h"
+#include "testutil.h"
+
+#define CONF_FILENAME "test.conf"
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: init
+{
+ char to[256];
+ idn_result_t r;
+
+ setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
+ unsetenv("IDN_DISABLE");
+ create_conf_file(CONF_FILENAME, 0,
+ "idn-encoding UTF-8",
+ NULL);
+}
+
+//# TEARDOWN
+// group: init
+{
+ remove(CONF_FILENAME);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: call decodename() and nameinit()
+// group: init
+{
+ r = idn__setconffile(CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_decodename(IDN_DECODE_APP, "aaa", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_nameinit(1);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_decodename(IDN_DECODE_APP, "xn--l8j", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "<U+3042>");
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/api-init5-3.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/api-init5-3.tsy
new file mode 100644
index 0000000..fae1942
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/api-init5-3.tsy
@@ -0,0 +1,109 @@
+#ifndef lint
+static char *rcsid = "$Id: api-init5-3.tsy,v 1.1.1.1 2003/06/04 00:26:48 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <idn/api.h>
+#include <idn/log.h>
+
+#include "codeset.h"
+#include "setenv.h"
+#include "testutil.h"
+
+#ifndef EUCJP_ENCODING_NAME
+#define EUCJP_ENCODING_NAME "eucJP"
+#endif
+
+#define CONF_FILENAME "test.conf"
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: init
+{
+ char to[256];
+ idn_result_t r;
+
+ setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
+ unsetenv("IDN_DISABLE");
+ create_conf_file(CONF_FILENAME, 0,
+ "idn-encoding UTF-8",
+ NULL);
+}
+
+//# TEARDOWN
+// group: init
+{
+ remove(CONF_FILENAME);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: call decodename2() and nameinit()
+// group: init
+{
+ r = idn__setconffile(CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_decodename2(IDN_DECODE_APP, "aaa", to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_nameinit(1);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_decodename2(IDN_DECODE_APP, "xn--l8j", to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "<U+3042>");
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/api.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/api.tsy
new file mode 100644
index 0000000..3ecfb20
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/api.tsy
@@ -0,0 +1,1009 @@
+#ifndef lint
+static char *rcsid = "$Id: api.tsy,v 1.1.1.1 2003/06/04 00:26:50 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <idn/api.h>
+#include <idn/log.h>
+
+#include "codeset.h"
+#include "setenv.h"
+
+#ifndef EUCJP_ENCODING_NAME
+#define EUCJP_ENCODING_NAME "eucJP"
+#endif
+
+/*
+ * U+304B: hiragana letter KA
+ * U+3099: combining katakana-hiragana voiced sound mark
+ *
+ * map("U+304B U+3099") -> "U+304C"
+ *
+ * U+304C: hiragana letter GA
+ */
+#define UTF8_NAME "A<U+304B><U+3099>"
+#define UTF8_REVNAME "a<U+304C>"
+
+/*
+ * A4AC: hiragana letter GA (in EUC-JP)
+ */
+#define EUCJP_NAME "\xa4\xac"
+#define EUCJP_REVNAME "\xa4\xac"
+
+/*
+ * Conversion result of "U+304B U+3099 A"
+ */
+#define PUNYCODE_NAME "xn--a-i8t"
+
+/*
+ * Conversion result of "A U+304B U+3099" (in EUC-JP).
+ */
+#define AUX_EUCJP_NAME "xn--a-i\xa3\xb8t"
+
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: generic-conversion
+//--
+// Initialize the `api' module.
+// Set local encoding to `UTF-8'.
+{
+ char to[256];
+ idn_result_t r;
+
+ setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
+ unsetenv("IDN_DISABLE");
+ idn_nameinit(0);
+}
+
+//# SETUP
+// group: quiet
+//--
+// Set log level to `fatal' to supress log messages.
+{
+ int saved_log_level;
+
+ saved_log_level = idn_log_getlevel();
+ idn_log_setlevel(idn_log_level_fatal);
+}
+
+//# TEARDOWN
+// group: quiet
+//--
+// Restore log level.
+{
+ idn_log_setlevel(saved_log_level);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: basic conversion by encodename()
+// group: generic-conversion
+{
+ r = idn_encodename(IDN_ENCODE_APP, UTF8_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, PUNYCODE_NAME);
+}
+
+//# TESTCASE
+// title: basic conversion by decodename()
+// group: generic-conversion
+{
+ r = idn_decodename(IDN_DECODE_APP, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_REVNAME);
+}
+
+//# TESTCASE
+// title: basic conversion by decodename2()
+// group: generic-conversion
+{
+ r = idn_decodename2(IDN_DECODE_APP, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+#ifdef WITHOUT_ICONV
+ ASSERT_RESULT(r, idn_failure);
+#else
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_REVNAME);
+#endif
+}
+
+//# TESTCASE
+// title: call decodename2() with auxencoding=NULL
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_decodename2(IDN_DECODE_APP, PUNYCODE_NAME, to, sizeof(to),
+ NULL);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_REVNAME);
+#endif
+}
+
+//# TESTCASE
+// title: call encodename() with actions=0
+// group: generic-conversion
+{
+ r = idn_encodename(0, UTF8_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_NAME);
+}
+
+//# TESTCASE
+// title: call decodename() with actions=0
+// group: generic-conversion
+{
+ r = idn_decodename(0, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, PUNYCODE_NAME);
+}
+
+//# TESTCASE
+// title: call decodename2() with actions=0
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_decodename2(0, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, AUX_EUCJP_NAME);
+#endif
+}
+
+//# TESTCASE
+// title: call encodename() with actions=rtcheck
+// group: generic-conversion quiet
+{
+ r = idn_encodename(IDN_RTCHECK, EUCJP_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call encodename() with actions=decode-query
+// group: generic-conversion quiet
+{
+ r = idn_encodename(IDN_DECODE_QUERY, EUCJP_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call encodename() with actions=decode-app
+// group: generic-conversion quiet
+{
+ r = idn_encodename(IDN_DECODE_APP, EUCJP_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call encodename() with actions=decode-stored
+// group: generic-conversion quiet
+{
+ r = idn_encodename(IDN_DECODE_STORED, EUCJP_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call encodename() with actions=(1<<31)
+// group: generic-conversion quiet
+{
+ r = idn_encodename(1 << 31, EUCJP_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call decodename() with actions=localmap
+// group: generic-conversion quiet
+{
+ r = idn_decodename(IDN_LOCALMAP, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call decodename2() with actions=localmap
+// group: generic-conversion quiet
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_decodename2(IDN_LOCALMAP, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_invalid_action);
+#endif
+}
+
+//# TESTCASE
+// title: call decodename() with actions=lencheck
+// group: generic-conversion quiet
+{
+ r = idn_decodename(IDN_LENCHECK, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call decodename2() with actions=lencheck
+// group: generic-conversion quiet
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_decodename2(IDN_LENCHECK, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_invalid_action);
+#endif
+}
+
+//# TESTCASE
+// title: call decodename() with actions=encode-query
+// group: generic-conversion quiet
+{
+ r = idn_decodename(IDN_ENCODE_QUERY, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call decodename2() with actions=encode-query
+// group: generic-conversion quiet
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_decodename2(IDN_ENCODE_QUERY, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_invalid_action);
+#endif
+}
+
+//# TESTCASE
+// title: call decodename() with actions=encode-app
+// group: generic-conversion quiet
+{
+ r = idn_decodename(IDN_ENCODE_APP, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call decodename2() with actions=encode-app
+// group: generic-conversion quiet
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_decodename2(IDN_ENCODE_APP, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_invalid_action);
+#endif
+}
+
+//# TESTCASE
+// title: call decodename() with actions=encode-stored
+// group: generic-conversion quiet
+{
+ r = idn_decodename(IDN_ENCODE_STORED, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call decodename2() with actions=encode-stored
+// group: generic-conversion quiet
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_decodename2(IDN_ENCODE_STORED, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_invalid_action);
+#endif
+}
+
+//# TESTCASE
+// title: call decodename() with actions=(1<<31)
+// group: generic-conversion quiet
+{
+ r = idn_decodename(1 << 31, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call decodename2() with actions=(1<<31)
+// group: generic-conversion quiet
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_decodename2(1 << 31, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_invalid_action);
+#endif
+}
+
+//# TESTCASE
+// title: call encodename() with actions=localconv
+// group: generic-conversion quiet
+{
+#ifndef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_encodename(IDN_LOCALCONV, UTF8_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+#endif
+}
+
+//# TESTCASE
+// title: call decodename() with actions=localconv
+// group: generic-conversion quiet
+{
+#ifndef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_decodename(IDN_LOCALCONV, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+#endif
+}
+
+//# TESTCASE
+// title: call decodename2() with actions=localconv
+// group: generic-conversion
+{
+#ifndef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_decodename2(IDN_LOCALCONV, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_failure);
+#endif
+}
+
+//# TESTCASE
+// title: call enable(0) and then encodename()
+// group: generic-conversion
+{
+ idn_enable(0);
+ r = idn_encodename(IDN_ENCODE_APP, UTF8_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_NAME);
+}
+
+//# TESTCASE
+// title: call decodename() when IDN_DISABLE is defined
+// group: generic-conversion
+{
+ idn_enable(0);
+ r = idn_decodename(IDN_DECODE_APP, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, PUNYCODE_NAME);
+}
+
+//# TESTCASE
+// title: call decodename() when IDN_DISABLE is defined
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ idn_enable(0);
+ r = idn_decodename2(IDN_DECODE_APP, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, AUX_EUCJP_NAME);
+#endif
+}
+
+//# TESTCASE
+// title: call enable(0) and then encodename()
+// group: generic-conversion
+{
+ idn_enable(0);
+ r = idn_encodename(IDN_ENCODE_APP, UTF8_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_NAME);
+}
+
+//# TESTCASE
+// title: call enable(0) and then decodename()
+// group: generic-conversion
+{
+ idn_enable(0);
+ r = idn_decodename(IDN_DECODE_APP, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, PUNYCODE_NAME);
+}
+
+//# TESTCASE
+// title: call enable(0) and then decodename2()
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ idn_enable(0);
+ r = idn_decodename2(IDN_DECODE_APP, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, AUX_EUCJP_NAME);
+#endif
+}
+
+//# TESTCASE
+// title: set IDN_DISABLE and call encodename()
+// group: generic-conversion
+{
+ setenv("IDN_DISABLE", "1", 1);
+ r = idn_encodename(IDN_ENCODE_APP, UTF8_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_NAME);
+}
+
+//# TESTCASE
+// title: set IDN_DISABLE and call decodename()
+// group: generic-conversion
+{
+ setenv("IDN_DISABLE", "1", 1);
+ r = idn_decodename(IDN_DECODE_APP, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, PUNYCODE_NAME);
+}
+
+//# TESTCASE
+// title: set IDN_DISABLE and call decodename2()
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ setenv("IDN_DISABLE", "1", 1);
+ r = idn_decodename2(IDN_DECODE_APP, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, AUX_EUCJP_NAME);
+#endif
+}
+
+//# TESTCASE
+// title: set IDN_DISABLE, and then call enable(1) and encodename()
+// group: generic-conversion
+{
+ setenv("IDN_DISABLE", "1", 1);
+ idn_enable(1);
+ r = idn_encodename(IDN_ENCODE_APP, UTF8_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, PUNYCODE_NAME);
+}
+
+//# TESTCASE
+// title: set IDN_DISABLE, and then call enable(1) and decodename()
+// group: generic-conversion
+{
+ setenv("IDN_DISABLE", "1", 1);
+ idn_enable(1);
+ r = idn_decodename(IDN_DECODE_APP, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_REVNAME);
+}
+
+//# TESTCASE
+// title: set IDN_DISABLE, and then call enable(1) and decodename2()
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ setenv("IDN_DISABLE", "1", 1);
+ idn_enable(1);
+ r = idn_decodename2(IDN_DECODE_APP, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_REVNAME);
+#endif
+}
+
+//# TESTCASE
+// title: overrun test for arg `to' of encodename()
+// group: generic-conversion
+{
+ /* Normal case */
+ r = idn_encodename(IDN_ENCODE_APP, UTF8_NAME, to,
+ strlen(PUNYCODE_NAME) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, PUNYCODE_NAME);
+
+ r = idn_encodename(IDN_ENCODE_APP, UTF8_NAME, to,
+ strlen(PUNYCODE_NAME));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ /* enable(0) case */
+ idn_enable(0);
+ r = idn_encodename(IDN_ENCODE_APP, UTF8_NAME, to,
+ strlen(UTF8_NAME) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_NAME);
+
+ r = idn_encodename(IDN_ENCODE_APP, UTF8_NAME, to,
+ strlen(UTF8_NAME));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ /* actions=0 case */
+ idn_enable(1);
+ r = idn_encodename(0, UTF8_NAME, to, strlen(UTF8_NAME) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_NAME);
+
+ r = idn_encodename(0, UTF8_NAME, to, strlen(UTF8_NAME));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+}
+
+//# TESTCASE
+// title: overrun test for arg `to' of decodename()
+// group: generic-conversion
+{
+ /* Normal case */
+ r = idn_decodename(IDN_DECODE_APP, PUNYCODE_NAME, to,
+ strlen(UTF8_REVNAME) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_REVNAME);
+
+ r = idn_decodename(IDN_DECODE_APP, PUNYCODE_NAME, to,
+ strlen(UTF8_REVNAME));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ /* idn_enable(0) case */
+ idn_enable(0);
+ r = idn_decodename(IDN_DECODE_APP, PUNYCODE_NAME, to,
+ strlen(PUNYCODE_NAME) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, PUNYCODE_NAME);
+
+ r = idn_decodename(IDN_DECODE_APP, PUNYCODE_NAME, to,
+ strlen(PUNYCODE_NAME));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ /* actions=0 case */
+ idn_enable(1);
+ r = idn_decodename(0, PUNYCODE_NAME, to, strlen(PUNYCODE_NAME) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, PUNYCODE_NAME);
+
+ r = idn_decodename(0, PUNYCODE_NAME, to, strlen(PUNYCODE_NAME));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+}
+
+//# TESTCASE
+// title: overrun test for arg `to' of decodename2()
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ /* Normal case */
+ r = idn_decodename2(IDN_DECODE_APP, AUX_EUCJP_NAME, to,
+ strlen(UTF8_REVNAME) + 1, EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_REVNAME);
+
+ r = idn_decodename2(IDN_DECODE_APP, AUX_EUCJP_NAME, to,
+ strlen(UTF8_REVNAME), EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ /* idn_enable(0) case */
+ idn_enable(0);
+ r = idn_decodename2(IDN_DECODE_APP, AUX_EUCJP_NAME, to,
+ strlen(AUX_EUCJP_NAME) + 1, EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, AUX_EUCJP_NAME);
+
+ r = idn_decodename2(IDN_DECODE_APP, AUX_EUCJP_NAME, to,
+ strlen(AUX_EUCJP_NAME), EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ /* actions=0 case */
+ idn_enable(1);
+ r = idn_decodename2(0, AUX_EUCJP_NAME, to, strlen(AUX_EUCJP_NAME) + 1,
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, AUX_EUCJP_NAME);
+
+ r = idn_decodename2(0, AUX_EUCJP_NAME, to, strlen(AUX_EUCJP_NAME),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+#endif
+}
+
+//# TESTCASE
+// title: call encodename() with tolen=0
+// group: generic-conversion
+{
+ r = idn_encodename(IDN_ENCODE_APP, UTF8_NAME, to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+}
+
+//# TESTCASE
+// title: call decodename() with tolen=0
+// group: generic-conversion
+{
+ r = idn_decodename(IDN_DECODE_APP, PUNYCODE_NAME, to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+}
+
+//# TESTCASE
+// title: call decodename2() with tolen=0
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_decodename2(IDN_DECODE_APP, AUX_EUCJP_NAME, to, 0,
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+#endif
+}
+
+//# TESTCASE
+// title: convert an empty string using encodename()
+// group: generic-conversion
+{
+ r = idn_encodename(IDN_ENCODE_APP, "", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "");
+}
+
+//# TESTCASE
+// title: convert an empty string using decodename()
+// group: generic-conversion
+{
+ r = idn_decodename(IDN_DECODE_APP, "", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "");
+}
+
+//# TESTCASE
+// title: convert an empty string using decodename2()
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_decodename2(IDN_DECODE_APP, "", to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "");
+#endif
+}
+
+//# TESTCASE
+// title: prohcheck by encodename()
+// group: generic-conversion
+{
+ /* U+1680: prohibited character */
+ r = idn_encodename(IDN_PROHCHECK, "<U+1680>", to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+}
+
+//# TESTCASE
+// title: unascheck by encodename()
+// group: generic-conversion
+{
+ /* U+0221: unassigned codepoint */
+ r = idn_encodename(IDN_UNASCHECK, "<U+0221>", to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+}
+
+//# TESTCASE
+// title: bidicheck by encodename()
+// group: generic-conversion
+{
+ /* U+05D0: bidirectional property is "R" */
+ /* `a': bidirectional property is "L" */
+ /* `0', `-': bidirectional property is "N" */
+ r = idn_encodename(IDN_BIDICHECK, "<U+05D0>", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_encodename(IDN_BIDICHECK, "<U+05D0><U+05D0>",
+ to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_encodename(IDN_BIDICHECK, "<U+05D0><U+05D0>-a",
+ to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+
+ r = idn_encodename(IDN_BIDICHECK, "<U+05D0>-a-<U+05D0>",
+ to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+
+ r = idn_encodename(IDN_BIDICHECK, "a-<U+05D0><U+05D0>",
+ to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+
+ r = idn_encodename(IDN_BIDICHECK, "<U+05D0><U+05D0>-0",
+ to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+
+ r = idn_encodename(IDN_BIDICHECK, "<U+05D0>-0-<U+05D0>",
+ to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_encodename(IDN_BIDICHECK, "0-<U+05D0><U+05D0>",
+ to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+}
+
+//# TESTCASE
+// title: asccheck by encodename()
+// group: generic-conversion
+{
+ r = idn_encodename(IDN_ASCCHECK, "-name", to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+
+ r = idn_encodename(IDN_ASCCHECK, "name-", to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+
+ r = idn_encodename(IDN_ASCCHECK, "n ame", to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+}
+
+//# TESTCASE
+// title: lencheck by encodename()
+// group: generic-conversion
+{
+ r = idn_encodename(IDN_LENCHECK,
+ "123456789-123456789-123456789-123456789-"
+ "123456789-123456789-123", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_encodename(IDN_LENCHECK,
+ "123456789-123456789-123456789-123456789-"
+ "123456789-123456789-1234", to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_length);
+
+ r = idn_encodename(IDN_LENCHECK, "a..b", to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_length);
+}
+
+//# TESTCASE
+// title: rtcheck non-prohchecked label by decodename()
+// group: generic-conversion
+{
+ /* "xn--6ue" -> "U+1680" (prohibited character) */
+ r = idn_decodename(IDN_RTCHECK, "xn--6ue", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn--6ue");
+}
+
+//# TESTCASE
+// title: rtcheck non-unaschecked label by decodename()
+// group: generic-conversion
+{
+ /* "xn--6la" -> "U+0221" (unassigned codepoint) */
+ r = idn_decodename(IDN_IDNCONV | IDN_RTCHECK | IDN_UNASCHECK,
+ "xn--6la", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn--6la");
+}
+
+//# TESTCASE
+// title: rtcheck non-ascchecked label by decodename()
+// group: generic-conversion
+{
+ /* "xn----x7t" -> "- U+3042" */
+ r = idn_decodename(IDN_IDNCONV | IDN_RTCHECK | IDN_ASCCHECK,
+ "xn----x7t", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn----x7t");
+
+ /* "xn----w7t" -> "U+3042 -" */
+ r = idn_decodename(IDN_IDNCONV | IDN_RTCHECK | IDN_ASCCHECK,
+ "xn----w7t", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn----w7t");
+}
+
+//# TESTCASE
+// title: rtcheck non-lenchecked label by decodename()
+// group: generic-conversion
+{
+ /* `s1' has 63 characters */
+ const char *s1 =
+ "xn--l8jaa5522a8sj38bzugvvblo3y90fjzgvxlmxscifws3d43odzaq6aj340b";
+
+ const char *s1rev =
+ "<U+9752><U+68EE><U+5CA9><U+624B><U+5BAE><U+57CE><U+79CB><U+7530>"
+ "<U+5C71><U+5F62><U+798F><U+5CF6><U+6771><U+4EAC><U+795E><U+5948>"
+ "<U+5DDD><U+3042><U+3042><U+3042>";
+
+ /* `s2' has 64 characters */
+ const char *s2 =
+ "xn--a-w7ta6522a8sj38bzugvvblo3y90fjzgvxlmxscifws3d43odzaq6aj340b";
+
+ /* `s3' has an empty label */
+ const char *s3 = "a..b";
+
+ r = idn_decodename(IDN_IDNCONV | IDN_RTCHECK, s1, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, s1rev);
+
+ r = idn_decodename(IDN_IDNCONV | IDN_RTCHECK, s2, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, s2);
+
+ r = idn_decodename(IDN_IDNCONV | IDN_RTCHECK, s3, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, s3);
+}
+
+//# TESTCASE
+// title: rtcheck non-prohchecked label by decodename2()
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ /* "xn--6ue" -> "U+1680" (prohibited character) */
+ r = idn_decodename2(IDN_RTCHECK, "xn--6ue", to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn--6ue");
+#endif
+}
+
+//# TESTCASE
+// title: rtcheck non-unaschecked label by decodename2()
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ /* "xn--6la" -> "U+0221" (unassigned codepoint) */
+ r = idn_decodename2(IDN_IDNCONV | IDN_RTCHECK | IDN_UNASCHECK,
+ "xn--6la", to, sizeof(to), EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn--6la");
+#endif
+}
+
+//# TESTCASE
+// title: rtcheck non-ascchecked label by decodename2()
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ /* "xn----x7t" -> "- U+3042" */
+ r = idn_decodename2(IDN_IDNCONV | IDN_RTCHECK | IDN_ASCCHECK,
+ "xn----x7t", to, sizeof(to), EUCJP_ENCODING_NAME);
+
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn----x7t");
+
+ /* "xn----w7t" -> "U+3042 -" */
+ r = idn_decodename2(IDN_IDNCONV | IDN_RTCHECK | IDN_ASCCHECK,
+ "xn----w7t", to, sizeof(to), EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn----w7t");
+#endif
+}
+
+//# TESTCASE
+// title: rtcheck non-lenchecked label by decodename2()
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ /* `s1' has 63 characters */
+ const char *s1 =
+ "xn--l8jaa5522a8sj38bzugvvblo3y90fjzgvxlmxscifws3d43odzaq6aj340b";
+
+ const char *s1rev =
+ "<U+9752><U+68EE><U+5CA9><U+624B><U+5BAE><U+57CE><U+79CB><U+7530>"
+ "<U+5C71><U+5F62><U+798F><U+5CF6><U+6771><U+4EAC><U+795E><U+5948>"
+ "<U+5DDD><U+3042><U+3042><U+3042>";
+
+ /* `s2' has 64 characters */
+ const char *s2 =
+ "xn--a-w7ta6522a8sj38bzugvvblo3y90fjzgvxlmxscifws3d43odzaq6aj340b";
+
+ /* `s3' has an empty label */
+ const char *s3 = "a..b";
+
+ r = idn_decodename2(IDN_IDNCONV | IDN_RTCHECK, s1, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, s1rev);
+
+ r = idn_decodename2(IDN_IDNCONV | IDN_RTCHECK, s2, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, s2);
+
+ r = idn_decodename(IDN_IDNCONV | IDN_RTCHECK, s3, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, s3);
+#endif
+}
+
+//# TESTCASE
+// title: pass broken string as `from' to encodename()
+// group: generic-conversion quiet
+{
+ /* "\xe3\x21" is not valid UTF-8 string */
+ r = idn_encodename(IDN_ENCODE_APP, "\xe3\x21", to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_encoding);
+}
+
+//# TESTCASE
+// title: pass broken string as `from' to decodename()
+// group: generic-conversion quiet
+{
+ /* "\xe3\x21" is not valid UTF-8 string */
+ r = idn_decodename(IDN_DECODE_APP, "\xe3\x21", to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_encoding);
+}
+
+//# TESTCASE
+// title: pass broken string as `from' to decodename2()
+// group: generic-conversion quiet
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ /* "\xa4\x21" is not valid EUC-JP string */
+ r = idn_decodename2(IDN_DECODE_APP, "\xa4\x21", to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_invalid_encoding);
+#endif
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/checker.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/checker.tsy
new file mode 100644
index 0000000..54f8ea0
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/checker.tsy
@@ -0,0 +1,610 @@
+#ifndef lint
+static char *rcsid = "$Id: checker.tsy,v 1.1.1.1 2003/06/04 00:26:51 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <idn/checker.h>
+#include <idn/log.h>
+#include <idn/ucs4.h>
+#include "testutil.h"
+
+#define SIZEOFUCS4(x) (sizeof(x) / sizeof(unsigned long))
+
+#define UCS4_NAME_STR "U+304C" /* hiragana letter ga */
+#define UCS4_NAME 0x304C
+
+#define BUF_SIZE 128
+#define ARRAY_SIZE 9
+
+#define CONF_FILENAME "test.map"
+
+#define LINEBUF_SIZE 2001
+
+/*
+ * Sample strings for `from' argument of normalize(),
+ * and its expected outputs.
+ */
+const unsigned long from[4] = {
+ UCS4_NAME,
+ 0x00A0, /* no-break space: prohibited character */
+ 0x0221, /* unassigned character */
+ 0x0000
+};
+
+
+#define FROM_UCS4NAME_OFFSET 0
+#define FROM_PROH_OFFSET 1
+#define FROM_UNAS_OFFSET 2
+
+const unsigned long from2[4] = {
+ UCS4_NAME,
+ 0x0221, /* unassigned character */
+ 0x00A0, /* no-break space: prohibited character */
+ 0x0000
+};
+
+#define FROM2_UCS4NAME_OFFSET 0
+#define FROM2_PROH_OFFSET 2
+#define FROM2_UNAS_OFFSET 1
+
+static const unsigned long bidi_from[4] = {
+ 0x05BE, /* hebrew punctuation maqaf */
+ 0x0041, /* latin capital letter a */
+ 0xFEFC, /* arabic ligature lam with alef final form */
+ 0x0000
+};
+#define BIDIFROM_OFFSET 1
+
+idn_result_t
+test_createproc(const char *parameter, void **ctxp)
+{
+ return (idn_success);
+}
+
+void
+test_destroyproc(void *ctx)
+{
+}
+
+#define FOUNDPTR_OFFSET 2
+idn_result_t
+test_lookupproc(void *ctx, const unsigned long *ucs4,
+ const unsigned long **found)
+{
+ *found = ucs4 + FOUNDPTR_OFFSET;
+ return (idn_success);
+}
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: generic
+//--
+// Initialize the module and create context.
+{
+ idn_result_t r;
+ idn_checker_t ctx = NULL;
+ char name[BUF_SIZE];
+
+ r = idn_checker_initialize();
+ ASSERT_RESULT(r, idn_success);
+ r = idn_checker_create(&ctx);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TEARDOWN
+// group: generic
+//--
+// Destroy context.
+{
+ if (ctx != NULL)
+ idn_checker_destroy(ctx);
+}
+
+//# SETUP
+// group: lookup
+//--
+// Initialize the module and create context.
+{
+ idn_result_t r;
+ idn_checker_t ctx = NULL;
+ char name[BUF_SIZE];
+ const unsigned long *ptr;
+
+ r = idn_checker_initialize();
+ ASSERT_RESULT(r, idn_success);
+ r = idn_checker_create(&ctx);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TEARDOWN
+// group: lookup
+//--
+// Destroy context.
+{
+ if (ctx != NULL)
+ idn_checker_destroy(ctx);
+}
+
+//# SETUP
+// group: addall
+//--
+// Initialize the module and create context.
+{
+ idn_result_t r;
+ idn_checker_t ctx = NULL;
+ char *names[ARRAY_SIZE];
+ int i;
+ const unsigned long *ptr;
+
+ for (i = 0; i < ARRAY_SIZE; i++) {
+ names[i] = malloc(BUF_SIZE);
+ if (names[i] == NULL) {
+ ASSERT("malloc failed\n");
+ }
+ }
+
+ r = idn_checker_initialize();
+ ASSERT_RESULT(r, idn_success);
+ r = idn_checker_create(&ctx);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TEARDOWN
+// group: addall
+//--
+// Destroy context and free some blocks.
+{
+ if (ctx != NULL)
+ idn_checker_destroy(ctx);
+ for (i = 0; i < ARRAY_SIZE; i++) {
+ free(names[i]);
+ }
+}
+
+//# SETUP
+// group: quiet
+//--
+// Set log level to `fatal' to supress log messages.
+{
+ int saved_log_level;
+
+ saved_log_level = idn_log_getlevel();
+ idn_log_setlevel(idn_log_level_fatal);
+}
+
+//# TEARDOWN
+// group: quiet
+//--
+// Restore log level.
+{
+ idn_log_setlevel(saved_log_level);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: idn_checker_add() - boundary condition
+// group: generic quiet
+{
+ r = idn_checker_add(ctx, "");
+ ASSERT_RESULT(r, idn_invalid_name);
+}
+
+//# TESTCASE
+// title: idn_checker_add() - builtin schemes, prohibit
+// group: generic quiet
+{
+ sprintf(name, "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_success);
+
+ sprintf(name, "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "nameprep-01");
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_invalid_name);
+}
+
+//# TESTCASE
+// title: idn_checker_add() - builtin schemes, unassigned
+// group: generic quiet
+{
+ sprintf(name, "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_success);
+
+ sprintf(name, "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "nameprep-01");
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_invalid_name);
+}
+
+//# TESTCASE
+// title: idn_checker_add() - builtin schemes, bidi
+// group: generic quiet
+{
+ sprintf(name, "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_success);
+
+ sprintf(name, "%s%s", IDN_CHECKER_BIDI_PREFIX, "nameprep-01");
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_invalid_name);
+}
+
+//# TESTCASE
+// title: idn_checker_add() - file - boundary condition
+// group: generic quiet
+{
+ sprintf(name, "%sfileset:%s", IDN_CHECKER_UNASSIGNED_PREFIX, "");
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_nofile);
+ sprintf(name, "%sfileset:%s", IDN_CHECKER_PROHIBIT_PREFIX, "");
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_nofile);
+ sprintf(name, "%sfileset:%s", IDN_CHECKER_BIDI_PREFIX, "");
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_invalid_name);
+}
+
+//# TESTCASE
+// title: idn_checker_add() - file - long line
+// group: generic quiet
+{
+ char line[LINEBUF_SIZE];
+ const char *first_entry = "304C;";
+ const char *other_entry = " 304D";
+ int i;
+ int len;
+
+ memcpy(line, first_entry, strlen(first_entry));
+ len = strlen(other_entry);
+ for (i = len; i < LINEBUF_SIZE - len; i += len) {
+ memcpy(line + i, other_entry, len);
+ }
+ *(line + i) = '\0';
+
+ create_conf_file(CONF_FILENAME, 0, line, NULL);
+ sprintf(name, "%sfileset:%s", IDN_CHECKER_UNASSIGNED_PREFIX,
+ CONF_FILENAME);
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+ sprintf(name, "%sfileset:%s", IDN_CHECKER_PROHIBIT_PREFIX,
+ CONF_FILENAME);
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+}
+
+//# TESTCASE
+// title: idn_checker_add() - file, prohibit
+// group: lookup
+{
+ create_conf_file(CONF_FILENAME, 0,
+ UCS4_NAME_STR,
+ NULL);
+ sprintf(name, "%sfileset:%s", IDN_CHECKER_PROHIBIT_PREFIX,
+ CONF_FILENAME);
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_checker_lookup(ctx, from, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, from + FROM_UCS4NAME_OFFSET);
+ r = idn_checker_lookup(ctx, from2, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, from2 + FROM2_UCS4NAME_OFFSET);
+}
+
+//# TESTCASE
+// title: idn_checker_add() - file, unassigned
+// group: lookup
+{
+ create_conf_file(CONF_FILENAME, 0,
+ UCS4_NAME_STR,
+ NULL);
+ sprintf(name, "%sfileset:%s", IDN_CHECKER_UNASSIGNED_PREFIX,
+ CONF_FILENAME);
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_checker_lookup(ctx, from, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, from + FROM_UCS4NAME_OFFSET);
+ r = idn_checker_lookup(ctx, from2, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, from2 + FROM2_UCS4NAME_OFFSET);
+}
+
+//# TESTCASE
+// title: idn_checker_add() - file, bidi
+// group: lookup quiet
+{
+ create_conf_file(CONF_FILENAME, 0,
+ UCS4_NAME_STR,
+ NULL);
+ sprintf(name, "%sfileset:%s", IDN_CHECKER_BIDI_PREFIX,
+ CONF_FILENAME);
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_invalid_name);
+}
+
+//# TESTCASE
+// title: idn_checker_addall() - boundary condition - scheme name
+// group: addall quiet
+{
+ sprintf(names[0], "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
+ sprintf(names[1], "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
+ sprintf(names[2], "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
+ sprintf(names[3], "%s%s", IDN_CHECKER_BIDI_PREFIX, "");
+ r = idn_checker_addall(ctx, (const char **)names, 4);
+ ASSERT_RESULT(r, idn_invalid_name);
+}
+
+//# TESTCASE
+// title: idn_checker_addall() - boundary condition - nschemes = 0
+// group: addall quiet
+{
+ sprintf(names[0], "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "nameprep-01");
+ sprintf(names[1], "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "nameprep-01");
+ sprintf(names[2], "%s%s", IDN_CHECKER_BIDI_PREFIX, "");
+ sprintf(names[3], "%s%s", IDN_CHECKER_BIDI_PREFIX, "nameprep-01");
+ r = idn_checker_addall(ctx, (const char **)names, 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_checker_lookup(ctx, from, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, NULL);
+}
+
+//# TESTCASE
+// title: idn_checker_addall() - add a lot of schemes #1
+// group: addall
+{
+ sprintf(names[0], "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
+ sprintf(names[1], "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
+ sprintf(names[2], "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
+ sprintf(names[3], "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
+ sprintf(names[4], "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
+ sprintf(names[5], "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
+ sprintf(names[6], "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
+ sprintf(names[7], "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
+ sprintf(names[8], "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
+
+ r = idn_checker_addall(ctx, (const char **)names, 9);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_checker_lookup(ctx, from, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, from + FROM_PROH_OFFSET);
+
+ r = idn_checker_lookup(ctx, from2, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, from2 + FROM2_PROH_OFFSET);
+
+ r = idn_checker_lookup(ctx, bidi_from, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, bidi_from + BIDIFROM_OFFSET);
+}
+
+//# TESTCASE
+// title: idn_checker_addall() - add a lot of schemes #2
+// group: addall
+{
+ sprintf(names[0], "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
+ sprintf(names[1], "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
+ sprintf(names[2], "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
+ sprintf(names[3], "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
+ sprintf(names[4], "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
+ sprintf(names[5], "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
+ sprintf(names[6], "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
+ sprintf(names[7], "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
+ sprintf(names[8], "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
+
+ r = idn_checker_addall(ctx, (const char **)names, 9);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_checker_lookup(ctx, from, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, from + FROM_UNAS_OFFSET);
+
+ r = idn_checker_lookup(ctx, from2, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, from2 + FROM2_UNAS_OFFSET);
+
+ r = idn_checker_lookup(ctx, bidi_from, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, bidi_from + BIDIFROM_OFFSET);
+}
+
+//# TESTCASE
+// title: idn_checker_addall() - add same scheme repetedly
+// group: addall
+{
+ int i;
+
+ sprintf(names[0], "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
+ for (i = 1; i < ARRAY_SIZE; i++) {
+ strcpy(names[i], names[0]);
+ }
+ r = idn_checker_addall(ctx, (const char **)names, ARRAY_SIZE);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_checker_lookup(ctx, from, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, from + FROM_PROH_OFFSET);
+
+ r = idn_checker_lookup(ctx, from2, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, from2 + FROM2_PROH_OFFSET);
+}
+
+//# TESTCASE
+// title: idn_checker_lookup() - builtin schemes - RFC3491 prohibit
+// group: lookup
+{
+ sprintf(name, "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
+
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_checker_lookup(ctx, from, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, from + FROM_PROH_OFFSET);
+
+ r = idn_checker_lookup(ctx, from2, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, from2 + FROM2_PROH_OFFSET);
+}
+
+//# TESTCASE
+// title: idn_checker_lookup() - builtin schemes - RFC3491 unassigned
+// group: lookup
+{
+ sprintf(name, "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
+
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_checker_lookup(ctx, from, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, from + FROM_UNAS_OFFSET);
+
+ r = idn_checker_lookup(ctx, from2, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, from2 + FROM2_UNAS_OFFSET);
+}
+
+//# TESTCASE
+// title: idn_checker_lookup() - builtin schemes - RFC3491 bidi
+// group: lookup
+{
+ sprintf(name, "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
+
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_checker_lookup(ctx, bidi_from, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, bidi_from + BIDIFROM_OFFSET);
+
+ r = idn_checker_lookup(ctx, from, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, NULL);
+
+ r = idn_checker_lookup(ctx, from2, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, NULL);
+}
+
+//# TESTCASE
+// title: idn_checker_lookup() - context without procedure
+// group: lookup
+{
+ r = idn_checker_lookup(ctx, from, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, NULL);
+}
+
+//# TESTCASE
+// title: idn_checker_lookup() - string in ascii
+// group: lookup
+{
+ char *ascii_str = "test";
+ unsigned long ucs4_str[5];
+
+ r = idn_ucs4_utf8toucs4(ascii_str, ucs4_str, SIZEOFUCS4(ucs4_str));
+
+ sprintf(name, "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_success);
+ sprintf(name, "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_success);
+ sprintf(name, "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
+ r = idn_checker_add(ctx, name);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_checker_lookup(ctx, ucs4_str, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, NULL);
+}
+
+//# TESTCASE
+// title: idn_checker_destroy(), idn_checker_incrref()
+// group:
+{
+ idn_result_t r;
+ idn_checker_t ctx = NULL;
+
+ r = idn_checker_initialize();
+ ASSERT_RESULT(r, idn_success);
+ r = idn_checker_create(&ctx);
+ ASSERT_RESULT(r, idn_success);
+ idn_checker_incrref(ctx);
+ idn_checker_destroy(ctx);
+ idn_checker_destroy(ctx);
+}
+
+//# TESTCASE
+// title: idn_checker_register()
+// group: generic
+{
+ const unsigned long *ptr = NULL;
+
+ r = idn_checker_register("test",
+ test_createproc,
+ test_destroyproc,
+ test_lookupproc);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_checker_add(ctx, "test");
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_checker_lookup(ctx, from, &ptr);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(ptr, from + FOUNDPTR_OFFSET);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/codeset.h b/contrib/idn/idnkit-1.0-src/lib/tests/codeset.h
new file mode 100644
index 0000000..735a023
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/codeset.h
@@ -0,0 +1,71 @@
+/* $Id: codeset.h,v 1.1.1.1 2003/06/04 00:26:51 marka Exp $ */
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef CODESET_H
+#define CODESET_H
+
+/*
+ * Character encoding name that iconv() recognizes as Japanese EUC.
+ *
+ * Please edit the cpp macro definition if iconv() on the system doesn't
+ * recognize "EUC-JP".
+ *
+ * NOTE:
+ * Konstantin Chuguev's iconv-2.0 doesn't accept "eucJP", but "euc-jp".
+ */
+#define EUCJP_ENCODING_NAME "eucJP"
+
+
+/*
+ * Character encoding name that iconv() recognizes as Japanese Shift JIS.
+ *
+ * Please edit the cpp macro definition if iconv() on the system doesn't
+ * recognize "SJIS".
+ *
+ * NOTE:
+ * Konstantin Chuguev's iconv-2.0 doesn't accept "SJIS", but "Shift_JIS".
+ */
+#define SJIS_ENCODING_NAME "SJIS"
+
+#endif /* CODESET_H */
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/converter.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/converter.tsy
new file mode 100644
index 0000000..94c865e
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/converter.tsy
@@ -0,0 +1,822 @@
+#ifndef lint
+static char *rcsid = "$Id: converter.tsy,v 1.1.1.1 2003/06/04 00:26:53 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <idn/converter.h>
+#include <idn/log.h>
+
+#include "codeset.h"
+#include "testutil.h"
+
+
+#ifndef IDN_PUNYCODE_ENCODING_NAME
+#define IDN_PUNYCODE_ENCODING_NAME "Punycode"
+#endif
+
+#ifndef IDN_UTF8_ENCODING_NAME
+#define IDN_UTF8_ENCODING_NAME "UTF-8" /* by IANA */
+#endif
+
+#ifndef EUCJP_ENCODING_NAME
+#define EUCJP_ENCODING_NAME "eucJP"
+#endif
+
+#ifndef SJIS_ENCODING_NAME
+#define SJIS_ENCODING_NAME "SJIS"
+#endif
+
+#define CONF_FILENAME "testalias.conf"
+#define LINEBUF_SIZE 2001
+
+#define SIZEOFUCS4(x) (sizeof(x) / sizeof(unsigned long))
+
+/*
+ * U+1820: mongorian letter a
+ */
+#define UCS4_INVALID_NAME_FOR_EUCJP 0x1820
+
+/*
+ * A4AC: hiragana letter GA (in EUC-JP)
+ */
+#define EUCJP_NAME "\xa4\xac"
+#define EUCJP_NAME_SIZE 3
+
+/*
+ * U+304C: hiragana letter GA
+ */
+#define UCS4_NAME 0x304C
+
+/*
+ * Conversion result of "U+304C"
+ */
+#define PUNYCODE_NAME "xn--v8j"
+#define PUNYCODE_NAME_SIZE 8
+
+#define BUF_SIZE 128
+
+idn_result_t
+idn_test_encode(idn_converter_t ctx, void *privdata,
+ const unsigned long *from, char *to, size_t tolen)
+{
+ idn_result_t r;
+
+ if (tolen >= EUCJP_NAME_SIZE) {
+ strcpy(to, EUCJP_NAME);
+ r = idn_success;
+ } else {
+ r = idn_buffer_overflow;
+ }
+ return (r);
+
+}
+
+idn_result_t
+idn_test_decode(idn_converter_t ctx, void *privdata,
+ const char *from, unsigned long *to, size_t tolen)
+{
+ idn_result_t r;
+
+ if (tolen >= 2) {
+ to[0] = UCS4_NAME;
+ to[1] = 0x0000;
+ r = idn_success;
+ } else {
+ r = idn_buffer_overflow;
+ }
+ return (r);
+}
+
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: noinit
+//--
+// Do nothing
+{
+ idn_result_t r;
+}
+
+//# SETUP
+// group: generic
+//--
+// Initialize the module.
+{
+ idn_result_t r;
+ idn_converter_t ctx = NULL;
+ const char *name;
+
+ r = idn_converter_initialize();
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_resetalias();
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# SETUP
+// group: localencoding
+//--
+// Initialize the module and load alias file.
+{
+ idn_result_t r;
+ idn_converter_t ctx = NULL;
+ const char *name;
+
+ r = idn_converter_initialize();
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_resetalias();
+ ASSERT_RESULT(r, idn_success);
+ create_conf_file(CONF_FILENAME, 0,
+ "*.KOI8-R KOI8-R",
+ "*.ISO_8859-1 ISO-8859-1",
+ "*.ISO_8859-2 ISO-8859-1",
+ "*.UTF-8 UTF-8",
+ "ja_JP.EUC eucJP",
+ "japanese eucJP",
+ NULL);
+ r = idn_converter_aliasfile(CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TEARDOWN
+// group: localencoding
+//--
+// reset alias information.
+{
+ idn_converter_resetalias();
+}
+
+//# SETUP
+// group: conversion
+//--
+// Initialize the module and create contexts.
+{
+ idn_result_t r;
+ idn_converter_t punycode_ctx = NULL;
+ idn_converter_t utf8_ctx = NULL;
+#ifndef WITHOUT_ICONV
+ idn_converter_t eucjp_ctx = NULL;
+#endif
+
+ r = idn_converter_initialize();
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_create(IDN_PUNYCODE_ENCODING_NAME, &punycode_ctx,
+ 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_create(IDN_UTF8_ENCODING_NAME, &utf8_ctx,
+ IDN_CONVERTER_DELAYEDOPEN);
+ ASSERT_RESULT(r, idn_success);
+#ifndef WITHOUT_ICONV
+ r = idn_converter_create(EUCJP_ENCODING_NAME, &eucjp_ctx,
+ IDN_CONVERTER_DELAYEDOPEN);
+ ASSERT_RESULT(r, idn_success);
+#endif
+}
+
+//# TEARDOWN
+// group: conversion
+//--
+// Destroy contexts.
+{
+ if (punycode_ctx != NULL) {
+ idn_converter_destroy(punycode_ctx);
+ }
+ if (utf8_ctx != NULL) {
+ idn_converter_destroy(utf8_ctx);
+ }
+#ifndef WITHOUT_ICONV
+ if (eucjp_ctx != NULL) {
+ idn_converter_destroy(eucjp_ctx);
+ }
+#endif
+}
+
+//# SETUP
+// group: quiet
+//--
+// Set log level to `fatal' to supress log messages.
+{
+ int saved_log_level;
+
+ saved_log_level = idn_log_getlevel();
+ idn_log_setlevel(idn_log_level_fatal);
+}
+
+//# TEARDOWN
+// group: quiet
+//--
+// Restore log level.
+{
+ idn_log_setlevel(saved_log_level);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: idn_converter_addalias() test - without initialization
+// group: noinit quiet
+{
+ r = idn_converter_addalias("a", "b", 0);
+ ASSERT_RESULT(r, idn_failure);
+}
+
+//# TESTCASE
+// title: idn_converter_aliasfile() - without initialization
+// group: noinit quiet
+{
+ r = idn_converter_aliasfile("a");
+ ASSERT_RESULT(r, idn_failure);
+}
+
+//# TESTCASE
+// title: idn_converter_resetalias() - without initialization
+// group: noinit quiet
+{
+ r = idn_converter_resetalias();
+ ASSERT_RESULT(r, idn_failure);
+}
+
+//# TESTCASE
+// title: idn_converter_getrealname() - without initialization
+// group: noinit quiet
+{
+ const char *name;
+
+ name = idn_converter_getrealname("test");
+ ASSERT_STRING(name, "test");
+}
+
+//# TESTCASE
+// title: idn_converter_create()
+// group: generic quiet
+{
+#ifdef WITHOUT_ICONV
+ r = idn_converter_addalias("*pc", "Punycode", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("*ej", EUCJP_ENCODING_NAME, 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("*sj", SJIS_ENCODING_NAME, 0);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_converter_create("abcsj", &ctx, 0);
+ ASSERT_RESULT(r, idn_invalid_name);
+
+ r = idn_converter_create("notresolved", &ctx, 0);
+ ASSERT_RESULT(r, idn_invalid_name);
+ r = idn_converter_create("notresolved", &ctx,
+ IDN_CONVERTER_DELAYEDOPEN);
+ ASSERT_RESULT(r, idn_invalid_name);
+#else
+ r = idn_converter_addalias("*pc", IDN_PUNYCODE_ENCODING_NAME, 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("*ej", EUCJP_ENCODING_NAME, 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("*sj", SJIS_ENCODING_NAME, 0);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_converter_create("abcsj", &ctx, 0);
+ ASSERT_RESULT(r, idn_success);
+ idn_converter_destroy(ctx);
+
+ r = idn_converter_create("notresolved", &ctx, 0);
+ ASSERT_RESULT(r, idn_invalid_name);
+ r = idn_converter_create("notresolved", &ctx,
+ IDN_CONVERTER_DELAYEDOPEN);
+ ASSERT_RESULT(r, idn_success);
+ {
+ unsigned long ucs4_to[BUF_SIZE];
+
+ r = idn_converter_convtoucs4(ctx, "a", ucs4_to, BUF_SIZE);
+ ASSERT_RESULT(r, idn_invalid_name);
+ idn_converter_destroy(ctx);
+ }
+#endif /* WITHOUT_ICONV */
+}
+
+//# TESTCASE
+// title: idn_converter_addalias() - #1
+// group: generic
+{
+ r = idn_converter_addalias("test", "result-a", 0);
+ ASSERT_RESULT(r, idn_success);
+ name = idn_converter_getrealname("test");
+ ASSERT_STRING(name, "result-a");
+}
+
+//# TESTCASE
+// title: idn_converter_addalias() - #2
+// group: generic
+{
+ r = idn_converter_addalias("test", "result-b", 1);
+ ASSERT_RESULT(r, idn_success);
+ name = idn_converter_getrealname("test");
+ ASSERT_STRING(name, "result-b");
+}
+
+//# TESTCASE
+// title: idn_converter_addalias() - #3
+// group: generic
+{
+ r = idn_converter_addalias("test", "result-a", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-b", 0);
+ ASSERT_RESULT(r, idn_success);
+ name = idn_converter_getrealname("test");
+ ASSERT_STRING(name, "result-a");
+}
+
+//# TESTCASE
+// title: idn_converter_addalias() - #4
+// group: generic
+{
+ r = idn_converter_addalias("test", "result-a", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-b", 1);
+ ASSERT_RESULT(r, idn_success);
+ name = idn_converter_getrealname("test");
+ ASSERT_STRING(name, "result-b");
+}
+
+//# TESTCASE
+// title: idn_converter_addalias() - #5
+// group: generic
+{
+ r = idn_converter_addalias("test", "result-a", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-b", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-c", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-d", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-e", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-f", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-g", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-h", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-i", 0);
+ ASSERT_RESULT(r, idn_success);
+ name = idn_converter_getrealname("test");
+ ASSERT_STRING(name, "result-a");
+}
+
+//# TESTCASE
+// title: idn_converter_addalias() - #6
+// group: generic
+{
+ r = idn_converter_addalias("test", "result-a", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-b", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-c", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-d", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-e", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-f", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-g", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-h", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-i", 1);
+ ASSERT_RESULT(r, idn_success);
+ name = idn_converter_getrealname("test");
+ ASSERT_STRING(name, "result-i");
+}
+
+//# TESTCASE
+// title: idn_converter_addalias() - null character
+// group: generic
+{
+ r = idn_converter_addalias("", "result", 0);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+ r = idn_converter_addalias("test", "", 0);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+ r = idn_converter_addalias("", "", 0);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+}
+
+//# TESTCASE
+// title: idn_converter_resetalias() - no alias added
+// group: generic
+{
+ r = idn_converter_resetalias();
+ ASSERT_RESULT(r, idn_success);
+ name = idn_converter_getrealname("test");
+ ASSERT_STRING(name, "test");
+
+}
+
+//# TESTCASE
+// title: idn_converter_resetalias() - one alias added
+// group: generic
+{
+ r = idn_converter_addalias("test", "result-a", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_resetalias();
+ ASSERT_RESULT(r, idn_success);
+ name = idn_converter_getrealname("test");
+ ASSERT_STRING(name, "test");
+
+}
+
+//# TESTCASE
+// title: idn_converter_resetalias() - many aliases added
+// group: generic
+{
+ r = idn_converter_addalias("test", "result-a", 1);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-b", 1);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-c", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-d", 1);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-e", 1);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-f", 1);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-g", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-h", 0);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_addalias("test", "result-i", 1);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_resetalias();
+ ASSERT_RESULT(r, idn_success);
+ name = idn_converter_getrealname("test");
+ ASSERT_STRING(name, "test");
+}
+
+//# TESTCASE
+// title: idn_converter_aliasfile() - boundary condition
+// group: generic quiet
+{
+ r = idn_converter_aliasfile("");
+ ASSERT_RESULT(r, idn_nofile);
+
+ r = idn_converter_aliasfile("idnalias-not-found.conf");
+ ASSERT_RESULT(r, idn_nofile);
+}
+
+//# TESTCASE
+// title: idn_converter_aliasfile() - long line
+// group: generic quiet
+{
+ char line[LINEBUF_SIZE];
+ const char *entry = "aaaaaaaaaa";
+ int i;
+ int len;
+
+ len = strlen(entry);
+ for (i = 0; i < LINEBUF_SIZE - len; i += len) {
+ memcpy(line + i, entry, len);
+ }
+ *(line + (LINEBUF_SIZE / 2)) = ' ';
+ *(line + i) = '\0';
+ create_conf_file(CONF_FILENAME, 0, line, NULL);
+ r = idn_converter_aliasfile(CONF_FILENAME);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+}
+
+//# TESTCASE
+// title: idn_converter_aliasfile() - no new line at end of file
+// group: generic quiet
+{
+ create_conf_file(CONF_FILENAME, CONF_NO_EOF_NEWLINE,
+ "*.ISO_8859-1 ISO-8859-1",
+ "*.ISO_8859-2 ISO-8859-1",
+ "*.SJIS Shift_JIS",
+ "*.Shift_JIS Shift_JIS",
+ "ja_JP.EUC eucJP",
+ "japanese eucJP",
+ NULL);
+ r = idn_converter_aliasfile(CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+ name = idn_converter_getrealname("japanese");
+ ASSERT_STRING(name, "eucJP");
+
+}
+
+//# TESTCASE
+// title: idn_converter_aliasfile() - invalid entries
+// group: generic quiet
+{
+ create_conf_file(CONF_FILENAME, 0,
+ "*.ISO_8859-1 ISO-8859-1",
+ "*.ISO_8859-2 ISO-8859-1",
+ "*.SJIS",
+ "*.Shift_JIS",
+ "ja_JP.EUC eucJP",
+ "japanese eucJP",
+ NULL);
+ r = idn_converter_aliasfile(CONF_FILENAME);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+}
+
+//# TESTCASE
+// title: idn_converter_aliasfile() - more then two items in one line
+// group: generic quiet
+{
+ create_conf_file(CONF_FILENAME, 0,
+ "*.ISO_8859-1 ISO-8859-1",
+ "*.ISO_8859-2 ISO-8859-1",
+ "*.SJIS Shift_JIS ko_KR.EUC",
+ "*.Shift_JIS Shift_JIS",
+ "*.big5 Big5 *.big5 *.big5",
+ "ja_JP.EUC eucJP",
+ "japanese eucJP",
+ NULL);
+ r = idn_converter_aliasfile(CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+ name = idn_converter_getrealname("japanese");
+ ASSERT_STRING(name, "eucJP");
+}
+
+//# TESTCASE
+// title: idn_converter_localencoding() - #1
+// group: localencoding
+{
+ r = idn_converter_create("test.UTF-8", &ctx,
+ IDN_CONVERTER_DELAYEDOPEN);
+ ASSERT_RESULT(r, idn_success);
+ name = idn_converter_localencoding(ctx);
+ ASSERT_STRING(name, "UTF-8");
+ idn_converter_destroy(ctx);
+}
+
+//# TESTCASE
+// title: idn_converter_localencoding() - #2
+// group: localencoding
+{
+ r = idn_converter_create("test.KOI8-R", &ctx,
+ IDN_CONVERTER_DELAYEDOPEN);
+#ifdef WITHOUT_ICONV
+ ASSERT_RESULT(r, idn_invalid_name);
+#else
+ ASSERT_RESULT(r, idn_success);
+ name = idn_converter_localencoding(ctx);
+ ASSERT_STRING(name, "KOI8-R");
+ idn_converter_destroy(ctx);
+#endif
+}
+
+//# TESTCASE
+// title: idn_converter_localencoding() - #3
+// group: localencoding
+{
+ r = idn_converter_create("unresolvedname", &ctx,
+ IDN_CONVERTER_DELAYEDOPEN);
+#ifdef WITHOUT_ICONV
+ ASSERT_RESULT(r, idn_invalid_name);
+#else
+ ASSERT_RESULT(r, idn_success);
+ name = idn_converter_localencoding(ctx);
+ ASSERT_STRING(name, "unresolvedname");
+ idn_converter_destroy(ctx);
+#endif
+}
+
+//# TESTCASE
+// title: idn_converter_encodingtype()
+// group: conversion
+{
+ ASSERT_INT(idn_converter_encodingtype(punycode_ctx),
+ IDN_ACE_STRICTCASE);
+ ASSERT_INT(idn_converter_encodingtype(utf8_ctx),
+ IDN_NONACE);
+#ifndef WITHOUT_ICONV
+ ASSERT_INT(idn_converter_encodingtype(eucjp_ctx),
+ IDN_NONACE);
+#endif
+}
+
+//# TESTCASE
+// title: idn_converter_isasciicompatible()
+// group: conversion
+{
+ ASSERT_INT(idn_converter_isasciicompatible(punycode_ctx), 1);
+ ASSERT_INT(idn_converter_isasciicompatible(utf8_ctx), 0);
+#ifndef WITHOUT_ICONV
+ ASSERT_INT(idn_converter_isasciicompatible(eucjp_ctx), 0);
+#endif
+}
+
+//# TESTCASE
+// title: idn_converter_convfromucs4()
+// group: conversion quiet
+{
+ unsigned long from_nullchar = 0x0000;
+ unsigned long from[2] = { UCS4_NAME, 0x0000 };
+ char to[1];
+ char to_punycode[PUNYCODE_NAME_SIZE];
+#ifndef WITHOUT_ICONV
+ char to_eucjp[EUCJP_NAME_SIZE];
+#endif
+
+ r = idn_converter_convfromucs4(punycode_ctx, &from_nullchar, to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ r = idn_converter_convfromucs4(punycode_ctx, &from_nullchar, to, 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "");
+
+ r = idn_converter_convfromucs4(punycode_ctx, from, to_punycode, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ r = idn_converter_convfromucs4(punycode_ctx, from, to_punycode,
+ PUNYCODE_NAME_SIZE - 1);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+ r = idn_converter_convfromucs4(punycode_ctx, from, to_punycode,
+ PUNYCODE_NAME_SIZE);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to_punycode, PUNYCODE_NAME);
+
+#ifndef WITHOUT_ICONV
+ r = idn_converter_convfromucs4(eucjp_ctx, &from_nullchar, to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ r = idn_converter_convfromucs4(eucjp_ctx, &from_nullchar, to, 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "");
+
+ r = idn_converter_convfromucs4(eucjp_ctx, from, to_eucjp, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ r = idn_converter_convfromucs4(eucjp_ctx, from, to_eucjp,
+ EUCJP_NAME_SIZE - 1);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ r = idn_converter_convfromucs4(eucjp_ctx, from, to_eucjp,
+ EUCJP_NAME_SIZE);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to_eucjp, EUCJP_NAME);
+
+ from[0] = 0x80000000;
+ r = idn_converter_convfromucs4(eucjp_ctx, from, to_eucjp,
+ EUCJP_NAME_SIZE);
+ ASSERT_RESULT(r, idn_invalid_encoding);
+
+ from[0] = UCS4_INVALID_NAME_FOR_EUCJP;
+ r = idn_converter_convfromucs4(eucjp_ctx, from, to_eucjp,
+ EUCJP_NAME_SIZE);
+ ASSERT_RESULT(r, idn_nomapping);
+#endif
+}
+
+//# TESTCASE
+// title: idn_converter_convtoucs4()
+// group: conversion
+{
+ unsigned long to_nullchar = 0x0000;
+ unsigned long to[1];
+ unsigned long punycode_to[2];
+#ifndef WITHOUT_ICONV
+ unsigned long eucjp_to[2];
+#endif
+ unsigned long ucs4_name[2] = { UCS4_NAME, 0x0000 };
+
+ r = idn_converter_convtoucs4(punycode_ctx, "", to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ r = idn_converter_convtoucs4(punycode_ctx, "", to, 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, &to_nullchar);
+
+ r = idn_converter_convtoucs4(punycode_ctx, PUNYCODE_NAME,
+ punycode_to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ r = idn_converter_convtoucs4(punycode_ctx, PUNYCODE_NAME,
+ punycode_to, 1);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+ r = idn_converter_convtoucs4(punycode_ctx, PUNYCODE_NAME, punycode_to,
+ 2);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING_THRU(punycode_to, ucs4_name);
+
+#ifndef WITHOUT_ICONV
+ r = idn_converter_convtoucs4(eucjp_ctx, "", to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ r = idn_converter_convtoucs4(eucjp_ctx, "", to, 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, &to_nullchar);
+
+ r = idn_converter_convtoucs4(eucjp_ctx, EUCJP_NAME, eucjp_to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ r = idn_converter_convtoucs4(eucjp_ctx, EUCJP_NAME, eucjp_to, 1);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ r = idn_converter_convtoucs4(eucjp_ctx, EUCJP_NAME, eucjp_to, 2);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, &to_nullchar);
+
+ r = idn_converter_convtoucs4(eucjp_ctx, "\xFF\xFF", eucjp_to, 2);
+ ASSERT_RESULT(r, idn_invalid_encoding);
+#endif
+}
+
+//# TESTCASE
+// title: idn_converter_destroy(), idn_converter_incrref()
+// group: generic
+{
+ idn_converter_t ctx2;
+
+ r = idn_converter_create(IDN_UTF8_ENCODING_NAME, &ctx, 0);
+ ASSERT_RESULT(r, idn_success);
+ idn_converter_destroy(ctx);
+
+ r = idn_converter_create(IDN_UTF8_ENCODING_NAME, &ctx2, 0);
+ ASSERT_RESULT(r, idn_success);
+ idn_converter_incrref(ctx2);
+ ASSERT_RESULT(r, idn_success);
+ idn_converter_destroy(ctx2);
+ idn_converter_destroy(ctx2);
+}
+
+//# TESTCASE
+// title: idn_converter_register()
+// group: generic
+{
+ char eucjp_to[3];
+ unsigned long ucs4_to[2];
+ unsigned long ucs4_name[2] = { UCS4_NAME, 0x0000 };
+
+ r = idn_converter_register("test",
+ NULL,
+ NULL,
+ idn_test_encode,
+ idn_test_decode,
+ NULL,
+ IDN_ACE_STRICTCASE);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_converter_create("test", &ctx, 0);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_converter_convfromucs4(ctx, ucs4_name, eucjp_to, sizeof(eucjp_to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(eucjp_to, EUCJP_NAME);
+
+ r = idn_converter_convtoucs4(ctx, "", ucs4_to, SIZEOFUCS4(ucs4_to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(ucs4_to, ucs4_name);
+
+ idn_converter_destroy(ctx);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/delimitermap.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/delimitermap.tsy
new file mode 100644
index 0000000..aeaa46c
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/delimitermap.tsy
@@ -0,0 +1,257 @@
+#ifndef lint
+static char *rcsid = "$Id: delimitermap.tsy,v 1.1.1.1 2003/06/04 00:26:53 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <idn/delimitermap.h>
+#include <idn/ucs4.h>
+#include <idn/log.h>
+#include "testutil.h"
+
+/*
+ * Codepoions to test the add() function.
+ */
+#define ADDITIONAL_DELIMITER0 0xe0
+#define ADDITIONAL_DELIMITER1 0xe1
+
+/*
+ * Sample string for `from' argument of map(),
+ * and its expected outputs.
+ */
+static const unsigned long from[] = {
+ 0x002e, /* full stop */
+ 0x3002, /* ideographic full stop */
+ 0xff0e, /* fullwidth full stop */
+ 0xff61, /* halfwidth ideographic full stop */
+ ADDITIONAL_DELIMITER0,
+ ADDITIONAL_DELIMITER1,
+ 0x0000
+};
+
+static const unsigned long expected_default[] = {
+ 0x002e, /* full stop */
+ 0x002e, /* full stop */
+ 0x002e, /* full stop */
+ 0x002e, /* full stop */
+ ADDITIONAL_DELIMITER0,
+ ADDITIONAL_DELIMITER1,
+ 0x0000
+};
+
+static const unsigned long expected_add[] = {
+ 0x002e, /* full stop */
+ 0x002e, /* full stop */
+ 0x002e, /* full stop */
+ 0x002e, /* full stop */
+ 0x002e, /* full stop */
+ ADDITIONAL_DELIMITER1,
+ 0x0000
+};
+
+static const unsigned long expected_addall[] = {
+ 0x002e, /* full stop */
+ 0x002e, /* full stop */
+ 0x002e, /* full stop */
+ 0x002e, /* full stop */
+ 0x002e, /* full stop */
+ 0x002e, /* full stop */
+ 0x0000
+};
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: generic-init
+{
+ idn_result_t r;
+ idn_delimitermap_t ctx;
+ unsigned long to[256];
+
+ r = idn_delimitermap_create(&ctx);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TEARDOWN
+// group: generic-init
+{
+ if (ctx != NULL)
+ idn_delimitermap_destroy(ctx);
+}
+
+//# SETUP
+// group: quiet
+{
+ int saved_log_level;
+
+ saved_log_level = idn_log_getlevel();
+ idn_log_setlevel(idn_log_level_fatal);
+}
+
+//# TEARDOWN
+// group: quiet
+{
+ idn_log_setlevel(saved_log_level);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: call create()
+// group: generic-init
+{
+}
+
+//# TESTCASE
+// title: call map() without additional delimiters
+// group: generic-init
+{
+ r = idn_delimitermap_map(ctx, from, to, sizeof(to) / sizeof(*to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, expected_default);
+}
+
+//# TESTCASE
+// title: call add() and map()
+// group: generic-init
+{
+ r = idn_delimitermap_add(ctx, ADDITIONAL_DELIMITER0);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_delimitermap_map(ctx, from, to, sizeof(to) / sizeof(*to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, expected_add);
+}
+
+//# TESTCASE
+// title: call addall()
+// group: generic-init
+{
+ unsigned long delimiters[2];
+
+ delimiters[0] = ADDITIONAL_DELIMITER0;
+ delimiters[1] = ADDITIONAL_DELIMITER1;
+ r = idn_delimitermap_addall(ctx, delimiters, 2);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_delimitermap_map(ctx, from, to, sizeof(to) / sizeof(*to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, expected_addall);
+}
+
+//# TESTCASE
+// title: call addall() with nnames=0
+// group: generic-init
+{
+ unsigned long delimiters[2];
+
+ r = idn_delimitermap_addall(ctx, delimiters, 0);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_delimitermap_map(ctx, from, to, sizeof(to) / sizeof(*to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, expected_default);
+}
+
+//# TESTCASE
+// title: call add() with invalid codepoint
+// group: generic-init quiet
+{
+ r = idn_delimitermap_add(ctx, 0x0000); /* NUL */
+ ASSERT_RESULT(r, idn_invalid_codepoint);
+
+ r = idn_delimitermap_add(ctx, 0xd800); /* surrogate */
+ ASSERT_RESULT(r, idn_invalid_codepoint);
+
+ r = idn_delimitermap_add(ctx, 0x110000); /* out of range */
+ ASSERT_RESULT(r, idn_invalid_codepoint);
+}
+
+//# TESTCASE
+// title: call addall() with invalid codepoint
+// group: generic-init quiet
+{
+ unsigned long delimiters[1];
+
+ delimiters[0] = 0x0000; /* NUL */
+ r = idn_delimitermap_addall(ctx, delimiters, 1);
+ ASSERT_RESULT(r, idn_invalid_codepoint);
+
+ delimiters[0] = 0xd800; /* surrogate */
+ r = idn_delimitermap_addall(ctx, delimiters, 1);
+ ASSERT_RESULT(r, idn_invalid_codepoint);
+
+ delimiters[0] = 0x110000; /* out of range */
+ r = idn_delimitermap_addall(ctx, delimiters, 1);
+ ASSERT_RESULT(r, idn_invalid_codepoint);
+}
+
+//# TESTCASE
+// title: overrun test for arg `to' of map()
+// group: generic-init
+{
+ r = idn_delimitermap_map(ctx, from, to,
+ idn_ucs4_strlen(expected_default) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, expected_default);
+ r = idn_delimitermap_map(ctx, from, to,
+ idn_ucs4_strlen(expected_default));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+}
+
+//# TESTCASE
+// title: call map() with tolen=0
+// group: generic-init
+{
+ r = idn_delimitermap_map(ctx, from, to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/iconvchk.c b/contrib/idn/idnkit-1.0-src/lib/tests/iconvchk.c
new file mode 100644
index 0000000..895b197
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/iconvchk.c
@@ -0,0 +1,132 @@
+#ifndef lint
+static char *rcsid = "$Id: iconvchk.c,v 1.1.1.1 2003/06/04 00:26:54 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <idn/api.h>
+#include <idn/converter.h>
+#include <idn/result.h>
+
+#include "codeset.h"
+
+#define IDN_UTF8_ENCODING_NAME "UTF-8"
+
+void
+eucjp_check(void)
+{
+ idn_result_t r;
+ idn_converter_t eucjp_ctx = NULL;
+
+ r = idn_nameinit(0);
+ if (r != idn_success) {
+ fprintf(stderr, "idn_nameinit(): failed\n");
+ exit (1);
+ }
+
+ r = idn_converter_create(EUCJP_ENCODING_NAME, &eucjp_ctx, 0);
+
+ if (eucjp_ctx != NULL) {
+ idn_converter_destroy(eucjp_ctx);
+ }
+
+ if (r != idn_success) {
+ if (r == idn_invalid_name) {
+ fprintf(stderr, \
+ "\"%s\" is invalid codeset name, edit codeset.h\n", \
+ EUCJP_ENCODING_NAME);
+ exit (1);
+ } else {
+ fprintf(stderr, \
+ "idn_converter_create() failed with error \"%s\"\n", \
+ idn_result_tostring(r));
+ exit (1);
+ }
+ }
+}
+
+void
+sjis_check(void)
+{
+ idn_result_t r;
+ idn_converter_t sjis_ctx = NULL;
+
+ r = idn_nameinit(0);
+ if (r != idn_success) {
+ fprintf(stderr, "idn_nameinit(): failed\n");
+ exit (1);
+ }
+
+ r = idn_converter_create(SJIS_ENCODING_NAME, &sjis_ctx, 0);
+
+ if (sjis_ctx != NULL) {
+ idn_converter_destroy(sjis_ctx);
+ }
+
+ if (r != idn_success) {
+ if (r == idn_invalid_name) {
+ fprintf(stderr, \
+ "\"%s\" is invalid codeset name, edit codeset.h\n", \
+ SJIS_ENCODING_NAME);
+ exit (1);
+ } else {
+ fprintf(stderr, \
+ "idn_converter_create() failed with error \"%s\"\n", \
+ idn_result_tostring(r));
+ exit (1);
+ }
+ }
+}
+
+int
+main (int ac, char **av)
+{
+ eucjp_check();
+ sjis_check();
+
+ exit (0);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/mapper.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/mapper.tsy
new file mode 100644
index 0000000..5db6c65
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/mapper.tsy
@@ -0,0 +1,497 @@
+#ifndef lint
+static char *rcsid = "$Id: mapper.tsy,v 1.1.1.1 2003/06/04 00:26:54 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <idn/mapper.h>
+#include <idn/log.h>
+#include <idn/ucs4.h>
+#include "testutil.h"
+
+#define SIZEOFUCS4(x) (sizeof(x) / sizeof(unsigned long))
+
+#define UCS4_NAME_STR "U+304C" /* hiragana letter ga */
+#define UCS4_NAME 0x304C
+
+#define BUF_SIZE 128
+#define ARRAY_SIZE 9
+#define CONF_FILENAME "test.map"
+
+#define LINEBUF_SIZE 2001
+
+/*
+ * Sample string for `from' argument of map(),
+ * and its expected outputs.
+ */
+static const unsigned long from[] = {
+ 0x0041, /* latin capital letter a */
+ 0x0042, /* latin capital letter b */
+ UCS4_NAME,
+ 0x0000
+};
+
+static const unsigned long expected_default[] = {
+ 0x0061, /* latin small letter a */
+ 0x0062, /* latin small letter b */
+ UCS4_NAME,
+ 0x0000
+};
+
+idn_result_t
+test_create(const char *parameter, void **ctxp)
+{
+ return (idn_success);
+}
+
+void
+test_destroy(void *ctxp)
+{
+}
+
+idn_result_t
+test_map(void *ctx, const unsigned long *from, unsigned long *to,
+ size_t tolen)
+{
+ if (tolen > idn_ucs4_strlen(from)) {
+ idn_ucs4_strcpy(to, from);
+ } else {
+ return (idn_buffer_overflow);
+ }
+
+ return (idn_success);
+}
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: noinit
+//--
+// Do nothing
+{
+ idn_result_t r;
+ const char *name;
+}
+
+//# SETUP
+// group: generic
+//--
+// Initialize the module and create context.
+{
+ idn_result_t r;
+ idn_mapper_t ctx = NULL;
+
+ r = idn_mapper_initialize();
+ ASSERT_RESULT(r, idn_success);
+ r = idn_mapper_create(&ctx);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TEARDOWN
+// group: generic
+//--
+// Destroy context.
+{
+ idn_mapper_destroy(ctx);
+}
+
+//# SETUP
+// group: addall
+//--
+// Initialize the module and create context.
+{
+ idn_result_t r;
+ idn_mapper_t ctx = NULL;
+ char *names[ARRAY_SIZE];
+ int i;
+ unsigned long to[4];
+
+ for (i = 0; i < ARRAY_SIZE; i++) {
+ names[i] = malloc(BUF_SIZE);
+ if (names[i] == NULL) {
+ ASSERT("malloc failed\n");
+ }
+ }
+
+ r = idn_mapper_initialize();
+ ASSERT_RESULT(r, idn_success);
+ r = idn_mapper_create(&ctx);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TEARDOWN
+// group: addall
+//--
+// Destroy context and free some blocks.
+{
+ idn_mapper_destroy(ctx);
+ for (i = 0; i < ARRAY_SIZE; i++) {
+ free(names[i]);
+ }
+}
+
+//# SETUP
+// group: quiet
+//--
+// Set log level to `fatal' to supress log messages.
+{
+ int saved_log_level;
+
+ saved_log_level = idn_log_getlevel();
+ idn_log_setlevel(idn_log_level_fatal);
+}
+
+//# TEARDOWN
+// group: quiet
+//--
+// Restore log level.
+{
+ idn_log_setlevel(saved_log_level);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: idn_mapper_add() - boundary condition
+// group: generic quiet
+{
+ r = idn_mapper_add(ctx, "");
+ ASSERT_RESULT(r, idn_invalid_name);
+}
+
+//# TESTCASE
+// title: idn_mapper_add() - builtin schemes
+// group: generic quiet
+{
+ r = idn_mapper_add(ctx, "RFC3491");
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_mapper_add(ctx, "nameprep-01");
+ ASSERT_RESULT(r, idn_invalid_name);
+}
+
+//# TESTCASE
+// title: idn_mapper_add() - boundary condition
+// group: generic quiet
+{
+ r = idn_mapper_add(ctx, "");
+ ASSERT_RESULT(r, idn_invalid_name);
+ r = idn_mapper_add(ctx, "filemap:");
+ ASSERT_RESULT(r, idn_nofile);
+ r = idn_mapper_add(ctx, "filemap:notfound.map");
+ ASSERT_RESULT(r, idn_nofile);
+}
+
+//# TESTCASE
+// title: idn_mapper_add() - file
+// group: generic quiet
+{
+ char name[BUF_SIZE];
+ unsigned long to[4];
+
+ create_conf_file(CONF_FILENAME, 0,
+ "0041; 0061;",
+ "0042; 0062;",
+ NULL);
+ sprintf(name, "filemap:%s", CONF_FILENAME);
+
+ r = idn_mapper_add(ctx, name);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_mapper_map(ctx, from, to, SIZEOFUCS4(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, expected_default);
+}
+
+//# TESTCASE
+// title: idn_mapper_add() - file - long line
+// group: generic quiet
+{
+ char line[LINEBUF_SIZE];
+ char name[BUF_SIZE];
+ const char *first_entry = "0041;";
+ const char *other_entry = " 0061";
+ int i;
+ int len;
+
+ memcpy(line, first_entry, strlen(first_entry));
+ len = strlen(other_entry);
+ for (i = len; i < LINEBUF_SIZE - len; i += len) {
+ memcpy(line + i, other_entry, len);
+ }
+ *(line + i) = '\0';
+
+ create_conf_file(CONF_FILENAME, 0, line, NULL);
+ sprintf(name, "filemap:%s", CONF_FILENAME);
+ r = idn_mapper_add(ctx, name);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+}
+
+//# TESTCASE
+// title: idn_mapper_add() - file - no new line at end of file
+// group: generic quiet
+{
+ char name[BUF_SIZE];
+ unsigned long to[4];
+
+ create_conf_file(CONF_FILENAME, CONF_NO_EOF_NEWLINE,
+ "0041; 0061;",
+ "0042; 0062;",
+ NULL);
+ sprintf(name, "filemap:%s", CONF_FILENAME);
+ r = idn_mapper_add(ctx, name);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_mapper_map(ctx, from, to, SIZEOFUCS4(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, expected_default);
+}
+
+//# TESTCASE
+// title: idn_mapper_add() - file - one item in one line #1
+// group: generic quiet
+{
+ char name[BUF_SIZE];
+ unsigned long to[3];
+ unsigned long expected[] = {
+ 0x0061,
+ UCS4_NAME,
+ 0x0000
+ };
+
+ create_conf_file(CONF_FILENAME, 0,
+ "0041; 0061;",
+ "0042;",
+ NULL);
+ sprintf(name, "filemap:%s", CONF_FILENAME);
+ r = idn_mapper_add(ctx, name);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_mapper_map(ctx, from, to, SIZEOFUCS4(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, expected);
+}
+
+//# TESTCASE
+// title: idn_mapper_add() - file - one item in one line #2
+// group: generic quiet
+{
+ char name[BUF_SIZE];
+ unsigned long to[3];
+ unsigned long expected[] = {
+ 0x0061,
+ UCS4_NAME,
+ 0x0000
+ };
+
+ create_conf_file(CONF_FILENAME, 0,
+ "0041; 0061;",
+ "0042; ;",
+ NULL);
+ sprintf(name, "filemap:%s", CONF_FILENAME);
+ r = idn_mapper_add(ctx, name);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_mapper_map(ctx, from, to, SIZEOFUCS4(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, expected);
+}
+
+//# TESTCASE
+// title: idn_mapper_add() - file - more then two items in one line #1
+// group: generic quiet
+{
+ char name[BUF_SIZE];
+ unsigned long to[4];
+
+ create_conf_file(CONF_FILENAME, 0,
+ "0041; 0061; 0062;",
+ "0042; 0062; 0063;",
+ NULL);
+ sprintf(name, "filemap:%s", CONF_FILENAME);
+ r = idn_mapper_add(ctx, name);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_mapper_map(ctx, from, to, SIZEOFUCS4(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, expected_default);
+}
+
+//# TESTCASE
+// title: idn_mapper_add() - file - more then two items in one line #2
+// group: generic quiet
+{
+ char name[BUF_SIZE];
+ unsigned long to[6];
+ unsigned long expected_to[] = {
+ 0x0061,
+ 0x0062,
+ 0x0062,
+ 0x0063,
+ UCS4_NAME,
+ 0x0000
+ };
+
+ create_conf_file(CONF_FILENAME, 0,
+ "0041; 0061 0062;",
+ "0042; 0062 0063;",
+ NULL);
+ sprintf(name, "filemap:%s", CONF_FILENAME);
+ r = idn_mapper_add(ctx, name);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_mapper_map(ctx, from, to, SIZEOFUCS4(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, expected_to);
+}
+
+//# TESTCASE
+// title: idn_mapper_add() - file - more then two items in one line #3
+// group: generic quiet
+{
+ char name[BUF_SIZE];
+ unsigned long to[3];
+
+ create_conf_file(CONF_FILENAME, 0,
+ "0041 0042; 0063;",
+ NULL);
+ sprintf(name, "filemap:%s", CONF_FILENAME);
+ r = idn_mapper_add(ctx, name);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+}
+
+//# TESTCASE
+// title: idn_mapper_addall() - add all builtin schemes
+// group: addall quiet
+{
+ strcpy(names[0], "RFC3491");
+ strcpy(names[1], "RFC3491");
+ strcpy(names[2], "RFC3491");
+ strcpy(names[3], "RFC3491");
+ strcpy(names[4], "RFC3491");
+ strcpy(names[5], "RFC3491");
+ strcpy(names[6], "RFC3491");
+ strcpy(names[7], "RFC3491");
+ strcpy(names[8], "RFC3491");
+
+ r = idn_mapper_addall(ctx, (const char **)names, 9);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_mapper_map(ctx, from, to, SIZEOFUCS4(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, expected_default);
+}
+
+//# TESTCASE
+// title: idn_mapper_addall() - add same scheme repetedly
+// group: addall quiet
+{
+ for (i = 0; i < ARRAY_SIZE; i++) {
+ strcpy(names[i], "RFC3491");
+ }
+ r = idn_mapper_addall(ctx, (const char **)names, 3);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_mapper_map(ctx, from, to, SIZEOFUCS4(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, expected_default);
+}
+
+//# TESTCASE
+// title: idn_mapper_map() - builtin schemes check - RFC3491
+// group: generic quiet
+{
+ unsigned long to[4];
+
+ r = idn_mapper_add(ctx, "RFC3491");
+ ASSERT_RESULT(r, idn_success);
+ r = idn_mapper_map(ctx, from, to, SIZEOFUCS4(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, expected_default);
+}
+
+//# TESTCASE
+// title: idn_mapper_map() - context without procedure
+// group: generic
+{
+ unsigned long to[4];
+
+ r = idn_mapper_map(ctx, from, to, SIZEOFUCS4(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, from);
+}
+
+//# TESTCASE
+// title: idn_mapper_destroy(), idn_mapper_incrref()
+// group:
+{
+ idn_result_t r;
+ idn_mapper_t ctx = NULL;
+
+ r = idn_mapper_initialize();
+ ASSERT_RESULT(r, idn_success);
+ r = idn_mapper_create(&ctx);
+ ASSERT_RESULT(r, idn_success);
+ idn_mapper_incrref(ctx);
+ idn_mapper_destroy(ctx);
+ idn_mapper_destroy(ctx);
+}
+
+//# TESTCASE
+// title: idn_mapper_register()
+// group: generic quiet
+{
+ unsigned long to[10];
+
+ r = idn_mapper_register("test", test_create, test_destroy, test_map);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_mapper_add(ctx, "test");
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_mapper_map(ctx, from, to, SIZEOFUCS4(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, from);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/mapselector.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/mapselector.tsy
new file mode 100644
index 0000000..1484f6c
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/mapselector.tsy
@@ -0,0 +1,592 @@
+#ifndef lint
+static char *rcsid = "$Id: mapselector.tsy,v 1.1.1.1 2003/06/04 00:26:55 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <idn/mapselector.h>
+#include <idn/ucs4.h>
+#include <idn/log.h>
+
+#include "testutil.h"
+
+#define CONF_FILENAME "test.conf"
+#define MAP_FILENAME "test.map"
+
+/*
+ * Sample TLDs.
+ */
+static const char *utf8_tlds_jp[] = {"jp", ".jp", "JP", ".JP"};
+static const char *utf8_tlds_tw[] = {"tw", ".tw", "TW", ".TW"};
+
+static const unsigned long ucs4_tlds_jp[][4] = {{'j', 'p', '\0', '\0'},
+ {'.', 'j', 'p', '\0'},
+ {'J', 'P', '\0', '\0'},
+ {'.', 'J', 'P', '\0'}};
+
+static const unsigned long ucs4_tlds_tw[][4] = {{'t', 'w', '\0', '\0'},
+ {'.', 't', 'w', '\0'},
+ {'T', 'W', '\0', '\0'},
+ {'.', 'T', 'W', '\0'}};
+
+/* How many elements in `utf8_tlds_{jp|tw}[]' and `ucs4_tlds_{jp|tw}[]'. */
+#define TLD_NVARIANTS 4
+
+/*
+ * Sample input string for mapping. (UCS4)
+ */
+static const unsigned long in_string[] = {0x00C0, 0x2212, 0};
+
+/*
+ * Sample mapping results of IN_STRING.
+ *
+ * OUT_STRING_FILEMAP is the result of file-mapping (U+2212 -> U+002D).
+ * OUT_STRING_NAMEPREP is the result of the latest nameprep
+ * OUT_STRING_BOTH is the result of both file-mapping and nameprep.
+ */
+static const unsigned long out_string_filemap[] = {0x00C0, 0x002D, 0};
+static const unsigned long out_string_nameprep[] = {0x00E0, 0x2212, 0};
+static const unsigned long out_string_both[] = {0x00E0, 0x002D, 0};
+
+#define MAP_FILENAME "test.map"
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: generic-init
+{
+ idn_result_t r;
+ idn_mapselector_t ctxs[TLD_NVARIANTS];
+ unsigned long to[256];
+
+ {
+ int i;
+ for (i = 0; i < TLD_NVARIANTS; i++)
+ ctxs[i] = NULL;
+ }
+
+ r = idn_mapselector_initialize();
+ ASSERT_RESULT(r, idn_success);
+
+ {
+ int i;
+ for (i = 0; i < TLD_NVARIANTS; i++) {
+ r = idn_mapselector_create(&ctxs[i]);
+ ASSERT_RESULT(r, idn_success);
+ }
+ }
+}
+
+//# TEARDOWN
+// group: generic-init
+{
+ {
+ int i;
+
+ for (i = 0; i < TLD_NVARIANTS; i++) {
+ if (ctxs[i] != NULL)
+ idn_mapselector_destroy(ctxs[i]);
+ remove(CONF_FILENAME);
+ }
+ }
+}
+
+//# SETUP
+// group: quiet
+{
+ int saved_log_level;
+
+ saved_log_level = idn_log_getlevel();
+ idn_log_setlevel(idn_log_level_fatal);
+}
+
+//# TEARDOWN
+// group: quiet
+{
+ idn_log_setlevel(saved_log_level);
+}
+
+//# SETUP
+// group: generic-filemap
+{
+ create_conf_file(MAP_FILENAME, 0,
+ "U+2212; U+002D",
+ NULL);
+}
+
+//# TEARDOWN
+// group: generic-filemap
+{
+ remove(MAP_FILENAME);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: call initialize() twice.
+//
+{
+ idn_result_t r;
+
+ r = idn_mapselector_initialize();
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_mapselector_initialize();
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: call create()
+{
+ idn_result_t r;
+ idn_mapselector_t ctx;
+
+ r = idn_mapselector_initialize();
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_mapselector_create(&ctx);
+ ASSERT_RESULT(r, idn_success);
+
+ idn_mapselector_destroy(ctx);
+}
+
+//# TESTCASE
+// title: call add(filemap) and map()
+// group: generic-init generic-filemap
+{
+ int i, j;
+
+ for (i = 0; i < TLD_NVARIANTS; i++) {
+ r = idn_mapselector_add(ctxs[i], utf8_tlds_jp[i],
+ "filemap:" MAP_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+ }
+
+ for (i = 0; i < TLD_NVARIANTS; i++) {
+ for (j = 0; j < TLD_NVARIANTS; j++) {
+ r = idn_mapselector_map(ctxs[i], in_string,
+ utf8_tlds_jp[j], to,
+ sizeof(to) / sizeof(*to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, out_string_filemap);
+
+ r = idn_mapselector_map(ctxs[i], in_string,
+ utf8_tlds_tw[j], to,
+ sizeof(to) / sizeof(*to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, in_string);
+ }
+ }
+}
+
+//# TESTCASE
+// title: call add(nameprep) and map()
+// group: generic-init generic-filemap
+{
+ int i, j;
+
+ for (i = 0; i < TLD_NVARIANTS; i++) {
+ r = idn_mapselector_add(ctxs[i], utf8_tlds_jp[i],
+ IDN_NAMEPREP_CURRENT);
+ ASSERT_RESULT(r, idn_success);
+ }
+
+ for (i = 0; i < TLD_NVARIANTS; i++) {
+ for (j = 0; j < TLD_NVARIANTS; j++) {
+ r = idn_mapselector_map(ctxs[i], in_string,
+ utf8_tlds_jp[j], to,
+ sizeof(to) / sizeof(*to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, out_string_nameprep);
+
+ r = idn_mapselector_map(ctxs[i], in_string,
+ utf8_tlds_tw[j], to,
+ sizeof(to) / sizeof(*to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, in_string);
+ }
+ }
+}
+
+//# TESTCASE
+// title: call add(filemap) and map2()
+// group: generic-init generic-filemap
+{
+ int i, j;
+
+ for (i = 0; i < TLD_NVARIANTS; i++) {
+ r = idn_mapselector_add(ctxs[i], utf8_tlds_jp[i],
+ "filemap:" MAP_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+ }
+
+ for (i = 0; i < TLD_NVARIANTS; i++) {
+ for (j = 0; j < TLD_NVARIANTS; j++) {
+ r = idn_mapselector_map2(ctxs[i], in_string,
+ ucs4_tlds_jp[j], to,
+ sizeof(to) / sizeof(*to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, out_string_filemap);
+
+ r = idn_mapselector_map2(ctxs[i], in_string,
+ ucs4_tlds_tw[j], to,
+ sizeof(to) / sizeof(*to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, in_string);
+ }
+ }
+}
+
+//# TESTCASE
+// title: call add(nameprep) and map2()
+// group: generic-init generic-filemap
+{
+ int i, j;
+
+ for (i = 0; i < TLD_NVARIANTS; i++) {
+ r = idn_mapselector_add(ctxs[i], utf8_tlds_jp[i],
+ IDN_NAMEPREP_CURRENT);
+ ASSERT_RESULT(r, idn_success);
+ }
+
+ for (i = 0; i < TLD_NVARIANTS; i++) {
+ for (j = 0; j < TLD_NVARIANTS; j++) {
+ r = idn_mapselector_map2(ctxs[i], in_string,
+ ucs4_tlds_jp[j], to,
+ sizeof(to) / sizeof(*to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, out_string_nameprep);
+
+ r = idn_mapselector_map2(ctxs[i], in_string,
+ ucs4_tlds_tw[j], to,
+ sizeof(to) / sizeof(*to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, in_string);
+ }
+ }
+}
+
+//# TESTCASE
+// title: call add(filemap) and map()
+// group: generic-init generic-filemap
+{
+ int i, j;
+
+ for (i = 0; i < TLD_NVARIANTS; i++) {
+ r = idn_mapselector_add(ctxs[i], utf8_tlds_jp[i],
+ "filemap:" MAP_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+ }
+
+ for (i = 0; i < TLD_NVARIANTS; i++) {
+ for (j = 0; j < TLD_NVARIANTS; j++) {
+ r = idn_mapselector_map(ctxs[i], in_string,
+ utf8_tlds_jp[j], to,
+ sizeof(to) / sizeof(*to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, out_string_filemap);
+
+ r = idn_mapselector_map(ctxs[i], in_string,
+ utf8_tlds_tw[j], to,
+ sizeof(to) / sizeof(*to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, in_string);
+ }
+ }
+}
+
+//# TESTCASE
+// title: call add(nameprep) and map()
+// group: generic-init generic-filemap
+{
+ int i, j;
+
+ for (i = 0; i < TLD_NVARIANTS; i++) {
+ r = idn_mapselector_add(ctxs[i], utf8_tlds_jp[i],
+ IDN_NAMEPREP_CURRENT);
+ ASSERT_RESULT(r, idn_success);
+ }
+
+ for (i = 0; i < TLD_NVARIANTS; i++) {
+ for (j = 0; j < TLD_NVARIANTS; j++) {
+ r = idn_mapselector_map(ctxs[i], in_string,
+ utf8_tlds_jp[j], to,
+ sizeof(to) / sizeof(*to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, out_string_nameprep);
+
+ r = idn_mapselector_map(ctxs[i], in_string,
+ utf8_tlds_tw[j], to,
+ sizeof(to) / sizeof(*to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, in_string);
+ }
+ }
+}
+
+//# TESTCASE
+// title: call addall()
+// group: generic-init generic-filemap
+{
+ static const char *names[] = {
+ "filemap:" MAP_FILENAME,
+ IDN_NAMEPREP_CURRENT
+ };
+ int i, j;
+
+ for (i = 0; i < TLD_NVARIANTS; i++) {
+ r = idn_mapselector_addall(ctxs[i], utf8_tlds_jp[i], names,
+ sizeof(names) / sizeof(*names));
+ ASSERT_RESULT(r, idn_success);
+ }
+
+ for (i = 0; i < TLD_NVARIANTS; i++) {
+ for (j = 0; j < TLD_NVARIANTS; j++) {
+ r = idn_mapselector_map2(ctxs[i], in_string,
+ ucs4_tlds_jp[j], to,
+ sizeof(to) / sizeof(*to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, out_string_both);
+
+ r = idn_mapselector_map2(ctxs[i], in_string,
+ ucs4_tlds_tw[j], to,
+ sizeof(to) / sizeof(*to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, in_string);
+ }
+ }
+}
+
+//# TESTCASE
+// title: call addall() with nnames=0
+// group: generic-init
+{
+ static const char *names[] = {IDN_NAMEPREP_CURRENT};
+
+ r = idn_mapselector_addall(ctxs[0], ".", names, 0);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: call add() with empty tld
+// group: generic-init
+{
+ r = idn_mapselector_add(ctxs[0], "", IDN_NAMEPREP_CURRENT);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: call addall() with empty tld
+// group: generic-init
+{
+ static const char *names[] = {IDN_NAMEPREP_CURRENT};
+
+ r = idn_mapselector_addall(ctxs[0], "", names, 1);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: call add() with too long tld
+// group: generic-init quiet
+{
+ r = idn_mapselector_add(ctxs[0],
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "ABCDEFGHIJK",
+ IDN_NAMEPREP_CURRENT);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_mapselector_add(ctxs[0],
+ "."
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "ABCDEFGHIJK",
+ IDN_NAMEPREP_CURRENT);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_mapselector_add(ctxs[0],
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "ABCDEFGHIJKL",
+ IDN_NAMEPREP_CURRENT);
+ ASSERT_RESULT(r, idn_invalid_name);
+
+ r = idn_mapselector_add(ctxs[0],
+ "."
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "ABCDEFGHIJKL",
+ IDN_NAMEPREP_CURRENT);
+ ASSERT_RESULT(r, idn_invalid_name);
+}
+
+//# TESTCASE
+// title: call addall() with too long tld
+// group: generic-init quiet
+{
+ static const char *names[] = {IDN_NAMEPREP_CURRENT};
+
+ r = idn_mapselector_addall(ctxs[0],
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "ABCDEFGHIJK",
+ names, 1);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_mapselector_addall(ctxs[0],
+ "."
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "ABCDEFGHIJK",
+ names, 1);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_mapselector_addall(ctxs[0],
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "ABCDEFGHIJKL",
+ names, 1);
+ ASSERT_RESULT(r, idn_invalid_name);
+
+ r = idn_mapselector_addall(ctxs[0],
+ "."
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "ABCDEFGHIJKL",
+ names, 1);
+ ASSERT_RESULT(r, idn_invalid_name);
+}
+
+//# TESTCASE
+// title: overrun test for arg `to' of map()
+// group: generic-init
+{
+ r = idn_mapselector_add(ctxs[0], utf8_tlds_jp[0],
+ IDN_NAMEPREP_CURRENT);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_mapselector_map(ctxs[0], in_string, utf8_tlds_jp[0], to,
+ idn_ucs4_strlen(out_string_nameprep) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, out_string_nameprep);
+
+ r = idn_mapselector_map(ctxs[0], in_string, utf8_tlds_tw[0], to,
+ idn_ucs4_strlen(in_string) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, in_string);
+
+ r = idn_mapselector_map(ctxs[0], in_string, utf8_tlds_jp[0], to,
+ idn_ucs4_strlen(out_string_nameprep));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ r = idn_mapselector_map(ctxs[0], in_string, utf8_tlds_tw[0], to,
+ idn_ucs4_strlen(in_string));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+}
+
+//# TESTCASE
+// title: overrun test for arg `to' of map2()
+// group: generic-init
+{
+ r = idn_mapselector_add(ctxs[0], utf8_tlds_jp[0],
+ IDN_NAMEPREP_CURRENT);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_mapselector_map2(ctxs[0], in_string, ucs4_tlds_jp[0], to,
+ idn_ucs4_strlen(out_string_nameprep) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, out_string_nameprep);
+
+ r = idn_mapselector_map2(ctxs[0], in_string, ucs4_tlds_tw[0], to,
+ idn_ucs4_strlen(in_string) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, in_string);
+
+ r = idn_mapselector_map2(ctxs[0], in_string, ucs4_tlds_jp[0], to,
+ idn_ucs4_strlen(out_string_nameprep));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ r = idn_mapselector_map2(ctxs[0], in_string, ucs4_tlds_tw[0], to,
+ idn_ucs4_strlen(in_string));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+}
+
+//# TESTCASE
+// title: call map() with tolen=0
+// group: generic-init
+{
+ r = idn_mapselector_add(ctxs[0], utf8_tlds_jp[0],
+ IDN_NAMEPREP_CURRENT);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_mapselector_map(ctxs[0], in_string, utf8_tlds_jp[0], to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ r = idn_mapselector_map(ctxs[0], in_string, utf8_tlds_tw[0], to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+}
+
+//# TESTCASE
+// title: call map2() with tolen=0
+// group: generic-init
+{
+ r = idn_mapselector_add(ctxs[0], utf8_tlds_jp[0],
+ IDN_NAMEPREP_CURRENT);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_mapselector_map2(ctxs[0], in_string, ucs4_tlds_jp[0], to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ r = idn_mapselector_map2(ctxs[0], in_string, ucs4_tlds_tw[0], to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+}
+
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/nameprep.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/nameprep.tsy
new file mode 100644
index 0000000..bba49c7
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/nameprep.tsy
@@ -0,0 +1,340 @@
+#ifndef lint
+static char *rcsid = "$Id: nameprep.tsy,v 1.1.1.1 2003/06/04 00:26:56 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <idn/nameprep.h>
+#include <idn/log.h>
+#include "testutil.h"
+
+#define UCS4_NAME 0x304C /* hiragana letter ga */
+#define BUF_SIZE 4
+/*
+ * Sample string for `from' argument for map(),
+ * and its expected outputs.
+ */
+static const unsigned long map_from[] = {
+ 0x0041, /* latin capital letter a */
+ 0x0042, /* latin capital letter b */
+ UCS4_NAME,
+ 0x0000
+};
+
+static const unsigned long map_expected[] = {
+ 0x0061, /* latin small letter a */
+ 0x0062, /* latin small letter b */
+ UCS4_NAME,
+ 0x0000
+};
+
+/*
+ * Sample string for `from' argument for isprohibited().
+ */
+static const unsigned long check_from[4] = {
+ UCS4_NAME,
+ 0x00A0, /* no-break space: prohibited character */
+ 0x0221, /* unassigned character */
+ 0x0000
+};
+
+#define FROM_UCS4NAME_OFFSET 0
+#define FROM_PROH_OFFSET 1
+#define FROM_UNAS_OFFSET 2
+
+/*
+ * Sample string for `from' argument for isunassigned().
+ */
+static const unsigned long check_from2[4] = {
+ UCS4_NAME,
+ 0x0221, /* unassigned character */
+ 0x00A0, /* no-break space: prohibited character */
+ 0x0000
+};
+
+#define FROM2_UCS4NAME_OFFSET 0
+#define FROM2_PROH_OFFSET 2
+#define FROM2_UNAS_OFFSET 1
+
+/*
+ * Sample string for `from' argument for isvalidbidi().
+ * (It is not a valid bidi label.)
+ */
+static const unsigned long bidi_from[4] = {
+ 0x05BE, /* hebrew punctuation maqaf */
+ 0x0041, /* latin capital letter a */
+ 0xFEFC, /* arabic ligature lam with alef final form */
+ 0x0000
+};
+#define BIDIFROM_OFFSET 1
+
+/*
+ * Empty string.
+ */
+static const unsigned long ucs4_nullstr[] = {
+ 0x0000
+};
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: generic
+//--
+// Nothing happens.
+{
+ idn_result_t r;
+ idn_nameprep_t handle = NULL;
+
+}
+
+//# SETUP
+// group: check
+//--
+// Initialize the module and create contexts.
+{
+ idn_result_t r;
+ idn_nameprep_t handle11 = NULL;
+
+ r = idn_nameprep_create("RFC3491", &handle11);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TEARDOWN
+// group: check
+//--
+// Destroy contexts.
+{
+ if (handle11 != NULL) {
+ idn_nameprep_destroy(handle11);
+ }
+}
+
+//# SETUP
+// group: quiet
+//--
+// Set log level to `fatal' to supress log messages.
+{
+ int saved_log_level;
+
+ saved_log_level = idn_log_getlevel();
+ idn_log_setlevel(idn_log_level_fatal);
+}
+
+//# TEARDOWN
+// group: quiet
+//--
+// Restore log level.
+{
+ idn_log_setlevel(saved_log_level);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: idn_nameprep_create() - boundary condition
+// group: generic quiet
+{
+ r = idn_nameprep_create("", &handle);
+ ASSERT_RESULT(r, idn_notfound);
+}
+
+//# TESTCASE
+// title: idn_nameprep_create() - version is NULL (current nameprep)
+// group: generic quiet
+{
+ unsigned long to[BUF_SIZE];
+ const unsigned long *found;
+
+ r = idn_nameprep_create(NULL, &handle);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_nameprep_map(handle, map_from, to, BUF_SIZE);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, map_expected);
+
+ r = idn_nameprep_isunassigned(handle, check_from, &found);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(found, check_from + FROM_UNAS_OFFSET);
+
+ r = idn_nameprep_isprohibited(handle, check_from, &found);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(found, check_from + FROM_PROH_OFFSET);
+
+ r = idn_nameprep_isvalidbidi(handle, bidi_from, &found);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(found, bidi_from + BIDIFROM_OFFSET);
+
+ idn_nameprep_destroy(handle);
+}
+
+//# TESTCASE
+// title: idn_nameprep_create() - nameprep-01
+// group: generic quiet
+{
+ r = idn_nameprep_create("nameprep-01", &handle);
+ ASSERT_RESULT(r, idn_notfound);
+}
+
+//# TESTCASE
+// title: idn_nameprep_create() - RFC3491
+// group: generic
+{
+ r = idn_nameprep_create("RFC3491", &handle);
+ ASSERT_RESULT(r, idn_success);
+ idn_nameprep_destroy(handle);
+}
+
+//# TESTCASE
+// title: idn_nameprep_map() - boundary condition
+// group: check
+{
+ unsigned long to[BUF_SIZE];
+
+ r = idn_nameprep_map(handle11, ucs4_nullstr, to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+ r = idn_nameprep_map(handle11, ucs4_nullstr, to, 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, ucs4_nullstr);
+}
+
+//# TESTCASE
+// title: idn_nameprep_map() - RFC3491
+// group: check
+{
+ unsigned long to[BUF_SIZE];
+
+ r = idn_nameprep_map(handle11, map_from, to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+ r = idn_nameprep_map(handle11, map_from, to, BUF_SIZE - 1);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+ r = idn_nameprep_map(handle11, map_from, to, BUF_SIZE);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, map_expected);
+}
+
+//# TESTCASE
+// title: idn_nameprep_isunassigned() - boundary condition
+// group: check
+{
+ const unsigned long *found;
+
+ r = idn_nameprep_isunassigned(handle11, ucs4_nullstr, &found);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(found, NULL);
+}
+
+//# TESTCASE
+// title: idn_nameprep_isunassigned() - RFC3491
+// group: check
+{
+ const unsigned long *found;
+
+ r = idn_nameprep_isunassigned(handle11, check_from, &found);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(found, check_from + FROM_UNAS_OFFSET);
+
+ r = idn_nameprep_isunassigned(handle11, check_from2, &found);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(found, check_from2 + FROM2_UNAS_OFFSET);
+}
+
+//# TESTCASE
+// title: idn_nameprep_isprohibited() - boundary condition
+// group: check
+{
+ const unsigned long *found;
+
+ r = idn_nameprep_isprohibited(handle11, ucs4_nullstr, &found);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(found, NULL);
+}
+
+//# TESTCASE
+// title: idn_nameprep_isprohibited() - RFC3491
+// group: check
+{
+ const unsigned long *found;
+
+ r = idn_nameprep_isprohibited(handle11, check_from, &found);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(found, check_from + FROM_PROH_OFFSET);
+
+ r = idn_nameprep_isprohibited(handle11, check_from2, &found);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(found, check_from2 + FROM2_PROH_OFFSET);
+}
+
+//# TESTCASE
+// title: idn_nameprep_isvalidbidi() - boundary condition
+// group: check
+{
+ const unsigned long *found;
+
+ r = idn_nameprep_isvalidbidi(handle11, ucs4_nullstr, &found);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(found, NULL);
+}
+
+//# TESTCASE
+// title: idn_nameprep_isvalidbidi() - RFC3491
+// group: check
+{
+ const unsigned long *found;
+
+ r = idn_nameprep_isvalidbidi(handle11, bidi_from, &found);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(found, bidi_from + BIDIFROM_OFFSET);
+
+ r = idn_nameprep_isvalidbidi(handle11, check_from2, &found);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_PTR(found, NULL);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/normalizer.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/normalizer.tsy
new file mode 100644
index 0000000..dc9906d
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/normalizer.tsy
@@ -0,0 +1,346 @@
+#ifndef lint
+static char *rcsid = "$Id: normalizer.tsy,v 1.1.1.1 2003/06/04 00:26:57 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <idn/normalizer.h>
+#include <idn/log.h>
+#include <idn/ucs4.h>
+
+#define BUF_SIZE 64
+#define TOBUF_SIZE 4
+#define ARRAY_SIZE 20
+#define CONF_FILENAME "test.map"
+
+/*
+ * Sample string for `from' argument of normalize(),
+ * and its expected outputs.
+ */
+static const unsigned long from[4] = {
+ 0x304B, /* hiragana letter ka */
+ 0x3099, /* combining katakana-hiragana voiced sound mark */
+ 0x32D0, /* circled katakana a */
+ 0x0000
+};
+
+static const unsigned long normalized_kc_str[3] = {
+ 0x304C, /* hiragana letter ga */
+ 0x30A2, /* katakana letter a */
+ 0x0000
+};
+
+static const unsigned long normalized_c_str[3] = {
+ 0x304C, /* hiragana letter ga */
+ 0x32D0, /* circled katakana a */
+ 0x0000
+};
+
+idn_result_t
+test_proc(const unsigned long *from, unsigned long *to, size_t tolen)
+{
+ if (tolen > idn_ucs4_strlen(from)) {
+ idn_ucs4_strcpy(to, from);
+ } else {
+ return (idn_buffer_overflow);
+ }
+
+ return (idn_success);
+}
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: noinit
+//--
+// Do nothing
+{
+ idn_result_t r;
+ const char *name;
+}
+
+//# SETUP
+// group: generic
+//--
+// Initialize the module and create context.
+{
+ idn_result_t r;
+ idn_normalizer_t ctx = NULL;
+
+ r = idn_normalizer_initialize();
+ ASSERT_RESULT(r, idn_success);
+ r = idn_normalizer_create(&ctx);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TEARDOWN
+// group: generic
+//--
+// Destroy context.
+{
+ idn_normalizer_destroy(ctx);
+}
+
+//# SETUP
+// group: addall
+//--
+// Initialize the module and create context.
+{
+ idn_result_t r;
+ idn_normalizer_t ctx = NULL;
+ char *names[ARRAY_SIZE];
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE; i++) {
+ names[i] = malloc(BUF_SIZE);
+ if (names[i] == NULL) {
+ ASSERT("malloc failed\n");
+ }
+ }
+
+ strcpy(names[0], "RFC3491");
+ strcpy(names[1], "unicode-form-kc");
+ strcpy(names[2], "unicode-form-kc/3.2.0");
+ strcpy(names[3], "RFC3491");
+ strcpy(names[4], "unicode-form-kc");
+ strcpy(names[5], "unicode-form-kc/3.2.0");
+ strcpy(names[6], "RFC3491");
+ strcpy(names[7], "unicode-form-kc");
+ strcpy(names[8], "unicode-form-kc/3.2.0");
+ strcpy(names[9], "RFC3491");
+ strcpy(names[10], "unicode-form-kc");
+ strcpy(names[11], "unicode-form-kc/3.2.0");
+ strcpy(names[12], "RFC3491");
+ strcpy(names[13], "unicode-form-kc");
+ strcpy(names[14], "unicode-form-kc/3.2.0");
+ strcpy(names[15], "RFC3491");
+ strcpy(names[16], "unicode-form-kc");
+ strcpy(names[17], "unicode-form-kc/3.2.0");
+ strcpy(names[18], "RFC3491");
+ strcpy(names[19], "unicode-form-kc");
+
+ r = idn_normalizer_initialize();
+ ASSERT_RESULT(r, idn_success);
+ r = idn_normalizer_create(&ctx);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TEARDOWN
+// group: addall
+//--
+// Destroy context.
+{
+ idn_normalizer_destroy(ctx);
+ for (i = 0; i < ARRAY_SIZE; i++) {
+ free(names[i]);
+ }
+}
+
+//# SETUP
+// group: quiet
+//--
+// Set log level to `fatal' to supress log messages.
+{
+ int saved_log_level;
+
+ saved_log_level = idn_log_getlevel();
+ idn_log_setlevel(idn_log_level_fatal);
+}
+
+//# TEARDOWN
+// group: quiet
+//--
+// Restore log level.
+{
+ idn_log_setlevel(saved_log_level);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: idn_normalizer_add() - boundary condition
+// group: generic quiet
+{
+ r = idn_normalizer_add(ctx, "");
+ ASSERT_RESULT(r, idn_invalid_name);
+}
+
+//# TESTCASE
+// title: idn_normalizer_add() - builtin schemes
+// group: generic quiet
+{
+ r = idn_normalizer_add(ctx, "RFC3491");
+ ASSERT_RESULT(r, idn_success);
+ r = idn_normalizer_add(ctx, "unicode-form-kc");
+ ASSERT_RESULT(r, idn_success);
+ r = idn_normalizer_add(ctx, "unicode-form-kc/3.2.0");
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_normalizer_add(ctx, "nameprep-01");
+ ASSERT_RESULT(r, idn_invalid_name);
+}
+
+//# TESTCASE
+// title: idn_normalizer_addall() - boundary condition
+// group: addall quiet
+{
+ strcpy(names[3], "");
+ r = idn_normalizer_addall(ctx, (const char **)names, ARRAY_SIZE);
+ ASSERT_RESULT(r, idn_invalid_name);
+}
+
+//# TESTCASE
+// title: idn_normalizer_addall() - nschemes is 0
+// group: addall quiet
+{
+ r = idn_normalizer_addall(ctx, (const char **)names, 0);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: idn_normalizer_addall() - add a lot of schemes
+// group: addall quiet
+{
+ unsigned long to[TOBUF_SIZE];
+
+ r = idn_normalizer_addall(ctx, (const char **)names, ARRAY_SIZE);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_normalizer_normalize(ctx, from, to, TOBUF_SIZE);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, normalized_kc_str);
+}
+
+//# TESTCASE
+// title: idn_normalizer_addall() - add same scheme repetedly
+// group: addall quiet
+{
+ int i;
+ unsigned long to[TOBUF_SIZE];
+
+ for (i = 0; i < ARRAY_SIZE; i++) {
+ strcpy(names[i], "RFC3491");
+ }
+ r = idn_normalizer_addall(ctx, (const char **)names, ARRAY_SIZE);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_normalizer_normalize(ctx, from, to, TOBUF_SIZE);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, normalized_kc_str);
+}
+
+//# TESTCASE
+// title: idn_normalizer_normalize() - schemes check - RFC3491
+// group: generic quiet
+{
+ unsigned long to[TOBUF_SIZE];
+
+ r = idn_normalizer_add(ctx, "RFC3491");
+ ASSERT_RESULT(r, idn_success);
+ r = idn_normalizer_normalize(ctx, from, to, TOBUF_SIZE);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, normalized_kc_str);
+}
+
+//# TESTCASE
+// title: idn_normalizer_normalize() - schemes check - unicode-form-kc/3.2.0
+// group: generic quiet
+{
+ unsigned long to[TOBUF_SIZE];
+
+ r = idn_normalizer_add(ctx, "unicode-form-kc/3.2.0");
+ ASSERT_RESULT(r, idn_success);
+ r = idn_normalizer_normalize(ctx, from, to, TOBUF_SIZE);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, normalized_kc_str);
+}
+
+//# TESTCASE
+// title: idn_normalizer_normalize() - context without procedure
+// group: generic quiet
+{
+ unsigned long to[TOBUF_SIZE];
+
+ r = idn_normalizer_normalize(ctx, from, to, TOBUF_SIZE);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, from);
+}
+
+//# TESTCASE
+// title: idn_normalizer_destroy(), idn_normalizer_incrref()
+// group:
+{
+ idn_result_t r;
+ idn_normalizer_t ctx = NULL;
+
+ r = idn_normalizer_initialize();
+ ASSERT_RESULT(r, idn_success);
+ r = idn_normalizer_create(&ctx);
+ ASSERT_RESULT(r, idn_success);
+ idn_normalizer_incrref(ctx);
+ idn_normalizer_destroy(ctx);
+ idn_normalizer_destroy(ctx);
+}
+
+//# TESTCASE
+// title: idn_normalizer_register()
+// group: generic quiet
+{
+ unsigned long to[TOBUF_SIZE];
+
+ r = idn_normalizer_register("test", test_proc);
+ ASSERT_RESULT(r, idn_success);
+ r = idn_normalizer_add(ctx, "test");
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_normalizer_normalize(ctx, from, to, TOBUF_SIZE);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, from);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/res.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/res.tsy
new file mode 100644
index 0000000..39c3895
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/res.tsy
@@ -0,0 +1,1026 @@
+#ifndef lint
+static char *rcsid = "$Id: res.tsy,v 1.1.1.1 2003/06/04 00:26:59 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <idn/res.h>
+#include <idn/log.h>
+
+#include "codeset.h"
+#include "setenv.h"
+
+#ifndef EUCJP_ENCODING_NAME
+#define EUCJP_ENCODING_NAME "eucJP"
+#endif
+
+/*
+ * U+304B: hiragana letter KA
+ * U+3099: combining katakana-hiragana voiced sound mark
+ *
+ * map("U+304B U+3099") -> "U+304C"
+ *
+ * U+304C: hiragana letter GA
+ */
+#define UTF8_NAME "A<U+304B><U+3099>"
+#define UTF8_REVNAME "a<U+304C>"
+
+/*
+ * A4AC: hiragana letter GA (in EUC-JP)
+ */
+#define EUCJP_NAME "\xa4\xac"
+#define EUCJP_REVNAME "\xa4\xac"
+
+/*
+ * Conversion result of "U+304B U+3099 A"
+ */
+#define PUNYCODE_NAME "xn--a-i8t"
+
+/*
+ * Conversion result of "A U+304B U+3099" (in EUC-JP).
+ */
+#define AUX_EUCJP_NAME "xn--a-i\xa3\xb8t"
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: generic-conversion
+//--
+// Initialize the `resconf' context.
+// Set local encoding to `UTF-8'.
+{
+ char to[256];
+ idn_result_t r;
+ idn_resconf_t ctx;
+
+ setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
+ unsetenv("IDN_DISABLE");
+
+ r = idn_resconf_initialize();
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_resconf_create(&ctx);
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_resconf_setdefaults(ctx);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TEARDOWN
+// group: generic-conversion
+{
+ idn_resconf_destroy(ctx);
+}
+
+//# SETUP
+// group: quiet
+//--
+// Set log level to `fatal' to supress log messages.
+{
+ int saved_log_level;
+
+ saved_log_level = idn_log_getlevel();
+ idn_log_setlevel(idn_log_level_fatal);
+}
+
+//# TEARDOWN
+// group: quiet
+//--
+// Restore log level.
+{
+ idn_log_setlevel(saved_log_level);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: basic conversion by encodename()
+// group: generic-conversion
+{
+ r = idn_res_encodename(ctx, IDN_ENCODE_APP, UTF8_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, PUNYCODE_NAME);
+}
+
+//# TESTCASE
+// title: basic conversion by decodename()
+// group: generic-conversion
+{
+ r = idn_res_decodename(ctx, IDN_DECODE_APP, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_REVNAME);
+}
+
+//# TESTCASE
+// title: basic conversion by decodename2()
+// group: generic-conversion
+{
+ r = idn_res_decodename2(ctx, IDN_DECODE_APP, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+#ifdef WITHOUT_ICONV
+ ASSERT_RESULT(r, idn_failure);
+#else
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_REVNAME);
+#endif
+}
+
+//# TESTCASE
+// title: call decodename2() with auxencoding=NULL
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_res_decodename2(ctx, IDN_DECODE_APP, PUNYCODE_NAME, to, sizeof(to),
+ NULL);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_REVNAME);
+#endif
+}
+
+//# TESTCASE
+// title: call encodename() with actions=0
+// group: generic-conversion
+{
+ r = idn_res_encodename(ctx, 0, UTF8_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_NAME);
+}
+
+//# TESTCASE
+// title: call decodename() with actions=0
+// group: generic-conversion
+{
+ r = idn_res_decodename(ctx, 0, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, PUNYCODE_NAME);
+}
+
+//# TESTCASE
+// title: call decodename2() with actions=0
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_res_decodename2(ctx, 0, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, AUX_EUCJP_NAME);
+#endif
+}
+
+//# TESTCASE
+// title: call encodename() with actions=rtcheck
+// group: generic-conversion quiet
+{
+ r = idn_res_encodename(ctx, IDN_RTCHECK, EUCJP_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call encodename() with actions=decode-query
+// group: generic-conversion quiet
+{
+ r = idn_res_encodename(ctx, IDN_DECODE_QUERY, EUCJP_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call encodename() with actions=decode-app
+// group: generic-conversion quiet
+{
+ r = idn_res_encodename(ctx, IDN_DECODE_APP, EUCJP_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call encodename() with actions=decode-stored
+// group: generic-conversion quiet
+{
+ r = idn_res_encodename(ctx, IDN_DECODE_STORED, EUCJP_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call encodename() with actions=(1<<31)
+// group: generic-conversion quiet
+{
+ r = idn_res_encodename(ctx, 1 << 31, EUCJP_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call decodename() with actions=localmap
+// group: generic-conversion quiet
+{
+ r = idn_res_decodename(ctx, IDN_LOCALMAP, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call decodename2() with actions=localmap
+// group: generic-conversion quiet
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_res_decodename2(ctx, IDN_LOCALMAP, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_invalid_action);
+#endif
+}
+
+//# TESTCASE
+// title: call decodename() with actions=lencheck
+// group: generic-conversion quiet
+{
+ r = idn_res_decodename(ctx, IDN_LENCHECK, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call decodename2() with actions=lencheck
+// group: generic-conversion quiet
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_res_decodename2(ctx, IDN_LENCHECK, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_invalid_action);
+#endif
+}
+
+//# TESTCASE
+// title: call decodename() with actions=encode-query
+// group: generic-conversion quiet
+{
+ r = idn_res_decodename(ctx, IDN_ENCODE_QUERY, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call decodename2() with actions=encode-query
+// group: generic-conversion quiet
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_res_decodename2(ctx, IDN_ENCODE_QUERY, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_invalid_action);
+#endif
+}
+
+//# TESTCASE
+// title: call decodename() with actions=encode-app
+// group: generic-conversion quiet
+{
+ r = idn_res_decodename(ctx, IDN_ENCODE_APP, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call decodename2() with actions=encode-app
+// group: generic-conversion quiet
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_res_decodename2(ctx, IDN_ENCODE_APP, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_invalid_action);
+#endif
+}
+
+//# TESTCASE
+// title: call decodename() with actions=encode-stored
+// group: generic-conversion quiet
+{
+ r = idn_res_decodename(ctx, IDN_ENCODE_STORED, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call decodename2() with actions=encode-stored
+// group: generic-conversion quiet
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_res_decodename2(ctx, IDN_ENCODE_STORED, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_invalid_action);
+#endif
+}
+
+//# TESTCASE
+// title: call decodename() with actions=(1<<31)
+// group: generic-conversion quiet
+{
+ r = idn_res_decodename(ctx, 1 << 31, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+}
+
+//# TESTCASE
+// title: call decodename2() with actions=(1<<31)
+// group: generic-conversion quiet
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_res_decodename2(ctx, 1 << 31, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_invalid_action);
+#endif
+}
+
+//# TESTCASE
+// title: call encodename() with actions=localconv
+// group: generic-conversion quiet
+{
+#ifndef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_res_encodename(ctx, IDN_LOCALCONV, UTF8_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+#endif
+}
+
+//# TESTCASE
+// title: call decodename() with actions=localconv
+// group: generic-conversion quiet
+{
+#ifndef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_res_decodename(ctx, IDN_LOCALCONV, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_action);
+#endif
+}
+
+//# TESTCASE
+// title: call decodename2() with actions=localconv
+// group: generic-conversion
+{
+#ifndef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_res_decodename2(ctx, IDN_LOCALCONV, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_failure);
+#endif
+}
+
+//# TESTCASE
+// title: call enable(0) and then encodename()
+// group: generic-conversion
+{
+ idn_res_enable(0);
+ r = idn_res_encodename(ctx, IDN_ENCODE_APP, UTF8_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_NAME);
+}
+
+//# TESTCASE
+// title: call decodename() when IDN_DISABLE is defined
+// group: generic-conversion
+{
+ idn_res_enable(0);
+ r = idn_res_decodename(ctx, IDN_DECODE_APP, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, PUNYCODE_NAME);
+}
+
+//# TESTCASE
+// title: call decodename() when IDN_DISABLE is defined
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ idn_res_enable(0);
+ r = idn_res_decodename2(ctx, IDN_DECODE_APP, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, AUX_EUCJP_NAME);
+#endif
+}
+
+//# TESTCASE
+// title: call enable(0) and then encodename()
+// group: generic-conversion
+{
+ idn_res_enable(0);
+ r = idn_res_encodename(ctx, IDN_ENCODE_APP, UTF8_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_NAME);
+}
+
+//# TESTCASE
+// title: call enable(0) and then decodename()
+// group: generic-conversion
+{
+ idn_res_enable(0);
+ r = idn_res_decodename(ctx, IDN_DECODE_APP, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, PUNYCODE_NAME);
+}
+
+//# TESTCASE
+// title: call enable(0) and then decodename2()
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ idn_res_enable(0);
+ r = idn_res_decodename2(ctx, IDN_DECODE_APP, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, AUX_EUCJP_NAME);
+#endif
+}
+
+//# TESTCASE
+// title: set IDN_DISABLE and call encodename()
+// group: generic-conversion
+{
+ setenv("IDN_DISABLE", "1", 1);
+ r = idn_res_encodename(ctx, IDN_ENCODE_APP, UTF8_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_NAME);
+}
+
+//# TESTCASE
+// title: set IDN_DISABLE and call decodename()
+// group: generic-conversion
+{
+ setenv("IDN_DISABLE", "1", 1);
+ r = idn_res_decodename(ctx, IDN_DECODE_APP, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, PUNYCODE_NAME);
+}
+
+//# TESTCASE
+// title: set IDN_DISABLE and call decodename2()
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ setenv("IDN_DISABLE", "1", 1);
+ r = idn_res_decodename2(ctx, IDN_DECODE_APP, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, AUX_EUCJP_NAME);
+#endif
+}
+
+//# TESTCASE
+// title: set IDN_DISABLE, and then call enable(1) and encodename()
+// group: generic-conversion
+{
+ setenv("IDN_DISABLE", "1", 1);
+ idn_res_enable(1);
+ r = idn_res_encodename(ctx, IDN_ENCODE_APP, UTF8_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, PUNYCODE_NAME);
+}
+
+//# TESTCASE
+// title: set IDN_DISABLE, and then call enable(1) and decodename()
+// group: generic-conversion
+{
+ setenv("IDN_DISABLE", "1", 1);
+ idn_res_enable(1);
+ r = idn_res_decodename(ctx, IDN_DECODE_APP, PUNYCODE_NAME, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_REVNAME);
+}
+
+//# TESTCASE
+// title: set IDN_DISABLE, and then call enable(1) and decodename2()
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ setenv("IDN_DISABLE", "1", 1);
+ idn_res_enable(1);
+ r = idn_res_decodename2(ctx, IDN_DECODE_APP, AUX_EUCJP_NAME, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_REVNAME);
+#endif
+}
+
+//# TESTCASE
+// title: overrun test for arg `to' of encodename()
+// group: generic-conversion
+{
+ /* Normal case */
+ r = idn_res_encodename(ctx, IDN_ENCODE_APP, UTF8_NAME, to,
+ strlen(PUNYCODE_NAME) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, PUNYCODE_NAME);
+
+ r = idn_res_encodename(ctx, IDN_ENCODE_APP, UTF8_NAME, to,
+ strlen(PUNYCODE_NAME));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ /* enable(0) case */
+ idn_res_enable(0);
+ r = idn_res_encodename(ctx, IDN_ENCODE_APP, UTF8_NAME, to,
+ strlen(UTF8_NAME) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_NAME);
+
+ r = idn_res_encodename(ctx, IDN_ENCODE_APP, UTF8_NAME, to,
+ strlen(UTF8_NAME));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ /* actions=0 case */
+ idn_res_enable(1);
+ r = idn_res_encodename(ctx, 0, UTF8_NAME, to, strlen(UTF8_NAME) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_NAME);
+
+ r = idn_res_encodename(ctx, 0, UTF8_NAME, to, strlen(UTF8_NAME));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+}
+
+//# TESTCASE
+// title: overrun test for arg `to' of decodename()
+// group: generic-conversion
+{
+ /* Normal case */
+ r = idn_res_decodename(ctx, IDN_DECODE_APP, PUNYCODE_NAME, to,
+ strlen(UTF8_REVNAME) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_REVNAME);
+
+ r = idn_res_decodename(ctx, IDN_DECODE_APP, PUNYCODE_NAME, to,
+ strlen(UTF8_REVNAME));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ /* idn_res_enable(0) case */
+ idn_res_enable(0);
+ r = idn_res_decodename(ctx, IDN_DECODE_APP, PUNYCODE_NAME, to,
+ strlen(PUNYCODE_NAME) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, PUNYCODE_NAME);
+
+ r = idn_res_decodename(ctx, IDN_DECODE_APP, PUNYCODE_NAME, to,
+ strlen(PUNYCODE_NAME));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ /* actions=0 case */
+ idn_res_enable(1);
+ r = idn_res_decodename(ctx, 0, PUNYCODE_NAME, to,
+ strlen(PUNYCODE_NAME) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, PUNYCODE_NAME);
+
+ r = idn_res_decodename(ctx, 0, PUNYCODE_NAME, to,
+ strlen(PUNYCODE_NAME));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+}
+
+//# TESTCASE
+// title: overrun test for arg `to' of decodename2()
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ /* Normal case */
+ r = idn_res_decodename2(ctx, IDN_DECODE_APP, AUX_EUCJP_NAME, to,
+ strlen(UTF8_REVNAME) + 1, EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, UTF8_REVNAME);
+
+ r = idn_res_decodename2(ctx, IDN_DECODE_APP, AUX_EUCJP_NAME, to,
+ strlen(UTF8_REVNAME), EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ /* idn_res_enable(0) case */
+ idn_res_enable(0);
+ r = idn_res_decodename2(ctx, IDN_DECODE_APP, AUX_EUCJP_NAME, to,
+ strlen(AUX_EUCJP_NAME) + 1, EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, AUX_EUCJP_NAME);
+
+ r = idn_res_decodename2(ctx, IDN_DECODE_APP, AUX_EUCJP_NAME, to,
+ strlen(AUX_EUCJP_NAME), EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ /* actions=0 case */
+ idn_res_enable(1);
+ r = idn_res_decodename2(ctx, 0, AUX_EUCJP_NAME, to,
+ strlen(AUX_EUCJP_NAME) + 1, EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, AUX_EUCJP_NAME);
+
+ r = idn_res_decodename2(ctx, 0, AUX_EUCJP_NAME, to,
+ strlen(AUX_EUCJP_NAME), EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+#endif
+}
+
+//# TESTCASE
+// title: call encodename() with tolen=0
+// group: generic-conversion
+{
+ r = idn_res_encodename(ctx, IDN_ENCODE_APP, UTF8_NAME, to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+}
+
+//# TESTCASE
+// title: call decodename() with tolen=0
+// group: generic-conversion
+{
+ r = idn_res_decodename(ctx, IDN_DECODE_APP, PUNYCODE_NAME, to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+}
+
+//# TESTCASE
+// title: call decodename2() with tolen=0
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_res_decodename2(ctx, IDN_DECODE_APP, AUX_EUCJP_NAME, to, 0,
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+#endif
+}
+
+//# TESTCASE
+// title: convert an empty string using encodename()
+// group: generic-conversion
+{
+ r = idn_res_encodename(ctx, IDN_ENCODE_APP, "", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "");
+}
+
+//# TESTCASE
+// title: convert an empty string using decodename()
+// group: generic-conversion
+{
+ r = idn_res_decodename(ctx, IDN_DECODE_APP, "", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "");
+}
+
+//# TESTCASE
+// title: convert an empty string using decodename2()
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ r = idn_res_decodename2(ctx, IDN_DECODE_APP, "", to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "");
+#endif
+}
+
+//# TESTCASE
+// title: prohcheck by encodename()
+// group: generic-conversion
+{
+ /* U+1680: prohibited character */
+ r = idn_res_encodename(ctx, IDN_PROHCHECK, "<U+1680>", to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+}
+
+//# TESTCASE
+// title: unascheck by encodename()
+// group: generic-conversion
+{
+ /* U+0221: unassigned codepoint */
+ r = idn_res_encodename(ctx, IDN_UNASCHECK, "<U+0221>", to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+}
+
+//# TESTCASE
+// title: bidicheck by encodename()
+// group: generic-conversion
+{
+ /* U+05D0: bidirectional property is "R" */
+ /* `a': bidirectional property is "L" */
+ /* `0', `-': bidirectional property is "N" */
+ r = idn_res_encodename(ctx, IDN_BIDICHECK, "<U+05D0>", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_res_encodename(ctx, IDN_BIDICHECK, "<U+05D0><U+05D0>",
+ to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_res_encodename(ctx, IDN_BIDICHECK, "<U+05D0><U+05D0>-a",
+ to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+
+ r = idn_res_encodename(ctx, IDN_BIDICHECK, "<U+05D0>-a-<U+05D0>",
+ to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+
+ r = idn_res_encodename(ctx, IDN_BIDICHECK, "a-<U+05D0><U+05D0>",
+ to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+
+ r = idn_res_encodename(ctx, IDN_BIDICHECK, "<U+05D0><U+05D0>-0",
+ to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+
+ r = idn_res_encodename(ctx, IDN_BIDICHECK, "<U+05D0>-0-<U+05D0>",
+ to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_res_encodename(ctx, IDN_BIDICHECK, "0-<U+05D0><U+05D0>",
+ to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+}
+
+//# TESTCASE
+// title: asccheck by encodename()
+// group: generic-conversion
+{
+ r = idn_res_encodename(ctx, IDN_ASCCHECK, "-name", to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+
+ r = idn_res_encodename(ctx, IDN_ASCCHECK, "name-", to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+
+ r = idn_res_encodename(ctx, IDN_ASCCHECK, "n ame", to, sizeof(to));
+ ASSERT_RESULT(r, idn_prohibited);
+}
+
+//# TESTCASE
+// title: lencheck by encodename()
+// group: generic-conversion
+{
+ r = idn_res_encodename(ctx, IDN_LENCHECK,
+ "123456789-123456789-123456789-123456789-"
+ "123456789-123456789-123", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_res_encodename(ctx, IDN_LENCHECK,
+ "123456789-123456789-123456789-123456789-"
+ "123456789-123456789-1234", to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_length);
+
+ r = idn_res_encodename(ctx, IDN_LENCHECK, "a..b", to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_length);
+}
+
+//# TESTCASE
+// title: rtcheck non-prohchecked label by decodename()
+// group: generic-conversion
+{
+ /* "xn--6ue" -> "U+1680" (prohibited character) */
+ r = idn_res_decodename(ctx, IDN_RTCHECK, "xn--6ue", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn--6ue");
+}
+
+//# TESTCASE
+// title: rtcheck non-unaschecked label by decodename()
+// group: generic-conversion
+{
+ /* "xn--6la" -> "U+0221" (unassigned codepoint) */
+ r = idn_res_decodename(ctx, IDN_IDNCONV | IDN_RTCHECK | IDN_UNASCHECK,
+ "xn--6la", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn--6la");
+}
+
+//# TESTCASE
+// title: rtcheck non-ascchecked label by decodename()
+// group: generic-conversion
+{
+ /* "xn----x7t" -> "- U+3042" */
+ r = idn_res_decodename(ctx, IDN_IDNCONV | IDN_RTCHECK | IDN_ASCCHECK,
+ "xn----x7t", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn----x7t");
+
+ /* "xn----w7t" -> "U+3042 -" */
+ r = idn_res_decodename(ctx, IDN_IDNCONV | IDN_RTCHECK | IDN_ASCCHECK,
+ "xn----w7t", to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn----w7t");
+}
+
+//# TESTCASE
+// title: rtcheck non-lenchecked label by decodename()
+// group: generic-conversion
+{
+ /* `s1' has 63 characters */
+ const char *s1 =
+ "xn--l8jaa5522a8sj38bzugvvblo3y90fjzgvxlmxscifws3d43odzaq6aj340b";
+
+ const char *s1rev =
+ "<U+9752><U+68EE><U+5CA9><U+624B><U+5BAE><U+57CE><U+79CB><U+7530>"
+ "<U+5C71><U+5F62><U+798F><U+5CF6><U+6771><U+4EAC><U+795E><U+5948>"
+ "<U+5DDD><U+3042><U+3042><U+3042>";
+
+ /* `s2' has 64 characters */
+ const char *s2 =
+ "xn--a-w7ta6522a8sj38bzugvvblo3y90fjzgvxlmxscifws3d43odzaq6aj340b";
+
+ /* `s3' has an empty label */
+ const char *s3 = "a..b";
+
+ r = idn_res_decodename(ctx, IDN_IDNCONV | IDN_RTCHECK, s1, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, s1rev);
+
+ r = idn_res_decodename(ctx, IDN_IDNCONV | IDN_RTCHECK, s2, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, s2);
+
+ r = idn_res_decodename(ctx, IDN_IDNCONV | IDN_RTCHECK, s3, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, s3);
+}
+
+//# TESTCASE
+// title: rtcheck non-prohchecked label by decodename2()
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ /* "xn--6ue" -> "U+1680" (prohibited character) */
+ r = idn_res_decodename2(ctx, IDN_RTCHECK, "xn--6ue", to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn--6ue");
+#endif
+}
+
+//# TESTCASE
+// title: rtcheck non-unaschecked label by decodename2()
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ /* "xn--6la" -> "U+0221" (unassigned codepoint) */
+ r = idn_res_decodename2(ctx, IDN_IDNCONV | IDN_RTCHECK | IDN_UNASCHECK,
+ "xn--6la", to, sizeof(to), EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn--6la");
+#endif
+}
+
+//# TESTCASE
+// title: rtcheck non-ascchecked label by decodename2()
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ /* "xn----x7t" -> "- U+3042" */
+ r = idn_res_decodename2(ctx, IDN_IDNCONV | IDN_RTCHECK | IDN_ASCCHECK,
+ "xn----x7t", to, sizeof(to), EUCJP_ENCODING_NAME);
+
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn----x7t");
+
+ /* "xn----w7t" -> "U+3042 -" */
+ r = idn_res_decodename2(ctx, IDN_IDNCONV | IDN_RTCHECK | IDN_ASCCHECK,
+ "xn----w7t", to, sizeof(to), EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "xn----w7t");
+#endif
+}
+
+//# TESTCASE
+// title: rtcheck non-lenchecked label by decodename2()
+// group: generic-conversion
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ /* `s1' has 63 characters */
+ const char *s1 =
+ "xn--l8jaa5522a8sj38bzugvvblo3y90fjzgvxlmxscifws3d43odzaq6aj340b";
+
+ const char *s1rev =
+ "<U+9752><U+68EE><U+5CA9><U+624B><U+5BAE><U+57CE><U+79CB><U+7530>"
+ "<U+5C71><U+5F62><U+798F><U+5CF6><U+6771><U+4EAC><U+795E><U+5948>"
+ "<U+5DDD><U+3042><U+3042><U+3042>";
+
+ /* `s2' has 64 characters */
+ const char *s2 =
+ "xn--a-w7ta6522a8sj38bzugvvblo3y90fjzgvxlmxscifws3d43odzaq6aj340b";
+
+ /* `s3' has an empty label */
+ const char *s3 = "a..b";
+
+ r = idn_res_decodename2(ctx, IDN_IDNCONV | IDN_RTCHECK, s1, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, s1rev);
+
+ r = idn_res_decodename2(ctx, IDN_IDNCONV | IDN_RTCHECK, s2, to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, s2);
+
+ r = idn_res_decodename(ctx, IDN_IDNCONV | IDN_RTCHECK, s3, to, sizeof(to));
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, s3);
+#endif
+}
+
+//# TESTCASE
+// title: pass broken string as `from' to encodename()
+// group: generic-conversion quiet
+{
+ /* "\xe3\x21" is not valid UTF-8 string */
+ r = idn_res_encodename(ctx, IDN_ENCODE_APP, "\xe3\x21", to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_encoding);
+}
+
+//# TESTCASE
+// title: pass broken string as `from' to decodename()
+// group: generic-conversion quiet
+{
+ /* "\xe3\x21" is not valid UTF-8 string */
+ r = idn_res_decodename(ctx, IDN_DECODE_APP, "\xe3\x21", to, sizeof(to));
+ ASSERT_RESULT(r, idn_invalid_encoding);
+}
+
+//# TESTCASE
+// title: pass broken string as `from' to decodename2()
+// group: generic-conversion quiet
+{
+#ifdef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ /* "\xa4\x21" is not valid EUC-JP string */
+ r = idn_res_decodename2(ctx, IDN_DECODE_APP, "\xa4\x21", to, sizeof(to),
+ EUCJP_ENCODING_NAME);
+ ASSERT_RESULT(r, idn_invalid_encoding);
+#endif
+}
+
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/resconf.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/resconf.tsy
new file mode 100644
index 0000000..a4c2f35
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/resconf.tsy
@@ -0,0 +1,1026 @@
+#ifndef lint
+static char *rcsid = "$Id: resconf.tsy,v 1.1.1.1 2003/06/04 00:27:00 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <idn/resconf.h>
+#include <idn/converter.h>
+#include <idn/log.h>
+
+#include "setenv.h"
+#include "testutil.h"
+
+#define CONF_FILENAME "test.conf"
+#define MAP_FILENAME "test.map"
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: generic-init
+{
+ idn_result_t r;
+ idn_resconf_t ctx = NULL;
+
+ setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
+
+ r = idn_resconf_initialize();
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_resconf_create(&ctx);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TEARDOWN
+// group: generic-init
+{
+ if (ctx != NULL)
+ idn_resconf_destroy(ctx);
+ remove(CONF_FILENAME);
+ remove(MAP_FILENAME);
+}
+
+//# SETUP
+// group: set-defaults
+{
+ r = idn_resconf_setdefaults(ctx);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TEARDOWN
+// group: set-defaults
+{
+}
+
+//# SETUP
+// group: quiet
+{
+ int saved_log_level;
+
+ saved_log_level = idn_log_getlevel();
+ idn_log_setlevel(idn_log_level_fatal);
+}
+
+//# TEARDOWN
+// group: quiet
+{
+ idn_log_setlevel(saved_log_level);
+}
+
+//# SETUP
+// group: delimitermap_ctx
+{
+ idn_delimitermap_t delimitermap_ctx1 = NULL;
+ idn_delimitermap_t delimitermap_ctx2 = NULL;
+}
+
+//# TEARDOWN
+// group: delimitermap_ctx
+{
+ if (delimitermap_ctx1 != NULL)
+ idn_delimitermap_destroy(delimitermap_ctx1);
+ if (delimitermap_ctx2 != NULL)
+ idn_delimitermap_destroy(delimitermap_ctx2);
+}
+
+//# SETUP
+// group: idnconverter_ctx
+{
+ idn_converter_t idnconverter_ctx1 = NULL;
+ idn_converter_t idnconverter_ctx2 = NULL;
+}
+
+//# TEARDOWN
+// group: idnconverter_ctx
+{
+ if (idnconverter_ctx1 != NULL)
+ idn_converter_destroy(idnconverter_ctx1);
+ if (idnconverter_ctx2 != NULL)
+ idn_converter_destroy(idnconverter_ctx2);
+}
+
+//# SETUP
+// group: localconverter_ctx
+{
+ idn_converter_t localconverter_ctx1 = NULL;
+ idn_converter_t localconverter_ctx2 = NULL;
+}
+
+//# TEARDOWN
+// group: localconverter_ctx
+{
+ if (localconverter_ctx1 != NULL)
+ idn_converter_destroy(localconverter_ctx1);
+ if (localconverter_ctx2 != NULL)
+ idn_converter_destroy(localconverter_ctx2);
+}
+
+//# SETUP
+// group: auxidnconverter_ctx
+{
+ idn_converter_t auxidnconverter_ctx1 = NULL;
+ idn_converter_t auxidnconverter_ctx2 = NULL;
+}
+
+//# TEARDOWN
+// group: auxidnconverter_ctx
+{
+ if (auxidnconverter_ctx1 != NULL)
+ idn_converter_destroy(auxidnconverter_ctx1);
+ if (auxidnconverter_ctx2 != NULL)
+ idn_converter_destroy(auxidnconverter_ctx2);
+}
+
+//# SETUP
+// group: mapselector_ctx
+{
+ idn_mapselector_t mapselector_ctx1 = NULL;
+ idn_mapselector_t mapselector_ctx2 = NULL;
+}
+
+//# TEARDOWN
+// group: mapselector_ctx
+{
+ if (mapselector_ctx1 != NULL)
+ idn_mapselector_destroy(mapselector_ctx1);
+ if (mapselector_ctx2 != NULL)
+ idn_mapselector_destroy(mapselector_ctx2);
+}
+
+//# SETUP
+// group: mapper_ctx
+{
+ idn_mapper_t mapper_ctx1 = NULL;
+ idn_mapper_t mapper_ctx2 = NULL;
+}
+
+//# TEARDOWN
+// group: mapper_ctx
+{
+ if (mapper_ctx1 != NULL)
+ idn_mapper_destroy(mapper_ctx1);
+ if (mapper_ctx2 != NULL)
+ idn_mapper_destroy(mapper_ctx2);
+}
+
+//# SETUP
+// group: normalizer_ctx
+{
+ idn_normalizer_t normalizer_ctx1 = NULL;
+ idn_normalizer_t normalizer_ctx2 = NULL;
+}
+
+//# TEARDOWN
+// group: normalizer_ctx
+{
+ if (normalizer_ctx1 != NULL)
+ idn_normalizer_destroy(normalizer_ctx1);
+ if (normalizer_ctx2 != NULL)
+ idn_normalizer_destroy(normalizer_ctx2);
+}
+
+//# SETUP
+// group: prohibitchecker_ctx
+{
+ idn_checker_t prohibitchecker_ctx1 = NULL;
+ idn_checker_t prohibitchecker_ctx2 = NULL;
+}
+
+//# TEARDOWN
+// group: prohibitchecker_ctx
+{
+ if (prohibitchecker_ctx1 != NULL)
+ idn_checker_destroy(prohibitchecker_ctx1);
+ if (prohibitchecker_ctx2 != NULL)
+ idn_checker_destroy(prohibitchecker_ctx2);
+}
+
+//# SETUP
+// group: unassignedchecker_ctx
+{
+ idn_checker_t unassignedchecker_ctx1 = NULL;
+ idn_checker_t unassignedchecker_ctx2 = NULL;
+}
+
+//# TEARDOWN
+// group: unassignedchecker_ctx
+{
+ if (unassignedchecker_ctx1 != NULL)
+ idn_checker_destroy(unassignedchecker_ctx1);
+ if (unassignedchecker_ctx2 != NULL)
+ idn_checker_destroy(unassignedchecker_ctx2);
+}
+
+//# SETUP
+// group: bidichecker_ctx
+{
+ idn_checker_t bidichecker_ctx1 = NULL;
+ idn_checker_t bidichecker_ctx2 = NULL;
+}
+
+//# TEARDOWN
+// group: bidichecker_ctx
+{
+ if (bidichecker_ctx1 != NULL)
+ idn_checker_destroy(bidichecker_ctx1);
+ if (bidichecker_ctx2 != NULL)
+ idn_checker_destroy(bidichecker_ctx2);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: call create() without initialization.
+//--
+// This must be the first test case.
+{
+ idn_result_t r;
+ idn_resconf_t ctx = NULL;
+
+ r = idn_resconf_create(&ctx);
+ ASSERT_RESULT(r, idn_failure);
+
+ if (ctx != NULL)
+ idn_resconf_destroy(ctx);
+}
+
+//# TESTCASE
+// title: call initialize() twice.
+//
+{
+ idn_result_t r;
+
+ r = idn_resconf_initialize();
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_resconf_initialize();
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: call create()
+{
+ idn_result_t r;
+ idn_resconf_t ctx;
+
+ r = idn_resconf_initialize();
+ ASSERT_RESULT(r, idn_success);
+
+ r = idn_resconf_create(&ctx);
+ ASSERT_RESULT(r, idn_success);
+
+ if (ctx != NULL)
+ idn_resconf_destroy(ctx);
+}
+
+//# TESTCASE
+// title: load file (idn-encoding)
+// group: generic-init
+{
+ const char *idn_encoding;
+
+ create_conf_file(CONF_FILENAME, 0,
+ "idn-encoding Punycode",
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: load file (nameprep)
+// group: generic-init
+{
+ const char *idn_encoding;
+
+ create_conf_file(CONF_FILENAME, 0,
+ "nameprep " IDN_NAMEPREP_CURRENT,
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: load file (idn-encoding & nameprep)
+// group: generic-init
+{
+ const char *idn_encoding;
+
+ create_conf_file(CONF_FILENAME, 0,
+ "idn-encoding Punycode",
+ "nameprep " IDN_NAMEPREP_CURRENT,
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: load file (empty)
+// group: generic-init
+{
+ const char *idn_encoding;
+
+ create_conf_file(CONF_FILENAME, 0,
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: load file (local-map filemap)
+// group: generic-init
+{
+ const char *idn_encoding;
+
+ create_conf_file(CONF_FILENAME, 0,
+ "local-map .jp filemap:" MAP_FILENAME,
+ NULL);
+ create_conf_file(MAP_FILENAME, 0,
+ "2212; FF0D",
+ NULL);
+
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: load file (local-map nameprep)
+// group: generic-init
+{
+ const char *idn_encoding;
+
+ create_conf_file(CONF_FILENAME, 0,
+ "local-map .jp " IDN_NAMEPREP_CURRENT,
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: set defaults
+// group: generic-init set-defaults
+{
+}
+
+//# TESTCASE
+// title: load file (no file)
+// group: generic-init
+{
+ r = idn_resconf_loadfile(ctx, "no-such-file");
+ ASSERT_RESULT(r, idn_nofile);
+}
+
+//# TESTCASE
+// title: load file (empty file name)
+// group: generic-init
+{
+ r = idn_resconf_loadfile(ctx, "");
+ ASSERT_RESULT(r, idn_nofile);
+}
+
+//# TESTCASE
+// title: load file (unknown command)
+// group: generic-init quiet
+{
+ create_conf_file(CONF_FILENAME, 0,
+ "unknown-command " IDN_NAMEPREP_CURRENT,
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+}
+
+//# TESTCASE
+// title: load file (no newline at the end of file)
+// group: generic-init quiet
+{
+ create_conf_file(CONF_FILENAME, CONF_NO_EOF_NEWLINE,
+ "nameprep " IDN_NAMEPREP_CURRENT,
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: load file (too long line)
+// group: generic-init quiet
+{
+ char arg[1024];
+ char *line;
+
+ /* arg = "local-map . ////..." */
+ memset(arg, '/', sizeof(arg));
+ arg[sizeof(arg) - 1] = '\0';
+ line = "local-map . ";
+ memcpy(arg, line, strlen(line));
+
+ create_conf_file(CONF_FILENAME, 0, arg, NULL);
+
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+}
+
+//# TESTCASE
+// title: load file (empty file)
+// group: generic-init
+{
+ create_conf_file(CONF_FILENAME, 0, "", NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: load file (invalid parameter for idn-encoding)
+// group: generic-init quiet
+{
+#ifndef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ create_conf_file(CONF_FILENAME, 0,
+ "idn-encoding invalid-encoding-name",
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_invalid_name);
+#endif
+}
+
+//# TESTCASE
+// title: load file (define idn-encoding twice)
+// group: generic-init quiet
+{
+#ifndef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ create_conf_file(CONF_FILENAME, CONF_NO_EOF_NEWLINE,
+ "idn-encoding Punycode",
+ "idn-encoding Punycode",
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+#endif
+}
+
+//# TESTCASE
+// title: load file (invalid parameter for nameprep)
+// group: generic-init quiet
+{
+ create_conf_file(CONF_FILENAME, 0,
+ "nameprep invalid-version",
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_invalid_name);
+}
+
+//# TESTCASE
+// title: load file (define nameprep twice)
+// group: generic-init quiet
+{
+#ifndef WITHOUT_ICONV
+ SKIP_TESTCASE;
+#else
+ create_conf_file(CONF_FILENAME, CONF_NO_EOF_NEWLINE,
+ "nameprep " IDN_NAMEPREP_CURRENT,
+ "nameprep " IDN_NAMEPREP_CURRENT,
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+#endif
+}
+
+//# TESTCASE
+// title: load file (invalid parameter for local-map)
+// group: generic-init quiet
+{
+ create_conf_file(CONF_FILENAME, 0,
+ "local-map .jp :",
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_invalid_name);
+
+ create_conf_file(CONF_FILENAME, 0,
+ "local-map .jp invalid:/dev/null",
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_invalid_name);
+
+ create_conf_file(CONF_FILENAME, 0,
+ "local-map .jp filemap",
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_nofile);
+
+ create_conf_file(CONF_FILENAME, 0,
+ "local-map .jp filemap:",
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_nofile);
+
+ create_conf_file(CONF_FILENAME, 0,
+ "local-map .jp filemap:no-such-file",
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_nofile);
+
+ create_conf_file(CONF_FILENAME, 0,
+ "local-map "
+ "abcdefghijklmnopqrstuvwxyz0123"
+ "abcdefghijklmnopqrstuvwxyz0123"
+ "4567 "
+ IDN_NAMEPREP_CURRENT,
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_invalid_name);
+}
+
+//# TESTCASE
+// title: load file (pass wrong number of parameters to idn-encoding)
+// group: generic-init quiet
+{
+ create_conf_file(CONF_FILENAME, 0,
+ "idn-encoding ",
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+
+ create_conf_file(CONF_FILENAME, 0,
+ "idn-encoding Punycode ?",
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+}
+
+//# TESTCASE
+// title: load file (pass wrong number of parameters to nameprep)
+// group: generic-init quiet
+{
+ create_conf_file(CONF_FILENAME, 0,
+ "nameprep ",
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+
+ create_conf_file(CONF_FILENAME, 0,
+ "nameprep " IDN_NAMEPREP_CURRENT " ?",
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+}
+
+//# TESTCASE
+// title: load file (pass wrong number of parameters to local-map)
+// group: generic-init quiet
+{
+ create_conf_file(CONF_FILENAME, 0,
+ "local-map ",
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+
+ create_conf_file(CONF_FILENAME, 0,
+ "local-map .jp ",
+ NULL);
+ r = idn_resconf_loadfile(ctx, CONF_FILENAME);
+ ASSERT_RESULT(r, idn_invalid_syntax);
+}
+
+//# TESTCASE
+// title: getdelimitermap
+// group: generic-init set-defaults delimitermap_ctx
+{
+ delimitermap_ctx1 = idn_resconf_getdelimitermap(ctx);
+ ASSERT_PTR_NE(delimitermap_ctx1, NULL);
+}
+
+//# TESTCASE
+// title: setdelimitermap
+// group: generic-init set-defaults delimitermap_ctx
+{
+ r = idn_delimitermap_create(&delimitermap_ctx1);
+ ASSERT_RESULT(r, idn_success);
+
+ /* set delimitermap context. */
+ idn_resconf_setdelimitermap(ctx, delimitermap_ctx1);
+ delimitermap_ctx2 = idn_resconf_getdelimitermap(ctx);
+ ASSERT_PTR(delimitermap_ctx2, delimitermap_ctx1);
+ idn_delimitermap_destroy(delimitermap_ctx2);
+
+ /* set NULL as delimitermap context */
+ idn_resconf_setdelimitermap(ctx, NULL);
+ delimitermap_ctx2 = idn_resconf_getdelimitermap(ctx);
+ ASSERT_PTR(delimitermap_ctx2, NULL);
+}
+
+//# TESTCASE
+// title: addalldelimitermapucs
+// group: generic-init set-defaults
+{
+ static unsigned long v[] = {0x002C, 0x3001, 0xFF0C};
+ int nv = sizeof(v) / sizeof(*v);
+
+ r = idn_resconf_addalldelimitermapucs(ctx, v, nv);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: getidnconverter
+// group: generic-init set-defaults idnconverter_ctx
+{
+ idnconverter_ctx1 = idn_resconf_getidnconverter(ctx);
+ ASSERT_PTR_NE(idnconverter_ctx1, NULL);
+}
+
+//# TESTCASE
+// title: setidnconverter
+// group: generic-init set-defaults idnconverter_ctx
+{
+ r = idn_converter_create("Punycode", &idnconverter_ctx1, 0);
+ ASSERT_RESULT(r, idn_success);
+
+ /* set idnconverter context. */
+ idn_resconf_setidnconverter(ctx, idnconverter_ctx1);
+ idnconverter_ctx2 = idn_resconf_getidnconverter(ctx);
+ ASSERT_PTR(idnconverter_ctx2, idnconverter_ctx1);
+ idn_converter_destroy(idnconverter_ctx2);
+
+ /* set NULL as idnconverter context */
+ idn_resconf_setidnconverter(ctx, NULL);
+ idnconverter_ctx2 = idn_resconf_getidnconverter(ctx);
+ ASSERT_PTR(idnconverter_ctx2, NULL);
+}
+
+//# TESTCASE
+// title: getlocalconverter
+// group: generic-init set-defaults localconverter_ctx
+{
+ localconverter_ctx1 = idn_resconf_getlocalconverter(ctx);
+#ifdef WITHOUT_ICONV
+ ASSERT_PTR(localconverter_ctx1, NULL);
+#else
+ ASSERT_PTR_NE(localconverter_ctx1, NULL);
+#endif
+}
+
+//# TESTCASE
+// title: setlocalconverter
+// group: generic-init set-defaults localconverter_ctx
+{
+ r = idn_converter_create("UTF-8", &localconverter_ctx1, 0);
+ ASSERT_RESULT(r, idn_success);
+
+ /* set localconverter context. */
+ idn_resconf_setlocalconverter(ctx, localconverter_ctx1);
+ localconverter_ctx2 = idn_resconf_getlocalconverter(ctx);
+#ifdef WITHOUT_ICONV
+ ASSERT_PTR(localconverter_ctx2, NULL);
+#else
+ ASSERT_PTR(localconverter_ctx2, localconverter_ctx1);
+ idn_converter_destroy(localconverter_ctx2);
+#endif
+
+ /* set NULL as localconverter context */
+ idn_resconf_setlocalconverter(ctx, NULL);
+ localconverter_ctx2 = idn_resconf_getlocalconverter(ctx);
+#ifdef WITHOUT_ICONV
+ ASSERT_PTR(localconverter_ctx2, NULL);
+#else
+ ASSERT_PTR_NE(localconverter_ctx2, NULL);
+#endif
+}
+
+//# TESTCASE
+// title: getauxidnconverter
+// group: generic-init set-defaults auxidnconverter_ctx
+{
+ auxidnconverter_ctx1 = idn_resconf_getauxidnconverter(ctx);
+ ASSERT_PTR(auxidnconverter_ctx1, NULL);
+}
+
+//# TESTCASE
+// title: setauxidnconverter
+// group: generic-init set-defaults auxidnconverter_ctx
+{
+ r = idn_converter_create("Punycode", &auxidnconverter_ctx1, 0);
+ ASSERT_RESULT(r, idn_success);
+
+ /* set auxidnconverter context. */
+ idn_resconf_setauxidnconverter(ctx, auxidnconverter_ctx1);
+ auxidnconverter_ctx2 = idn_resconf_getauxidnconverter(ctx);
+ ASSERT_PTR(auxidnconverter_ctx2, auxidnconverter_ctx1);
+ idn_converter_destroy(auxidnconverter_ctx2);
+
+ /* set NULL as auxidnconverter context */
+ idn_resconf_setauxidnconverter(ctx, NULL);
+ auxidnconverter_ctx2 = idn_resconf_getauxidnconverter(ctx);
+ ASSERT_PTR(auxidnconverter_ctx2, NULL);
+}
+
+//# TESTCASE
+// title: getlocalmapselector
+// group: generic-init set-defaults mapselector_ctx
+{
+ mapselector_ctx1 = idn_resconf_getlocalmapselector(ctx);
+ ASSERT_PTR(mapselector_ctx1, NULL);
+}
+
+//# TESTCASE
+// title: setlocalmapselector
+// group: generic-init set-defaults mapselector_ctx
+{
+ r = idn_mapselector_create(&mapselector_ctx1);
+ ASSERT_RESULT(r, idn_success);
+
+ /* set localmapselector context. */
+ idn_resconf_setlocalmapselector(ctx, mapselector_ctx1);
+ mapselector_ctx2 = idn_resconf_getlocalmapselector(ctx);
+ ASSERT_PTR(mapselector_ctx2, mapselector_ctx1);
+ idn_mapselector_destroy(mapselector_ctx2);
+
+ /* set NULL as localmapselector context */
+ idn_resconf_setlocalmapselector(ctx, NULL);
+ mapselector_ctx2 = idn_resconf_getlocalmapselector(ctx);
+ ASSERT_PTR(mapselector_ctx2, NULL);
+}
+
+//# TESTCASE
+// title: addalllocalmapselectornames
+// group: generic-init set-defaults
+{
+ static const char *names[] = {
+ "filemap:" MAP_FILENAME,
+ "filemap:" MAP_FILENAME,
+ "filemap:" MAP_FILENAME
+ };
+ int nnames = sizeof(names) / sizeof(*names);
+
+ create_conf_file(MAP_FILENAME, 0,
+ "2212; FF0D",
+ NULL);
+ r = idn_resconf_addalllocalmapselectornames(ctx, ".jp", names, nnames);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: getmapper
+// group: generic-init set-defaults mapper_ctx
+{
+ mapper_ctx1 = idn_resconf_getmapper(ctx);
+ ASSERT_PTR_NE(mapper_ctx1, NULL);
+}
+
+//# TESTCASE
+// title: setmapper
+// group: generic-init set-defaults mapper_ctx
+{
+ r = idn_mapper_create(&mapper_ctx1);
+ ASSERT_RESULT(r, idn_success);
+
+ /* set mapper context. */
+ idn_resconf_setmapper(ctx, mapper_ctx1);
+ mapper_ctx2 = idn_resconf_getmapper(ctx);
+ ASSERT_PTR(mapper_ctx2, mapper_ctx1);
+ idn_mapper_destroy(mapper_ctx2);
+
+ /* set NULL as mapper context */
+ idn_resconf_setmapper(ctx, NULL);
+ mapper_ctx2 = idn_resconf_getmapper(ctx);
+ ASSERT_PTR(mapper_ctx2, NULL);
+}
+
+//# TESTCASE
+// title: addallmappernames
+// group: generic-init set-defaults
+{
+ static const char *names[] = {
+ IDN_NAMEPREP_CURRENT,
+ IDN_NAMEPREP_CURRENT,
+ IDN_NAMEPREP_CURRENT
+ };
+ int nnames = sizeof(names) / sizeof(*names);
+
+ r = idn_resconf_addallmappernames(ctx, names, nnames);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: getnormalizer
+// group: generic-init set-defaults normalizer_ctx
+{
+ normalizer_ctx1 = idn_resconf_getnormalizer(ctx);
+ ASSERT_PTR_NE(normalizer_ctx1, NULL);
+}
+
+//# TESTCASE
+// title: setnormalizer
+// group: generic-init set-defaults normalizer_ctx
+{
+ r = idn_normalizer_create(&normalizer_ctx1);
+ ASSERT_RESULT(r, idn_success);
+
+ /* set normalizer context. */
+ idn_resconf_setnormalizer(ctx, normalizer_ctx1);
+ normalizer_ctx2 = idn_resconf_getnormalizer(ctx);
+ ASSERT_PTR(normalizer_ctx2, normalizer_ctx1);
+ idn_normalizer_destroy(normalizer_ctx2);
+
+ /* set NULL as normalizer context */
+ idn_resconf_setnormalizer(ctx, NULL);
+ normalizer_ctx2 = idn_resconf_getnormalizer(ctx);
+ ASSERT_PTR(normalizer_ctx2, NULL);
+}
+
+//# TESTCASE
+// title: addallnormalizernames
+// group: generic-init set-defaults
+{
+ static const char *names[] = {
+ IDN_NAMEPREP_CURRENT,
+ IDN_NAMEPREP_CURRENT,
+ IDN_NAMEPREP_CURRENT
+ };
+ int nnames = sizeof(names) / sizeof(*names);
+
+ r = idn_resconf_addallnormalizernames(ctx, names, nnames);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: getprohibitchecker
+// group: generic-init set-defaults prohibitchecker_ctx
+{
+ prohibitchecker_ctx1 = idn_resconf_getprohibitchecker(ctx);
+ ASSERT_PTR_NE(prohibitchecker_ctx1, NULL);
+}
+
+//# TESTCASE
+// title: setprohibitchecker
+// group: generic-init set-defaults prohibitchecker_ctx
+{
+ r = idn_checker_create(&prohibitchecker_ctx1);
+ ASSERT_RESULT(r, idn_success);
+
+ /* set checker context. */
+ idn_resconf_setprohibitchecker(ctx, prohibitchecker_ctx1);
+ prohibitchecker_ctx2 = idn_resconf_getprohibitchecker(ctx);
+ ASSERT_PTR(prohibitchecker_ctx2, prohibitchecker_ctx1);
+ idn_checker_destroy(prohibitchecker_ctx2);
+
+ /* set NULL as checker context */
+ idn_resconf_setprohibitchecker(ctx, NULL);
+ prohibitchecker_ctx2 = idn_resconf_getprohibitchecker(ctx);
+ ASSERT_PTR(prohibitchecker_ctx2, NULL);
+}
+
+//# TESTCASE
+// title: addallprohibitcheckernames
+// group: generic-init set-defaults
+{
+ static const char *names[] = {
+ IDN_NAMEPREP_CURRENT,
+ IDN_NAMEPREP_CURRENT,
+ IDN_NAMEPREP_CURRENT
+ };
+ int nnames = sizeof(names) / sizeof(*names);
+
+ r = idn_resconf_addallprohibitcheckernames(ctx, names, nnames);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: getunassignedchecker
+// group: generic-init set-defaults unassignedchecker_ctx
+{
+ unassignedchecker_ctx1 = idn_resconf_getunassignedchecker(ctx);
+ ASSERT_PTR_NE(unassignedchecker_ctx1, NULL);
+}
+
+//# TESTCASE
+// title: setunassignedchecker
+// group: generic-init set-defaults unassignedchecker_ctx
+{
+ r = idn_checker_create(&unassignedchecker_ctx1);
+ ASSERT_RESULT(r, idn_success);
+
+ /* set checker context. */
+ idn_resconf_setunassignedchecker(ctx, unassignedchecker_ctx1);
+ unassignedchecker_ctx2 = idn_resconf_getunassignedchecker(ctx);
+ ASSERT_PTR(unassignedchecker_ctx2, unassignedchecker_ctx1);
+ idn_checker_destroy(unassignedchecker_ctx2);
+
+ /* set NULL as checker context */
+ idn_resconf_setunassignedchecker(ctx, NULL);
+ unassignedchecker_ctx2 = idn_resconf_getunassignedchecker(ctx);
+ ASSERT_PTR(unassignedchecker_ctx2, NULL);
+}
+
+//# TESTCASE
+// title: addallunassignedcheckernames
+// group: generic-init set-defaults
+{
+ static const char *names[] = {
+ IDN_NAMEPREP_CURRENT,
+ IDN_NAMEPREP_CURRENT,
+ IDN_NAMEPREP_CURRENT
+ };
+ int nnames = sizeof(names) / sizeof(*names);
+
+ r = idn_resconf_addallunassignedcheckernames(ctx, names, nnames);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: getbidichecker
+// group: generic-init set-defaults bidichecker_ctx
+{
+ bidichecker_ctx1 = idn_resconf_getbidichecker(ctx);
+ ASSERT_PTR_NE(bidichecker_ctx1, NULL);
+}
+
+//# TESTCASE
+// title: setbidichecker
+// group: generic-init set-defaults bidichecker_ctx
+{
+ r = idn_checker_create(&bidichecker_ctx1);
+ ASSERT_RESULT(r, idn_success);
+
+ /* set checker context. */
+ idn_resconf_setbidichecker(ctx, bidichecker_ctx1);
+ bidichecker_ctx2 = idn_resconf_getbidichecker(ctx);
+ ASSERT_PTR(bidichecker_ctx2, bidichecker_ctx1);
+ idn_checker_destroy(bidichecker_ctx2);
+
+ /* set NULL as checker context */
+ idn_resconf_setbidichecker(ctx, NULL);
+ bidichecker_ctx2 = idn_resconf_getbidichecker(ctx);
+ ASSERT_PTR(bidichecker_ctx2, NULL);
+}
+
+//# TESTCASE
+// title: addallbidicheckernames
+// group: generic-init set-defaults
+{
+ static const char *names[] = {
+ IDN_NAMEPREP_CURRENT,
+ IDN_NAMEPREP_CURRENT,
+ IDN_NAMEPREP_CURRENT
+ };
+ int nnames = sizeof(names) / sizeof(*names);
+
+ r = idn_resconf_addallbidicheckernames(ctx, names, nnames);
+ ASSERT_RESULT(r, idn_success);
+}
+
+//# TESTCASE
+// title: setnameprepversion
+// group: generic-init set-defaults
+{
+ idn_resconf_setnameprepversion(ctx, IDN_NAMEPREP_CURRENT);
+ ASSERT_RESULT(r, idn_success);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/setenv.c b/contrib/idn/idnkit-1.0-src/lib/tests/setenv.c
new file mode 100644
index 0000000..9c12bf1
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/setenv.c
@@ -0,0 +1,134 @@
+#ifndef lint
+static char *rcsid = "$Id: setenv.c,v 1.1.1.1 2003/06/04 00:27:01 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <string.h>
+
+/*
+ * We don't include <stdlib.h> here.
+ * Also <stdlib.h> may declare `environ' and its type might be different
+ * from ours.
+ */
+extern char **environ;
+
+typedef struct myenv myenv_t;
+
+struct myenv {
+ char *pointer;
+ myenv_t *next;
+ myenv_t *prev;
+};
+
+static myenv_t *myenvs = NULL;
+
+void
+myunsetenv(const char *name) {
+ char **e;
+ myenv_t *mye;
+ size_t namelen;
+ extern void free(void *);
+
+ namelen = strlen(name);
+ for (e = environ; *e != NULL; e++) {
+ if (strncmp(*e, name, namelen) == 0 && (*e)[namelen] == '=')
+ break;
+ }
+ if (*e == NULL)
+ return;
+
+ for (mye = myenvs; mye != NULL; mye = mye->next) {
+ if (mye->pointer == *e) {
+ if (mye->next != NULL)
+ mye->next->prev = mye->prev;
+ if (mye->prev != NULL)
+ mye->prev->next = mye->next;
+ if (mye->next == NULL && mye->prev == NULL)
+ myenvs = NULL;
+ free(mye);
+ free(*e);
+ break;
+ }
+ }
+
+ for ( ; *e != NULL; e++)
+ *e = *(e + 1);
+}
+
+#include <stdlib.h>
+
+int
+mysetenv(const char *name, const char *value, int overwrite) {
+ myenv_t *mye;
+ char *buffer;
+ int result;
+
+ if (getenv(name) != NULL && !overwrite)
+ return 0;
+
+ buffer = (char *) malloc(strlen(name) + strlen(value) + 2);
+ if (buffer == NULL)
+ return -1;
+ strcpy(buffer, name);
+ strcat(buffer, "=");
+ strcat(buffer, value);
+
+ myunsetenv(name);
+
+ mye = (myenv_t *) malloc(sizeof(myenv_t));
+ if (mye == NULL)
+ return -1;
+ mye->pointer = buffer;
+ mye->next = myenvs;
+ mye->prev = NULL;
+ if (myenvs != NULL)
+ myenvs->prev = mye;
+ myenvs = mye;
+
+ result = putenv(buffer);
+
+ return result;
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/setenv.h b/contrib/idn/idnkit-1.0-src/lib/tests/setenv.h
new file mode 100644
index 0000000..704c179
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/setenv.h
@@ -0,0 +1,61 @@
+/* $Id: setenv.h,v 1.1.1.1 2003/06/04 00:27:01 marka Exp $ */
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_SETENV_H
+#define IDN_SETENV_H
+
+#include "testconfig.h"
+
+#ifndef HAVE_SETENV
+#define unsetenv(a1) myunsetenv(a1)
+#endif
+
+#ifndef HAVE_SETENV
+#define setenv(a1, a2, a3) mysetenv(a1, a2, a3)
+#endif
+
+void myunsetenv(const char *name);
+int mysetenv(const char *name, const char *value, int overwrite);
+
+#endif /* IDN_SETENV_H */
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/testsuite.c b/contrib/idn/idnkit-1.0-src/lib/tests/testsuite.c
new file mode 100644
index 0000000..14b202f
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/testsuite.c
@@ -0,0 +1,578 @@
+#ifndef lint
+static char *rcsid = "$Id";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#include <idn/result.h>
+#include <idn/ucs4.h>
+#include <testsuite.h>
+
+typedef struct idn_testcase *idn_testcase_t;
+
+struct idn_testcase {
+ char *title;
+ idn_testsuite_testproc_t proc;
+};
+
+struct idn_testsuite {
+ idn_testcase_t testcases;
+ int ntestcases;
+ int testcase_size;
+
+ int npassed;
+ int nfailed;
+ int nskipped;
+ idn_testcase_t current_testcase;
+ idn_teststatus_t current_status;
+
+ idn_testsuite_msgproc_t msgproc;
+ int verbose;
+};
+
+#define INITIAL_TESTCASE_SIZE 16
+#define INITIAL_SETUP_SIZE 4
+#define INITIAL_TEARDOWN_SIZE 4
+
+static void run_internal(idn_testsuite_t ctx, char *titles[]);
+static char *make_hex_string(const char *string);
+static char *make_hex_ucs4string(const unsigned long *string);
+static void put_failure_message(idn_testsuite_t ctx, const char *msg,
+ const char *file, int lineno);
+static void idn_testsuite_msgtostderr(const char *msg);
+
+int
+idn_testsuite_create(idn_testsuite_t *ctxp) {
+ idn_testsuite_t ctx = NULL;
+
+ assert(ctxp != NULL);
+
+ ctx = (idn_testsuite_t) malloc(sizeof(struct idn_testsuite));
+ if (ctx == NULL)
+ goto error;
+
+ ctx->testcases = NULL;
+ ctx->ntestcases = 0;
+ ctx->testcase_size = 0;
+ ctx->npassed = 0;
+ ctx->nfailed = 0;
+ ctx->nskipped = 0;
+ ctx->current_testcase = NULL;
+ ctx->current_status = idn_teststatus_pass;
+ ctx->msgproc = NULL;
+ ctx->verbose = 0;
+
+ ctx->testcases = (idn_testcase_t) malloc(sizeof(struct idn_testcase)
+ * INITIAL_TESTCASE_SIZE);
+ if (ctx->testcases == NULL)
+ goto error;
+ ctx->testcase_size = INITIAL_TESTCASE_SIZE;
+
+ *ctxp = ctx;
+ return (1);
+
+error:
+ if (ctx != NULL)
+ free(ctx->testcases);
+ free(ctx);
+ return (0);
+}
+
+void
+idn_testsuite_destroy(idn_testsuite_t ctx) {
+ int i;
+
+ assert(ctx != NULL);
+
+ for (i = 0; i < ctx->ntestcases; i++)
+ free(ctx->testcases[i].title);
+
+ free(ctx->testcases);
+ free(ctx);
+}
+
+int
+idn_testsuite_addtestcase(idn_testsuite_t ctx, const char *title,
+ idn_testsuite_testproc_t proc) {
+ char *dup_title = NULL;
+ idn_testcase_t new_buffer = NULL;
+ idn_testcase_t new_testcase;
+ int new_size;
+
+ assert(ctx != NULL && title != NULL && proc != NULL);
+
+ dup_title = (char *)malloc(strlen(title) + 1);
+ if (dup_title == NULL)
+ goto error;
+ strcpy(dup_title, title);
+
+ if (ctx->ntestcases == ctx->testcase_size) {
+ new_size = ctx->testcase_size + INITIAL_TESTCASE_SIZE;
+ new_buffer = (idn_testcase_t)
+ realloc(ctx->testcases,
+ sizeof(struct idn_testcase) * new_size);
+ if (new_buffer == NULL)
+ goto error;
+ ctx->testcases = new_buffer;
+ ctx->testcase_size = new_size;
+ }
+
+ new_testcase = ctx->testcases + ctx->ntestcases;
+ new_testcase->title = dup_title;
+ new_testcase->proc = proc;
+ ctx->ntestcases++;
+ return (1);
+
+error:
+ free(dup_title);
+ free(new_buffer);
+ return (0);
+}
+
+int
+idn_testsuite_ntestcases(idn_testsuite_t ctx) {
+ assert(ctx != NULL);
+ return (ctx->ntestcases);
+}
+
+void
+idn_testsuite_setverbose(idn_testsuite_t ctx) {
+ assert(ctx != NULL);
+ ctx->verbose = 1;
+}
+
+void
+idn_testsuite_unsetverbose(idn_testsuite_t ctx) {
+ assert(ctx != NULL);
+ ctx->verbose = 0;
+}
+
+static void
+run_internal(idn_testsuite_t ctx, char *titles[]) {
+ int i, j;
+ int run_testcase;
+ const char *status;
+
+ assert(ctx != NULL);
+
+ ctx->npassed = 0;
+ ctx->nfailed = 0;
+ ctx->nskipped = 0;
+
+ for (i = 0; i < ctx->ntestcases; i++) {
+ ctx->current_testcase = ctx->testcases + i;
+ ctx->current_status = idn_teststatus_pass;
+
+ if (titles == NULL)
+ run_testcase = 1;
+ else {
+ run_testcase = 0;
+ for (j = 0; titles[j] != NULL; j++) {
+ if (strcmp(ctx->current_testcase->title,
+ titles[j]) == 0) {
+ run_testcase = 1;
+ break;
+ }
+ }
+ }
+
+ if (!run_testcase) {
+ ctx->nskipped++;
+ continue;
+ }
+ if (ctx->verbose) {
+ fprintf(stderr, "start testcase %d: %s\n", i + 1,
+ ctx->testcases[i].title);
+ }
+ (ctx->testcases[i].proc)(ctx);
+ status = idn_teststatus_tostring(ctx->current_status);
+ if (ctx->verbose) {
+ fprintf(stderr, "end testcase %d: %s\n", i + 1,
+ status);
+ }
+
+ switch (ctx->current_status) {
+ case idn_teststatus_pass:
+ ctx->npassed++;
+ break;
+ case idn_teststatus_fail:
+ ctx->nfailed++;
+ break;
+ case idn_teststatus_skip:
+ ctx->nskipped++;
+ break;
+ }
+ }
+}
+
+void
+idn_testsuite_runall(idn_testsuite_t ctx) {
+ assert(ctx != NULL);
+ run_internal(ctx, NULL);
+}
+
+void
+idn_testsuite_run(idn_testsuite_t ctx, char *titles[]) {
+ assert(ctx != NULL && titles != NULL);
+ run_internal(ctx, titles);
+}
+
+int
+idn_testsuite_npassed(idn_testsuite_t ctx) {
+ assert(ctx != NULL);
+ return (ctx->npassed);
+}
+
+int
+idn_testsuite_nfailed(idn_testsuite_t ctx) {
+ assert(ctx != NULL);
+ return (ctx->nfailed);
+}
+
+int
+idn_testsuite_nskipped(idn_testsuite_t ctx) {
+ assert(ctx != NULL);
+ return (ctx->nskipped);
+}
+
+idn_teststatus_t
+idn_testsuite_getstatus(idn_testsuite_t ctx) {
+ assert(ctx != NULL);
+ return (ctx->current_status);
+}
+
+void
+idn_testsuite_setstatus(idn_testsuite_t ctx, idn_teststatus_t status) {
+ assert(ctx != NULL);
+ assert(status == idn_teststatus_pass ||
+ status == idn_teststatus_fail ||
+ status == idn_teststatus_skip);
+
+ ctx->current_status = status;
+}
+
+const char *
+idn_teststatus_tostring(idn_teststatus_t status) {
+ assert(status == idn_teststatus_pass ||
+ status == idn_teststatus_fail ||
+ status == idn_teststatus_skip);
+
+ switch (status) {
+ case idn_teststatus_pass:
+ return "pass";
+ break;
+ case idn_teststatus_fail:
+ return "failed";
+ break;
+ case idn_teststatus_skip:
+ return "skipped";
+ break;
+ }
+
+ return "unknown";
+}
+
+void
+idn_testsuite_assert(idn_testsuite_t ctx, const char *msg,
+ const char *file, int lineno) {
+ assert(ctx != NULL && msg != NULL && file != NULL);
+
+ if (idn_testsuite_getstatus(ctx) != idn_teststatus_pass)
+ return;
+ idn_testsuite_setstatus(ctx, idn_teststatus_fail);
+ put_failure_message(ctx, msg, file, lineno);
+}
+
+void
+idn_testsuite_assertint(idn_testsuite_t ctx, int gotten, int expected,
+ const char *file, int lineno) {
+ char msg[256]; /* large enough */
+
+ assert(ctx != NULL && file != NULL);
+
+ if (idn_testsuite_getstatus(ctx) != idn_teststatus_pass)
+ return;
+ if (expected == gotten)
+ return;
+ idn_testsuite_setstatus(ctx, idn_teststatus_fail);
+
+ sprintf(msg, "`%d' expected, but got `%d'", expected, gotten);
+ put_failure_message(ctx, msg, file, lineno);
+}
+
+void
+idn_testsuite_assertstring(idn_testsuite_t ctx,
+ const char *gotten, const char *expected,
+ const char *file, int lineno) {
+ char *expected_hex = NULL;
+ char *gotten_hex = NULL;
+ char *msg;
+
+ assert(ctx != NULL && gotten != NULL && expected != NULL &&
+ file != NULL);
+
+ if (idn_testsuite_getstatus(ctx) != idn_teststatus_pass)
+ return;
+ if (strcmp(expected, gotten) == 0)
+ return;
+ idn_testsuite_setstatus(ctx, idn_teststatus_fail);
+
+ msg = (char *)malloc(strlen(expected) * 4 + strlen(gotten) * 4 + 32);
+ expected_hex = make_hex_string(expected);
+ gotten_hex = make_hex_string(gotten);
+ if (msg == NULL || expected_hex == NULL || gotten_hex == NULL) {
+ msg = "";
+ } else {
+ sprintf(msg, "`%s' expected, but got `%s'",
+ expected_hex, gotten_hex);
+ }
+
+ put_failure_message(ctx, msg, file, lineno);
+
+ free(msg);
+ free(expected_hex);
+ free(gotten_hex);
+}
+
+void
+idn_testsuite_assertptr(idn_testsuite_t ctx, const void *gotten,
+ const void *expected, const char *file, int lineno) {
+ char *msg;
+
+ assert(ctx != NULL && file != NULL);
+
+ if (idn_testsuite_getstatus(ctx) != idn_teststatus_pass)
+ return;
+ if (expected == gotten)
+ return;
+ idn_testsuite_setstatus(ctx, idn_teststatus_fail);
+
+ if (expected == NULL)
+ msg = "NULL expected, but got non-NULL";
+ else if (gotten == NULL)
+ msg = "non-NULL expected, but got NULL";
+ else
+ msg = "expected pointer != gotten pointer";
+ put_failure_message(ctx, msg, file, lineno);
+}
+
+void
+idn_testsuite_assertptrne(idn_testsuite_t ctx,
+ const void *gotten, const void *unexpected,
+ const char *file, int lineno) {
+ char *msg;
+
+ assert(ctx != NULL && file != NULL);
+
+ if (idn_testsuite_getstatus(ctx) != idn_teststatus_pass)
+ return;
+ if (unexpected != gotten)
+ return;
+ idn_testsuite_setstatus(ctx, idn_teststatus_fail);
+
+ if (unexpected == NULL)
+ msg = "non-NULL unexpected, but got NULL";
+ else if (gotten == NULL)
+ msg = "non-NULL expected, but got NULL";
+ else
+ msg = "expected pointer == gotten pointer";
+ put_failure_message(ctx, msg, file, lineno);
+}
+
+void
+idn_testsuite_assertresult(idn_testsuite_t ctx,
+ idn_result_t gotten, idn_result_t expected,
+ const char *file, int lineno) {
+ char msg[256]; /* large enough */
+
+ assert(ctx != NULL && file != NULL);
+
+ if (idn_testsuite_getstatus(ctx) != idn_teststatus_pass)
+ return;
+ if (expected == gotten)
+ return;
+ idn_testsuite_setstatus(ctx, idn_teststatus_fail);
+
+ sprintf(msg, "`%s' expected, but got `%s'",
+ idn_result_tostring(expected), idn_result_tostring(gotten));
+ put_failure_message(ctx, msg, file, lineno);
+}
+
+void
+idn_testsuite_assertucs4string(idn_testsuite_t ctx,
+ const unsigned long *gotten,
+ const unsigned long *expected,
+ const char *file, int lineno) {
+ char *expected_hex = NULL;
+ char *gotten_hex = NULL;
+ char *msg;
+
+ assert(ctx != NULL && gotten != NULL && expected != NULL &&
+ file != NULL);
+
+ if (idn_testsuite_getstatus(ctx) != idn_teststatus_pass)
+ return;
+ if (idn_ucs4_strcmp(expected, gotten) == 0)
+ return;
+ idn_testsuite_setstatus(ctx, idn_teststatus_fail);
+
+ msg = (char *)malloc(idn_ucs4_strlen(expected) * 8 +
+ idn_ucs4_strlen(gotten) * 8 + 32);
+ expected_hex = make_hex_ucs4string(expected);
+ gotten_hex = make_hex_ucs4string(gotten);
+ if (msg == NULL || expected_hex == NULL || gotten_hex == NULL) {
+ msg = "";
+ } else {
+ sprintf(msg, "`%s' expected, but got `%s'",
+ expected_hex, gotten_hex);
+ }
+
+ put_failure_message(ctx, msg, file, lineno);
+
+ free(msg);
+ free(expected_hex);
+ free(gotten_hex);
+}
+
+static char *
+make_hex_string(const char *string) {
+ static const char hex[] = {"0123456789abcdef"};
+ char *hex_string;
+ const char *src;
+ char *dst;
+
+ hex_string = (char *)malloc((strlen(string)) * 4 + 1);
+ if (hex_string == NULL)
+ return NULL;
+
+ for (src = string, dst = hex_string; *src != '\0'; src++) {
+ if (0x20 <= *src && *src <= 0x7e && *src != '\\') {
+ *dst++ = *src;
+ } else {
+ *dst++ = '\\';
+ *dst++ = 'x';
+ *dst++ = hex[*(const unsigned char *)src >> 4];
+ *dst++ = hex[*src & 0x0f];
+ }
+ }
+ *dst = '\0';
+
+ return hex_string;
+}
+
+#define UCS4_MAX 0x10fffffUL
+
+static char *
+make_hex_ucs4string(const unsigned long *string) {
+ static const char hex[] = {"0123456789abcdef"};
+ char *hex_string;
+ const unsigned long *src;
+ char *dst;
+
+ hex_string = (char *)malloc((idn_ucs4_strlen(string)) * 8 + 1);
+ if (hex_string == NULL)
+ return NULL;
+
+ for (src = string, dst = hex_string; *src != '\0'; src++) {
+ if (0x20 <= *src && *src <= 0x7e && *src != '\\') {
+ *dst++ = *src;
+ } else if (*src <= UCS4_MAX) {
+ *dst++ = '\\';
+ *dst++ = 'u';
+ if (*src >= 0x100000) {
+ *dst++ = hex[(*src >> 20) & 0x0f];
+ }
+ if (*src >= 0x10000) {
+ *dst++ = hex[(*src >> 16) & 0x0f];
+ }
+ *dst++ = hex[(*src >> 12) & 0x0f];
+ *dst++ = hex[(*src >> 8) & 0x0f];
+ *dst++ = hex[(*src >> 4) & 0x0f];
+ *dst++ = hex[*src & 0x0f];
+ } else {
+ *dst++ = '\\';
+ *dst++ = 'u';
+ *dst++ = '?';
+ *dst++ = '?';
+ *dst++ = '?';
+ *dst++ = '?';
+ }
+ }
+ *dst = '\0';
+
+ return hex_string;
+}
+
+static void
+put_failure_message(idn_testsuite_t ctx, const char *msg, const char *file,
+ int lineno) {
+ idn_testsuite_msgproc_t proc;
+ char buffer[256];
+ const char *title;
+
+ proc = (ctx->msgproc == NULL) ?
+ idn_testsuite_msgtostderr : ctx->msgproc;
+ title = (ctx->current_testcase != NULL &&
+ ctx->current_testcase->title != NULL) ?
+ ctx->current_testcase->title : "anonymous";
+
+ sprintf(buffer, "%.100s: In test `%.100s':", file, title);
+ (*proc)(buffer);
+
+ sprintf(buffer, "%.100s:%d: failed (%.100s)", file, lineno, msg);
+ (*proc)(buffer);
+}
+
+
+static void
+idn_testsuite_msgtostderr(const char *msg) {
+ fputs(msg, stderr);
+ fputc('\n', stderr);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/testsuite.h b/contrib/idn/idnkit-1.0-src/lib/tests/testsuite.h
new file mode 100644
index 0000000..a5e4774
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/testsuite.h
@@ -0,0 +1,276 @@
+/* $Id: testsuite.h,v 1.1.1.1 2003/06/04 00:27:03 marka Exp $ */
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_TESTSUITE_H
+#define IDN_TESTSUITE_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Result codes for test case.
+ */
+typedef enum {
+ idn_teststatus_pass,
+ idn_teststatus_fail,
+ idn_teststatus_skip
+} idn_teststatus_t;
+
+/*
+ * Testsuite manager type (opaque).
+ */
+typedef struct idn_testsuite *idn_testsuite_t;
+
+/*
+ * Testcase function type.
+ */
+typedef void (*idn_testsuite_testproc_t)(idn_testsuite_t ctx);
+
+/*
+ * Message handler type.
+ */
+typedef void (*idn_testsuite_msgproc_t)(const char *msg);
+
+/*
+ * Create a testsuite manager context.
+ *
+ * Create an empty context and store it in '*ctxp'.
+ * Return 1 on success. Return 0 if memory is exhausted.
+ */
+extern int
+idn_testsuite_create(idn_testsuite_t *ctxp);
+
+/*
+ * Destory the testsuite manager context.
+ *
+ * Destroy the context created by idn_testsuite_create(), and release
+ * memory allocated to the context.
+ */
+extern void
+idn_testsuite_destroy(idn_testsuite_t ctx);
+
+/*
+ * Add a test case to the `group' test group.
+ * Return 1 on success. Return 0 if memory is exhausted.
+ */
+extern int
+idn_testsuite_addtestcase(idn_testsuite_t ctx, const char *title,
+ idn_testsuite_testproc_t proc);
+
+/*
+ * Return the number of test cases registered in the context.
+ */
+extern int
+idn_testsuite_ntestcases(idn_testsuite_t ctx);
+
+/*
+ * Run test cases registered in the context.
+ */
+extern void
+idn_testsuite_runall(idn_testsuite_t ctx);
+extern void
+idn_testsuite_run(idn_testsuite_t ctx, char *titles[]);
+
+/*
+ * Return the string description of `status'.
+ */
+extern const char *
+idn_teststatus_tostring(idn_teststatus_t status);
+
+/*
+ * Return the number of passed/failed/skipped test cases.
+ */
+extern int
+idn_testsuite_npassed(idn_testsuite_t ctx);
+extern int
+idn_testsuite_nfailed(idn_testsuite_t ctx);
+extern int
+idn_testsuite_nskipped(idn_testsuite_t ctx);
+
+/*
+ * Set/Get status of the test case running currently.
+ *
+ * These functions must be called by test case function.
+ */
+extern idn_teststatus_t
+idn_testsuite_getstatus(idn_testsuite_t ctx);
+extern void
+idn_testsuite_setstatus(idn_testsuite_t ctx, idn_teststatus_t status);
+
+/*
+ * Enable/Disable verbose mode.
+ */
+extern void
+idn_testsuite_setverbose(idn_testsuite_t ctx);
+extern void
+idn_testsuite_unsetverbose(idn_testsuite_t ctx);
+
+/*
+ * Generic assertion with message
+ */
+extern void
+idn_testsuite_assert(idn_testsuite_t ctx, const char *msg,
+ const char *file, int lineno);
+
+#define ASSERT_THRU(msg) \
+ idn_testsuite_assert(ctx__, msg, __FILE__, __LINE__)
+#define ASSERT(msg) \
+ do { \
+ ASSERT_THRU(msg); \
+ if (idn_testsuite_getstatus(ctx__) != idn_teststatus_pass) \
+ goto EXIT__; \
+ } while (0)
+
+/*
+ * Assertion function and macro to compare two `int' values.
+ * The assertion passes if `gotten' is equal to `expected'.
+ */
+extern void
+idn_testsuite_assertint(idn_testsuite_t ctx, int gotten, int expected,
+ const char *file, int lineno);
+
+#define ASSERT_INT(gotten, expected) \
+ do { \
+ idn_testsuite_assertint(ctx__, gotten, expected, __FILE__, __LINE__); \
+ if (idn_testsuite_getstatus(ctx__) != idn_teststatus_pass) \
+ goto EXIT__; \
+ } while (0)
+
+/*
+ * Assertion function and macro to compare two strings.
+ * The assertion passes if `gotten' is lexically equal to `expected'.
+ */
+extern void
+idn_testsuite_assertstring(idn_testsuite_t ctx, const char *gotten,
+ const char *expected, const char *file, int lineno);
+
+#define ASSERT_STRING(gotten, expected) \
+ do { \
+ idn_testsuite_assertstring(ctx__, gotten, expected, __FILE__, __LINE__); \
+ if (idn_testsuite_getstatus(ctx__) != idn_teststatus_pass) \
+ goto EXIT__; \
+ } while (0)
+
+/*
+ * Assertion function and macro to compare two pointers.
+ * The assertion passes if `gotten' is equal to `expected'.
+ */
+extern void
+idn_testsuite_assertptr(idn_testsuite_t ctx, const void *gotten,
+ const void *expected, const char *file, int lineno);
+
+#define ASSERT_PTR(gotten, expected) \
+ do { \
+ idn_testsuite_assertptr(ctx__, gotten, expected, __FILE__, __LINE__); \
+ if (idn_testsuite_getstatus(ctx__) != idn_teststatus_pass) \
+ goto EXIT__; \
+ } while (0)
+
+/*
+ * Assertion function and macro to compare two pointers.
+ * The assertion passes if `gotten' is NOT equal to `expected'.
+ */
+extern void
+idn_testsuite_assertptrne(idn_testsuite_t ctx,
+ const void *gotten, const void *unexpected,
+ const char *file, int lineno);
+
+#define ASSERT_PTR_NE(gotten, unexpected) \
+ do { \
+ idn_testsuite_assertptrne(ctx__, gotten, unexpected, __FILE__, __LINE__); \
+ if (idn_testsuite_getstatus(ctx__) != idn_teststatus_pass) \
+ goto EXIT__; \
+ } while (0)
+
+/*
+ * Assertion function and macro to compare two `idn_result_t' values.
+ * The assertion passes if `gotten' is equal to `expected'.
+ */
+extern void
+idn_testsuite_assertresult(idn_testsuite_t ctx,
+ idn_result_t gotten, idn_result_t expected,
+ const char *file, int lineno);
+
+#define ASSERT_RESULT(gotten, expected) \
+ do { \
+ idn_testsuite_assertresult(ctx__, gotten, expected, __FILE__, __LINE__); \
+ if (idn_testsuite_getstatus(ctx__) != idn_teststatus_pass) \
+ goto EXIT__; \
+ } while (0)
+
+/*
+ * Assertion function and macro to compare two UCS4 strings.
+ * The assertion passes if `gotten' is lexically equal to `expected'.
+ */
+extern void
+idn_testsuite_assertucs4string(idn_testsuite_t ctx,
+ const unsigned long *gotten,
+ const unsigned long *expected,
+ const char *file,
+ int lineno);
+
+#define ASSERT_UCS4STRING_THRU(gotten, expected) \
+ idn_testsuite_assertucs4string(ctx__, gotten, expected, __FILE__, __LINE__)
+#define ASSERT_UCS4STRING(gotten, expected) \
+ do { \
+ ASSERT_UCS4STRING_THRU(gotten, expected); \
+ if (idn_testsuite_getstatus(ctx__) != idn_teststatus_pass) \
+ goto EXIT__; \
+ } while (0)
+
+/*
+ * Shorthands.
+ */
+#define SKIP_TESTCASE \
+ do { \
+ idn_testsuite_setstatus(ctx__, idn_teststatus_skip); \
+ goto EXIT__; \
+ } while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IDN_TESTSUITE_H */
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/testutil.c b/contrib/idn/idnkit-1.0-src/lib/tests/testutil.c
new file mode 100644
index 0000000..c1872fd
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/testutil.c
@@ -0,0 +1,83 @@
+#ifndef lint
+static char *rcsid = "$Id: testutil.c,v 1.1.1.1 2003/06/04 00:27:03 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include "testutil.h"
+
+int
+create_conf_file(const char *filename, unsigned int flags, ...) {
+ FILE *file;
+ va_list ap;
+ const char *arg;
+ int arg_index;
+
+ file = fopen(filename, "w");
+ if (file == NULL) {
+ fprintf(stderr, "failed to create config file `%s'\n",
+ filename);
+ return 0;
+ }
+
+ arg_index = 0;
+ va_start(ap, flags);
+ for (;;) {
+ arg = va_arg(ap, const char *);
+ if (arg == NULL)
+ break;
+ if (arg_index++ > 0)
+ fputc('\n', file);
+ fputs(arg, file);
+ }
+ if (!(flags & CONF_NO_EOF_NEWLINE) && arg_index > 0)
+ fputc('\n', file);
+
+ fclose(file);
+ return 1;
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/testutil.h b/contrib/idn/idnkit-1.0-src/lib/tests/testutil.h
new file mode 100644
index 0000000..0e6405d
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/testutil.h
@@ -0,0 +1,71 @@
+/* $Id: testutil.h,v 1.1.1.1 2003/06/04 00:27:03 marka Exp $ */
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_TESTUTIL_H
+#define IDN_TESTUTIL_H 1
+
+/*
+ * Option flags for create_conf_file().
+ *
+ * CONF_NO_EOF_NEWLINE -- Don't put newline character
+ * at the end of file.
+ */
+#define CONF_NO_EOF_NEWLINE 0x0001
+
+/*
+ * Create a configuration file.
+ *
+ * Write strings specified as variable length arguments (`...') to
+ * `filename'. Note that the arguments must be terminated with `NULL'.
+ *
+ * In the created config file, each string in the variable length
+ * arguments becomes a line. In other words, newline characters are
+ * added automatically.
+ *
+ * This function returns 1 upon success, 0 otherwise.
+ */
+int
+create_conf_file(const char *filename, unsigned int flags, ...);
+
+#endif /* IDN_TESTUTIL_H */
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/testygen b/contrib/idn/idnkit-1.0-src/lib/tests/testygen
new file mode 100755
index 0000000..5d2f9ca
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/testygen
@@ -0,0 +1,557 @@
+#! /usr/bin/perl -w
+#
+# Copyright (c) 2002 Japan Network Information Center.
+# All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+#
+use FileHandle;
+use Getopt::Std;
+
+#
+# Parsing status.
+#
+my $STATUS_HEADER = 0;
+my $STATUS_HEADER_COMMENT = 1;
+my $STATUS_SEPARATOR = 2;
+my $STATUS_BODY = 3;
+my $STATUS_GLOBAL = 4;
+my $STATUS_GLOBAL_COMMENT = 5;
+my $STATUS_PREAMBLE = 6;
+
+my $LINENO_MARK = "<LINENO>";
+
+#
+# Create a new testsuite context.
+#
+sub new_testsuite {
+ return {'ntests' => 0,
+ 'setups' => {},
+ 'teardowns' => {},
+ 'tests' => [],
+ 'titles' => [],
+ 'preambles' => ''};
+}
+
+#
+# Read `$file' and put the result into `$testsutie'.
+#
+sub parse_file {
+ my ($testsuite, $file, $lineinfo) = @_;
+ my $parser = {'type' => '',
+ 'group' => '',
+ 'title' => '',
+ 'status' => $STATUS_PREAMBLE,
+ 'error' => '',
+ 'file' => $file,
+ 'lineno' => 0,
+ 'lineinfo' => $lineinfo};
+
+ my $handle = FileHandle->new($file, 'r');
+ if (!defined($handle)) {
+ die "failed to open the file, $!: $file\n";
+ }
+
+ my ($result, $line);
+ for (;;) {
+ $line = $handle->getline();
+ last if (!defined($line));
+
+ chomp($line);
+ $line .= "\n";
+ $parser->{lineno}++;
+ $result = parse_line($testsuite, $parser, $line);
+ if (!$result) {
+ die sprintf("%s, at line %d\n",
+ $parser->{error}, $parser->{lineno});
+ }
+ }
+
+ if ($parser->{status} != $STATUS_GLOBAL) {
+ die "unexpected EOF, at line $.\n";
+ }
+
+ $handle->close();
+}
+
+sub parse_line {
+ my ($testsuite, $parser, $line) = @_;
+ my $result = 1;
+
+ if ($parser->{status} == $STATUS_HEADER) {
+ if ($line =~ /^\/\/--/) {
+ $parser->{status} = $STATUS_HEADER_COMMENT;
+ } elsif ($line =~ /^\/\//) {
+ $result = parse_header($testsuite, $parser, $line);
+ } elsif ($line =~ /^\s*$/) {
+ $parser->{status} = $STATUS_SEPARATOR;
+ $result = parse_endheader($testsuite, $parser, $line);
+ } elsif ($line =~ /^\{\s*$/) {
+ $parser->{status} = $STATUS_BODY;
+ $result = parse_endheader($testsuite, $parser, $line)
+ && parse_startbody($testsuite, $parser, $line);
+ } else {
+ $parser->{error} = 'syntax error';
+ $result = 0;
+ }
+
+ } elsif ($parser->{status} == $STATUS_HEADER_COMMENT) {
+ if ($line =~ /^\/\//) {
+ # nothing to be done.
+ } elsif ($line =~ /^\s*$/) {
+ $parser->{status} = $STATUS_SEPARATOR;
+ $result = parse_endheader($testsuite, $parser, $line);
+ } elsif ($line =~ /^\{\s*$/) {
+ $parser->{status} = $STATUS_BODY;
+ $result = parse_endheader($testsuite, $parser, $line)
+ && parse_startbody($testsuite, $parser, $line);
+ } else {
+ $parser->{error} = 'syntax error';
+ $result = 0;
+ }
+
+ } elsif ($parser->{status} == $STATUS_SEPARATOR) {
+ if ($line =~ /^\s*$/) {
+ # nothing to be done.
+ } elsif ($line =~ /^\{\s*$/) {
+ $parser->{status} = $STATUS_BODY;
+ $result = parse_startbody($testsuite, $parser, $line);
+ } else {
+ $parser->{error} = 'syntax error';
+ $result = 0;
+ }
+
+ } elsif ($parser->{status} == $STATUS_BODY) {
+ if ($line =~ /^\}\s*$/) {
+ $parser->{status} = $STATUS_GLOBAL;
+ $result = parse_endbody($testsuite, $parser, $line);
+ } else {
+ $result = parse_body($testsuite, $parser, $line);
+ }
+
+ } elsif ($parser->{status} == $STATUS_GLOBAL) {
+ if ($line =~ /^\/\/\#/) {
+ $parser->{status} = $STATUS_HEADER;
+ $result = parse_startheader($testsuite, $parser, $line);
+ } elsif ($line =~ /^\/\/--/) {
+ $parser->{status} = $STATUS_GLOBAL_COMMENT;
+ } elsif ($line =~ /^\s*$/) {
+ # nothing to be done.
+ } else {
+ $parser->{error} = 'syntax error';
+ $result = 0;
+ }
+
+ } elsif ($parser->{status} == $STATUS_GLOBAL_COMMENT) {
+ if ($line =~ /^\/\//) {
+ # nothing to be done.
+ } elsif ($line =~ /^\s*$/) {
+ $parser->{status} = $STATUS_GLOBAL;
+ } else {
+ $parser->{error} = 'syntax error';
+ $result = 0;
+ }
+
+ } elsif ($parser->{status} == $STATUS_PREAMBLE) {
+ if ($line =~ /^\/\/\#/) {
+ $parser->{status} = $STATUS_HEADER;
+ $result = parse_startheader($testsuite, $parser, $line);
+ } elsif ($line =~ /^\/\/--/) {
+ $parser->{status} = $STATUS_GLOBAL_COMMENT;
+ } else {
+ $result = parse_preamble($testsuite, $parser, $line);
+ }
+
+ } else {
+ $parser->{error} = 'syntax error';
+ $result = 0;
+ }
+
+ return $result;
+}
+
+sub parse_startheader {
+ my ($testsuite, $parser, $line) = @_;
+
+ if ($line =~ /^\/\/\#\s*(SETUP|TEARDOWN|TESTCASE)\s*$/) {
+ $parser->{type} = $1;
+ $parser->{group} = '';
+ $parser->{title} = '';
+ } else {
+ $parser->{error} = 'invalid test-header format';
+ return 0;
+ }
+
+
+ return 1;
+}
+
+sub parse_header {
+ my ($testsuite, $parser, $line) = @_;
+
+ my $field = $line;
+ $field =~ s/^\/\/\s*//;
+ $field =~ s/^(\S+):\s*/$1:/;
+ $field =~ s/\s+$//;
+
+ return 1 if ($field eq '');
+
+ if ($field =~ /^group:(.*)$/) {
+ my $group = $1;
+
+ if ($parser->{group} ne '') {
+ $parser->{error} = "group defined twice in a header";
+ return 0;
+ }
+ if ($parser->{type} eq 'SETUP') {
+ if ($group !~ /^[0-9A-Za-z_\-]+$/) {
+ $parser->{error} = "invalid group name";
+ return 0;
+ }
+ if (defined($testsuite->{setups}->{$group})) {
+ $parser->{error} = sprintf("SETUP \`%s' redefined", $group);
+ return 0;
+ }
+ } elsif ($parser->{type} eq 'TEARDOWN') {
+ if ($group !~ /^[0-9A-Za-z_\-]+$/) {
+ $parser->{error} = "invalid group name";
+ return 0;
+ }
+ if (defined($testsuite->{teardowns}->{$group})) {
+ $parser->{error} = sprintf("TEARDOWN \`%s' redefined", $group);
+ return 0;
+ }
+ } else {
+ foreach my $i (split(/[ \t]+/, $group)) {
+ if ($i !~ /^[0-9A-Za-z_\-]+$/) {
+ $parser->{error} = "invalid group name \`$i'";
+ return 0;
+ }
+ if (!defined($testsuite->{setups}->{$i})
+ && !defined($testsuite->{teardowns}->{$i})) {
+ $parser->{error} = sprintf("group \'%s' not defined", $i);
+ return 0;
+ }
+ }
+ }
+ $parser->{group} = $group;
+
+ } elsif ($field =~ /^title:(.*)$/) {
+ my $title = $1;
+
+ if ($parser->{title} ne '') {
+ $parser->{error} = "title defined twice in a header";
+ return 0;
+ }
+ if ($title =~ /[\x00-\x1f\x7f-\xff\"\\]/ || $title eq '') {
+ $parser->{error} = "invalid title";
+ return 0;
+ }
+ if ($parser->{type} ne 'TESTCASE') {
+ $parser->{error} = sprintf("title for %s is not permitted",
+ $parser->{type});
+ return 0;
+ }
+ $parser->{title} = $title;
+
+ } else {
+ $parser->{error} = "invalid test-header field";
+ return 0;
+ }
+
+ return 1;
+}
+
+sub parse_endheader {
+ my ($testsuite, $parser, $line) = @_;
+
+ if ($parser->{type} ne 'TESTCASE' && $parser->{group} eq '') {
+ $parser->{error} = "missing \`group' in the header";
+ return 0;
+ }
+
+ if ($parser->{type} eq 'TESTCASE' && $parser->{title} eq '') {
+ $parser->{error} = "missing \`title' in the header";
+ return 0;
+ }
+
+ return 1;
+}
+
+sub parse_startbody {
+ my ($testsuite, $parser, $line) = @_;
+ my $group = $parser->{group};
+
+ if ($parser->{type} eq 'SETUP') {
+ if ($parser->{lineinfo}) {
+ $testsuite->{setups}->{$group} =
+ generate_line_info($parser->{lineno} + 1, $parser->{file});
+ }
+ } elsif ($parser->{type} eq 'TEARDOWN') {
+ if ($parser->{lineinfo}) {
+ $testsuite->{teardowns}->{$group} =
+ generate_line_info($parser->{lineno} + 1, $parser->{file});
+ }
+ } else {
+ $testsuite->{ntests}++;
+ push(@{$testsuite->{tests}}, '');
+ push(@{$testsuite->{titles}}, $parser->{title});
+
+ $testsuite->{tests}->[-1] .= "\n";
+ $testsuite->{tests}->[-1] .= "$LINENO_MARK\n";
+ $testsuite->{tests}->[-1] .=
+ sprintf("static void\ntestcase\%d(idn_testsuite_t ctx__) {\n",
+ $testsuite->{ntests});
+
+ my (@group_names) = split(/[ \t]+/, $group);
+ for (my $i = 0; $i < @group_names; $i++) {
+ if (defined($testsuite->{setups}->{$group_names[$i]})) {
+ $testsuite->{tests}->[-1] .= "\t\{\n";
+ $testsuite->{tests}->[-1] .= "#undef EXIT__\n";
+ $testsuite->{tests}->[-1] .= "#define EXIT__ exit${i}__\n";
+ $testsuite->{tests}->[-1] .=
+ $testsuite->{setups}->{$group_names[$i]};
+ }
+ }
+ $testsuite->{tests}->[-1] .= "$LINENO_MARK\n";
+ $testsuite->{tests}->[-1] .= "\t\{\n";
+ $testsuite->{tests}->[-1] .= "#undef EXIT__\n";
+ $testsuite->{tests}->[-1] .= "#define EXIT__ exit__\n";
+ if ($parser->{lineinfo}) {
+ $testsuite->{tests}->[-1] .=
+ generate_line_info($parser->{lineno} + 1, $parser->{file});
+ }
+ }
+
+ return 1;
+}
+
+sub parse_body {
+ my ($testsuite, $parser, $line) = @_;
+ my ($group) = $parser->{group};
+
+ if ($parser->{type} eq 'SETUP') {
+ $testsuite->{setups}->{$group} .= $line;
+ } elsif ($parser->{type} eq 'TEARDOWN') {
+ $testsuite->{teardowns}->{$group} .= $line;
+ } else {
+ $testsuite->{tests}->[-1] .= $line;
+ }
+
+ return 1;
+}
+
+sub parse_endbody {
+ my ($testsuite, $parser, $line) = @_;
+ my ($group) = $parser->{group};
+
+ if ($parser->{type} eq 'TESTCASE') {
+ $testsuite->{tests}->[-1] .= "$LINENO_MARK\n";
+ $testsuite->{tests}->[-1] .= "\t\}\n";
+ $testsuite->{tests}->[-1] .= " exit__:\n";
+ $testsuite->{tests}->[-1] .= "\t;\n";
+
+ my (@group_names) = split(/[ \t]+/, $group);
+ for (my $i = @group_names - 1; $i >= 0; $i--) {
+ $testsuite->{tests}->[-1] .= " exit${i}__:\n";
+ $testsuite->{tests}->[-1] .= "\t;\n";
+ if (defined($testsuite->{teardowns}->{$group_names[$i]})) {
+ $testsuite->{tests}->[-1] .=
+ $testsuite->{teardowns}->{$group_names[$i]};
+ }
+ $testsuite->{tests}->[-1] .= "$LINENO_MARK\n";
+ $testsuite->{tests}->[-1] .= "\t\}\n";
+ }
+
+ $testsuite->{tests}->[-1] .= "}\n";
+ }
+
+ return 1;
+}
+
+sub parse_preamble {
+ my ($testsuite, $parser, $line) = @_;
+
+ if ($parser->{lineinfo} && $parser->{lineno} == 1) {
+ $testsuite->{preambles} .= generate_line_info(1, $parser->{file});
+ }
+ $testsuite->{preambles} .= $line;
+ return 1;
+}
+
+sub generate_line_info {
+ my ($lineno, $file) = @_;
+ return "#line $lineno \"$file\"\n";
+}
+
+#
+# Output `$testsuite' as source codes of C.
+#
+sub output_tests {
+ my ($testsuite, $file, $lineinfo) = @_;
+
+ my $generator = {
+ 'file' => $file,
+ 'lineno' => 0
+ };
+
+ my $handle = FileHandle->new($file, 'w');
+ if (!defined($handle)) {
+ die "failed to open the file, $!: $file\n";
+ }
+
+ my $preamble_header =
+ "/* This file is automatically generated by testygen. */\n\n"
+ . "#define TESTYGEN 1\n"
+ . "\n";
+ output_lines($preamble_header, $generator, $handle, $lineinfo);
+
+ output_lines($testsuite->{preambles}, $generator, $handle, $lineinfo);
+
+ my $preamble_footer =
+ "\n"
+ . "$LINENO_MARK\n"
+ . "#include \"testsuite.h\"\n"
+ . "\n";
+ output_lines($preamble_footer, $generator, $handle, $lineinfo);
+
+
+ for (my $i = 0; $i < $testsuite->{ntests}; $i++) {
+ output_lines($testsuite->{tests}->[$i], $generator, $handle,
+ $lineinfo);
+ }
+
+ my $main_header =
+ "\n"
+ . "$LINENO_MARK\n"
+ . "int\n"
+ . "main(int argc, char *argv[]) {\n"
+ . "\tidn_testsuite_t ctx;\n"
+ . "\tconst char *title;\n"
+ . "\n"
+ . "\tidn_testsuite_create(&ctx);\n";
+ output_lines($main_header, $generator, $handle, $lineinfo);
+
+ for (my $i = 0; $i < $testsuite->{ntests}; $i++) {
+ my $title = $testsuite->{titles}->[$i];
+ my $proc = sprintf("testcase%d", $i + 1);
+ output_lines("\tidn_testsuite_addtestcase(ctx, \"$title\", $proc);\n",
+ $generator, $handle, $lineinfo);
+ }
+
+ my $main_footer =
+ "\n"
+ . "\tif (argc > 1 && strcmp(argv[1], \"-v\") == 0) {\n"
+ . "\t idn_testsuite_setverbose(ctx);\n"
+ . "\t argc--;\n"
+ . "\t argv++;\n"
+ . "\t}\n"
+ . "\tif (argc == 1)\n"
+ . "\t idn_testsuite_runall(ctx);\n"
+ . "\telse\n"
+ . "\t idn_testsuite_run(ctx, argv + 1);\n"
+ . "\n"
+ . "\tprintf(\"passed=%d, failed=%d, total=%d\\n\",\n"
+ . "\t idn_testsuite_npassed(ctx),\n"
+ . "\t idn_testsuite_nfailed(ctx),\n"
+ . "\t idn_testsuite_ntestcases(ctx) - idn_testsuite_nskipped(ctx));\n"
+ . "\n"
+ . "\tidn_testsuite_destroy(ctx);\n"
+ . "\treturn (0);\n"
+ . "\}\n";
+ output_lines($main_footer, $generator, $handle, $lineinfo);
+
+ $handle->close();
+}
+
+sub output_lines {
+ my ($lines, $generator, $handle, $lineinfo) = @_;
+ my ($line);
+
+ chomp($lines);
+ $lines .= "\n";
+
+ while ($lines ne '') {
+ $lines =~ s/^([^\n]*)\n//;
+ $line = $1;
+ $generator->{lineno}++;
+ if ($line eq $LINENO_MARK) {
+ if ($lineinfo) {
+ $handle->printf("#line %d \"%s\"\n", $generator->{lineno} + 1,
+ $generator->{file});
+ }
+ } else {
+ $handle->print("$line\n");
+ }
+ }
+}
+
+sub output_usage {
+ warn "$0: [-o output-file] input-file\n";
+}
+
+#
+# main.
+#
+my (%options);
+
+if (!getopts('Lo:', \%options)) {
+ output_usage;
+ exit(1);
+}
+if (@ARGV != 1) {
+ output_usage;
+ exit(1);
+}
+
+my ($in_file) = $ARGV[0];
+my ($out_file);
+if (!defined($options{o})) {
+ $out_file = $in_file;
+ $out_file .= '\.tsy' if ($out_file !~ /\.tsy$/);
+ $out_file =~ s/\.tsy$/\.c/;
+} else {
+ $out_file = $options{o};
+}
+
+my $testsuite = new_testsuite();
+parse_file($testsuite, $in_file, !$options{L});
+output_tests($testsuite, $out_file, !$options{L});
+
+exit(0);
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/ucs4.tsy b/contrib/idn/idnkit-1.0-src/lib/tests/ucs4.tsy
new file mode 100644
index 0000000..205edae
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/ucs4.tsy
@@ -0,0 +1,257 @@
+#ifndef lint
+static char *rcsid = "$Id: ucs4.tsy,v 1.1.1.1 2003/06/04 00:27:04 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <idn/ucs4.h>
+#include <idn/log.h>
+#include "testutil.h"
+
+/*
+ * Sample UTF8 and UCS4 strings.
+ */
+static const char *utf8_string =
+ "\x7f" /* 0x0000007f */
+ "\xdf\xbf" /* 0x000007ff */
+ "\xef\xbf\xbf" /* 0x0000ffff */
+ "\xf7\xbf\xbf\xbf" /* 0x001fffff */
+ "\xfb\xbf\xbf\xbf\xbf" /* 0x03ffffff */
+ "\xfd\xbf\xbf\xbf\xbf\xbf"; /* 0x7fffffff */
+
+static const unsigned long ucs4_string[] = {
+ 0x0000007f,
+ 0x000007ff,
+ 0x0000ffff,
+ 0x001fffff,
+ 0x03ffffff,
+ 0x7fffffff,
+ 0x00000000
+};
+
+//--------------------------------------------------------------------
+// Setups and Teardowns.
+//--------------------------------------------------------------------
+
+//# SETUP
+// group: utf8-init
+{
+ unsigned long to[256];
+ size_t tolen = 256;
+ idn_result_t r;
+}
+
+//# SETUP
+// group: ucs4-init
+{
+ char to[256];
+ size_t tolen = 256;
+ idn_result_t r;
+}
+
+//# SETUP
+// group: quiet
+{
+ int saved_log_level;
+
+ saved_log_level = idn_log_getlevel();
+ idn_log_setlevel(idn_log_level_fatal);
+}
+
+//# TEARDOWN
+// group: quiet
+{
+ idn_log_setlevel(saved_log_level);
+}
+
+//--------------------------------------------------------------------
+// Testcases.
+//--------------------------------------------------------------------
+
+//# TESTCASE
+// title: call utf8toucs4()
+// group: utf8-init
+{
+ r = idn_ucs4_utf8toucs4(utf8_string, to, tolen);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, ucs4_string);
+}
+
+//# TESTCASE
+// title: call ucs4toutf8()
+// group: ucs4-init
+{
+ r = idn_ucs4_ucs4toutf8(ucs4_string, to, tolen);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, utf8_string);
+}
+
+//# TESTCASE
+// title: call utf8toucs4() with empty from
+// group: utf8-init
+{
+ static unsigned long empty_ucs4_string[] = {0};
+
+ r = idn_ucs4_utf8toucs4("", to, tolen);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, empty_ucs4_string);
+}
+
+//# TESTCASE
+// title: call ucs4toutf8() with empty from
+// group: ucs4-init
+{
+ static unsigned long empty_ucs4_string[] = {0};
+
+ r = idn_ucs4_ucs4toutf8(empty_ucs4_string, to, tolen);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, "");
+}
+
+//# TESTCASE
+// title: call utf8toucs4() with broken string
+// group: utf8-init quiet
+{
+ /* "\xfe" as the 1st byte is out of range. */
+ r = idn_ucs4_utf8toucs4("\xfe\xbf\xbf\xbf\xbf\xbf\xbf", to, tolen);
+ ASSERT_RESULT(r, idn_invalid_encoding);
+
+ /* "\x7f" as the 2nd byte is out of range. */
+ r = idn_ucs4_utf8toucs4("\xdf\x7f", to, tolen);
+ ASSERT_RESULT(r, idn_invalid_encoding);
+
+ /* "\xc0" as the 2nd byte is out of range. */
+ r = idn_ucs4_utf8toucs4("\xdf\xc0", to, tolen);
+ ASSERT_RESULT(r, idn_invalid_encoding);
+
+ /* "\x7f" as the 3rd byte is out of range. */
+ r = idn_ucs4_utf8toucs4("\xef\xbf\x7f", to, tolen);
+ ASSERT_RESULT(r, idn_invalid_encoding);
+
+ /* "\xc0" as the 3rd byte is out of range. */
+ r = idn_ucs4_utf8toucs4("\xef\xbf\xc0", to, tolen);
+ ASSERT_RESULT(r, idn_invalid_encoding);
+
+ /* "\x7f" as the 4th byte is out of range. */
+ r = idn_ucs4_utf8toucs4("\xf7\xbf\xbf\x7f", to, tolen);
+ ASSERT_RESULT(r, idn_invalid_encoding);
+
+ /* "\xc0" as the 4th byte is out of range. */
+ r = idn_ucs4_utf8toucs4("\xf7\xbf\xbf\xc0", to, tolen);
+ ASSERT_RESULT(r, idn_invalid_encoding);
+
+ /* "\x7f" as the 5th byte is out of range. */
+ r = idn_ucs4_utf8toucs4("\xfb\xbf\xbf\xbf\x7f", to, tolen);
+ ASSERT_RESULT(r, idn_invalid_encoding);
+
+ /* "\xc0" as the 5th byte is out of range. */
+ r = idn_ucs4_utf8toucs4("\xfb\xbf\xbf\xbf\xc0", to, tolen);
+ ASSERT_RESULT(r, idn_invalid_encoding);
+
+ /* "\x7f" as the 6th byte is out of range. */
+ r = idn_ucs4_utf8toucs4("\xfd\xbf\xbf\xbf\xbf\x7f", to, tolen);
+ ASSERT_RESULT(r, idn_invalid_encoding);
+
+ /* "\xc0" as the 6th byte is out of range. */
+ r = idn_ucs4_utf8toucs4("\xfd\xbf\xbf\xbf\xbf\xc0", to, tolen);
+ ASSERT_RESULT(r, idn_invalid_encoding);
+
+ /* `from' contains surrogate pair */
+ r = idn_ucs4_utf8toucs4("\xed\xa0\x80\xed\xbf\xbf", to, tolen);
+ ASSERT_RESULT(r, idn_invalid_encoding);
+}
+
+//# TESTCASE
+// title: call ucs4toutf8() with broken string
+// group: ucs4-init quiet
+{
+ static unsigned long invalid_ucs4_string0[] = {0x80000000, 0};
+ static unsigned long invalid_ucs4_string1[] = {0xd800, 0xdfff, 0};
+
+ /* 0x80000000 is out of range */
+ r = idn_ucs4_ucs4toutf8(invalid_ucs4_string0, to, tolen);
+ ASSERT_RESULT(r, idn_invalid_encoding);
+
+ /* `from' contains surrogate pair */
+ r = idn_ucs4_ucs4toutf8(invalid_ucs4_string1, to, tolen);
+ ASSERT_RESULT(r, idn_invalid_encoding);
+}
+
+//# TESTCASE
+// title: buffer overrun test for utf8toucs4()
+// group: utf8-init
+{
+ r = idn_ucs4_utf8toucs4(utf8_string, to,
+ idn_ucs4_strlen(ucs4_string) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_UCS4STRING(to, ucs4_string);
+
+ r = idn_ucs4_utf8toucs4(utf8_string, to,
+ idn_ucs4_strlen(ucs4_string));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ r = idn_ucs4_utf8toucs4(utf8_string, to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+}
+
+//# TESTCASE
+// title: buffer overrun test for ucs4toutf8()
+// group: ucs4-init
+{
+ r = idn_ucs4_ucs4toutf8(ucs4_string, to, strlen(utf8_string) + 1);
+ ASSERT_RESULT(r, idn_success);
+ ASSERT_STRING(to, utf8_string);
+
+ r = idn_ucs4_ucs4toutf8(ucs4_string, to, strlen(utf8_string));
+ ASSERT_RESULT(r, idn_buffer_overflow);
+
+ r = idn_ucs4_ucs4toutf8(ucs4_string, to, 0);
+ ASSERT_RESULT(r, idn_buffer_overflow);
+}
+
diff --git a/contrib/idn/idnkit-1.0-src/lib/tests/utffilter b/contrib/idn/idnkit-1.0-src/lib/tests/utffilter
new file mode 100755
index 0000000..cebd4dc
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/tests/utffilter
@@ -0,0 +1,82 @@
+#! /usr/bin/perl -wp
+#
+# Copyright (c) 2002 Japan Network Information Center.
+# All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+#
+
+sub to_utf8 ($) {
+ my ($utf32) = hex($_[0]);
+ my ($mask, $length);
+
+ if ($utf32 < 0x80) {
+ $mask = 0;
+ $length = 1;
+ } elsif ($utf32 < 0x800) {
+ $mask = 0xc0;
+ $length = 2;
+ } elsif ($utf32 < 0x10000) {
+ $mask = 0xe0;
+ $length = 3;
+ } elsif ($utf32 < 0x200000) {
+ $mask = 0xf0;
+ $length = 4;
+ } elsif ($utf32 < 0x4000000) {
+ $mask = 0xf8;
+ $length = 5;
+ } elsif ($utf32 < 0x80000000) {
+ $mask = 0xfc;
+ $length = 6;
+ } else {
+ return '';
+ }
+
+ my ($result, $offset);
+ $offset = 6 * ($length - 1);
+ $result .= sprintf('\\x%02x', ($utf32 >> $offset) | $mask);
+ while ($offset > 0) {
+ $offset -= 6;
+ $result .= sprintf('\\x%02x', (($utf32 >> $offset) & 0x3f) | 0x80);
+ }
+
+ return $result;
+}
+
+s/<U\+([0-9A-Fa-f]+)>/&to_utf8($1)/eg;
diff --git a/contrib/idn/idnkit-1.0-src/lib/ucs4.c b/contrib/idn/idnkit-1.0-src/lib/ucs4.c
new file mode 100644
index 0000000..a5f4e8c
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/ucs4.c
@@ -0,0 +1,461 @@
+#ifndef lint
+static char *rcsid = "$Id: ucs4.c,v 1.1.1.1 2003/06/04 00:26:14 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <idn/assert.h>
+#include <idn/result.h>
+#include <idn/logmacro.h>
+#include <idn/util.h>
+#include <idn/ucs4.h>
+#include <idn/debug.h>
+
+/*
+ * Unicode surrogate pair.
+ */
+#define IS_SURROGATE_HIGH(v) (0xd800 <= (v) && (v) <= 0xdbff)
+#define IS_SURROGATE_LOW(v) (0xdc00 <= (v) && (v) <= 0xdfff)
+#define SURROGATE_HIGH(v) (SURROGATE_H_OFF + (((v) - 0x10000) >> 10))
+#define SURROGATE_LOW(v) (SURROGATE_L_OFF + ((v) & 0x3ff))
+#define SURROGATE_BASE 0x10000
+#define SURROGATE_H_OFF 0xd800
+#define SURROGATE_L_OFF 0xdc00
+#define COMBINE_SURROGATE(h, l) \
+ (SURROGATE_BASE + (((h)-SURROGATE_H_OFF)<<10) + ((l)-SURROGATE_L_OFF))
+
+/*
+ * ASCII ctype macros.
+ * Note that these macros evaluate the argument multiple times. Be careful.
+ */
+#define ASCII_TOUPPER(c) \
+ (('a' <= (c) && (c) <= 'z') ? ((c) - 'a' + 'A') : (c))
+#define ASCII_TOLOWER(c) \
+ (('A' <= (c) && (c) <= 'Z') ? ((c) - 'A' + 'a') : (c))
+
+idn_result_t
+idn_ucs4_ucs4toutf16(const unsigned long *ucs4, unsigned short *utf16,
+ size_t tolen) {
+ unsigned short *utf16p = utf16;
+ unsigned long v;
+ idn_result_t r;
+
+ TRACE(("idn_ucs4_ucs4toutf16(ucs4=\"%s\", tolen=%d)\n",
+ idn__debug_ucs4xstring(ucs4, 50), (int)tolen));
+
+ while (*ucs4 != '\0') {
+ v = *ucs4++;
+
+ if (IS_SURROGATE_LOW(v) || IS_SURROGATE_HIGH(v)) {
+ WARNING(("idn_ucs4_ucs4toutf16: UCS4 string contains "
+ "surrogate pair\n"));
+ r = idn_invalid_encoding;
+ goto ret;
+ } else if (v > 0xffff) {
+ /* Convert to surrogate pair */
+ if (v >= 0x110000) {
+ r = idn_invalid_encoding;
+ goto ret;
+ }
+ if (tolen < 2) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ *utf16p++ = SURROGATE_HIGH(v);
+ *utf16p++ = SURROGATE_LOW(v);
+ tolen -= 2;
+ } else {
+ if (tolen < 1) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ *utf16p++ = v;
+ tolen--;
+ }
+ }
+
+ if (tolen < 1) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ *utf16p = '\0';
+
+ r = idn_success;
+ret:
+ if (r == idn_success) {
+ TRACE(("idn_ucs4_ucs4toutf16(): success (utf16=\"%s\")\n",
+ idn__debug_utf16xstring(utf16, 50)));
+ } else {
+ TRACE(("idn_ucs4_ucs4toutf16(): %s\n",
+ idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+idn_result_t
+idn_ucs4_utf16toucs4(const unsigned short *utf16, unsigned long *ucs4,
+ size_t tolen) {
+ unsigned long *ucs4p = ucs4;
+ unsigned short v0, v1;
+ idn_result_t r;
+
+ TRACE(("idn_ucs4_utf16toucs4(utf16=\"%s\", tolen=%d)\n",
+ idn__debug_utf16xstring(utf16, 50), (int)tolen));
+
+ while (*utf16 != '\0') {
+ v0 = *utf16;
+
+ if (tolen < 1) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+
+ if (IS_SURROGATE_HIGH(v0)) {
+ v1 = *(utf16 + 1);
+ if (!IS_SURROGATE_LOW(v1)) {
+ WARNING(("idn_ucs4_utf16toucs4: "
+ "corrupted surrogate pair\n"));
+ r = idn_invalid_encoding;
+ goto ret;
+ }
+ *ucs4p++ = COMBINE_SURROGATE(v0, v1);
+ tolen--;
+ utf16 += 2;
+
+ } else {
+ *ucs4p++ = v0;
+ tolen--;
+ utf16++;
+
+ }
+ }
+
+ if (tolen < 1) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ *ucs4p = '\0';
+
+ r = idn_success;
+ret:
+ if (r == idn_success) {
+ TRACE(("idn_ucs4_utf16toucs4(): success (ucs4=\"%s\")\n",
+ idn__debug_ucs4xstring(ucs4, 50)));
+ } else {
+ TRACE(("idn_ucs4_utf16toucs4(): %s\n",
+ idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+idn_result_t
+idn_ucs4_utf8toucs4(const char *utf8, unsigned long *ucs4, size_t tolen) {
+ const unsigned char *utf8p = (const unsigned char *)utf8;
+ unsigned long *ucs4p = ucs4;
+ unsigned long v, min;
+ unsigned char c;
+ int width;
+ int i;
+ idn_result_t r;
+
+ TRACE(("idn_ucs4_utf8toucs4(utf8=\"%s\", tolen=%d)\n",
+ idn__debug_xstring(utf8, 50), (int)tolen));
+
+ while(*utf8p != '\0') {
+ c = *utf8p++;
+ if (c < 0x80) {
+ v = c;
+ min = 0;
+ width = 1;
+ } else if (c < 0xc0) {
+ WARNING(("idn_ucs4_utf8toucs4: invalid character\n"));
+ r = idn_invalid_encoding;
+ goto ret;
+ } else if (c < 0xe0) {
+ v = c & 0x1f;
+ min = 0x80;
+ width = 2;
+ } else if (c < 0xf0) {
+ v = c & 0x0f;
+ min = 0x800;
+ width = 3;
+ } else if (c < 0xf8) {
+ v = c & 0x07;
+ min = 0x10000;
+ width = 4;
+ } else if (c < 0xfc) {
+ v = c & 0x03;
+ min = 0x200000;
+ width = 5;
+ } else if (c < 0xfe) {
+ v = c & 0x01;
+ min = 0x4000000;
+ width = 6;
+ } else {
+ WARNING(("idn_ucs4_utf8toucs4: invalid character\n"));
+ r = idn_invalid_encoding;
+ goto ret;
+ }
+
+ for (i = width - 1; i > 0; i--) {
+ c = *utf8p++;
+ if (c < 0x80 || 0xc0 <= c) {
+ WARNING(("idn_ucs4_utf8toucs4: "
+ "invalid character\n"));
+ r = idn_invalid_encoding;
+ goto ret;
+ }
+ v = (v << 6) | (c & 0x3f);
+ }
+
+ if (v < min) {
+ WARNING(("idn_ucs4_utf8toucs4: invalid character\n"));
+ r = idn_invalid_encoding;
+ goto ret;
+ }
+ if (IS_SURROGATE_LOW(v) || IS_SURROGATE_HIGH(v)) {
+ WARNING(("idn_ucs4_utf8toucs4: UTF-8 string contains "
+ "surrogate pair\n"));
+ r = idn_invalid_encoding;
+ goto ret;
+ }
+ if (tolen < 1) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ tolen--;
+ *ucs4p++ = v;
+ }
+
+ if (tolen < 1) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ *ucs4p = '\0';
+
+ r = idn_success;
+ret:
+ if (r == idn_success) {
+ TRACE(("idn_ucs4_utf8toucs4(): success (ucs4=\"%s\")\n",
+ idn__debug_ucs4xstring(ucs4, 50)));
+ } else {
+ TRACE(("idn_ucs4_utf8toucs4(): %s\n",
+ idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+idn_result_t
+idn_ucs4_ucs4toutf8(const unsigned long *ucs4, char *utf8, size_t tolen) {
+ unsigned char *utf8p = (unsigned char *)utf8;
+ unsigned long v;
+ int width;
+ int mask;
+ int offset;
+ idn_result_t r;
+
+ TRACE(("idn_ucs4_ucs4toutf8(ucs4=\"%s\", tolen=%d)\n",
+ idn__debug_ucs4xstring(ucs4, 50), (int)tolen));
+
+ while (*ucs4 != '\0') {
+ v = *ucs4++;
+ if (IS_SURROGATE_LOW(v) || IS_SURROGATE_HIGH(v)) {
+ WARNING(("idn_ucs4_ucs4toutf8: UCS4 string contains "
+ "surrogate pair\n"));
+ r = idn_invalid_encoding;
+ goto ret;
+ }
+ if (v < 0x80) {
+ mask = 0;
+ width = 1;
+ } else if (v < 0x800) {
+ mask = 0xc0;
+ width = 2;
+ } else if (v < 0x10000) {
+ mask = 0xe0;
+ width = 3;
+ } else if (v < 0x200000) {
+ mask = 0xf0;
+ width = 4;
+ } else if (v < 0x4000000) {
+ mask = 0xf8;
+ width = 5;
+ } else if (v < 0x80000000) {
+ mask = 0xfc;
+ width = 6;
+ } else {
+ WARNING(("idn_ucs4_ucs4toutf8: invalid character\n"));
+ r = idn_invalid_encoding;
+ goto ret;
+ }
+
+ if (tolen < width) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ offset = 6 * (width - 1);
+ *utf8p++ = (v >> offset) | mask;
+ mask = 0x80;
+ while (offset > 0) {
+ offset -= 6;
+ *utf8p++ = ((v >> offset) & 0x3f) | mask;
+ }
+ tolen -= width;
+ }
+
+ if (tolen < 1) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ *utf8p = '\0';
+
+ r = idn_success;
+ret:
+ if (r == idn_success) {
+ TRACE(("idn_ucs4_ucs4toutf8(): success (utf8=\"%s\")\n",
+ idn__debug_xstring(utf8, 50)));
+ } else {
+ TRACE(("idn_ucs4_ucs4toutf8(): %s\n",
+ idn_result_tostring(r)));
+ }
+ return (r);
+}
+
+size_t
+idn_ucs4_strlen(const unsigned long *ucs4) {
+ size_t len;
+
+ for (len = 0; *ucs4 != '\0'; ucs4++, len++)
+ /* nothing to do */ ;
+
+ return (len);
+}
+
+unsigned long *
+idn_ucs4_strcpy(unsigned long *to, const unsigned long *from) {
+ unsigned long *result = to;
+
+ while (*from != '\0')
+ *to++ = *from++;
+ *to = '\0';
+
+ return (result);
+}
+
+unsigned long *
+idn_ucs4_strcat(unsigned long *to, const unsigned long *from) {
+ unsigned long *result = to;
+
+ while (*to != '\0')
+ to++;
+
+ while (*from != '\0')
+ *to++ = *from++;
+ *to = '\0';
+
+ return (result);
+}
+
+int
+idn_ucs4_strcmp(const unsigned long *str1, const unsigned long *str2) {
+ while (*str1 != '\0') {
+ if (*str1 > *str2)
+ return (1);
+ else if (*str1 < *str2)
+ return (-1);
+ str1++;
+ str2++;
+ }
+
+ if (*str1 > *str2)
+ return (1);
+ else if (*str1 < *str2)
+ return (-1);
+
+ return (0);
+}
+
+int
+idn_ucs4_strcasecmp(const unsigned long *str1, const unsigned long *str2) {
+ unsigned long c1, c2;
+
+ while (*str1 != '\0') {
+ c1 = ASCII_TOLOWER(*str1);
+ c2 = ASCII_TOLOWER(*str2);
+ if (c1 > c2)
+ return (1);
+ else if (c1 < c2)
+ return (-1);
+ str1++;
+ str2++;
+ }
+
+ c1 = ASCII_TOLOWER(*str1);
+ c2 = ASCII_TOLOWER(*str2);
+ if (c1 > c2)
+ return (1);
+ else if (c1 < c2)
+ return (-1);
+
+ return (0);
+}
+
+
+unsigned long *
+idn_ucs4_strdup(const unsigned long *str) {
+ size_t length = idn_ucs4_strlen(str);
+ unsigned long *dupstr;
+
+ dupstr = (unsigned long *)malloc(sizeof(*str) * (length + 1));
+ if (dupstr == NULL)
+ return NULL;
+ memcpy(dupstr, str, sizeof(*str) * (length + 1));
+
+ return dupstr;
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/ucsmap.c b/contrib/idn/idnkit-1.0-src/lib/ucsmap.c
new file mode 100644
index 0000000..633456d
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/ucsmap.c
@@ -0,0 +1,380 @@
+#ifndef lint
+static char *rcsid = "$Id: ucsmap.c,v 1.1.1.1 2003/06/04 00:26:14 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <idn/result.h>
+#include <idn/assert.h>
+#include <idn/log.h>
+#include <idn/logmacro.h>
+#include <idn/ucsmap.h>
+
+#define INIT_SIZE 50
+#define DEFAULT_BUF_SIZE 500
+#define UCSMAP_HASH_SIZE 103
+#define MAX_MAPLEN 0xffff
+
+/*
+ * This module implements UCS 1-to-N mapping.
+ * To speed up mapping table lookup, a combination of hash and
+ * binary search is used.
+ */
+
+/*
+ * Mapping entry.
+ * Entries are sorted by its hash index and code point.
+ */
+typedef struct {
+ short hidx; /* hash index */
+ unsigned short len; /* length of mapped sequence */
+ unsigned long ucs; /* code point to be mapped */
+ unsigned long *map; /* mapped sequence of code points */
+} ucsmap_entry_t;
+
+/*
+ * Hash table entry.
+ * Since the entries pointed by ucsmap_hash_t.entry are sorted,
+ * binary search can be used.
+ */
+typedef struct {
+ ucsmap_entry_t *entry; /* sorted by code point */
+ int n; /* length of 'entry' */
+} ucsmap_hash_t;
+
+/*
+ * UCS character buffer for storing target character sequence.
+ */
+typedef struct ucsmap_buf {
+ struct ucsmap_buf *next;
+ unsigned long buf[1]; /* actually a variable length array */
+} ucsmap_buf_t;
+
+/*
+ * Mapping object.
+ */
+typedef struct idn_ucsmap {
+ ucsmap_hash_t hash[UCSMAP_HASH_SIZE];
+ ucsmap_entry_t *entries; /* array of entries */
+ size_t entry_size; /* allocated size */
+ size_t nentries; /* # of entries in use */
+ ucsmap_buf_t *mapdata; /* list of character buffers */
+ size_t mapdata_size; /* allocated size of current buffer */
+ size_t mapdata_used; /* # of chars in use */
+ int fixed; /* already fixed? */
+ int refcnt; /* reference count */
+} ucsmap_t;
+
+static int ucsmap_hash(unsigned long v);
+static unsigned long *save_mapped_sequence(idn_ucsmap_t ctx,
+ unsigned long *map,
+ size_t maplen);
+static void free_mapbuf(ucsmap_buf_t *buf);
+static int comp_entry(const void *v1, const void *v2);
+
+idn_result_t
+idn_ucsmap_create(idn_ucsmap_t *ctxp) {
+ idn_ucsmap_t ctx;
+
+ assert(ctxp != NULL);
+
+ TRACE(("idn_ucsmap_create()\n"));
+
+ if ((ctx = malloc(sizeof(*ctx))) == NULL) {
+ WARNING(("idn_ucsmap_create: malloc failed\n"));
+ return (idn_nomemory);
+ }
+
+ ctx->entry_size = 0;
+ ctx->nentries = 0;
+ ctx->entries = NULL;
+ ctx->mapdata = NULL;
+ ctx->mapdata_size = 0;
+ ctx->mapdata_used = 0;
+ ctx->fixed = 0;
+ ctx->refcnt = 1;
+ *ctxp = ctx;
+ return (idn_success);
+}
+
+void
+idn_ucsmap_destroy(idn_ucsmap_t ctx) {
+ assert(ctx != NULL && ctx->refcnt > 0);
+
+ TRACE(("idn_ucsmap_destroy()\n"));
+
+ if (--ctx->refcnt == 0) {
+ if (ctx->entries != NULL)
+ free(ctx->entries);
+ if (ctx->mapdata != NULL)
+ free_mapbuf(ctx->mapdata);
+ free(ctx);
+ }
+}
+
+void
+idn_ucsmap_incrref(idn_ucsmap_t ctx) {
+ assert(ctx != NULL && ctx->refcnt > 0);
+
+ ctx->refcnt++;
+}
+
+idn_result_t
+idn_ucsmap_add(idn_ucsmap_t ctx, unsigned long ucs,
+ unsigned long *map, size_t maplen)
+{
+ ucsmap_entry_t *e;
+ ucsmap_entry_t *newbuf;
+
+ assert(ctx != NULL && ctx->refcnt > 0);
+
+ TRACE(("idn_ucsmap_add(ucs=U+%lX, maplen=%u)\n", ucs, maplen));
+
+ /* Make sure it is not fixed yet. */
+ if (ctx->fixed) {
+ WARNING(("idn_ucsmap_add: attempt to add to fixed map\n"));
+ return (idn_failure);
+ }
+
+ if (maplen > MAX_MAPLEN) {
+ WARNING(("idn_ucsmap_add: maplen too large (> %d)\n",
+ MAX_MAPLEN));
+ return (idn_failure);
+ }
+
+ /* Append an entry. */
+ if (ctx->nentries >= ctx->entry_size) {
+ if (ctx->entry_size == 0)
+ ctx->entry_size = INIT_SIZE;
+ else
+ ctx->entry_size *= 2;
+ newbuf = realloc(ctx->entries, sizeof(*e) * ctx->entry_size);
+ if (newbuf == NULL)
+ return (idn_nomemory);
+ ctx->entries = newbuf;
+ }
+ e = &ctx->entries[ctx->nentries];
+ e->hidx = ucsmap_hash(ucs);
+ e->len = maplen;
+ e->ucs = ucs;
+ if (maplen > 0) {
+ /* Save mapped sequence in the buffer. */
+ e->map = save_mapped_sequence(ctx, map, maplen);
+ if (e->map == NULL)
+ return (idn_nomemory);
+ } else {
+ /*
+ * Zero 'maplen' is perfectly valid meaning one-to-zero
+ * mapping.
+ */
+ e->map = NULL;
+ }
+ ctx->nentries++;
+
+ return (idn_success);
+}
+
+void
+idn_ucsmap_fix(idn_ucsmap_t ctx) {
+ ucsmap_entry_t *e;
+ int last_hidx;
+ int i;
+
+ assert(ctx != NULL && ctx->refcnt > 0);
+
+ TRACE(("idn_ucsmap_fix()\n"));
+
+ if (ctx->fixed)
+ return;
+
+ ctx->fixed = 1;
+
+ /* Initialize hash. */
+ for (i = 0; i < UCSMAP_HASH_SIZE; i++) {
+ ctx->hash[i].entry = NULL;
+ ctx->hash[i].n = 0;
+ }
+
+ if (ctx->nentries == 0)
+ return;
+
+ /* Sort entries by the hash value and code point. */
+ qsort(ctx->entries, ctx->nentries, sizeof(ucsmap_entry_t), comp_entry);
+
+ /*
+ * Now the entries are sorted by their hash value, and
+ * sorted by its code point among the ones with the same hash value.
+ */
+
+ /* Build hash table. */
+ last_hidx = -1;
+ for (i = 0, e = ctx->entries; i < ctx->nentries; i++, e++) {
+ if (e->hidx != last_hidx) {
+ ctx->hash[e->hidx].entry = e;
+ last_hidx = e->hidx;
+ }
+ ctx->hash[last_hidx].n++;
+ }
+}
+
+idn_result_t
+idn_ucsmap_map(idn_ucsmap_t ctx, unsigned long v, unsigned long *to,
+ size_t tolen, size_t *maplenp) {
+ int hash;
+ ucsmap_entry_t *e;
+ int n;
+ int hi, lo, mid;
+
+ assert(ctx != NULL && ctx->refcnt > 0 && to != NULL &&
+ maplenp != NULL);
+
+ TRACE(("idn_ucsmap_map(v=U+%lX)\n", v));
+
+ if (!ctx->fixed) {
+ WARNING(("idn_ucsmap_map: not fixed yet\n"));
+ return (idn_failure);
+ }
+
+ /* First, look up hash table. */
+ hash = ucsmap_hash(v);
+ if ((n = ctx->hash[hash].n) == 0)
+ goto nomap;
+
+ /* Then do binary search. */
+ e = ctx->hash[hash].entry;
+ lo = 0;
+ hi = n - 1;
+ while (lo <= hi) {
+ mid = (lo + hi) / 2;
+ if (v < e[mid].ucs)
+ hi = mid - 1;
+ else if (v > e[mid].ucs)
+ lo = mid + 1;
+ else {
+ /* Found. */
+ if (tolen < e[mid].len)
+ return (idn_buffer_overflow);
+ memcpy(to, e[mid].map, sizeof(*to) * e[mid].len);
+ *maplenp = e[mid].len;
+ return (idn_success);
+ }
+ }
+
+ /*
+ * Not found. Put the original character to 'to'
+ * just for convenience.
+ */
+ nomap:
+ if (tolen < 1)
+ return (idn_buffer_overflow);
+ *to = v;
+ *maplenp = 1;
+ return (idn_nomapping);
+}
+
+static int
+ucsmap_hash(unsigned long v) {
+ return (v % UCSMAP_HASH_SIZE);
+}
+
+static unsigned long *
+save_mapped_sequence(idn_ucsmap_t ctx, unsigned long *map, size_t maplen) {
+ ucsmap_buf_t *buf;
+ unsigned long *p;
+ size_t allocsize;
+
+ /*
+ * If the current buffer (the first one in the ctx->mapdata list)
+ * has enough space, use it. Otherwise, allocate a new buffer and
+ * insert it at the beginning of the list.
+ */
+ if (ctx->mapdata_used + maplen > ctx->mapdata_size) {
+ if (maplen > DEFAULT_BUF_SIZE)
+ allocsize = maplen * 2;
+ else
+ allocsize = DEFAULT_BUF_SIZE;
+ buf = malloc(sizeof(ucsmap_hash_t) +
+ sizeof(unsigned long) * allocsize);
+ if (buf == NULL)
+ return (NULL);
+ buf->next = ctx->mapdata;
+ ctx->mapdata = buf;
+ ctx->mapdata_size = allocsize;
+ ctx->mapdata_used = 0;
+ }
+ p = ctx->mapdata->buf + ctx->mapdata_used;
+ memcpy(p, map, sizeof(unsigned long) * maplen);
+ ctx->mapdata_used += maplen;
+ return (p);
+}
+
+static void
+free_mapbuf(ucsmap_buf_t *buf) {
+ while (buf != NULL) {
+ ucsmap_buf_t *next = buf->next;
+ free(buf);
+ buf = next;
+ }
+}
+
+static int
+comp_entry(const void *v1, const void *v2) {
+ const ucsmap_entry_t *e1 = v1;
+ const ucsmap_entry_t *e2 = v2;
+
+ if (e1->hidx < e2->hidx)
+ return (-1);
+ else if (e1->hidx > e2->hidx)
+ return (1);
+ else if (e1->ucs < e2->ucs)
+ return (-1);
+ else if (e1->ucs > e2->ucs)
+ return (1);
+ else
+ return (0);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/ucsset.c b/contrib/idn/idnkit-1.0-src/lib/ucsset.c
new file mode 100644
index 0000000..76e2970
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/ucsset.c
@@ -0,0 +1,368 @@
+#ifndef lint
+static char *rcsid = "$Id: ucsset.c,v 1.1.1.1 2003/06/04 00:26:15 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <idn/result.h>
+#include <idn/assert.h>
+#include <idn/logmacro.h>
+#include <idn/ucsset.h>
+
+#define UCS_MAX 0x80000000UL
+
+#define INIT_SIZE 50
+
+/*
+ * Code point range.
+ *
+ * The set of code points is represented by an array of code point ranges.
+ * In the building phase, specified ranges by 'idn_ucsset_add' or
+ * 'idn_ucsset_addrange' are simply appended to the array.
+ * And 'idn_ucsset_fix' sorts the array by the code point value, and also
+ * merges any intersecting ranges. Since the array is sorted, a binary
+ * search can be used for looking up.
+ */
+typedef struct {
+ unsigned long from;
+ unsigned long to;
+} range_t;
+
+/*
+ * Code point segment.
+ *
+ * To speed up searching further, the entire region of UCS-4 code points
+ * (U+0000 - U+7FFFFFFF) are divided into segments. For each segment,
+ * the first and last element of the range array corresponding to the
+ * segment are computed by 'idn_ucsset_fix'. This narrows down the
+ * (initial) search range.
+ */
+typedef struct {
+ int range_start; /* index of ucsset.ranges */
+ int range_end; /* ditto */
+} segment_t;
+
+/*
+ * Code point to segment index conversion.
+ *
+ * Below is the function that maps a code point to the corresponding segment.
+ * The mapping is non-uniform, so that BMP, the following 16 planes that
+ * comprise Unicode code points together with BMP, and other planes
+ * have different granularity.
+ */
+#define SEG_THLD1 0x10000 /* BMP */
+#define SEG_THLD2 0x110000 /* Unicode (BMP+16planes) */
+#define SEG_SFT1 10 /* BMP: 1K code points/segment */
+#define SEG_SFT2 14 /* following 16 planes: 16K cp/seg */
+#define SEG_SFT3 24 /* rest: 16M cp/seg */
+#define SEG_OFF1 (SEG_THLD1 >> SEG_SFT1)
+#define SEG_OFF2 (((SEG_THLD2 - SEG_THLD1) >> SEG_SFT2) + SEG_OFF1)
+#define SEG_INDEX(v) \
+ (((v) < SEG_THLD1) ? ((v) >> SEG_SFT1) : \
+ ((v) < SEG_THLD2) ? ((((v) - SEG_THLD1) >> SEG_SFT2) + SEG_OFF1) : \
+ ((((v) - SEG_THLD2) >> SEG_SFT3) + SEG_OFF2))
+#define SEG_LEN (SEG_INDEX(UCS_MAX - 1) + 1)
+
+/*
+ * Representation of set of UCS code points.
+ */
+typedef struct idn_ucsset {
+ segment_t segments[SEG_LEN];
+ int fixed;
+ int size; /* allocated size of 'ranges' */
+ int nranges; /* num of ranges */
+ range_t *ranges;
+ int refcnt; /* reference count */
+} ucsset;
+
+static idn_result_t addrange(idn_ucsset_t ctx, unsigned long from,
+ unsigned long to, char *func_name);
+static int comp_range(const void *v1, const void *v2);
+
+idn_result_t
+idn_ucsset_create(idn_ucsset_t *ctx) {
+ idn_ucsset_t bm;
+
+ assert(ctx != NULL);
+
+ TRACE(("idn_ucsset_create()\n"));
+
+ if ((bm = malloc(sizeof(ucsset))) == NULL) {
+ WARNING(("idn_ucsset_create: malloc failed\n"));
+ return idn_nomemory;
+ }
+ bm->size = bm->nranges = 0;
+ bm->ranges = NULL;
+ bm->fixed = 0;
+ bm->refcnt = 1;
+ *ctx = bm;
+ return (idn_success);
+}
+
+void
+idn_ucsset_destroy(idn_ucsset_t ctx) {
+ assert(ctx != NULL && ctx->refcnt > 0);
+
+ TRACE(("idn_ucsset_destroy()\n"));
+
+ if (--ctx->refcnt == 0) {
+ if (ctx->ranges != NULL)
+ free(ctx->ranges);
+ free(ctx);
+ }
+}
+
+void
+idn_ucsset_incrref(idn_ucsset_t ctx) {
+ assert(ctx != NULL && ctx->refcnt > 0);
+
+ TRACE(("idn_ucsset_incrref()\n"));
+
+ ctx->refcnt++;
+}
+
+idn_result_t
+idn_ucsset_add(idn_ucsset_t ctx, unsigned long v) {
+ assert(ctx != NULL && ctx->refcnt > 0);
+
+ TRACE(("idn_ucsset_add(v=U+%lX)\n", v));
+
+ return (addrange(ctx, v, v, "idn_ucsset_add"));
+}
+
+idn_result_t
+idn_ucsset_addrange(idn_ucsset_t ctx, unsigned long from,
+ unsigned long to)
+{
+ assert(ctx != NULL && ctx->refcnt > 0);
+
+ TRACE(("idn_ucsset_addrange(from=U+%lX, to=U+%lX)\n",
+ from, to));
+
+ return (addrange(ctx, from, to, "idn_ucsset_addrange"));
+}
+
+void
+idn_ucsset_fix(idn_ucsset_t ctx) {
+ int nranges;
+ range_t *ranges;
+ segment_t *segments;
+ int i, j;
+
+ assert(ctx != NULL && ctx->refcnt > 0);
+
+ TRACE(("idn_ucsset_fix()\n"));
+
+ nranges = ctx->nranges;
+ ranges = ctx->ranges;
+ segments = ctx->segments;
+
+ if (ctx->fixed)
+ return;
+
+ ctx->fixed = 1;
+
+ /* Initialize segment array */
+ for (i = 0; i < SEG_LEN; i++) {
+ segments[i].range_start = -1;
+ segments[i].range_end = -1;
+ }
+
+ /* If the set is empty, there's nothing to be done. */
+ if (nranges == 0)
+ return;
+
+ /* Sort ranges. */
+ qsort(ranges, nranges, sizeof(range_t), comp_range);
+
+ /* Merge overlapped/continuous ranges. */
+ for (i = 0, j = 1; j < nranges; j++) {
+ if (ranges[i].to + 1 >= ranges[j].from) {
+ /* can be merged */
+ if (ranges[i].to < ranges[j].to) {
+ ranges[i].to = ranges[j].to;
+ }
+ } else {
+ i++;
+ if (i < j)
+ ranges[i] = ranges[j];
+ }
+ }
+ /* 'i' points the last range in the array. */
+ ctx->nranges = nranges = ++i;
+
+ /* Create segment array. */
+ for (i = 0; i < nranges; i++) {
+ int fidx = SEG_INDEX(ranges[i].from);
+ int tidx = SEG_INDEX(ranges[i].to);
+
+ for (j = fidx; j <= tidx; j++) {
+ if (segments[j].range_start < 0)
+ segments[j].range_start = i;
+ segments[j].range_end = i;
+ }
+ }
+
+#if 0
+ /*
+ * Does the standard guarantee realloc() always succeeds
+ * when shrinking?
+ */
+ /* Shrink malloc'ed space if possible. */
+ ctx->ranges = realloc(ctx->ranges, ctx->nranges * sizeof(range_t));
+#endif
+}
+
+idn_result_t
+idn_ucsset_lookup(idn_ucsset_t ctx, unsigned long v, int *found) {
+ int idx;
+ segment_t *segments;
+
+ assert(ctx != NULL && ctx->refcnt > 0 && found != NULL);
+
+ TRACE(("idn_ucsset_lookup(v=U+%lX)\n", v));
+
+ /* Make sure it is fixed. */
+ if (!ctx->fixed) {
+ WARNING(("idn_ucsset_lookup: not fixed yet\n"));
+ return (idn_failure);
+ }
+
+ /* Check the given code point. */
+ if (v >= UCS_MAX)
+ return (idn_invalid_codepoint);
+
+ /* Get the segment 'v' belongs to. */
+ segments = ctx->segments;
+ idx = SEG_INDEX(v);
+
+ /* Do binary search. */
+ *found = 0;
+ if (segments[idx].range_start >= 0) {
+ int lo = segments[idx].range_start;
+ int hi = segments[idx].range_end;
+ range_t *ranges = ctx->ranges;
+
+ while (lo <= hi) {
+ int mid = (lo + hi) / 2;
+ if (v < ranges[mid].from) {
+ hi = mid - 1;
+ } else if (v > ranges[mid].to) {
+ lo = mid + 1;
+ } else {
+ *found = 1;
+ break;
+ }
+ }
+ }
+ return (idn_success);
+}
+
+static idn_result_t
+addrange(idn_ucsset_t ctx, unsigned long from, unsigned long to,
+ char *func_name)
+{
+ range_t *newbuf;
+
+ /* Check the given code points. */
+ if (from > UCS_MAX) {
+ WARNING(("%s: code point out of range (U+%lX)\n",
+ func_name, from));
+ return (idn_invalid_codepoint);
+ } else if (to > UCS_MAX) {
+ WARNING(("%s: code point out of range (U+%lX)\n",
+ func_name, to));
+ return (idn_invalid_codepoint);
+ } else if (from > to) {
+ WARNING(("%s: invalid range spec (U+%lX-U+%lX)\n",
+ func_name, from, to));
+ return (idn_invalid_codepoint);
+ }
+
+ /* Make sure it is not fixed yet. */
+ if (ctx->fixed) {
+ WARNING(("%s: attempt to add to already fixed object\n",
+ func_name));
+ return (idn_failure);
+ }
+
+ /* Append the specified range to the 'ranges' array. */
+ if (ctx->nranges >= ctx->size) {
+ /* Make it bigger. */
+ if (ctx->size == 0)
+ ctx->size = INIT_SIZE;
+ else
+ ctx->size *= 2;
+ newbuf = realloc(ctx->ranges, ctx->size * sizeof(range_t));
+ if (newbuf == NULL)
+ return (idn_nomemory);
+ ctx->ranges = newbuf;
+ }
+ ctx->ranges[ctx->nranges].from = from;
+ ctx->ranges[ctx->nranges].to = to;
+ ctx->nranges++;
+
+ return (idn_success);
+}
+
+static int
+comp_range(const void *v1, const void *v2) {
+ /*
+ * Range comparation function suitable for qsort().
+ */
+ const range_t *r1 = v1;
+ const range_t *r2 = v2;
+
+ if (r1->from < r2->from)
+ return (-1);
+ else if (r1->from > r2->from)
+ return (1);
+ else
+ return (0);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/unicode.c b/contrib/idn/idnkit-1.0-src/lib/unicode.c
new file mode 100644
index 0000000..b584b8f
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/unicode.c
@@ -0,0 +1,309 @@
+#ifndef lint
+static char *rcsid = "$Id: unicode.c,v 1.1.1.1 2003/06/04 00:26:16 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000,2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <idn/result.h>
+#include <idn/logmacro.h>
+#include <idn/assert.h>
+#include <idn/unicode.h>
+
+#define UNICODE_CURRENT "3.2.0"
+
+#define UCS_MAX 0x10ffff
+#define END_BIT 0x80000000
+
+/*
+ * Some constants for Hangul decomposition/composition.
+ */
+#define SBase 0xac00
+#define LBase 0x1100
+#define VBase 0x1161
+#define TBase 0x11a7
+#define LCount 19
+#define VCount 21
+#define TCount 28
+#define SLast (SBase + LCount * VCount * TCount)
+
+/*
+ * Symbol composition macro.
+ */
+#define compose_sym(a, b) compose_symX(a, b)
+#define compose_symX(a, b) a ## b
+
+struct composition {
+ unsigned long c2; /* 2nd character */
+ unsigned long comp; /* composed character */
+};
+
+#include "unicodedata_320.c"
+#define VERSION v320
+#include "unicode_template.c"
+#undef VERSION
+
+typedef int (*unicode_canonclassproc)(unsigned long v);
+typedef int (*unicode_decomposeproc)(unsigned long c,
+ const unsigned long **seqp);
+typedef int (*unicode_composeproc)(unsigned long c,
+ const struct composition **compp);
+
+static struct idn__unicode_ops {
+ char *version;
+ unicode_canonclassproc canonclass_proc;
+ unicode_decomposeproc decompose_proc;
+ unicode_composeproc compose_proc;
+} unicode_versions[] = {
+#define MAKE_UNICODE_HANDLE(version, suffix) \
+ { version, \
+ compose_sym(canonclass_, suffix), \
+ compose_sym(decompose_, suffix), \
+ compose_sym(compose_, suffix) }
+ MAKE_UNICODE_HANDLE("3.2.0", v320),
+ { NULL },
+#undef MAKE_UNICODE_HANDLE
+};
+
+idn_result_t
+idn__unicode_create(const char *version,
+ idn__unicode_version_t *versionp) {
+ idn__unicode_version_t v;
+
+ assert(versionp != NULL);
+ TRACE(("idn__unicode_create(version=%-.50s)\n",
+ version == NULL ? "<NULL>" : version));
+
+ if (version == NULL)
+ version = UNICODE_CURRENT;
+
+ for (v = unicode_versions; v->version != NULL; v++) {
+ if (strcmp(v->version, version) == 0) {
+ *versionp = v;
+ return (idn_success);
+ }
+ }
+ return (idn_notfound);
+}
+
+void
+idn__unicode_destroy(idn__unicode_version_t version) {
+ assert(version != NULL);
+ TRACE(("idn__unicode_destroy()\n"));
+ /* Nothing to do */
+}
+
+int
+idn__unicode_canonicalclass(idn__unicode_version_t version, unsigned long c) {
+ if (c > UCS_MAX)
+ return (0);
+
+ return (*version->canonclass_proc)(c);
+}
+
+idn_result_t
+idn__unicode_decompose(idn__unicode_version_t version,
+ int compat, unsigned long *v, size_t vlen,
+ unsigned long c, int *decomp_lenp) {
+ unsigned long *vorg = v;
+ int seqidx;
+ const unsigned long *seq;
+
+ assert(v != NULL && vlen >= 0 && decomp_lenp != NULL);
+
+ if (c > UCS_MAX)
+ return (idn_notfound);
+
+ /*
+ * First, check for Hangul.
+ */
+ if (SBase <= c && c < SLast) {
+ int idx, t_offset, v_offset, l_offset;
+
+ idx = c - SBase;
+ t_offset = idx % TCount;
+ idx /= TCount;
+ v_offset = idx % VCount;
+ l_offset = idx / VCount;
+ if ((t_offset == 0 && vlen < 2) || (t_offset > 0 && vlen < 3))
+ return (idn_buffer_overflow);
+ *v++ = LBase + l_offset;
+ *v++ = VBase + v_offset;
+ if (t_offset > 0)
+ *v++ = TBase + t_offset;
+ *decomp_lenp = v - vorg;
+ return (idn_success);
+ }
+
+ /*
+ * Look up decomposition table. If no decomposition is defined
+ * or if it is a compatibility decomosition when canonical
+ * decomposition requested, return 'idn_notfound'.
+ */
+ seqidx = (*version->decompose_proc)(c, &seq);
+ if (seqidx == 0 || (compat == 0 && (seqidx & DECOMP_COMPAT) != 0))
+ return (idn_notfound);
+
+ /*
+ * Copy the decomposed sequence. The end of the sequence are
+ * marked with END_BIT.
+ */
+ do {
+ unsigned long c;
+ int dlen;
+ idn_result_t r;
+
+ c = *seq & ~END_BIT;
+
+ /* Decompose recursively. */
+ r = idn__unicode_decompose(version, compat, v, vlen, c, &dlen);
+ if (r == idn_success) {
+ v += dlen;
+ vlen -= dlen;
+ } else if (r == idn_notfound) {
+ if (vlen < 1)
+ return (idn_buffer_overflow);
+ *v++ = c;
+ vlen--;
+ } else {
+ return (r);
+ }
+
+ } while ((*seq++ & END_BIT) == 0);
+
+ *decomp_lenp = v - vorg;
+
+ return (idn_success);
+}
+
+int
+idn__unicode_iscompositecandidate(idn__unicode_version_t version,
+ unsigned long c) {
+ const struct composition *dummy;
+
+ if (c > UCS_MAX)
+ return (0);
+
+ /* Check for Hangul */
+ if ((LBase <= c && c < LBase + LCount) || (SBase <= c && c < SLast))
+ return (1);
+
+ /*
+ * Look up composition table. If there are no composition
+ * that begins with the given character, it is not a
+ * composition candidate.
+ */
+ if ((*version->compose_proc)(c, &dummy) == 0)
+ return (0);
+ else
+ return (1);
+}
+
+idn_result_t
+idn__unicode_compose(idn__unicode_version_t version, unsigned long c1,
+ unsigned long c2, unsigned long *compp) {
+ int n;
+ int lo, hi;
+ const struct composition *cseq;
+
+ assert(compp != NULL);
+
+ if (c1 > UCS_MAX || c2 > UCS_MAX)
+ return (idn_notfound);
+
+ /*
+ * Check for Hangul.
+ */
+ if (LBase <= c1 && c1 < LBase + LCount &&
+ VBase <= c2 && c2 < VBase + VCount) {
+ /*
+ * Hangul L and V.
+ */
+ *compp = SBase +
+ ((c1 - LBase) * VCount + (c2 - VBase)) * TCount;
+ return (idn_success);
+ } else if (SBase <= c1 && c1 < SLast &&
+ TBase <= c2 && c2 < TBase + TCount &&
+ (c1 - SBase) % TCount == 0) {
+ /*
+ * Hangul LV and T.
+ */
+ *compp = c1 + (c2 - TBase);
+ return (idn_success);
+ }
+
+ /*
+ * Look up composition table. If the result is 0, no composition
+ * is defined. Otherwise, upper 16bits of the result contains
+ * the number of composition that begins with 'c1', and the lower
+ * 16bits is the offset in 'compose_seq'.
+ */
+ if ((n = (*version->compose_proc)(c1, &cseq)) == 0)
+ return (idn_notfound);
+
+ /*
+ * The composite sequences are sorted by the 2nd character 'c2'.
+ * So we can use binary search.
+ */
+ lo = 0;
+ hi = n - 1;
+ while (lo <= hi) {
+ int mid = (lo + hi) / 2;
+
+ if (cseq[mid].c2 < c2) {
+ lo = mid + 1;
+ } else if (cseq[mid].c2 > c2) {
+ hi = mid - 1;
+ } else {
+ *compp = cseq[mid].comp;
+ return (idn_success);
+ }
+ }
+ return (idn_notfound);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/unicode_template.c b/contrib/idn/idnkit-1.0-src/lib/unicode_template.c
new file mode 100644
index 0000000..12ce571
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/unicode_template.c
@@ -0,0 +1,101 @@
+/* $Id: unicode_template.c,v 1.1.1.1 2003/06/04 00:26:16 marka Exp $ */
+
+/*
+ * Copyright (c) 2000,2001 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef UNICODE_TEMPLATE_INIT
+#define UNICODE_TEMPLATE_INIT
+
+/*
+ * Macro for multi-level index table.
+ */
+#define LOOKUPTBL(vprefix, mprefix, v) \
+ DMAP(vprefix)[\
+ IMAP(vprefix)[\
+ IMAP(vprefix)[IDX0(mprefix, v)] + IDX1(mprefix, v)\
+ ]\
+ ].tbl[IDX2(mprefix, v)]
+
+#define IDX0(mprefix, v) IDX_0(v, BITS1(mprefix), BITS2(mprefix))
+#define IDX1(mprefix, v) IDX_1(v, BITS1(mprefix), BITS2(mprefix))
+#define IDX2(mprefix, v) IDX_2(v, BITS1(mprefix), BITS2(mprefix))
+
+#define IDX_0(v, bits1, bits2) ((v) >> ((bits1) + (bits2)))
+#define IDX_1(v, bits1, bits2) (((v) >> (bits2)) & ((1 << (bits1)) - 1))
+#define IDX_2(v, bits1, bits2) ((v) & ((1 << (bits2)) - 1))
+
+#define BITS1(mprefix) mprefix ## _BITS_1
+#define BITS2(mprefix) mprefix ## _BITS_2
+
+#define IMAP(vprefix) concat4(VERSION, _, vprefix, _imap)
+#define DMAP(vprefix) concat4(VERSION, _, vprefix, _table)
+#define SEQ(vprefix) concat4(VERSION, _, vprefix, _seq)
+#define concat4(a,b,c,d) concat4X(a, b, c, d)
+#define concat4X(a,b,c,d) a ## b ## c ## d
+
+#endif /* UNICODE_TEMPLATE_INIT */
+
+static int
+compose_sym(canonclass_, VERSION) (unsigned long c) {
+ /* Look up canonicalclass table. */
+ return (LOOKUPTBL(canon_class, CANON_CLASS, c));
+}
+
+static int
+compose_sym(decompose_, VERSION) (unsigned long c, const unsigned long **seqp)
+{
+ /* Look up decomposition table. */
+ int seqidx = LOOKUPTBL(decompose, DECOMP, c);
+ *seqp = SEQ(decompose) + (seqidx & ~DECOMP_COMPAT);
+ return (seqidx);
+}
+
+static int
+compose_sym(compose_, VERSION) (unsigned long c,
+ const struct composition **compp)
+{
+ /* Look up composition table. */
+ int seqidx = LOOKUPTBL(compose, CANON_COMPOSE, c);
+ *compp = SEQ(compose) + (seqidx & 0xffff);
+ return (seqidx >> 16);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/unicodedata_320.c b/contrib/idn/idnkit-1.0-src/lib/unicodedata_320.c
new file mode 100644
index 0000000..64370e8
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/unicodedata_320.c
@@ -0,0 +1,7916 @@
+/* $Id: unicodedata_320.c,v 1.1.1.1 2003/06/04 00:26:43 marka Exp $ */
+/* $-Id: generate_normalize_data.pl,v 1.8 2001/10/31 08:51:30 m-kasahr Exp -$ */
+/*
+ * Do not edit this file!
+ * This file is generated from UnicodeData.txt, CompositionExclusions-1.txt,
+ * SpecialCasing.txt and CaseFolding.txt.
+ */
+
+
+/*
+ * Canonical Class
+ */
+
+#define CANON_CLASS_BITS_0 9
+#define CANON_CLASS_BITS_1 7
+#define CANON_CLASS_BITS_2 5
+
+static const unsigned short v320_canon_class_imap[] = {
+ 272, 400, 528, 656, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 912,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 1040, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 3, 4, 0, 0, 0, 0,
+ 0, 0, 0, 0, 5, 0, 0, 0,
+ 0, 0, 0, 0, 6, 7, 8, 0,
+ 0, 0, 9, 10, 0, 0, 11, 12,
+ 13, 14, 15, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 16, 17, 0, 0, 16, 18, 0,
+ 0, 16, 18, 0, 0, 16, 18, 0,
+ 0, 16, 18, 0, 0, 0, 18, 0,
+ 0, 0, 19, 0, 0, 0, 18, 0,
+ 0, 0, 18, 0, 0, 0, 20, 0,
+ 0, 21, 22, 0, 0, 23, 24, 0,
+ 25, 26, 0, 27, 28, 0, 29, 0,
+ 0, 30, 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, 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, 0, 0,
+ 31, 31, 0, 0, 0, 0, 32, 0,
+ 0, 0, 0, 0, 0, 33, 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,
+ 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, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 34, 35,
+ 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, 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, 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, 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,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 36, 0, 0, 37, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0,
+ 38, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 39, 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, 40, 41, 42, 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,
+ 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, 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, 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, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+static const struct {
+ unsigned char tbl[32];
+} v320_canon_class_table[] = {
+ {{
+ 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, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
+ 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 232,
+ 220, 220, 220, 220, 232, 216, 220, 220, 220, 220,
+ }},
+ {{
+ 220, 202, 202, 220, 220, 220, 220, 202, 202, 220, 220,
+ 220, 220, 220, 220, 220, 220, 220, 220, 220, 1, 1,
+ 1, 1, 1, 220, 220, 220, 220, 230, 230, 230,
+ }},
+ {{
+ 230, 230, 230, 230, 230, 240, 230, 220, 220, 220, 230,
+ 230, 230, 220, 220, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 234, 234, 233, 230, 230, 230, 230, 230, 230, 230, 230,
+ 230, 230, 230, 230, 230, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 230, 230, 230, 230, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 220, 230, 230, 230, 230,
+ 220, 230, 230, 230, 222, 220, 230, 230, 230, 230,
+ }},
+ {{
+ 230, 230, 0, 220, 220, 220, 220, 220, 230, 230, 220,
+ 230, 230, 222, 228, 230, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 0, 20, 21, 22, 0, 23,
+ }},
+ {{
+ 0, 24, 25, 0, 230, 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, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 27, 28, 29, 30, 31, 32, 33, 34, 230, 230, 220,
+ 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, 35, 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,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 230, 230, 230, 230, 230, 230, 230, 0, 0, 230,
+ }},
+ {{
+ 230, 230, 230, 220, 230, 0, 0, 230, 230, 0, 220,
+ 230, 230, 220, 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, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 36, 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, 0, 0, 0, 0, 230, 220, 230, 230, 220, 230,
+ 230, 220, 220, 220, 230, 220, 220, 230, 220, 230,
+ }},
+ {{
+ 230, 230, 220, 230, 220, 230, 220, 230, 220, 230, 230,
+ 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, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 7, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 9, 0, 0, 0, 230, 220, 230, 230, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 9, 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, 0, 0, 0,
+ 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 84,
+ 91, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,
+ 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, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 103, 103, 9, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 107, 107, 107,
+ 107, 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, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 118, 118, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 122, 122, 122,
+ 122, 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, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 220, 220, 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, 0, 220,
+ 0, 220, 0, 216, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 129, 130, 0, 132, 0,
+ 0, 0, 0, 0, 130, 130, 130, 130, 0, 0,
+ }},
+ {{
+ 130, 0, 230, 230, 9, 0, 230, 230, 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, 0, 0, 0, 0, 220, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 7, 0, 9, 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, 9, 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, 0, 0, 0, 9, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 228, 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, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 230, 230, 1, 1, 230, 230,
+ 230, 230, 1, 1, 1, 230, 230, 0, 0, 0,
+ }},
+ {{
+ 0, 230, 0, 0, 0, 1, 1, 230, 220, 230, 1,
+ 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, 0, 0, 0, 0, 0, 218,
+ 228, 232, 222, 224, 224, 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, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 8, 8, 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, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 26, 0,
+ }},
+ {{
+ 230, 230, 230, 230, 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, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 216, 216, 1, 1, 1, 0,
+ 0, 0, 226, 216, 216, 216, 216, 216, 0, 0, 0,
+ 0, 0, 0, 0, 0, 220, 220, 220, 220, 220,
+ }},
+ {{
+ 220, 220, 220, 0, 0, 230, 230, 230, 230, 230, 220,
+ 220, 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, 0, 0, 0, 0, 230,
+ 230, 230, 230, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+};
+
+/*
+ * Canonical Composition
+ */
+
+#define CANON_COMPOSE_BITS_0 9
+#define CANON_COMPOSE_BITS_1 7
+#define CANON_COMPOSE_BITS_2 5
+
+static const unsigned short v320_compose_imap[] = {
+ 272, 400, 528, 656, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 0, 1, 2, 3, 0, 4, 5, 6,
+ 7, 0, 8, 9, 0, 10, 0, 11,
+ 0, 12, 0, 0, 13, 0, 0, 0,
+ 0, 0, 0, 0, 14, 15, 16, 0,
+ 17, 18, 19, 20, 0, 0, 21, 22,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 23, 24, 0, 0, 0, 25, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 26, 0, 0, 0, 0, 27, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 28, 0, 29, 0, 30, 0,
+ 0, 0, 31, 0, 0, 32, 33, 0,
+ 0, 0, 34, 0, 0, 0, 35, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 36, 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, 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, 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,
+ 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, 0, 0, 0, 0, 0, 0,
+ 0, 37, 38, 39, 0, 40, 41, 0,
+ 42, 43, 44, 45, 0, 46, 47, 48,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 49, 0, 50, 0,
+ 51, 52, 53, 54, 55, 56, 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,
+ 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, 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, 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, 0, 0,
+ 0, 0, 57, 58, 59, 60, 61, 62,
+ 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, 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, 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, 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,
+ 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, 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, 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, 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,
+ 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, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+static const struct {
+ unsigned long tbl[32];
+} v320_compose_table[] = {
+ {{
+ 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, 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, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 65537, 65538, 65539, 0,
+ }},
+ {{
+ 0, 1048580, 196628, 327703, 393244, 1114146, 65587,
+ 458804, 458811, 983106, 65617, 327762, 393303, 196701,
+ 589920, 1048681, 131193, 0, 524411, 458883, 458890,
+ 1245329, 131236, 393382, 131244, 589998, 393399, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 0, 1048765, 196813, 327888, 393429, 1114331, 65772,
+ 458989, 524532, 917756, 131338, 327948, 393489, 196887,
+ 590106, 1048867, 131379, 0, 524597, 459069, 524612,
+ 1245516, 131423, 459105, 131432, 655722, 393588, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 196986, 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, 262525, 0, 65921, 65922, 131459,
+ 65925, 0, 0, 262534, 0, 0, 0,
+ 0, 65930, 0, 0, 0, 0, 262539,
+ 197007, 65938, 0, 65939, 0, 0, 0,
+ 262548, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 262552, 0, 65948, 65949, 131486,
+ 65952, 0, 0, 262561, 0, 0, 0,
+ 0, 65957, 0, 0, 0, 0, 262566,
+ 197034, 65965, 0, 65966, 0, 0, 0,
+ 262575, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 262579, 262583, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 131515, 131517, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 131519, 131521,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 65987, 65988,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 65989, 65990, 0, 0, 0, 0, 0,
+ 0, 65991, 65992, 65993, 65994, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 65995,
+ }},
+ {{
+ 328140, 328145, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 328150, 328155, 0, 0, 0, 0,
+ 0, 0, 66016, 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 66017, 66018, 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, 66019,
+ 66020, 66021, 66022, 0, 0, 0, 0,
+ 66023, 66024, 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, 0, 0, 0, 0,
+ 0, 0, 0, 0, 66025, 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, 0,
+ 0, 0, 0, 459242, 0, 0, 0,
+ 262641, 0, 328181, 0, 459258, 0, 0,
+ 0, 0, 0, 262657,
+ }},
+ {{
+ 0, 66053, 0, 0, 0, 393734, 0,
+ 0, 0, 328204, 0, 0, 66065, 0,
+ 66066, 0, 0, 524819, 0, 0, 0,
+ 262683, 0, 393759, 0, 524837, 0, 0,
+ 0, 0, 0, 262701,
+ }},
+ {{
+ 0, 131633, 0, 0, 0, 524851, 0,
+ 0, 0, 393787, 197185, 197188, 0, 0,
+ 66119, 0, 0, 0, 131656, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 66122,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 131659, 0, 0, 66125, 0,
+ 197198, 131665, 66131, 262740, 0, 66136, 0,
+ 0, 0, 66137, 0,
+ }},
+ {{
+ 0, 0, 0, 262746, 0, 0, 0,
+ 66142, 0, 0, 0, 66143, 0, 66144,
+ 0, 0, 131681, 0, 0, 66147, 0,
+ 197220, 131687, 66153, 262762, 0, 66158, 0,
+ 0, 0, 66159, 0,
+ }},
+ {{
+ 0, 0, 0, 262768, 0, 0, 0,
+ 66164, 0, 0, 0, 66165, 0, 66166,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 66167, 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, 0, 0, 0, 66168,
+ 66169, 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, 0, 0, 0, 0, 0,
+ 0, 0, 0, 66170, 66171, 0, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 66172, 66173, 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, 0, 0, 0,
+ 197246, 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, 0, 0, 0, 0, 0,
+ 0, 66177, 0, 66178, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 0, 66179, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 66180, 0, 0,
+ 66181, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 66182, 0, 0, 0, 0, 0,
+ 0, 0, 66183, 0, 0, 66184, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0,
+ 131721, 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, 0, 0, 0, 0, 0,
+ 197259, 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, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 66190, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 131727,
+ 66193, 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, 0, 0, 0, 0, 66194,
+ 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, 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, 0,
+ 0, 0, 0, 66195,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 197268,
+ 0, 0, 0, 66199, 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, 0, 131736,
+ 66202, 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, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 197275, 0, 0,
+ 66206, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 66207, 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,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 66208, 66209, 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, 0, 0, 0,
+ 0, 0, 0, 0, 0, 66210, 66211,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 66212, 66213, 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, 0, 0,
+ }},
+ {{
+ 131750, 131752, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 66218, 66219, 0, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 66220, 66221,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 262830, 262834, 66230, 66231, 66232, 66233, 66234,
+ 66235, 262844, 262848, 66244, 66245, 66246, 66247,
+ 66248, 66249, 131786, 131788, 0, 0, 0,
+ 0, 0, 0, 131790, 131792, 0, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 262866, 262870, 66266, 66267, 66268, 66269, 66270,
+ 66271, 262880, 262884, 66280, 66281, 66282, 66283,
+ 66284, 66285, 197358, 197361, 0, 0, 0,
+ 0, 0, 0, 197364, 197367, 0, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 131834, 131836, 0, 0, 0, 0, 0,
+ 0, 131838, 131840, 0, 0, 0, 0,
+ 0, 0, 197378, 197381, 0, 0, 0,
+ 0, 0, 0, 0, 197384, 0, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 262923, 262927, 66323, 66324, 66325, 66326, 66327,
+ 66328, 262937, 262941, 66337, 66338, 66339, 66340,
+ 66341, 66342, 66343, 0, 0, 0, 66344,
+ 0, 0, 0, 0, 0, 0, 0,
+ 66345, 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, 66346, 0, 0, 0, 0, 0,
+ 0, 0, 0, 197419,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 66350,
+ 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, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 66351, 0, 0, 0, 0, 0,
+ 0, 0, 197424, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 66355, 0, 66356, 0, 66357,
+ 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, 0, 66358, 0, 66359, 0, 66360,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 66361, 0, 0, 0,
+ 0, 66362, 0, 0, 66363, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 66364, 0, 66365, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 66366, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 66367, 0, 66368, 0,
+ 0, 66369, 0, 0, 0, 0, 66370,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 0, 66371, 0, 0, 66372, 66373, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 66374, 66375, 0,
+ 0, 66376, 66377, 0, 0, 66378, 66379,
+ 66380, 66381, 0, 0,
+ }},
+ {{
+ 0, 0, 66382, 66383, 0, 0, 66384,
+ 66385, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 66386, 66387, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 66388, 0, 0, 0, 0,
+ 0, 66389, 66390, 0, 66391, 0, 0,
+ 0, 0, 0, 0, 66392, 66393, 66394,
+ 66395, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 66396,
+ 0, 0, 0, 0, 66397, 0, 66398,
+ 0, 66399, 0, 66400, 0, 66401, 0,
+ 66402, 0, 66403, 0, 66404, 0, 66405,
+ 0, 66406, 0, 66407,
+ }},
+ {{
+ 0, 66408, 0, 0, 66409, 0, 66410,
+ 0, 66411, 0, 0, 0, 0, 0,
+ 0, 131948, 0, 0, 131950, 0, 0,
+ 131952, 0, 0, 131954, 0, 0, 131956,
+ 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, 0, 0, 0, 0, 0, 0,
+ 0, 66422, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 66423,
+ 0, 0, 0, 0, 66424, 0, 66425,
+ 0, 66426, 0, 66427, 0, 66428, 0,
+ 66429, 0, 66430, 0, 66431, 0, 66432,
+ 0, 66433, 0, 66434,
+ }},
+ {{
+ 0, 66435, 0, 0, 66436, 0, 66437,
+ 0, 66438, 0, 0, 0, 0, 0,
+ 0, 131975, 0, 0, 131977, 0, 0,
+ 131979, 0, 0, 131981, 0, 0, 131983,
+ 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 66449, 66450, 66451, 66452, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 66453, 0, 0,
+ }},
+};
+
+static const struct composition v320_compose_seq[] = {
+ { 0x00000000, 0x00000000 }, { 0x00000338, 0x0000226e },
+ { 0x00000338, 0x00002260 }, { 0x00000338, 0x0000226f },
+ { 0x00000300, 0x000000c0 }, { 0x00000301, 0x000000c1 },
+ { 0x00000302, 0x000000c2 }, { 0x00000303, 0x000000c3 },
+ { 0x00000304, 0x00000100 }, { 0x00000306, 0x00000102 },
+ { 0x00000307, 0x00000226 }, { 0x00000308, 0x000000c4 },
+ { 0x00000309, 0x00001ea2 }, { 0x0000030a, 0x000000c5 },
+ { 0x0000030c, 0x000001cd }, { 0x0000030f, 0x00000200 },
+ { 0x00000311, 0x00000202 }, { 0x00000323, 0x00001ea0 },
+ { 0x00000325, 0x00001e00 }, { 0x00000328, 0x00000104 },
+ { 0x00000307, 0x00001e02 }, { 0x00000323, 0x00001e04 },
+ { 0x00000331, 0x00001e06 }, { 0x00000301, 0x00000106 },
+ { 0x00000302, 0x00000108 }, { 0x00000307, 0x0000010a },
+ { 0x0000030c, 0x0000010c }, { 0x00000327, 0x000000c7 },
+ { 0x00000307, 0x00001e0a }, { 0x0000030c, 0x0000010e },
+ { 0x00000323, 0x00001e0c }, { 0x00000327, 0x00001e10 },
+ { 0x0000032d, 0x00001e12 }, { 0x00000331, 0x00001e0e },
+ { 0x00000300, 0x000000c8 }, { 0x00000301, 0x000000c9 },
+ { 0x00000302, 0x000000ca }, { 0x00000303, 0x00001ebc },
+ { 0x00000304, 0x00000112 }, { 0x00000306, 0x00000114 },
+ { 0x00000307, 0x00000116 }, { 0x00000308, 0x000000cb },
+ { 0x00000309, 0x00001eba }, { 0x0000030c, 0x0000011a },
+ { 0x0000030f, 0x00000204 }, { 0x00000311, 0x00000206 },
+ { 0x00000323, 0x00001eb8 }, { 0x00000327, 0x00000228 },
+ { 0x00000328, 0x00000118 }, { 0x0000032d, 0x00001e18 },
+ { 0x00000330, 0x00001e1a }, { 0x00000307, 0x00001e1e },
+ { 0x00000301, 0x000001f4 }, { 0x00000302, 0x0000011c },
+ { 0x00000304, 0x00001e20 }, { 0x00000306, 0x0000011e },
+ { 0x00000307, 0x00000120 }, { 0x0000030c, 0x000001e6 },
+ { 0x00000327, 0x00000122 }, { 0x00000302, 0x00000124 },
+ { 0x00000307, 0x00001e22 }, { 0x00000308, 0x00001e26 },
+ { 0x0000030c, 0x0000021e }, { 0x00000323, 0x00001e24 },
+ { 0x00000327, 0x00001e28 }, { 0x0000032e, 0x00001e2a },
+ { 0x00000300, 0x000000cc }, { 0x00000301, 0x000000cd },
+ { 0x00000302, 0x000000ce }, { 0x00000303, 0x00000128 },
+ { 0x00000304, 0x0000012a }, { 0x00000306, 0x0000012c },
+ { 0x00000307, 0x00000130 }, { 0x00000308, 0x000000cf },
+ { 0x00000309, 0x00001ec8 }, { 0x0000030c, 0x000001cf },
+ { 0x0000030f, 0x00000208 }, { 0x00000311, 0x0000020a },
+ { 0x00000323, 0x00001eca }, { 0x00000328, 0x0000012e },
+ { 0x00000330, 0x00001e2c }, { 0x00000302, 0x00000134 },
+ { 0x00000301, 0x00001e30 }, { 0x0000030c, 0x000001e8 },
+ { 0x00000323, 0x00001e32 }, { 0x00000327, 0x00000136 },
+ { 0x00000331, 0x00001e34 }, { 0x00000301, 0x00000139 },
+ { 0x0000030c, 0x0000013d }, { 0x00000323, 0x00001e36 },
+ { 0x00000327, 0x0000013b }, { 0x0000032d, 0x00001e3c },
+ { 0x00000331, 0x00001e3a }, { 0x00000301, 0x00001e3e },
+ { 0x00000307, 0x00001e40 }, { 0x00000323, 0x00001e42 },
+ { 0x00000300, 0x000001f8 }, { 0x00000301, 0x00000143 },
+ { 0x00000303, 0x000000d1 }, { 0x00000307, 0x00001e44 },
+ { 0x0000030c, 0x00000147 }, { 0x00000323, 0x00001e46 },
+ { 0x00000327, 0x00000145 }, { 0x0000032d, 0x00001e4a },
+ { 0x00000331, 0x00001e48 }, { 0x00000300, 0x000000d2 },
+ { 0x00000301, 0x000000d3 }, { 0x00000302, 0x000000d4 },
+ { 0x00000303, 0x000000d5 }, { 0x00000304, 0x0000014c },
+ { 0x00000306, 0x0000014e }, { 0x00000307, 0x0000022e },
+ { 0x00000308, 0x000000d6 }, { 0x00000309, 0x00001ece },
+ { 0x0000030b, 0x00000150 }, { 0x0000030c, 0x000001d1 },
+ { 0x0000030f, 0x0000020c }, { 0x00000311, 0x0000020e },
+ { 0x0000031b, 0x000001a0 }, { 0x00000323, 0x00001ecc },
+ { 0x00000328, 0x000001ea }, { 0x00000301, 0x00001e54 },
+ { 0x00000307, 0x00001e56 }, { 0x00000301, 0x00000154 },
+ { 0x00000307, 0x00001e58 }, { 0x0000030c, 0x00000158 },
+ { 0x0000030f, 0x00000210 }, { 0x00000311, 0x00000212 },
+ { 0x00000323, 0x00001e5a }, { 0x00000327, 0x00000156 },
+ { 0x00000331, 0x00001e5e }, { 0x00000301, 0x0000015a },
+ { 0x00000302, 0x0000015c }, { 0x00000307, 0x00001e60 },
+ { 0x0000030c, 0x00000160 }, { 0x00000323, 0x00001e62 },
+ { 0x00000326, 0x00000218 }, { 0x00000327, 0x0000015e },
+ { 0x00000307, 0x00001e6a }, { 0x0000030c, 0x00000164 },
+ { 0x00000323, 0x00001e6c }, { 0x00000326, 0x0000021a },
+ { 0x00000327, 0x00000162 }, { 0x0000032d, 0x00001e70 },
+ { 0x00000331, 0x00001e6e }, { 0x00000300, 0x000000d9 },
+ { 0x00000301, 0x000000da }, { 0x00000302, 0x000000db },
+ { 0x00000303, 0x00000168 }, { 0x00000304, 0x0000016a },
+ { 0x00000306, 0x0000016c }, { 0x00000308, 0x000000dc },
+ { 0x00000309, 0x00001ee6 }, { 0x0000030a, 0x0000016e },
+ { 0x0000030b, 0x00000170 }, { 0x0000030c, 0x000001d3 },
+ { 0x0000030f, 0x00000214 }, { 0x00000311, 0x00000216 },
+ { 0x0000031b, 0x000001af }, { 0x00000323, 0x00001ee4 },
+ { 0x00000324, 0x00001e72 }, { 0x00000328, 0x00000172 },
+ { 0x0000032d, 0x00001e76 }, { 0x00000330, 0x00001e74 },
+ { 0x00000303, 0x00001e7c }, { 0x00000323, 0x00001e7e },
+ { 0x00000300, 0x00001e80 }, { 0x00000301, 0x00001e82 },
+ { 0x00000302, 0x00000174 }, { 0x00000307, 0x00001e86 },
+ { 0x00000308, 0x00001e84 }, { 0x00000323, 0x00001e88 },
+ { 0x00000307, 0x00001e8a }, { 0x00000308, 0x00001e8c },
+ { 0x00000300, 0x00001ef2 }, { 0x00000301, 0x000000dd },
+ { 0x00000302, 0x00000176 }, { 0x00000303, 0x00001ef8 },
+ { 0x00000304, 0x00000232 }, { 0x00000307, 0x00001e8e },
+ { 0x00000308, 0x00000178 }, { 0x00000309, 0x00001ef6 },
+ { 0x00000323, 0x00001ef4 }, { 0x00000301, 0x00000179 },
+ { 0x00000302, 0x00001e90 }, { 0x00000307, 0x0000017b },
+ { 0x0000030c, 0x0000017d }, { 0x00000323, 0x00001e92 },
+ { 0x00000331, 0x00001e94 }, { 0x00000300, 0x000000e0 },
+ { 0x00000301, 0x000000e1 }, { 0x00000302, 0x000000e2 },
+ { 0x00000303, 0x000000e3 }, { 0x00000304, 0x00000101 },
+ { 0x00000306, 0x00000103 }, { 0x00000307, 0x00000227 },
+ { 0x00000308, 0x000000e4 }, { 0x00000309, 0x00001ea3 },
+ { 0x0000030a, 0x000000e5 }, { 0x0000030c, 0x000001ce },
+ { 0x0000030f, 0x00000201 }, { 0x00000311, 0x00000203 },
+ { 0x00000323, 0x00001ea1 }, { 0x00000325, 0x00001e01 },
+ { 0x00000328, 0x00000105 }, { 0x00000307, 0x00001e03 },
+ { 0x00000323, 0x00001e05 }, { 0x00000331, 0x00001e07 },
+ { 0x00000301, 0x00000107 }, { 0x00000302, 0x00000109 },
+ { 0x00000307, 0x0000010b }, { 0x0000030c, 0x0000010d },
+ { 0x00000327, 0x000000e7 }, { 0x00000307, 0x00001e0b },
+ { 0x0000030c, 0x0000010f }, { 0x00000323, 0x00001e0d },
+ { 0x00000327, 0x00001e11 }, { 0x0000032d, 0x00001e13 },
+ { 0x00000331, 0x00001e0f }, { 0x00000300, 0x000000e8 },
+ { 0x00000301, 0x000000e9 }, { 0x00000302, 0x000000ea },
+ { 0x00000303, 0x00001ebd }, { 0x00000304, 0x00000113 },
+ { 0x00000306, 0x00000115 }, { 0x00000307, 0x00000117 },
+ { 0x00000308, 0x000000eb }, { 0x00000309, 0x00001ebb },
+ { 0x0000030c, 0x0000011b }, { 0x0000030f, 0x00000205 },
+ { 0x00000311, 0x00000207 }, { 0x00000323, 0x00001eb9 },
+ { 0x00000327, 0x00000229 }, { 0x00000328, 0x00000119 },
+ { 0x0000032d, 0x00001e19 }, { 0x00000330, 0x00001e1b },
+ { 0x00000307, 0x00001e1f }, { 0x00000301, 0x000001f5 },
+ { 0x00000302, 0x0000011d }, { 0x00000304, 0x00001e21 },
+ { 0x00000306, 0x0000011f }, { 0x00000307, 0x00000121 },
+ { 0x0000030c, 0x000001e7 }, { 0x00000327, 0x00000123 },
+ { 0x00000302, 0x00000125 }, { 0x00000307, 0x00001e23 },
+ { 0x00000308, 0x00001e27 }, { 0x0000030c, 0x0000021f },
+ { 0x00000323, 0x00001e25 }, { 0x00000327, 0x00001e29 },
+ { 0x0000032e, 0x00001e2b }, { 0x00000331, 0x00001e96 },
+ { 0x00000300, 0x000000ec }, { 0x00000301, 0x000000ed },
+ { 0x00000302, 0x000000ee }, { 0x00000303, 0x00000129 },
+ { 0x00000304, 0x0000012b }, { 0x00000306, 0x0000012d },
+ { 0x00000308, 0x000000ef }, { 0x00000309, 0x00001ec9 },
+ { 0x0000030c, 0x000001d0 }, { 0x0000030f, 0x00000209 },
+ { 0x00000311, 0x0000020b }, { 0x00000323, 0x00001ecb },
+ { 0x00000328, 0x0000012f }, { 0x00000330, 0x00001e2d },
+ { 0x00000302, 0x00000135 }, { 0x0000030c, 0x000001f0 },
+ { 0x00000301, 0x00001e31 }, { 0x0000030c, 0x000001e9 },
+ { 0x00000323, 0x00001e33 }, { 0x00000327, 0x00000137 },
+ { 0x00000331, 0x00001e35 }, { 0x00000301, 0x0000013a },
+ { 0x0000030c, 0x0000013e }, { 0x00000323, 0x00001e37 },
+ { 0x00000327, 0x0000013c }, { 0x0000032d, 0x00001e3d },
+ { 0x00000331, 0x00001e3b }, { 0x00000301, 0x00001e3f },
+ { 0x00000307, 0x00001e41 }, { 0x00000323, 0x00001e43 },
+ { 0x00000300, 0x000001f9 }, { 0x00000301, 0x00000144 },
+ { 0x00000303, 0x000000f1 }, { 0x00000307, 0x00001e45 },
+ { 0x0000030c, 0x00000148 }, { 0x00000323, 0x00001e47 },
+ { 0x00000327, 0x00000146 }, { 0x0000032d, 0x00001e4b },
+ { 0x00000331, 0x00001e49 }, { 0x00000300, 0x000000f2 },
+ { 0x00000301, 0x000000f3 }, { 0x00000302, 0x000000f4 },
+ { 0x00000303, 0x000000f5 }, { 0x00000304, 0x0000014d },
+ { 0x00000306, 0x0000014f }, { 0x00000307, 0x0000022f },
+ { 0x00000308, 0x000000f6 }, { 0x00000309, 0x00001ecf },
+ { 0x0000030b, 0x00000151 }, { 0x0000030c, 0x000001d2 },
+ { 0x0000030f, 0x0000020d }, { 0x00000311, 0x0000020f },
+ { 0x0000031b, 0x000001a1 }, { 0x00000323, 0x00001ecd },
+ { 0x00000328, 0x000001eb }, { 0x00000301, 0x00001e55 },
+ { 0x00000307, 0x00001e57 }, { 0x00000301, 0x00000155 },
+ { 0x00000307, 0x00001e59 }, { 0x0000030c, 0x00000159 },
+ { 0x0000030f, 0x00000211 }, { 0x00000311, 0x00000213 },
+ { 0x00000323, 0x00001e5b }, { 0x00000327, 0x00000157 },
+ { 0x00000331, 0x00001e5f }, { 0x00000301, 0x0000015b },
+ { 0x00000302, 0x0000015d }, { 0x00000307, 0x00001e61 },
+ { 0x0000030c, 0x00000161 }, { 0x00000323, 0x00001e63 },
+ { 0x00000326, 0x00000219 }, { 0x00000327, 0x0000015f },
+ { 0x00000307, 0x00001e6b }, { 0x00000308, 0x00001e97 },
+ { 0x0000030c, 0x00000165 }, { 0x00000323, 0x00001e6d },
+ { 0x00000326, 0x0000021b }, { 0x00000327, 0x00000163 },
+ { 0x0000032d, 0x00001e71 }, { 0x00000331, 0x00001e6f },
+ { 0x00000300, 0x000000f9 }, { 0x00000301, 0x000000fa },
+ { 0x00000302, 0x000000fb }, { 0x00000303, 0x00000169 },
+ { 0x00000304, 0x0000016b }, { 0x00000306, 0x0000016d },
+ { 0x00000308, 0x000000fc }, { 0x00000309, 0x00001ee7 },
+ { 0x0000030a, 0x0000016f }, { 0x0000030b, 0x00000171 },
+ { 0x0000030c, 0x000001d4 }, { 0x0000030f, 0x00000215 },
+ { 0x00000311, 0x00000217 }, { 0x0000031b, 0x000001b0 },
+ { 0x00000323, 0x00001ee5 }, { 0x00000324, 0x00001e73 },
+ { 0x00000328, 0x00000173 }, { 0x0000032d, 0x00001e77 },
+ { 0x00000330, 0x00001e75 }, { 0x00000303, 0x00001e7d },
+ { 0x00000323, 0x00001e7f }, { 0x00000300, 0x00001e81 },
+ { 0x00000301, 0x00001e83 }, { 0x00000302, 0x00000175 },
+ { 0x00000307, 0x00001e87 }, { 0x00000308, 0x00001e85 },
+ { 0x0000030a, 0x00001e98 }, { 0x00000323, 0x00001e89 },
+ { 0x00000307, 0x00001e8b }, { 0x00000308, 0x00001e8d },
+ { 0x00000300, 0x00001ef3 }, { 0x00000301, 0x000000fd },
+ { 0x00000302, 0x00000177 }, { 0x00000303, 0x00001ef9 },
+ { 0x00000304, 0x00000233 }, { 0x00000307, 0x00001e8f },
+ { 0x00000308, 0x000000ff }, { 0x00000309, 0x00001ef7 },
+ { 0x0000030a, 0x00001e99 }, { 0x00000323, 0x00001ef5 },
+ { 0x00000301, 0x0000017a }, { 0x00000302, 0x00001e91 },
+ { 0x00000307, 0x0000017c }, { 0x0000030c, 0x0000017e },
+ { 0x00000323, 0x00001e93 }, { 0x00000331, 0x00001e95 },
+ { 0x00000300, 0x00001fed }, { 0x00000301, 0x00000385 },
+ { 0x00000342, 0x00001fc1 }, { 0x00000300, 0x00001ea6 },
+ { 0x00000301, 0x00001ea4 }, { 0x00000303, 0x00001eaa },
+ { 0x00000309, 0x00001ea8 }, { 0x00000304, 0x000001de },
+ { 0x00000301, 0x000001fa }, { 0x00000301, 0x000001fc },
+ { 0x00000304, 0x000001e2 }, { 0x00000301, 0x00001e08 },
+ { 0x00000300, 0x00001ec0 }, { 0x00000301, 0x00001ebe },
+ { 0x00000303, 0x00001ec4 }, { 0x00000309, 0x00001ec2 },
+ { 0x00000301, 0x00001e2e }, { 0x00000300, 0x00001ed2 },
+ { 0x00000301, 0x00001ed0 }, { 0x00000303, 0x00001ed6 },
+ { 0x00000309, 0x00001ed4 }, { 0x00000301, 0x00001e4c },
+ { 0x00000304, 0x0000022c }, { 0x00000308, 0x00001e4e },
+ { 0x00000304, 0x0000022a }, { 0x00000301, 0x000001fe },
+ { 0x00000300, 0x000001db }, { 0x00000301, 0x000001d7 },
+ { 0x00000304, 0x000001d5 }, { 0x0000030c, 0x000001d9 },
+ { 0x00000300, 0x00001ea7 }, { 0x00000301, 0x00001ea5 },
+ { 0x00000303, 0x00001eab }, { 0x00000309, 0x00001ea9 },
+ { 0x00000304, 0x000001df }, { 0x00000301, 0x000001fb },
+ { 0x00000301, 0x000001fd }, { 0x00000304, 0x000001e3 },
+ { 0x00000301, 0x00001e09 }, { 0x00000300, 0x00001ec1 },
+ { 0x00000301, 0x00001ebf }, { 0x00000303, 0x00001ec5 },
+ { 0x00000309, 0x00001ec3 }, { 0x00000301, 0x00001e2f },
+ { 0x00000300, 0x00001ed3 }, { 0x00000301, 0x00001ed1 },
+ { 0x00000303, 0x00001ed7 }, { 0x00000309, 0x00001ed5 },
+ { 0x00000301, 0x00001e4d }, { 0x00000304, 0x0000022d },
+ { 0x00000308, 0x00001e4f }, { 0x00000304, 0x0000022b },
+ { 0x00000301, 0x000001ff }, { 0x00000300, 0x000001dc },
+ { 0x00000301, 0x000001d8 }, { 0x00000304, 0x000001d6 },
+ { 0x0000030c, 0x000001da }, { 0x00000300, 0x00001eb0 },
+ { 0x00000301, 0x00001eae }, { 0x00000303, 0x00001eb4 },
+ { 0x00000309, 0x00001eb2 }, { 0x00000300, 0x00001eb1 },
+ { 0x00000301, 0x00001eaf }, { 0x00000303, 0x00001eb5 },
+ { 0x00000309, 0x00001eb3 }, { 0x00000300, 0x00001e14 },
+ { 0x00000301, 0x00001e16 }, { 0x00000300, 0x00001e15 },
+ { 0x00000301, 0x00001e17 }, { 0x00000300, 0x00001e50 },
+ { 0x00000301, 0x00001e52 }, { 0x00000300, 0x00001e51 },
+ { 0x00000301, 0x00001e53 }, { 0x00000307, 0x00001e64 },
+ { 0x00000307, 0x00001e65 }, { 0x00000307, 0x00001e66 },
+ { 0x00000307, 0x00001e67 }, { 0x00000301, 0x00001e78 },
+ { 0x00000301, 0x00001e79 }, { 0x00000308, 0x00001e7a },
+ { 0x00000308, 0x00001e7b }, { 0x00000307, 0x00001e9b },
+ { 0x00000300, 0x00001edc }, { 0x00000301, 0x00001eda },
+ { 0x00000303, 0x00001ee0 }, { 0x00000309, 0x00001ede },
+ { 0x00000323, 0x00001ee2 }, { 0x00000300, 0x00001edd },
+ { 0x00000301, 0x00001edb }, { 0x00000303, 0x00001ee1 },
+ { 0x00000309, 0x00001edf }, { 0x00000323, 0x00001ee3 },
+ { 0x00000300, 0x00001eea }, { 0x00000301, 0x00001ee8 },
+ { 0x00000303, 0x00001eee }, { 0x00000309, 0x00001eec },
+ { 0x00000323, 0x00001ef0 }, { 0x00000300, 0x00001eeb },
+ { 0x00000301, 0x00001ee9 }, { 0x00000303, 0x00001eef },
+ { 0x00000309, 0x00001eed }, { 0x00000323, 0x00001ef1 },
+ { 0x0000030c, 0x000001ee }, { 0x00000304, 0x000001ec },
+ { 0x00000304, 0x000001ed }, { 0x00000304, 0x000001e0 },
+ { 0x00000304, 0x000001e1 }, { 0x00000306, 0x00001e1c },
+ { 0x00000306, 0x00001e1d }, { 0x00000304, 0x00000230 },
+ { 0x00000304, 0x00000231 }, { 0x0000030c, 0x000001ef },
+ { 0x00000300, 0x00001fba }, { 0x00000301, 0x00000386 },
+ { 0x00000304, 0x00001fb9 }, { 0x00000306, 0x00001fb8 },
+ { 0x00000313, 0x00001f08 }, { 0x00000314, 0x00001f09 },
+ { 0x00000345, 0x00001fbc }, { 0x00000300, 0x00001fc8 },
+ { 0x00000301, 0x00000388 }, { 0x00000313, 0x00001f18 },
+ { 0x00000314, 0x00001f19 }, { 0x00000300, 0x00001fca },
+ { 0x00000301, 0x00000389 }, { 0x00000313, 0x00001f28 },
+ { 0x00000314, 0x00001f29 }, { 0x00000345, 0x00001fcc },
+ { 0x00000300, 0x00001fda }, { 0x00000301, 0x0000038a },
+ { 0x00000304, 0x00001fd9 }, { 0x00000306, 0x00001fd8 },
+ { 0x00000308, 0x000003aa }, { 0x00000313, 0x00001f38 },
+ { 0x00000314, 0x00001f39 }, { 0x00000300, 0x00001ff8 },
+ { 0x00000301, 0x0000038c }, { 0x00000313, 0x00001f48 },
+ { 0x00000314, 0x00001f49 }, { 0x00000314, 0x00001fec },
+ { 0x00000300, 0x00001fea }, { 0x00000301, 0x0000038e },
+ { 0x00000304, 0x00001fe9 }, { 0x00000306, 0x00001fe8 },
+ { 0x00000308, 0x000003ab }, { 0x00000314, 0x00001f59 },
+ { 0x00000300, 0x00001ffa }, { 0x00000301, 0x0000038f },
+ { 0x00000313, 0x00001f68 }, { 0x00000314, 0x00001f69 },
+ { 0x00000345, 0x00001ffc }, { 0x00000345, 0x00001fb4 },
+ { 0x00000345, 0x00001fc4 }, { 0x00000300, 0x00001f70 },
+ { 0x00000301, 0x000003ac }, { 0x00000304, 0x00001fb1 },
+ { 0x00000306, 0x00001fb0 }, { 0x00000313, 0x00001f00 },
+ { 0x00000314, 0x00001f01 }, { 0x00000342, 0x00001fb6 },
+ { 0x00000345, 0x00001fb3 }, { 0x00000300, 0x00001f72 },
+ { 0x00000301, 0x000003ad }, { 0x00000313, 0x00001f10 },
+ { 0x00000314, 0x00001f11 }, { 0x00000300, 0x00001f74 },
+ { 0x00000301, 0x000003ae }, { 0x00000313, 0x00001f20 },
+ { 0x00000314, 0x00001f21 }, { 0x00000342, 0x00001fc6 },
+ { 0x00000345, 0x00001fc3 }, { 0x00000300, 0x00001f76 },
+ { 0x00000301, 0x000003af }, { 0x00000304, 0x00001fd1 },
+ { 0x00000306, 0x00001fd0 }, { 0x00000308, 0x000003ca },
+ { 0x00000313, 0x00001f30 }, { 0x00000314, 0x00001f31 },
+ { 0x00000342, 0x00001fd6 }, { 0x00000300, 0x00001f78 },
+ { 0x00000301, 0x000003cc }, { 0x00000313, 0x00001f40 },
+ { 0x00000314, 0x00001f41 }, { 0x00000313, 0x00001fe4 },
+ { 0x00000314, 0x00001fe5 }, { 0x00000300, 0x00001f7a },
+ { 0x00000301, 0x000003cd }, { 0x00000304, 0x00001fe1 },
+ { 0x00000306, 0x00001fe0 }, { 0x00000308, 0x000003cb },
+ { 0x00000313, 0x00001f50 }, { 0x00000314, 0x00001f51 },
+ { 0x00000342, 0x00001fe6 }, { 0x00000300, 0x00001f7c },
+ { 0x00000301, 0x000003ce }, { 0x00000313, 0x00001f60 },
+ { 0x00000314, 0x00001f61 }, { 0x00000342, 0x00001ff6 },
+ { 0x00000345, 0x00001ff3 }, { 0x00000300, 0x00001fd2 },
+ { 0x00000301, 0x00000390 }, { 0x00000342, 0x00001fd7 },
+ { 0x00000300, 0x00001fe2 }, { 0x00000301, 0x000003b0 },
+ { 0x00000342, 0x00001fe7 }, { 0x00000345, 0x00001ff4 },
+ { 0x00000301, 0x000003d3 }, { 0x00000308, 0x000003d4 },
+ { 0x00000308, 0x00000407 }, { 0x00000306, 0x000004d0 },
+ { 0x00000308, 0x000004d2 }, { 0x00000301, 0x00000403 },
+ { 0x00000300, 0x00000400 }, { 0x00000306, 0x000004d6 },
+ { 0x00000308, 0x00000401 }, { 0x00000306, 0x000004c1 },
+ { 0x00000308, 0x000004dc }, { 0x00000308, 0x000004de },
+ { 0x00000300, 0x0000040d }, { 0x00000304, 0x000004e2 },
+ { 0x00000306, 0x00000419 }, { 0x00000308, 0x000004e4 },
+ { 0x00000301, 0x0000040c }, { 0x00000308, 0x000004e6 },
+ { 0x00000304, 0x000004ee }, { 0x00000306, 0x0000040e },
+ { 0x00000308, 0x000004f0 }, { 0x0000030b, 0x000004f2 },
+ { 0x00000308, 0x000004f4 }, { 0x00000308, 0x000004f8 },
+ { 0x00000308, 0x000004ec }, { 0x00000306, 0x000004d1 },
+ { 0x00000308, 0x000004d3 }, { 0x00000301, 0x00000453 },
+ { 0x00000300, 0x00000450 }, { 0x00000306, 0x000004d7 },
+ { 0x00000308, 0x00000451 }, { 0x00000306, 0x000004c2 },
+ { 0x00000308, 0x000004dd }, { 0x00000308, 0x000004df },
+ { 0x00000300, 0x0000045d }, { 0x00000304, 0x000004e3 },
+ { 0x00000306, 0x00000439 }, { 0x00000308, 0x000004e5 },
+ { 0x00000301, 0x0000045c }, { 0x00000308, 0x000004e7 },
+ { 0x00000304, 0x000004ef }, { 0x00000306, 0x0000045e },
+ { 0x00000308, 0x000004f1 }, { 0x0000030b, 0x000004f3 },
+ { 0x00000308, 0x000004f5 }, { 0x00000308, 0x000004f9 },
+ { 0x00000308, 0x000004ed }, { 0x00000308, 0x00000457 },
+ { 0x0000030f, 0x00000476 }, { 0x0000030f, 0x00000477 },
+ { 0x00000308, 0x000004da }, { 0x00000308, 0x000004db },
+ { 0x00000308, 0x000004ea }, { 0x00000308, 0x000004eb },
+ { 0x00000653, 0x00000622 }, { 0x00000654, 0x00000623 },
+ { 0x00000655, 0x00000625 }, { 0x00000654, 0x00000624 },
+ { 0x00000654, 0x00000626 }, { 0x00000654, 0x000006c2 },
+ { 0x00000654, 0x000006d3 }, { 0x00000654, 0x000006c0 },
+ { 0x0000093c, 0x00000929 }, { 0x0000093c, 0x00000931 },
+ { 0x0000093c, 0x00000934 }, { 0x000009be, 0x000009cb },
+ { 0x000009d7, 0x000009cc }, { 0x00000b3e, 0x00000b4b },
+ { 0x00000b56, 0x00000b48 }, { 0x00000b57, 0x00000b4c },
+ { 0x00000bd7, 0x00000b94 }, { 0x00000bbe, 0x00000bca },
+ { 0x00000bd7, 0x00000bcc }, { 0x00000bbe, 0x00000bcb },
+ { 0x00000c56, 0x00000c48 }, { 0x00000cd5, 0x00000cc0 },
+ { 0x00000cc2, 0x00000cca }, { 0x00000cd5, 0x00000cc7 },
+ { 0x00000cd6, 0x00000cc8 }, { 0x00000cd5, 0x00000ccb },
+ { 0x00000d3e, 0x00000d4a }, { 0x00000d57, 0x00000d4c },
+ { 0x00000d3e, 0x00000d4b }, { 0x00000dca, 0x00000dda },
+ { 0x00000dcf, 0x00000ddc }, { 0x00000ddf, 0x00000dde },
+ { 0x00000dca, 0x00000ddd }, { 0x0000102e, 0x00001026 },
+ { 0x00000304, 0x00001e38 }, { 0x00000304, 0x00001e39 },
+ { 0x00000304, 0x00001e5c }, { 0x00000304, 0x00001e5d },
+ { 0x00000307, 0x00001e68 }, { 0x00000307, 0x00001e69 },
+ { 0x00000302, 0x00001eac }, { 0x00000306, 0x00001eb6 },
+ { 0x00000302, 0x00001ead }, { 0x00000306, 0x00001eb7 },
+ { 0x00000302, 0x00001ec6 }, { 0x00000302, 0x00001ec7 },
+ { 0x00000302, 0x00001ed8 }, { 0x00000302, 0x00001ed9 },
+ { 0x00000300, 0x00001f02 }, { 0x00000301, 0x00001f04 },
+ { 0x00000342, 0x00001f06 }, { 0x00000345, 0x00001f80 },
+ { 0x00000300, 0x00001f03 }, { 0x00000301, 0x00001f05 },
+ { 0x00000342, 0x00001f07 }, { 0x00000345, 0x00001f81 },
+ { 0x00000345, 0x00001f82 }, { 0x00000345, 0x00001f83 },
+ { 0x00000345, 0x00001f84 }, { 0x00000345, 0x00001f85 },
+ { 0x00000345, 0x00001f86 }, { 0x00000345, 0x00001f87 },
+ { 0x00000300, 0x00001f0a }, { 0x00000301, 0x00001f0c },
+ { 0x00000342, 0x00001f0e }, { 0x00000345, 0x00001f88 },
+ { 0x00000300, 0x00001f0b }, { 0x00000301, 0x00001f0d },
+ { 0x00000342, 0x00001f0f }, { 0x00000345, 0x00001f89 },
+ { 0x00000345, 0x00001f8a }, { 0x00000345, 0x00001f8b },
+ { 0x00000345, 0x00001f8c }, { 0x00000345, 0x00001f8d },
+ { 0x00000345, 0x00001f8e }, { 0x00000345, 0x00001f8f },
+ { 0x00000300, 0x00001f12 }, { 0x00000301, 0x00001f14 },
+ { 0x00000300, 0x00001f13 }, { 0x00000301, 0x00001f15 },
+ { 0x00000300, 0x00001f1a }, { 0x00000301, 0x00001f1c },
+ { 0x00000300, 0x00001f1b }, { 0x00000301, 0x00001f1d },
+ { 0x00000300, 0x00001f22 }, { 0x00000301, 0x00001f24 },
+ { 0x00000342, 0x00001f26 }, { 0x00000345, 0x00001f90 },
+ { 0x00000300, 0x00001f23 }, { 0x00000301, 0x00001f25 },
+ { 0x00000342, 0x00001f27 }, { 0x00000345, 0x00001f91 },
+ { 0x00000345, 0x00001f92 }, { 0x00000345, 0x00001f93 },
+ { 0x00000345, 0x00001f94 }, { 0x00000345, 0x00001f95 },
+ { 0x00000345, 0x00001f96 }, { 0x00000345, 0x00001f97 },
+ { 0x00000300, 0x00001f2a }, { 0x00000301, 0x00001f2c },
+ { 0x00000342, 0x00001f2e }, { 0x00000345, 0x00001f98 },
+ { 0x00000300, 0x00001f2b }, { 0x00000301, 0x00001f2d },
+ { 0x00000342, 0x00001f2f }, { 0x00000345, 0x00001f99 },
+ { 0x00000345, 0x00001f9a }, { 0x00000345, 0x00001f9b },
+ { 0x00000345, 0x00001f9c }, { 0x00000345, 0x00001f9d },
+ { 0x00000345, 0x00001f9e }, { 0x00000345, 0x00001f9f },
+ { 0x00000300, 0x00001f32 }, { 0x00000301, 0x00001f34 },
+ { 0x00000342, 0x00001f36 }, { 0x00000300, 0x00001f33 },
+ { 0x00000301, 0x00001f35 }, { 0x00000342, 0x00001f37 },
+ { 0x00000300, 0x00001f3a }, { 0x00000301, 0x00001f3c },
+ { 0x00000342, 0x00001f3e }, { 0x00000300, 0x00001f3b },
+ { 0x00000301, 0x00001f3d }, { 0x00000342, 0x00001f3f },
+ { 0x00000300, 0x00001f42 }, { 0x00000301, 0x00001f44 },
+ { 0x00000300, 0x00001f43 }, { 0x00000301, 0x00001f45 },
+ { 0x00000300, 0x00001f4a }, { 0x00000301, 0x00001f4c },
+ { 0x00000300, 0x00001f4b }, { 0x00000301, 0x00001f4d },
+ { 0x00000300, 0x00001f52 }, { 0x00000301, 0x00001f54 },
+ { 0x00000342, 0x00001f56 }, { 0x00000300, 0x00001f53 },
+ { 0x00000301, 0x00001f55 }, { 0x00000342, 0x00001f57 },
+ { 0x00000300, 0x00001f5b }, { 0x00000301, 0x00001f5d },
+ { 0x00000342, 0x00001f5f }, { 0x00000300, 0x00001f62 },
+ { 0x00000301, 0x00001f64 }, { 0x00000342, 0x00001f66 },
+ { 0x00000345, 0x00001fa0 }, { 0x00000300, 0x00001f63 },
+ { 0x00000301, 0x00001f65 }, { 0x00000342, 0x00001f67 },
+ { 0x00000345, 0x00001fa1 }, { 0x00000345, 0x00001fa2 },
+ { 0x00000345, 0x00001fa3 }, { 0x00000345, 0x00001fa4 },
+ { 0x00000345, 0x00001fa5 }, { 0x00000345, 0x00001fa6 },
+ { 0x00000345, 0x00001fa7 }, { 0x00000300, 0x00001f6a },
+ { 0x00000301, 0x00001f6c }, { 0x00000342, 0x00001f6e },
+ { 0x00000345, 0x00001fa8 }, { 0x00000300, 0x00001f6b },
+ { 0x00000301, 0x00001f6d }, { 0x00000342, 0x00001f6f },
+ { 0x00000345, 0x00001fa9 }, { 0x00000345, 0x00001faa },
+ { 0x00000345, 0x00001fab }, { 0x00000345, 0x00001fac },
+ { 0x00000345, 0x00001fad }, { 0x00000345, 0x00001fae },
+ { 0x00000345, 0x00001faf }, { 0x00000345, 0x00001fb2 },
+ { 0x00000345, 0x00001fc2 }, { 0x00000345, 0x00001ff2 },
+ { 0x00000345, 0x00001fb7 }, { 0x00000300, 0x00001fcd },
+ { 0x00000301, 0x00001fce }, { 0x00000342, 0x00001fcf },
+ { 0x00000345, 0x00001fc7 }, { 0x00000345, 0x00001ff7 },
+ { 0x00000300, 0x00001fdd }, { 0x00000301, 0x00001fde },
+ { 0x00000342, 0x00001fdf }, { 0x00000338, 0x0000219a },
+ { 0x00000338, 0x0000219b }, { 0x00000338, 0x000021ae },
+ { 0x00000338, 0x000021cd }, { 0x00000338, 0x000021cf },
+ { 0x00000338, 0x000021ce }, { 0x00000338, 0x00002204 },
+ { 0x00000338, 0x00002209 }, { 0x00000338, 0x0000220c },
+ { 0x00000338, 0x00002224 }, { 0x00000338, 0x00002226 },
+ { 0x00000338, 0x00002241 }, { 0x00000338, 0x00002244 },
+ { 0x00000338, 0x00002247 }, { 0x00000338, 0x00002249 },
+ { 0x00000338, 0x0000226d }, { 0x00000338, 0x00002262 },
+ { 0x00000338, 0x00002270 }, { 0x00000338, 0x00002271 },
+ { 0x00000338, 0x00002274 }, { 0x00000338, 0x00002275 },
+ { 0x00000338, 0x00002278 }, { 0x00000338, 0x00002279 },
+ { 0x00000338, 0x00002280 }, { 0x00000338, 0x00002281 },
+ { 0x00000338, 0x000022e0 }, { 0x00000338, 0x000022e1 },
+ { 0x00000338, 0x00002284 }, { 0x00000338, 0x00002285 },
+ { 0x00000338, 0x00002288 }, { 0x00000338, 0x00002289 },
+ { 0x00000338, 0x000022e2 }, { 0x00000338, 0x000022e3 },
+ { 0x00000338, 0x000022ac }, { 0x00000338, 0x000022ad },
+ { 0x00000338, 0x000022ae }, { 0x00000338, 0x000022af },
+ { 0x00000338, 0x000022ea }, { 0x00000338, 0x000022eb },
+ { 0x00000338, 0x000022ec }, { 0x00000338, 0x000022ed },
+ { 0x00003099, 0x00003094 }, { 0x00003099, 0x0000304c },
+ { 0x00003099, 0x0000304e }, { 0x00003099, 0x00003050 },
+ { 0x00003099, 0x00003052 }, { 0x00003099, 0x00003054 },
+ { 0x00003099, 0x00003056 }, { 0x00003099, 0x00003058 },
+ { 0x00003099, 0x0000305a }, { 0x00003099, 0x0000305c },
+ { 0x00003099, 0x0000305e }, { 0x00003099, 0x00003060 },
+ { 0x00003099, 0x00003062 }, { 0x00003099, 0x00003065 },
+ { 0x00003099, 0x00003067 }, { 0x00003099, 0x00003069 },
+ { 0x00003099, 0x00003070 }, { 0x0000309a, 0x00003071 },
+ { 0x00003099, 0x00003073 }, { 0x0000309a, 0x00003074 },
+ { 0x00003099, 0x00003076 }, { 0x0000309a, 0x00003077 },
+ { 0x00003099, 0x00003079 }, { 0x0000309a, 0x0000307a },
+ { 0x00003099, 0x0000307c }, { 0x0000309a, 0x0000307d },
+ { 0x00003099, 0x0000309e }, { 0x00003099, 0x000030f4 },
+ { 0x00003099, 0x000030ac }, { 0x00003099, 0x000030ae },
+ { 0x00003099, 0x000030b0 }, { 0x00003099, 0x000030b2 },
+ { 0x00003099, 0x000030b4 }, { 0x00003099, 0x000030b6 },
+ { 0x00003099, 0x000030b8 }, { 0x00003099, 0x000030ba },
+ { 0x00003099, 0x000030bc }, { 0x00003099, 0x000030be },
+ { 0x00003099, 0x000030c0 }, { 0x00003099, 0x000030c2 },
+ { 0x00003099, 0x000030c5 }, { 0x00003099, 0x000030c7 },
+ { 0x00003099, 0x000030c9 }, { 0x00003099, 0x000030d0 },
+ { 0x0000309a, 0x000030d1 }, { 0x00003099, 0x000030d3 },
+ { 0x0000309a, 0x000030d4 }, { 0x00003099, 0x000030d6 },
+ { 0x0000309a, 0x000030d7 }, { 0x00003099, 0x000030d9 },
+ { 0x0000309a, 0x000030da }, { 0x00003099, 0x000030dc },
+ { 0x0000309a, 0x000030dd }, { 0x00003099, 0x000030f7 },
+ { 0x00003099, 0x000030f8 }, { 0x00003099, 0x000030f9 },
+ { 0x00003099, 0x000030fa }, { 0x00003099, 0x000030fe },
+};
+
+
+/*
+ * Canonical/Compatibility Decomposition
+ */
+
+#define DECOMP_BITS_0 9
+#define DECOMP_BITS_1 7
+#define DECOMP_BITS_2 5
+#define DECOMP_COMPAT 32768
+
+static const unsigned short v320_decompose_imap[] = {
+ 272, 400, 528, 656, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 912,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 1040, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 1168,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 0, 0, 0, 0, 0, 1, 2, 3,
+ 4, 5, 6, 7, 0, 8, 9, 10,
+ 11, 12, 0, 0, 0, 13, 14, 15,
+ 0, 0, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 0, 0, 26, 27,
+ 0, 0, 0, 0, 28, 0, 0, 0,
+ 0, 29, 0, 30, 0, 0, 31, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 32, 33, 0, 0, 0, 34, 0,
+ 0, 35, 36, 0, 0, 0, 0, 0,
+ 0, 0, 37, 0, 38, 0, 39, 0,
+ 0, 0, 40, 0, 0, 0, 41, 0,
+ 0, 0, 42, 0, 0, 0, 43, 0,
+ 0, 44, 0, 0, 0, 45, 46, 0,
+ 47, 0, 48, 49, 50, 51, 0, 0,
+ 0, 52, 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, 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, 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,
+ 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, 0, 0, 0, 0, 0, 0,
+ 53, 54, 55, 56, 57, 58, 59, 60,
+ 61, 62, 63, 64, 65, 66, 67, 68,
+ 69, 70, 71, 72, 73, 74, 0, 0,
+ 75, 76, 77, 78, 79, 80, 81, 0,
+ 82, 83, 84, 85, 86, 87, 0, 88,
+ 0, 89, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 90, 91, 92, 93, 94,
+ 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, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 95, 0, 0, 96, 0, 0, 97, 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, 0, 0, 0, 98, 0, 0, 99,
+ 100, 101, 102, 103, 104, 105, 106, 0,
+ 107, 108, 109, 110, 111, 112, 113, 114,
+ 0, 115, 116, 117, 118, 0, 0, 0,
+ 119, 120, 121, 122, 123, 124, 125, 126,
+ 127, 128, 129, 130, 131, 132, 133, 134,
+ 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, 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, 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, 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,
+ 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, 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, 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, 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,
+ 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, 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, 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, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 135, 136, 137, 138, 139, 140, 141, 142,
+ 143, 144, 145, 146, 0, 0, 0, 0,
+ 147, 148, 149, 150, 151, 152, 153, 154,
+ 155, 156, 157, 158, 159, 160, 161, 162,
+ 163, 164, 165, 166, 167, 168, 169, 170,
+ 0, 171, 172, 173, 174, 175, 176, 177,
+ 178, 179, 180, 181, 182, 183, 184, 185,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 186, 187, 0, 188, 189, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 190, 191, 192, 193, 194, 195, 196, 197,
+ 198, 199, 200, 201, 202, 203, 204, 205,
+ 206, 207, 208, 209, 210, 211, 212, 213,
+ 214, 215, 216, 217, 218, 219, 220, 221,
+ 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, 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, 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, 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,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 222, 223, 224, 225, 226, 227, 228, 229,
+ 230, 231, 232, 233, 234, 235, 236, 237,
+ 238, 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, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+static const struct {
+ unsigned short tbl[32];
+} v320_decompose_table[] = {
+ {{
+ 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, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 32769, 0, 0, 0, 0, 0, 0, 0,
+ 32770, 0, 32772, 0, 0, 0, 0, 32773,
+ 0, 0, 32775, 32776, 32777, 32779, 0, 0,
+ 32780, 32782, 32783, 0, 32784, 32787, 32790, 0,
+ }},
+ {{
+ 25, 27, 29, 31, 33, 35, 0, 37,
+ 39, 41, 43, 45, 47, 49, 51, 53,
+ 0, 55, 57, 59, 61, 63, 65, 0,
+ 0, 67, 69, 71, 73, 75, 0, 0,
+ }},
+ {{
+ 77, 79, 81, 83, 85, 87, 0, 89,
+ 91, 93, 95, 97, 99, 101, 103, 105,
+ 0, 107, 109, 111, 113, 115, 117, 0,
+ 0, 119, 121, 123, 125, 127, 0, 129,
+ }},
+ {{
+ 131, 133, 135, 137, 139, 141, 143, 145,
+ 147, 149, 151, 153, 155, 157, 159, 161,
+ 0, 0, 163, 165, 167, 169, 171, 173,
+ 175, 177, 179, 181, 183, 185, 187, 189,
+ }},
+ {{
+ 191, 193, 195, 197, 199, 201, 0, 0,
+ 203, 205, 207, 209, 211, 213, 215, 217,
+ 219, 0, 32989, 32991, 225, 227, 229, 231,
+ 0, 233, 235, 237, 239, 241, 243, 33013,
+ }},
+ {{
+ 33015, 0, 0, 249, 251, 253, 255, 257,
+ 259, 33029, 0, 0, 263, 265, 267, 269,
+ 271, 273, 0, 0, 275, 277, 279, 281,
+ 283, 285, 287, 289, 291, 293, 295, 297,
+ }},
+ {{
+ 299, 301, 303, 305, 307, 309, 0, 0,
+ 311, 313, 315, 317, 319, 321, 323, 325,
+ 327, 329, 331, 333, 335, 337, 339, 341,
+ 343, 345, 347, 349, 351, 353, 355, 33125,
+ }},
+ {{
+ 358, 360, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 362,
+ 364, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 33134, 33136, 33138, 33140,
+ 33142, 33144, 33146, 33148, 33150, 384, 386, 388,
+ 390, 392, 394, 396, 398, 400, 402, 404,
+ 406, 408, 410, 412, 414, 0, 416, 418,
+ }},
+ {{
+ 420, 422, 424, 426, 0, 0, 428, 430,
+ 432, 434, 436, 438, 440, 442, 444, 446,
+ 448, 33218, 33220, 33222, 456, 458, 0, 0,
+ 460, 462, 464, 466, 468, 470, 472, 474,
+ }},
+ {{
+ 476, 478, 480, 482, 484, 486, 488, 490,
+ 492, 494, 496, 498, 500, 502, 504, 506,
+ 508, 510, 512, 514, 516, 518, 520, 522,
+ 524, 526, 528, 530, 0, 0, 532, 534,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 536, 538,
+ 540, 542, 544, 546, 548, 550, 552, 554,
+ 556, 558, 560, 562, 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, 0, 0,
+ 33332, 33333, 33334, 33335, 33336, 33337, 33338, 33339,
+ 33340, 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, 0, 0, 0, 0, 0,
+ 33341, 33343, 33345, 33347, 33349, 33351, 0, 0,
+ }},
+ {{
+ 33353, 33354, 33355, 33356, 33357, 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, 0,
+ }},
+ {{
+ 590, 591, 0, 592, 593, 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, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 595, 0, 0, 0,
+ 0, 0, 33364, 0, 0, 0, 598, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 33367, 601, 603, 605,
+ 606, 608, 610, 0, 612, 0, 614, 616,
+ 618, 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, 620, 622, 624, 626, 628, 630,
+ 632, 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, 634, 636, 638, 640, 642, 0,
+ 33412, 33413, 33414, 647, 649, 33419, 33420, 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,
+ 33421, 33422, 33423, 0, 33424, 33425, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 658, 660, 0, 662, 0, 0, 0, 664,
+ 0, 0, 0, 0, 666, 668, 670, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 672, 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, 0, 0, 0, 0,
+ 0, 674, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 676, 678, 0, 680, 0, 0, 0, 682,
+ 0, 0, 0, 0, 684, 686, 688, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 690, 692,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 694, 696, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 698, 700, 702, 704, 0, 0, 706, 708,
+ 0, 0, 710, 712, 714, 716, 718, 720,
+ }},
+ {{
+ 0, 0, 722, 724, 726, 728, 730, 732,
+ 0, 0, 734, 736, 738, 740, 742, 744,
+ 746, 748, 750, 752, 754, 756, 0, 0,
+ 758, 760, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 33530,
+ 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, 764, 766, 768, 770, 772, 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, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 33542, 33544, 33546,
+ 33548, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 782, 0, 784, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 786, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 788, 0, 0, 0, 0, 0, 0,
+ 0, 790, 0, 0, 792, 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, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 794, 796, 798, 800, 802, 804, 806, 808,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 810, 812, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 814, 816, 0, 818,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 820, 0, 0, 822, 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, 0, 0, 0, 0, 0, 0, 0,
+ 0, 824, 826, 828, 0, 0, 830, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 832, 0, 0, 834, 836, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 838, 840, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 842, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 844, 846, 848, 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, 0,
+ 850, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 852, 0, 0, 0, 0, 0, 0, 854,
+ 856, 0, 858, 860, 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, 0, 0,
+ 0, 0, 862, 864, 866, 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, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 868, 0, 870, 872, 874, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 33644, 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, 0, 0,
+ 0, 0, 0, 33646, 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, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 33648, 33650, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 33652, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 885, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 887, 0, 0,
+ 0, 0, 889, 0, 0, 0, 0, 891,
+ 0, 0, 0, 0, 893, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 895, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 897, 0, 899, 901, 33671,
+ 905, 33675, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 909, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 911, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 913, 0, 0,
+ }},
+ {{
+ 0, 0, 915, 0, 0, 0, 0, 917,
+ 0, 0, 0, 0, 919, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 921, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 923, 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,
+ }},
+ {{
+ 925, 927, 929, 931, 933, 935, 937, 939,
+ 941, 943, 945, 947, 949, 951, 953, 955,
+ 957, 959, 961, 963, 965, 967, 969, 971,
+ 973, 975, 977, 979, 981, 983, 985, 987,
+ }},
+ {{
+ 989, 991, 993, 995, 997, 999, 1001, 1003,
+ 1005, 1007, 1009, 1011, 1013, 1015, 1017, 1019,
+ 1021, 1023, 1025, 1027, 1029, 1031, 1033, 1035,
+ 1037, 1039, 1041, 1043, 1045, 1047, 1049, 1051,
+ }},
+ {{
+ 1053, 1055, 1057, 1059, 1061, 1063, 1065, 1067,
+ 1069, 1071, 1073, 1075, 1077, 1079, 1081, 1083,
+ 1085, 1087, 1089, 1091, 1093, 1095, 1097, 1099,
+ 1101, 1103, 1105, 1107, 1109, 1111, 1113, 1115,
+ }},
+ {{
+ 1117, 1119, 1121, 1123, 1125, 1127, 1129, 1131,
+ 1133, 1135, 1137, 1139, 1141, 1143, 1145, 1147,
+ 1149, 1151, 1153, 1155, 1157, 1159, 1161, 1163,
+ 1165, 1167, 1169, 1171, 1173, 1175, 1177, 1179,
+ }},
+ {{
+ 1181, 1183, 1185, 1187, 1189, 1191, 1193, 1195,
+ 1197, 1199, 1201, 1203, 1205, 1207, 1209, 1211,
+ 1213, 1215, 1217, 1219, 1221, 1223, 1225, 1227,
+ 1229, 1231, 34001, 1235, 0, 0, 0, 0,
+ }},
+ {{
+ 1237, 1239, 1241, 1243, 1245, 1247, 1249, 1251,
+ 1253, 1255, 1257, 1259, 1261, 1263, 1265, 1267,
+ 1269, 1271, 1273, 1275, 1277, 1279, 1281, 1283,
+ 1285, 1287, 1289, 1291, 1293, 1295, 1297, 1299,
+ }},
+ {{
+ 1301, 1303, 1305, 1307, 1309, 1311, 1313, 1315,
+ 1317, 1319, 1321, 1323, 1325, 1327, 1329, 1331,
+ 1333, 1335, 1337, 1339, 1341, 1343, 1345, 1347,
+ 1349, 1351, 1353, 1355, 1357, 1359, 1361, 1363,
+ }},
+ {{
+ 1365, 1367, 1369, 1371, 1373, 1375, 1377, 1379,
+ 1381, 1383, 1385, 1387, 1389, 1391, 1393, 1395,
+ 1397, 1399, 1401, 1403, 1405, 1407, 1409, 1411,
+ 1413, 1415, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1417, 1419, 1421, 1423, 1425, 1427, 1429, 1431,
+ 1433, 1435, 1437, 1439, 1441, 1443, 1445, 1447,
+ 1449, 1451, 1453, 1455, 1457, 1459, 0, 0,
+ 1461, 1463, 1465, 1467, 1469, 1471, 0, 0,
+ }},
+ {{
+ 1473, 1475, 1477, 1479, 1481, 1483, 1485, 1487,
+ 1489, 1491, 1493, 1495, 1497, 1499, 1501, 1503,
+ 1505, 1507, 1509, 1511, 1513, 1515, 1517, 1519,
+ 1521, 1523, 1525, 1527, 1529, 1531, 1533, 1535,
+ }},
+ {{
+ 1537, 1539, 1541, 1543, 1545, 1547, 0, 0,
+ 1549, 1551, 1553, 1555, 1557, 1559, 0, 0,
+ 1561, 1563, 1565, 1567, 1569, 1571, 1573, 1575,
+ 0, 1577, 0, 1579, 0, 1581, 0, 1583,
+ }},
+ {{
+ 1585, 1587, 1589, 1591, 1593, 1595, 1597, 1599,
+ 1601, 1603, 1605, 1607, 1609, 1611, 1613, 1615,
+ 1617, 1619, 1620, 1622, 1623, 1625, 1626, 1628,
+ 1629, 1631, 1632, 1634, 1635, 1637, 0, 0,
+ }},
+ {{
+ 1638, 1640, 1642, 1644, 1646, 1648, 1650, 1652,
+ 1654, 1656, 1658, 1660, 1662, 1664, 1666, 1668,
+ 1670, 1672, 1674, 1676, 1678, 1680, 1682, 1684,
+ 1686, 1688, 1690, 1692, 1694, 1696, 1698, 1700,
+ }},
+ {{
+ 1702, 1704, 1706, 1708, 1710, 1712, 1714, 1716,
+ 1718, 1720, 1722, 1724, 1726, 1728, 1730, 1732,
+ 1734, 1736, 1738, 1740, 1742, 0, 1744, 1746,
+ 1748, 1750, 1752, 1754, 1755, 34525, 1759, 34528,
+ }},
+ {{
+ 34530, 1764, 1766, 1768, 1770, 0, 1772, 1774,
+ 1776, 1778, 1779, 1781, 1782, 1784, 1786, 1788,
+ 1790, 1792, 1794, 1796, 0, 0, 1797, 1799,
+ 1801, 1803, 1805, 1807, 0, 1808, 1810, 1812,
+ }},
+ {{
+ 1814, 1816, 1818, 1820, 1821, 1823, 1825, 1827,
+ 1829, 1831, 1833, 1835, 1836, 1838, 1840, 1841,
+ 0, 0, 1842, 1844, 1846, 0, 1848, 1850,
+ 1852, 1854, 1855, 1857, 1858, 1860, 34629, 0,
+ }},
+ {{
+ 1863, 1864, 34633, 34634, 34635, 34636, 34637, 34638,
+ 34639, 34640, 34641, 0, 0, 0, 0, 0,
+ 0, 34642, 0, 0, 0, 0, 0, 34643,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 34645, 34646, 34648, 0,
+ 0, 0, 0, 0, 0, 0, 0, 34651,
+ 0, 0, 0, 34652, 34654, 0, 34657, 34659,
+ 0, 0, 0, 0, 34662, 0, 34664, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 34666,
+ 34668, 34670, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 34672,
+ 0, 0, 0, 0, 0, 0, 0, 34676,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 34677, 34678, 0, 0, 34679, 34680, 34681, 34682,
+ 34683, 34684, 34685, 34686, 34687, 34688, 34689, 34690,
+ }},
+ {{
+ 34691, 34692, 34693, 34694, 34695, 34696, 34697, 34698,
+ 34699, 34700, 34701, 34702, 34703, 34704, 34705, 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,
+ 34706, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 34708, 34711, 34714, 34715, 0, 34717, 34720, 34723,
+ 0, 34724, 34726, 34727, 34728, 34729, 34730, 34731,
+ 34732, 34733, 34734, 34735, 0, 34736, 34737, 0,
+ 0, 34739, 34740, 34741, 34742, 34743, 0, 0,
+ }},
+ {{
+ 34744, 34746, 34749, 0, 34751, 0, 1984, 0,
+ 34753, 0, 1986, 1987, 34756, 34757, 0, 34758,
+ 34759, 34760, 0, 34761, 34762, 34763, 34764, 34765,
+ 34766, 34767, 0, 0, 0, 34768, 34769, 34770,
+ }},
+ {{
+ 34771, 0, 0, 0, 0, 34772, 34773, 34774,
+ 34775, 34776, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 34777, 34780, 34783, 34786, 34789,
+ 34792, 34795, 34798, 34801, 34804, 34807, 34810, 34813,
+ }},
+ {{
+ 34815, 34816, 34818, 34821, 34823, 34824, 34826, 34829,
+ 34833, 34835, 34836, 34838, 34841, 34842, 34843, 34844,
+ 34845, 34846, 34848, 34851, 34853, 34854, 34856, 34859,
+ 34863, 34865, 34866, 34868, 34871, 34872, 34873, 34874,
+ }},
+ {{
+ 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, 2107, 2109, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 2111, 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, 0, 0, 0, 0, 2113, 2115, 2117,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 2119, 0, 0, 0,
+ 0, 2121, 0, 0, 2123, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 2125, 0, 2127, 0,
+ 0, 0, 0, 0, 34897, 34899, 0, 34902,
+ 34904, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 2139, 0, 0, 2141, 0, 0, 2143,
+ 0, 2145, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2147, 0, 2149, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2151, 2153, 2155,
+ 2157, 2159, 0, 0, 2161, 2163, 0, 0,
+ 2165, 2167, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2169, 2171, 0, 0, 2173, 2175, 0, 0,
+ 2177, 2179, 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, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2181, 2183, 2185, 2187,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2189, 2191, 2193, 2195, 0, 0, 0, 0,
+ 0, 0, 2197, 2199, 2201, 2203, 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,
+ 0, 2205, 2206, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 34975, 34976, 34977, 34978, 34979, 34980, 34981, 34982,
+ 34983, 34984, 34986, 34988, 34990, 34992, 34994, 34996,
+ 34998, 35000, 35002, 35004, 35006, 35009, 35012, 35015,
+ 35018, 35021, 35024, 35027, 35030, 35033, 35037, 35041,
+ }},
+ {{
+ 35045, 35049, 35053, 35057, 35061, 35065, 35069, 35073,
+ 35077, 35079, 35081, 35083, 35085, 35087, 35089, 35091,
+ 35093, 35095, 35098, 35101, 35104, 35107, 35110, 35113,
+ 35116, 35119, 35122, 35125, 35128, 35131, 35134, 35137,
+ }},
+ {{
+ 35140, 35143, 35146, 35149, 35152, 35155, 35158, 35161,
+ 35164, 35167, 35170, 35173, 35176, 35179, 35182, 35185,
+ 35188, 35191, 35194, 35197, 35200, 35203, 35206, 35207,
+ 35208, 35209, 35210, 35211, 35212, 35213, 35214, 35215,
+ }},
+ {{
+ 35216, 35217, 35218, 35219, 35220, 35221, 35222, 35223,
+ 35224, 35225, 35226, 35227, 35228, 35229, 35230, 35231,
+ 35232, 35233, 35234, 35235, 35236, 35237, 35238, 35239,
+ 35240, 35241, 35242, 35243, 35244, 35245, 35246, 35247,
+ }},
+ {{
+ 35248, 35249, 35250, 35251, 35252, 35253, 35254, 35255,
+ 35256, 35257, 35258, 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, 0, 0, 0,
+ 0, 0, 0, 0, 35259, 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, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 35263, 35266, 35268, 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, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2503, 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, 0,
+ 0, 0, 0, 0, 0, 0, 0, 35273,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 35274, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 35275, 35276, 35277, 35278, 35279, 35280, 35281, 35282,
+ 35283, 35284, 35285, 35286, 35287, 35288, 35289, 35290,
+ 35291, 35292, 35293, 35294, 35295, 35296, 35297, 35298,
+ 35299, 35300, 35301, 35302, 35303, 35304, 35305, 35306,
+ }},
+ {{
+ 35307, 35308, 35309, 35310, 35311, 35312, 35313, 35314,
+ 35315, 35316, 35317, 35318, 35319, 35320, 35321, 35322,
+ 35323, 35324, 35325, 35326, 35327, 35328, 35329, 35330,
+ 35331, 35332, 35333, 35334, 35335, 35336, 35337, 35338,
+ }},
+ {{
+ 35339, 35340, 35341, 35342, 35343, 35344, 35345, 35346,
+ 35347, 35348, 35349, 35350, 35351, 35352, 35353, 35354,
+ 35355, 35356, 35357, 35358, 35359, 35360, 35361, 35362,
+ 35363, 35364, 35365, 35366, 35367, 35368, 35369, 35370,
+ }},
+ {{
+ 35371, 35372, 35373, 35374, 35375, 35376, 35377, 35378,
+ 35379, 35380, 35381, 35382, 35383, 35384, 35385, 35386,
+ 35387, 35388, 35389, 35390, 35391, 35392, 35393, 35394,
+ 35395, 35396, 35397, 35398, 35399, 35400, 35401, 35402,
+ }},
+ {{
+ 35403, 35404, 35405, 35406, 35407, 35408, 35409, 35410,
+ 35411, 35412, 35413, 35414, 35415, 35416, 35417, 35418,
+ 35419, 35420, 35421, 35422, 35423, 35424, 35425, 35426,
+ 35427, 35428, 35429, 35430, 35431, 35432, 35433, 35434,
+ }},
+ {{
+ 35435, 35436, 35437, 35438, 35439, 35440, 35441, 35442,
+ 35443, 35444, 35445, 35446, 35447, 35448, 35449, 35450,
+ 35451, 35452, 35453, 35454, 35455, 35456, 35457, 35458,
+ 35459, 35460, 35461, 35462, 35463, 35464, 35465, 35466,
+ }},
+ {{
+ 35467, 35468, 35469, 35470, 35471, 35472, 35473, 35474,
+ 35475, 35476, 35477, 35478, 35479, 35480, 35481, 35482,
+ 35483, 35484, 35485, 35486, 35487, 35488, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 35489, 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, 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, 0, 35490, 0,
+ 35491, 35492, 35493, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2726, 0, 2728, 0,
+ 2730, 0, 2732, 0, 2734, 0, 2736, 0,
+ 2738, 0, 2740, 0, 2742, 0, 2744, 0,
+ }},
+ {{
+ 2746, 0, 2748, 0, 0, 2750, 0, 2752,
+ 0, 2754, 0, 0, 0, 0, 0, 0,
+ 2756, 2758, 0, 2760, 2762, 0, 2764, 2766,
+ 0, 2768, 2770, 0, 2772, 2774, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2776, 0, 0, 0,
+ 0, 0, 0, 35546, 35548, 0, 2782, 35552,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2786, 0, 2788, 0,
+ 2790, 0, 2792, 0, 2794, 0, 2796, 0,
+ 2798, 0, 2800, 0, 2802, 0, 2804, 0,
+ }},
+ {{
+ 2806, 0, 2808, 0, 0, 2810, 0, 2812,
+ 0, 2814, 0, 0, 0, 0, 0, 0,
+ 2816, 2818, 0, 2820, 2822, 0, 2824, 2826,
+ 0, 2828, 2830, 0, 2832, 2834, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2836, 0, 0, 2838,
+ 2840, 2842, 2844, 0, 0, 0, 2846, 35616,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 35618, 35619, 35620, 35621, 35622, 35623, 35624,
+ 35625, 35626, 35627, 35628, 35629, 35630, 35631, 35632,
+ }},
+ {{
+ 35633, 35634, 35635, 35636, 35637, 35638, 35639, 35640,
+ 35641, 35642, 35643, 35644, 35645, 35646, 35647, 35648,
+ 35649, 35650, 35651, 35652, 35653, 35654, 35655, 35656,
+ 35657, 35658, 35659, 35660, 35661, 35662, 35663, 35664,
+ }},
+ {{
+ 35665, 35666, 35667, 35668, 35669, 35670, 35671, 35672,
+ 35673, 35674, 35675, 35676, 35677, 35678, 35679, 35680,
+ 35681, 35682, 35683, 35684, 35685, 35686, 35687, 35688,
+ 35689, 35690, 35691, 35692, 35693, 35694, 35695, 35696,
+ }},
+ {{
+ 35697, 35698, 35699, 35700, 35701, 35702, 35703, 35704,
+ 35705, 35706, 35707, 35708, 35709, 35710, 35711, 0,
+ 0, 0, 35712, 35713, 35714, 35715, 35716, 35717,
+ 35718, 35719, 35720, 35721, 35722, 35723, 35724, 35725,
+ }},
+ {{
+ 35726, 35729, 35732, 35735, 35738, 35741, 35744, 35747,
+ 35750, 35753, 35756, 35759, 35762, 35765, 35768, 35772,
+ 35776, 35780, 35784, 35788, 35792, 35796, 35800, 35804,
+ 35808, 35812, 35816, 35820, 35824, 0, 0, 0,
+ }},
+ {{
+ 35828, 35831, 35834, 35837, 35840, 35843, 35846, 35849,
+ 35852, 35855, 35858, 35861, 35864, 35867, 35870, 35873,
+ 35876, 35879, 35882, 35885, 35888, 35891, 35894, 35897,
+ 35900, 35903, 35906, 35909, 35912, 35915, 35918, 35921,
+ }},
+ {{
+ 35924, 35927, 35930, 35933, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 35936, 35938, 35940, 35942, 35944, 35946, 35948,
+ 35950, 35952, 35954, 35956, 35958, 35960, 35962, 35964,
+ }},
+ {{
+ 35966, 35967, 35968, 35969, 35970, 35971, 35972, 35973,
+ 35974, 35975, 35976, 35977, 35978, 35979, 35980, 35982,
+ 35984, 35986, 35988, 35990, 35992, 35994, 35996, 35998,
+ 36000, 36002, 36004, 36006, 0, 0, 0, 0,
+ }},
+ {{
+ 36008, 36009, 36010, 36011, 36012, 36013, 36014, 36015,
+ 36016, 36017, 36018, 36019, 36020, 36021, 36022, 36023,
+ 36024, 36025, 36026, 36027, 36028, 36029, 36030, 36031,
+ 36032, 36033, 36034, 36035, 36036, 36037, 36038, 36039,
+ }},
+ {{
+ 36040, 36041, 36042, 36043, 36044, 36045, 36046, 36047,
+ 36048, 36049, 36050, 36051, 36052, 36053, 36054, 36055,
+ 36056, 36057, 36059, 36061, 36063, 36065, 36067, 36069,
+ 36071, 36073, 36075, 36077, 36079, 36081, 36083, 36085,
+ }},
+ {{
+ 36087, 36089, 36091, 36093, 36095, 36097, 36099, 36101,
+ 36103, 36105, 36108, 36111, 0, 0, 0, 0,
+ 36114, 36115, 36116, 36117, 36118, 36119, 36120, 36121,
+ 36122, 36123, 36124, 36125, 36126, 36127, 36128, 36129,
+ }},
+ {{
+ 36130, 36131, 36132, 36133, 36134, 36135, 36136, 36137,
+ 36138, 36139, 36140, 36141, 36142, 36143, 36144, 36145,
+ 36146, 36147, 36148, 36149, 36150, 36151, 36152, 36153,
+ 36154, 36155, 36156, 36157, 36158, 36159, 36160, 0,
+ }},
+ {{
+ 36161, 36165, 36169, 36173, 36176, 36180, 36183, 36186,
+ 36191, 36195, 36198, 36201, 36204, 36208, 36212, 36215,
+ 36218, 36220, 36223, 36227, 36231, 36233, 36238, 36244,
+ 36249, 36252, 36257, 36262, 36266, 36269, 36272, 36275,
+ }},
+ {{
+ 36279, 36284, 36288, 36291, 36294, 36297, 36299, 36301,
+ 36303, 36305, 36308, 36311, 36316, 36319, 36323, 36328,
+ 36331, 36333, 36335, 36340, 36344, 36349, 36352, 36357,
+ 36359, 36362, 36365, 36368, 36371, 36374, 36378, 36381,
+ }},
+ {{
+ 36383, 36386, 36389, 36392, 36396, 36399, 36402, 36405,
+ 36410, 36414, 36416, 36421, 36423, 36427, 36431, 36434,
+ 36437, 36440, 36444, 36446, 36449, 36453, 36455, 36460,
+ 36463, 36465, 36467, 36469, 36471, 36473, 36475, 36477,
+ }},
+ {{
+ 36479, 36481, 36483, 36486, 36489, 36492, 36495, 36498,
+ 36501, 36504, 36507, 36510, 36513, 36516, 36519, 36522,
+ 36525, 36528, 36531, 36533, 36535, 36538, 36540, 0,
+ 0, 0, 0, 36542, 36544, 36546, 36548, 36550,
+ }},
+ {{
+ 36554, 36556, 36558, 36560, 36562, 36564, 36566, 36568,
+ 36570, 36573, 36577, 36579, 36581, 36583, 36585, 36587,
+ 36589, 36591, 36594, 36597, 36600, 36603, 36605, 36607,
+ 36609, 36611, 36613, 36615, 36617, 36619, 36621, 36623,
+ }},
+ {{
+ 36626, 36629, 36631, 36634, 36637, 36640, 36642, 36645,
+ 36648, 36652, 36654, 36657, 36660, 36663, 36666, 36671,
+ 36677, 36679, 36681, 36683, 36685, 36687, 36689, 36691,
+ 36693, 36695, 36697, 36699, 36701, 36703, 36705, 36707,
+ }},
+ {{
+ 36709, 36711, 36713, 36717, 36719, 36721, 36723, 36727,
+ 36730, 36732, 36734, 36736, 36738, 36740, 36742, 36744,
+ 36746, 36748, 36750, 36753, 36755, 36757, 36760, 36763,
+ 36765, 36769, 36772, 36774, 36776, 36778, 0, 0,
+ }},
+ {{
+ 36780, 36782, 36784, 36786, 36788, 36790, 36792, 36794,
+ 36796, 36798, 36801, 36804, 36807, 36810, 36813, 36816,
+ 36819, 36822, 36825, 36828, 36831, 36834, 36837, 36840,
+ 36843, 36846, 36849, 36852, 36855, 36858, 36861, 0,
+ }},
+ {{
+ 4096, 4097, 4098, 4099, 4100, 4101, 4102, 4103,
+ 4104, 4105, 4106, 4107, 4108, 4109, 4110, 4111,
+ 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119,
+ 4120, 4121, 4122, 4123, 4124, 4125, 4126, 4127,
+ }},
+ {{
+ 4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135,
+ 4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143,
+ 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4151,
+ 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159,
+ }},
+ {{
+ 4160, 4161, 4162, 4163, 4164, 4165, 4166, 4167,
+ 4168, 4169, 4170, 4171, 4172, 4173, 4174, 4175,
+ 4176, 4177, 4178, 4179, 4180, 4181, 4182, 4183,
+ 4184, 4185, 4186, 4187, 4188, 4189, 4190, 4191,
+ }},
+ {{
+ 4192, 4193, 4194, 4195, 4196, 4197, 4198, 4199,
+ 4200, 4201, 4202, 4203, 4204, 4205, 4206, 4207,
+ 4208, 4209, 4210, 4211, 4212, 4213, 4214, 4215,
+ 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223,
+ }},
+ {{
+ 4224, 4225, 4226, 4227, 4228, 4229, 4230, 4231,
+ 4232, 4233, 4234, 4235, 4236, 4237, 4238, 4239,
+ 4240, 4241, 4242, 4243, 4244, 4245, 4246, 4247,
+ 4248, 4249, 4250, 4251, 4252, 4253, 4254, 4255,
+ }},
+ {{
+ 4256, 4257, 4258, 4259, 4260, 4261, 4262, 4263,
+ 4264, 4265, 4266, 4267, 4268, 4269, 4270, 4271,
+ 4272, 4273, 4274, 4275, 4276, 4277, 4278, 4279,
+ 4280, 4281, 4282, 4283, 4284, 4285, 4286, 4287,
+ }},
+ {{
+ 4288, 4289, 4290, 4291, 4292, 4293, 4294, 4295,
+ 4296, 4297, 4298, 4299, 4300, 4301, 4302, 4303,
+ 4304, 4305, 4306, 4307, 4308, 4309, 4310, 4311,
+ 4312, 4313, 4314, 4315, 4316, 4317, 4318, 4319,
+ }},
+ {{
+ 4320, 4321, 4322, 4323, 4324, 4325, 4326, 4327,
+ 4328, 4329, 4330, 4331, 4332, 4333, 4334, 4335,
+ 4336, 4337, 4338, 4339, 4340, 4341, 4342, 4343,
+ 4344, 4345, 4346, 4347, 4348, 4349, 4350, 4351,
+ }},
+ {{
+ 4352, 4353, 4354, 4355, 4356, 4357, 4358, 4359,
+ 4360, 4361, 4362, 4363, 4364, 4365, 0, 0,
+ 4366, 0, 4367, 0, 0, 4368, 4369, 4370,
+ 4371, 4372, 4373, 4374, 4375, 4376, 4377, 0,
+ }},
+ {{
+ 4378, 0, 4379, 0, 0, 4380, 4381, 0,
+ 0, 0, 4382, 4383, 4384, 4385, 0, 0,
+ 4386, 4387, 4388, 4389, 4390, 4391, 4392, 4393,
+ 4394, 4395, 4396, 4397, 4398, 4399, 4400, 4401,
+ }},
+ {{
+ 4402, 4403, 4404, 4405, 4406, 4407, 4408, 4409,
+ 4410, 4411, 4412, 4413, 4414, 4415, 4416, 4417,
+ 4418, 4419, 4420, 4421, 4422, 4423, 4424, 4425,
+ 4426, 4427, 4428, 4429, 4430, 4431, 4432, 4433,
+ }},
+ {{
+ 4434, 4435, 4436, 4437, 4438, 4439, 4440, 4441,
+ 4442, 4443, 4444, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 37213, 37215, 37217, 37219, 37222, 37225, 37227, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 37229, 37231, 37233, 37235, 37237,
+ 0, 0, 0, 0, 0, 4471, 0, 4473,
+ }},
+ {{
+ 37243, 37244, 37245, 37246, 37247, 37248, 37249, 37250,
+ 37251, 37252, 4485, 4487, 4489, 4491, 4493, 4495,
+ 4497, 4499, 4501, 4503, 4505, 4507, 4509, 0,
+ 4511, 4513, 4515, 4517, 4519, 0, 4521, 0,
+ }},
+ {{
+ 4523, 4525, 0, 4527, 4529, 0, 4531, 4533,
+ 4535, 4537, 4539, 4541, 4543, 4545, 4547, 37317,
+ 37319, 37320, 37321, 37322, 37323, 37324, 37325, 37326,
+ 37327, 37328, 37329, 37330, 37331, 37332, 37333, 37334,
+ }},
+ {{
+ 37335, 37336, 37337, 37338, 37339, 37340, 37341, 37342,
+ 37343, 37344, 37345, 37346, 37347, 37348, 37349, 37350,
+ 37351, 37352, 37353, 37354, 37355, 37356, 37357, 37358,
+ 37359, 37360, 37361, 37362, 37363, 37364, 37365, 37366,
+ }},
+ {{
+ 37367, 37368, 37369, 37370, 37371, 37372, 37373, 37374,
+ 37375, 37376, 37377, 37378, 37379, 37380, 37381, 37382,
+ 37383, 37384, 37385, 37386, 37387, 37388, 37389, 37390,
+ 37391, 37392, 37393, 37394, 37395, 37396, 37397, 37398,
+ }},
+ {{
+ 37399, 37400, 37401, 37402, 37403, 37404, 37405, 37406,
+ 37407, 37408, 37409, 37410, 37411, 37412, 37413, 37414,
+ 37415, 37416, 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, 0, 0, 0, 0,
+ 0, 0, 0, 37417, 37418, 37419, 37420, 37421,
+ 37422, 37423, 37424, 37425, 37426, 37427, 37428, 37429,
+ }},
+ {{
+ 37430, 37431, 37432, 37433, 37434, 37435, 37436, 37437,
+ 37438, 37439, 37440, 37442, 37444, 37446, 37448, 37450,
+ 37452, 37454, 37456, 37458, 37460, 37462, 37464, 37466,
+ 37468, 37470, 37472, 37474, 37476, 37477, 37478, 37479,
+ }},
+ {{
+ 37480, 37482, 37484, 37486, 37488, 37490, 37492, 37494,
+ 37496, 37498, 37500, 37502, 37504, 37506, 37508, 37510,
+ 37512, 37514, 37516, 37518, 37520, 37522, 37524, 37526,
+ 37528, 37530, 37532, 37534, 37536, 37538, 37540, 37542,
+ }},
+ {{
+ 37544, 37546, 37548, 37550, 37552, 37554, 37556, 37558,
+ 37560, 37562, 37564, 37566, 37568, 37570, 37572, 37574,
+ 37576, 37578, 37580, 37582, 37584, 37586, 37588, 37590,
+ 37592, 37594, 37596, 37598, 37600, 37602, 37604, 37606,
+ }},
+ {{
+ 37608, 37610, 37612, 37614, 37616, 37618, 37620, 37622,
+ 37624, 37626, 37628, 37630, 37632, 37634, 37636, 37638,
+ 37640, 37642, 37644, 37646, 37648, 37650, 37652, 37654,
+ 37656, 37658, 37660, 37662, 37664, 37666, 37668, 37671,
+ }},
+ {{
+ 37674, 37677, 37680, 37683, 37686, 37688, 37690, 37692,
+ 37694, 37696, 37698, 37700, 37702, 37704, 37706, 37708,
+ 37710, 37712, 37714, 37716, 37718, 37720, 37722, 37724,
+ 37726, 37728, 37730, 37732, 37734, 37736, 37738, 37740,
+ }},
+ {{
+ 37742, 37744, 37746, 37748, 37750, 37752, 37754, 37756,
+ 37758, 37760, 37762, 37764, 37766, 37768, 37770, 37772,
+ 37774, 37776, 37778, 37780, 37782, 37784, 37786, 37788,
+ 37790, 37792, 37794, 37796, 37798, 37800, 37802, 37804,
+ }},
+ {{
+ 37806, 37808, 37810, 37812, 37814, 37816, 37818, 37820,
+ 37822, 37824, 37826, 37828, 37830, 37832, 37834, 37836,
+ 37838, 37840, 37842, 37844, 37846, 37848, 37850, 37852,
+ 37854, 37856, 37858, 37860, 37862, 37864, 37866, 37868,
+ }},
+ {{
+ 37870, 37872, 37874, 37876, 37878, 37880, 37882, 37884,
+ 37886, 37888, 37890, 37892, 37894, 37896, 37898, 37900,
+ 37902, 37904, 37906, 37908, 37910, 37912, 37914, 37916,
+ 37918, 37920, 37922, 37924, 37926, 37928, 37930, 37932,
+ }},
+ {{
+ 37934, 37936, 37938, 37940, 37942, 37944, 37946, 37948,
+ 37950, 37952, 37954, 37956, 37958, 37960, 37962, 37964,
+ 37966, 37968, 37970, 37973, 37976, 37979, 37981, 37983,
+ 37985, 37987, 37989, 37991, 37993, 37995, 37997, 37999,
+ }},
+ {{
+ 38001, 38003, 38005, 38007, 38009, 38011, 38013, 38015,
+ 38017, 38019, 38021, 38023, 38025, 38027, 38029, 38031,
+ 38033, 38035, 38037, 38039, 38041, 38043, 38045, 38047,
+ 38049, 38051, 38053, 38055, 38057, 38059, 38061, 38063,
+ }},
+ {{
+ 38065, 38067, 38069, 38071, 38073, 38075, 38077, 38079,
+ 38081, 38083, 38085, 38087, 38089, 38091, 38093, 38095,
+ 38097, 38099, 38101, 38103, 38105, 38107, 38109, 38111,
+ 38113, 38115, 38117, 38119, 38121, 38123, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 38125, 38128, 38131, 38134, 38137, 38140, 38143, 38146,
+ 38149, 38152, 38155, 38158, 38161, 38164, 38167, 38170,
+ }},
+ {{
+ 38173, 38176, 38179, 38182, 38185, 38188, 38191, 38194,
+ 38197, 38200, 38203, 38206, 38209, 38212, 38215, 38218,
+ 38221, 38224, 38227, 38230, 38233, 38236, 38239, 38242,
+ 38245, 38248, 38251, 38254, 38257, 38260, 38263, 38266,
+ }},
+ {{
+ 38269, 38272, 38275, 38278, 38281, 38284, 38287, 38290,
+ 38293, 38296, 38299, 38302, 38305, 38308, 38311, 38314,
+ 0, 0, 38317, 38320, 38323, 38326, 38329, 38332,
+ 38335, 38338, 38341, 38344, 38347, 38350, 38353, 38356,
+ }},
+ {{
+ 38359, 38362, 38365, 38368, 38371, 38374, 38377, 38380,
+ 38383, 38386, 38389, 38392, 38395, 38398, 38401, 38404,
+ 38407, 38410, 38413, 38416, 38419, 38422, 38425, 38428,
+ 38431, 38434, 38437, 38440, 38443, 38446, 38449, 38452,
+ }},
+ {{
+ 38455, 38458, 38461, 38464, 38467, 38470, 38473, 38476,
+ 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, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 38479, 38482, 38485, 38489, 38493, 38497, 38501, 38505,
+ 38509, 38513, 38516, 38534, 38542, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 38546, 38547, 38548, 38549, 38550, 38551, 38552, 38553,
+ 38554, 38555, 38556, 38557, 38558, 38559, 38560, 38561,
+ }},
+ {{
+ 38562, 38563, 38564, 38565, 38566, 0, 0, 0,
+ 0, 38567, 38568, 38569, 38570, 38571, 38572, 38573,
+ 38574, 38575, 38576, 0, 38577, 38578, 38579, 38580,
+ 38581, 38582, 38583, 38584, 38585, 38586, 38587, 38588,
+ }},
+ {{
+ 38589, 38590, 38591, 38592, 38593, 38594, 38595, 0,
+ 38596, 38597, 38598, 38599, 0, 0, 0, 0,
+ 38600, 38602, 38604, 0, 38606, 0, 38608, 38610,
+ 38612, 38614, 38616, 38618, 38620, 38622, 38624, 38626,
+ }},
+ {{
+ 38628, 38629, 38630, 38631, 38632, 38633, 38634, 38635,
+ 38636, 38637, 38638, 38639, 38640, 38641, 38642, 38643,
+ 38644, 38645, 38646, 38647, 38648, 38649, 38650, 38651,
+ 38652, 38653, 38654, 38655, 38656, 38657, 38658, 38659,
+ }},
+ {{
+ 38660, 38661, 38662, 38663, 38664, 38665, 38666, 38667,
+ 38668, 38669, 38670, 38671, 38672, 38673, 38674, 38675,
+ 38676, 38677, 38678, 38679, 38680, 38681, 38682, 38683,
+ 38684, 38685, 38686, 38687, 38688, 38689, 38690, 38691,
+ }},
+ {{
+ 38692, 38693, 38694, 38695, 38696, 38697, 38698, 38699,
+ 38700, 38701, 38702, 38703, 38704, 38705, 38706, 38707,
+ 38708, 38709, 38710, 38711, 38712, 38713, 38714, 38715,
+ 38716, 38717, 38718, 38719, 38720, 38721, 38722, 38723,
+ }},
+ {{
+ 38724, 38725, 38726, 38727, 38728, 38729, 38730, 38731,
+ 38732, 38733, 38734, 38735, 38736, 38737, 38738, 38739,
+ 38740, 38741, 38742, 38743, 38744, 38745, 38747, 38749,
+ 38751, 38753, 38755, 38757, 38759, 0, 0, 0,
+ }},
+ {{
+ 0, 38761, 38762, 38763, 38764, 38765, 38766, 38767,
+ 38768, 38769, 38770, 38771, 38772, 38773, 38774, 38775,
+ 38776, 38777, 38778, 38779, 38780, 38781, 38782, 38783,
+ 38784, 38785, 38786, 38787, 38788, 38789, 38790, 38791,
+ }},
+ {{
+ 38792, 38793, 38794, 38795, 38796, 38797, 38798, 38799,
+ 38800, 38801, 38802, 38803, 38804, 38805, 38806, 38807,
+ 38808, 38809, 38810, 38811, 38812, 38813, 38814, 38815,
+ 38816, 38817, 38818, 38819, 38820, 38821, 38822, 38823,
+ }},
+ {{
+ 38824, 38825, 38826, 38827, 38828, 38829, 38830, 38831,
+ 38832, 38833, 38834, 38835, 38836, 38837, 38838, 38839,
+ 38840, 38841, 38842, 38843, 38844, 38845, 38846, 38847,
+ 38848, 38849, 38850, 38851, 38852, 38853, 38854, 38855,
+ }},
+ {{
+ 38856, 38857, 38858, 38859, 38860, 38861, 38862, 38863,
+ 38864, 38865, 38866, 38867, 38868, 38869, 38870, 38871,
+ 38872, 38873, 38874, 38875, 38876, 38877, 38878, 38879,
+ 38880, 38881, 38882, 38883, 38884, 38885, 38886, 38887,
+ }},
+ {{
+ 38888, 38889, 38890, 38891, 38892, 38893, 38894, 38895,
+ 38896, 38897, 38898, 38899, 38900, 38901, 38902, 38903,
+ 38904, 38905, 38906, 38907, 38908, 38909, 38910, 38911,
+ 38912, 38913, 38914, 38915, 38916, 38917, 38918, 38919,
+ }},
+ {{
+ 38920, 38921, 38922, 38923, 38924, 38925, 38926, 38927,
+ 38928, 38929, 38930, 38931, 38932, 38933, 38934, 38935,
+ 38936, 38937, 38938, 38939, 38940, 38941, 38942, 38943,
+ 38944, 38945, 38946, 38947, 38948, 38949, 38950, 0,
+ }},
+ {{
+ 0, 0, 38951, 38952, 38953, 38954, 38955, 38956,
+ 0, 0, 38957, 38958, 38959, 38960, 38961, 38962,
+ 0, 0, 38963, 38964, 38965, 38966, 38967, 38968,
+ 0, 0, 38969, 38970, 38971, 0, 0, 0,
+ }},
+ {{
+ 38972, 38973, 38974, 38975, 38976, 38977, 38978, 0,
+ 38979, 38980, 38981, 38982, 38983, 38984, 38985, 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, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 6218, 6220,
+ }},
+ {{
+ 6222, 6224, 6226, 6228, 6230, 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, 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, 0, 0, 6232, 6234, 6236, 6238, 6240,
+ }},
+ {{
+ 6242, 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, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 39012, 39013, 39014, 39015, 39016, 39017, 39018, 39019,
+ 39020, 39021, 39022, 39023, 39024, 39025, 39026, 39027,
+ 39028, 39029, 39030, 39031, 39032, 39033, 39034, 39035,
+ 39036, 39037, 39038, 39039, 39040, 39041, 39042, 39043,
+ }},
+ {{
+ 39044, 39045, 39046, 39047, 39048, 39049, 39050, 39051,
+ 39052, 39053, 39054, 39055, 39056, 39057, 39058, 39059,
+ 39060, 39061, 39062, 39063, 39064, 39065, 39066, 39067,
+ 39068, 39069, 39070, 39071, 39072, 39073, 39074, 39075,
+ }},
+ {{
+ 39076, 39077, 39078, 39079, 39080, 39081, 39082, 39083,
+ 39084, 39085, 39086, 39087, 39088, 39089, 39090, 39091,
+ 39092, 39093, 39094, 39095, 39096, 0, 39097, 39098,
+ 39099, 39100, 39101, 39102, 39103, 39104, 39105, 39106,
+ }},
+ {{
+ 39107, 39108, 39109, 39110, 39111, 39112, 39113, 39114,
+ 39115, 39116, 39117, 39118, 39119, 39120, 39121, 39122,
+ 39123, 39124, 39125, 39126, 39127, 39128, 39129, 39130,
+ 39131, 39132, 39133, 39134, 39135, 39136, 39137, 39138,
+ }},
+ {{
+ 39139, 39140, 39141, 39142, 39143, 39144, 39145, 39146,
+ 39147, 39148, 39149, 39150, 39151, 39152, 39153, 39154,
+ 39155, 39156, 39157, 39158, 39159, 39160, 39161, 39162,
+ 39163, 39164, 39165, 39166, 39167, 0, 39168, 39169,
+ }},
+ {{
+ 0, 0, 39170, 0, 0, 39171, 39172, 0,
+ 0, 39173, 39174, 39175, 39176, 0, 39177, 39178,
+ 39179, 39180, 39181, 39182, 39183, 39184, 39185, 39186,
+ 39187, 39188, 0, 39189, 0, 39190, 39191, 39192,
+ }},
+ {{
+ 39193, 0, 39194, 39195, 0, 39196, 39197, 39198,
+ 39199, 39200, 39201, 39202, 39203, 39204, 39205, 39206,
+ 39207, 39208, 39209, 39210, 39211, 39212, 39213, 39214,
+ 39215, 39216, 39217, 39218, 39219, 39220, 39221, 39222,
+ }},
+ {{
+ 39223, 39224, 39225, 39226, 39227, 39228, 39229, 39230,
+ 39231, 39232, 39233, 39234, 39235, 39236, 39237, 39238,
+ 39239, 39240, 39241, 39242, 39243, 39244, 39245, 39246,
+ 39247, 39248, 39249, 39250, 39251, 39252, 39253, 39254,
+ }},
+ {{
+ 39255, 39256, 39257, 39258, 39259, 39260, 0, 39261,
+ 39262, 39263, 39264, 0, 0, 39265, 39266, 39267,
+ 39268, 39269, 39270, 39271, 39272, 0, 39273, 39274,
+ 39275, 39276, 39277, 39278, 39279, 0, 39280, 39281,
+ }},
+ {{
+ 39282, 39283, 39284, 39285, 39286, 39287, 39288, 39289,
+ 39290, 39291, 39292, 39293, 39294, 39295, 39296, 39297,
+ 39298, 39299, 39300, 39301, 39302, 39303, 39304, 39305,
+ 39306, 39307, 0, 39308, 39309, 39310, 39311, 0,
+ }},
+ {{
+ 39312, 39313, 39314, 39315, 39316, 0, 39317, 0,
+ 0, 0, 39318, 39319, 39320, 39321, 39322, 39323,
+ 39324, 0, 39325, 39326, 39327, 39328, 39329, 39330,
+ 39331, 39332, 39333, 39334, 39335, 39336, 39337, 39338,
+ }},
+ {{
+ 39339, 39340, 39341, 39342, 39343, 39344, 39345, 39346,
+ 39347, 39348, 39349, 39350, 39351, 39352, 39353, 39354,
+ 39355, 39356, 39357, 39358, 39359, 39360, 39361, 39362,
+ 39363, 39364, 39365, 39366, 39367, 39368, 39369, 39370,
+ }},
+ {{
+ 39371, 39372, 39373, 39374, 39375, 39376, 39377, 39378,
+ 39379, 39380, 39381, 39382, 39383, 39384, 39385, 39386,
+ 39387, 39388, 39389, 39390, 39391, 39392, 39393, 39394,
+ 39395, 39396, 39397, 39398, 39399, 39400, 39401, 39402,
+ }},
+ {{
+ 39403, 39404, 39405, 39406, 39407, 39408, 39409, 39410,
+ 39411, 39412, 39413, 39414, 39415, 39416, 39417, 39418,
+ 39419, 39420, 39421, 39422, 39423, 39424, 39425, 39426,
+ 39427, 39428, 39429, 39430, 39431, 39432, 39433, 39434,
+ }},
+ {{
+ 39435, 39436, 39437, 39438, 39439, 39440, 39441, 39442,
+ 39443, 39444, 39445, 39446, 39447, 39448, 39449, 39450,
+ 39451, 39452, 39453, 39454, 39455, 39456, 39457, 39458,
+ 39459, 39460, 39461, 39462, 39463, 39464, 39465, 39466,
+ }},
+ {{
+ 39467, 39468, 39469, 39470, 39471, 39472, 39473, 39474,
+ 39475, 39476, 39477, 39478, 39479, 39480, 39481, 39482,
+ 39483, 39484, 39485, 39486, 39487, 39488, 39489, 39490,
+ 39491, 39492, 39493, 39494, 39495, 39496, 39497, 39498,
+ }},
+ {{
+ 39499, 39500, 39501, 39502, 39503, 39504, 39505, 39506,
+ 39507, 39508, 39509, 39510, 39511, 39512, 39513, 39514,
+ 39515, 39516, 39517, 39518, 39519, 39520, 39521, 39522,
+ 39523, 39524, 39525, 39526, 39527, 39528, 39529, 39530,
+ }},
+ {{
+ 39531, 39532, 39533, 39534, 39535, 39536, 39537, 39538,
+ 39539, 39540, 39541, 39542, 39543, 39544, 39545, 39546,
+ 39547, 39548, 39549, 39550, 39551, 39552, 39553, 39554,
+ 39555, 39556, 39557, 39558, 39559, 39560, 39561, 39562,
+ }},
+ {{
+ 39563, 39564, 39565, 39566, 39567, 39568, 39569, 39570,
+ 39571, 39572, 39573, 39574, 39575, 39576, 39577, 39578,
+ 39579, 39580, 39581, 39582, 39583, 39584, 39585, 39586,
+ 39587, 39588, 39589, 39590, 39591, 39592, 39593, 39594,
+ }},
+ {{
+ 39595, 39596, 39597, 39598, 39599, 39600, 39601, 39602,
+ 39603, 39604, 39605, 39606, 39607, 39608, 39609, 39610,
+ 39611, 39612, 39613, 39614, 39615, 39616, 39617, 39618,
+ 39619, 39620, 39621, 39622, 39623, 39624, 39625, 39626,
+ }},
+ {{
+ 39627, 39628, 39629, 39630, 39631, 39632, 39633, 39634,
+ 39635, 39636, 39637, 39638, 39639, 39640, 39641, 39642,
+ 39643, 39644, 39645, 39646, 39647, 39648, 39649, 39650,
+ 39651, 39652, 39653, 39654, 39655, 39656, 39657, 39658,
+ }},
+ {{
+ 39659, 39660, 39661, 39662, 0, 0, 0, 0,
+ 39663, 39664, 39665, 39666, 39667, 39668, 39669, 39670,
+ 39671, 39672, 39673, 39674, 39675, 39676, 39677, 39678,
+ 39679, 39680, 39681, 39682, 39683, 39684, 39685, 39686,
+ }},
+ {{
+ 39687, 39688, 39689, 39690, 39691, 39692, 39693, 39694,
+ 39695, 39696, 39697, 39698, 39699, 39700, 39701, 39702,
+ 39703, 39704, 39705, 39706, 39707, 39708, 39709, 39710,
+ 39711, 39712, 39713, 39714, 39715, 39716, 39717, 39718,
+ }},
+ {{
+ 39719, 39720, 39721, 39722, 39723, 39724, 39725, 39726,
+ 39727, 39728, 39729, 39730, 39731, 39732, 39733, 39734,
+ 39735, 39736, 39737, 39738, 39739, 39740, 39741, 39742,
+ 39743, 39744, 39745, 39746, 39747, 39748, 39749, 39750,
+ }},
+ {{
+ 39751, 39752, 39753, 39754, 39755, 39756, 39757, 39758,
+ 39759, 39760, 39761, 39762, 39763, 39764, 39765, 39766,
+ 39767, 39768, 39769, 39770, 39771, 39772, 39773, 39774,
+ 39775, 39776, 39777, 39778, 39779, 39780, 39781, 39782,
+ }},
+ {{
+ 39783, 39784, 39785, 39786, 39787, 39788, 39789, 39790,
+ 39791, 39792, 39793, 39794, 39795, 39796, 39797, 39798,
+ 39799, 39800, 39801, 39802, 39803, 39804, 39805, 39806,
+ 39807, 39808, 39809, 39810, 39811, 39812, 39813, 39814,
+ }},
+ {{
+ 39815, 39816, 39817, 39818, 39819, 39820, 39821, 39822,
+ 39823, 39824, 39825, 39826, 39827, 39828, 39829, 39830,
+ 39831, 39832, 39833, 39834, 39835, 39836, 39837, 39838,
+ 39839, 39840, 39841, 39842, 39843, 39844, 39845, 39846,
+ }},
+ {{
+ 39847, 39848, 39849, 39850, 39851, 39852, 39853, 39854,
+ 39855, 39856, 39857, 39858, 39859, 39860, 39861, 39862,
+ 39863, 39864, 39865, 39866, 39867, 39868, 39869, 39870,
+ 39871, 39872, 39873, 39874, 39875, 39876, 39877, 39878,
+ }},
+ {{
+ 39879, 39880, 39881, 39882, 39883, 39884, 39885, 39886,
+ 39887, 39888, 39889, 39890, 39891, 39892, 39893, 39894,
+ 39895, 39896, 39897, 39898, 39899, 39900, 39901, 39902,
+ 39903, 39904, 39905, 39906, 39907, 39908, 39909, 39910,
+ }},
+ {{
+ 39911, 39912, 39913, 39914, 39915, 39916, 39917, 39918,
+ 39919, 39920, 39921, 39922, 39923, 39924, 39925, 39926,
+ 39927, 39928, 39929, 39930, 39931, 39932, 39933, 39934,
+ 39935, 39936, 39937, 39938, 39939, 39940, 39941, 39942,
+ }},
+ {{
+ 39943, 39944, 39945, 39946, 39947, 39948, 39949, 39950,
+ 39951, 39952, 0, 0, 0, 0, 39953, 39954,
+ 39955, 39956, 39957, 39958, 39959, 39960, 39961, 39962,
+ 39963, 39964, 39965, 39966, 39967, 39968, 39969, 39970,
+ }},
+ {{
+ 39971, 39972, 39973, 39974, 39975, 39976, 39977, 39978,
+ 39979, 39980, 39981, 39982, 39983, 39984, 39985, 39986,
+ 39987, 39988, 39989, 39990, 39991, 39992, 39993, 39994,
+ 39995, 39996, 39997, 39998, 39999, 40000, 40001, 40002,
+ }},
+ {{
+ 7235, 7236, 7237, 7238, 7239, 7240, 7241, 7242,
+ 7243, 7244, 7245, 7246, 7247, 7248, 7249, 7250,
+ 7251, 7252, 7253, 7254, 7255, 7256, 7257, 7258,
+ 7259, 7260, 7261, 7262, 7263, 7264, 7265, 7266,
+ }},
+ {{
+ 7267, 7268, 7269, 7270, 7271, 7272, 7273, 7274,
+ 7275, 7276, 7277, 7278, 7279, 7280, 7281, 7282,
+ 7283, 7284, 7285, 7286, 7287, 7288, 7289, 7290,
+ 7291, 7292, 7293, 7294, 7295, 7296, 7297, 7298,
+ }},
+ {{
+ 7299, 7300, 7301, 7302, 7303, 7304, 7305, 7306,
+ 7307, 7308, 7309, 7310, 7311, 7312, 7313, 7314,
+ 7315, 7316, 7317, 7318, 7319, 7320, 7321, 7322,
+ 7323, 7324, 7325, 7326, 7327, 7328, 7329, 7330,
+ }},
+ {{
+ 7331, 7332, 7333, 7334, 7335, 7336, 7337, 7338,
+ 7339, 7340, 7341, 7342, 7343, 7344, 7345, 7346,
+ 7347, 7348, 7349, 7350, 7351, 7352, 7353, 7354,
+ 7355, 7356, 7357, 7358, 7359, 7360, 7361, 7362,
+ }},
+ {{
+ 7363, 7364, 7365, 7366, 7367, 7368, 7369, 7370,
+ 7371, 7372, 7373, 7374, 7375, 7376, 7377, 7378,
+ 7379, 7380, 7381, 7382, 7383, 7384, 7385, 7386,
+ 7387, 7388, 7389, 7390, 7391, 7392, 7393, 7394,
+ }},
+ {{
+ 7395, 7396, 7397, 7398, 7399, 7400, 7401, 7402,
+ 7403, 7404, 7405, 7406, 7407, 7408, 7409, 7410,
+ 7411, 7412, 7413, 7414, 7415, 7416, 7417, 7418,
+ 7419, 7420, 7421, 7422, 7423, 7424, 7425, 7426,
+ }},
+ {{
+ 7427, 7428, 7429, 7430, 7431, 7432, 7433, 7434,
+ 7435, 7436, 7437, 7438, 7439, 7440, 7441, 7442,
+ 7443, 7444, 7445, 7446, 7447, 7448, 7449, 7450,
+ 7451, 7452, 7453, 7454, 7455, 7456, 7457, 7458,
+ }},
+ {{
+ 7459, 7460, 7461, 7462, 7463, 7464, 7465, 7466,
+ 7467, 7468, 7469, 7470, 7471, 7472, 7473, 7474,
+ 7475, 7476, 7477, 7478, 7479, 7480, 7481, 7482,
+ 7483, 7484, 7485, 7486, 7487, 7488, 7489, 7490,
+ }},
+ {{
+ 7491, 7492, 7493, 7494, 7495, 7496, 7497, 7498,
+ 7499, 7500, 7501, 7502, 7503, 7504, 7505, 7506,
+ 7507, 7508, 7509, 7510, 7511, 7512, 7513, 7514,
+ 7515, 7516, 7517, 7518, 7519, 7520, 7521, 7522,
+ }},
+ {{
+ 7523, 7524, 7525, 7526, 7527, 7528, 7529, 7530,
+ 7531, 7532, 7533, 7534, 7535, 7536, 7537, 7538,
+ 7539, 7540, 7541, 7542, 7543, 7544, 7545, 7546,
+ 7547, 7548, 7549, 7550, 7551, 7552, 7553, 7554,
+ }},
+ {{
+ 7555, 7556, 7557, 7558, 7559, 7560, 7561, 7562,
+ 7563, 7564, 7565, 7566, 7567, 7568, 7569, 7570,
+ 7571, 7572, 7573, 7574, 7575, 7576, 7577, 7578,
+ 7579, 7580, 7581, 7582, 7583, 7584, 7585, 7586,
+ }},
+ {{
+ 7587, 7588, 7589, 7590, 7591, 7592, 7593, 7594,
+ 7595, 7596, 7597, 7598, 7599, 7600, 7601, 7602,
+ 7603, 7604, 7605, 7606, 7607, 7608, 7609, 7610,
+ 7611, 7612, 7613, 7614, 7615, 7616, 7617, 7618,
+ }},
+ {{
+ 7619, 7620, 7621, 7622, 7623, 7624, 7625, 7626,
+ 7627, 7628, 7629, 7630, 7631, 7632, 7633, 7634,
+ 7635, 7636, 7637, 7638, 7639, 7640, 7641, 7642,
+ 7643, 7644, 7645, 7646, 7647, 7648, 7649, 7650,
+ }},
+ {{
+ 7651, 7652, 7653, 7654, 7655, 7656, 7657, 7658,
+ 7659, 7660, 7661, 7662, 7663, 7664, 7665, 7666,
+ 7667, 7668, 7669, 7670, 7671, 7672, 7673, 7674,
+ 7675, 7676, 7677, 7678, 7679, 7680, 7681, 7682,
+ }},
+ {{
+ 7683, 7684, 7685, 7686, 7687, 7688, 7689, 7690,
+ 7691, 7692, 7693, 7694, 7695, 7696, 7697, 7698,
+ 7699, 7700, 7701, 7702, 7703, 7704, 7705, 7706,
+ 7707, 7708, 7709, 7710, 7711, 7712, 7713, 7714,
+ }},
+ {{
+ 7715, 7716, 7717, 7718, 7719, 7720, 7721, 7722,
+ 7723, 7724, 7725, 7726, 7727, 7728, 7729, 7730,
+ 7731, 7732, 7733, 7734, 7735, 7736, 7737, 7738,
+ 7739, 7740, 7741, 7742, 7743, 7744, 7745, 7746,
+ }},
+ {{
+ 7747, 7748, 7749, 7750, 7751, 7752, 7753, 7754,
+ 7755, 7756, 7757, 7758, 7759, 7760, 7761, 7762,
+ 7763, 7764, 7765, 7766, 7767, 7768, 7769, 7770,
+ 7771, 7772, 7773, 7774, 7775, 7776, 0, 0,
+ }},
+};
+static const unsigned long v320_decompose_seq[] = {
+ 0x00000000, 0x80000020, 0x00000020, 0x80000308,
+ 0x80000061, 0x00000020, 0x80000304, 0x80000032,
+ 0x80000033, 0x00000020, 0x80000301, 0x800003bc,
+ 0x00000020, 0x80000327, 0x80000031, 0x8000006f,
+ 0x00000031, 0x00002044, 0x80000034, 0x00000031,
+ 0x00002044, 0x80000032, 0x00000033, 0x00002044,
+ 0x80000034, 0x00000041, 0x80000300, 0x00000041,
+ 0x80000301, 0x00000041, 0x80000302, 0x00000041,
+ 0x80000303, 0x00000041, 0x80000308, 0x00000041,
+ 0x8000030a, 0x00000043, 0x80000327, 0x00000045,
+ 0x80000300, 0x00000045, 0x80000301, 0x00000045,
+ 0x80000302, 0x00000045, 0x80000308, 0x00000049,
+ 0x80000300, 0x00000049, 0x80000301, 0x00000049,
+ 0x80000302, 0x00000049, 0x80000308, 0x0000004e,
+ 0x80000303, 0x0000004f, 0x80000300, 0x0000004f,
+ 0x80000301, 0x0000004f, 0x80000302, 0x0000004f,
+ 0x80000303, 0x0000004f, 0x80000308, 0x00000055,
+ 0x80000300, 0x00000055, 0x80000301, 0x00000055,
+ 0x80000302, 0x00000055, 0x80000308, 0x00000059,
+ 0x80000301, 0x00000061, 0x80000300, 0x00000061,
+ 0x80000301, 0x00000061, 0x80000302, 0x00000061,
+ 0x80000303, 0x00000061, 0x80000308, 0x00000061,
+ 0x8000030a, 0x00000063, 0x80000327, 0x00000065,
+ 0x80000300, 0x00000065, 0x80000301, 0x00000065,
+ 0x80000302, 0x00000065, 0x80000308, 0x00000069,
+ 0x80000300, 0x00000069, 0x80000301, 0x00000069,
+ 0x80000302, 0x00000069, 0x80000308, 0x0000006e,
+ 0x80000303, 0x0000006f, 0x80000300, 0x0000006f,
+ 0x80000301, 0x0000006f, 0x80000302, 0x0000006f,
+ 0x80000303, 0x0000006f, 0x80000308, 0x00000075,
+ 0x80000300, 0x00000075, 0x80000301, 0x00000075,
+ 0x80000302, 0x00000075, 0x80000308, 0x00000079,
+ 0x80000301, 0x00000079, 0x80000308, 0x00000041,
+ 0x80000304, 0x00000061, 0x80000304, 0x00000041,
+ 0x80000306, 0x00000061, 0x80000306, 0x00000041,
+ 0x80000328, 0x00000061, 0x80000328, 0x00000043,
+ 0x80000301, 0x00000063, 0x80000301, 0x00000043,
+ 0x80000302, 0x00000063, 0x80000302, 0x00000043,
+ 0x80000307, 0x00000063, 0x80000307, 0x00000043,
+ 0x8000030c, 0x00000063, 0x8000030c, 0x00000044,
+ 0x8000030c, 0x00000064, 0x8000030c, 0x00000045,
+ 0x80000304, 0x00000065, 0x80000304, 0x00000045,
+ 0x80000306, 0x00000065, 0x80000306, 0x00000045,
+ 0x80000307, 0x00000065, 0x80000307, 0x00000045,
+ 0x80000328, 0x00000065, 0x80000328, 0x00000045,
+ 0x8000030c, 0x00000065, 0x8000030c, 0x00000047,
+ 0x80000302, 0x00000067, 0x80000302, 0x00000047,
+ 0x80000306, 0x00000067, 0x80000306, 0x00000047,
+ 0x80000307, 0x00000067, 0x80000307, 0x00000047,
+ 0x80000327, 0x00000067, 0x80000327, 0x00000048,
+ 0x80000302, 0x00000068, 0x80000302, 0x00000049,
+ 0x80000303, 0x00000069, 0x80000303, 0x00000049,
+ 0x80000304, 0x00000069, 0x80000304, 0x00000049,
+ 0x80000306, 0x00000069, 0x80000306, 0x00000049,
+ 0x80000328, 0x00000069, 0x80000328, 0x00000049,
+ 0x80000307, 0x00000049, 0x8000004a, 0x00000069,
+ 0x8000006a, 0x0000004a, 0x80000302, 0x0000006a,
+ 0x80000302, 0x0000004b, 0x80000327, 0x0000006b,
+ 0x80000327, 0x0000004c, 0x80000301, 0x0000006c,
+ 0x80000301, 0x0000004c, 0x80000327, 0x0000006c,
+ 0x80000327, 0x0000004c, 0x8000030c, 0x0000006c,
+ 0x8000030c, 0x0000004c, 0x800000b7, 0x0000006c,
+ 0x800000b7, 0x0000004e, 0x80000301, 0x0000006e,
+ 0x80000301, 0x0000004e, 0x80000327, 0x0000006e,
+ 0x80000327, 0x0000004e, 0x8000030c, 0x0000006e,
+ 0x8000030c, 0x000002bc, 0x8000006e, 0x0000004f,
+ 0x80000304, 0x0000006f, 0x80000304, 0x0000004f,
+ 0x80000306, 0x0000006f, 0x80000306, 0x0000004f,
+ 0x8000030b, 0x0000006f, 0x8000030b, 0x00000052,
+ 0x80000301, 0x00000072, 0x80000301, 0x00000052,
+ 0x80000327, 0x00000072, 0x80000327, 0x00000052,
+ 0x8000030c, 0x00000072, 0x8000030c, 0x00000053,
+ 0x80000301, 0x00000073, 0x80000301, 0x00000053,
+ 0x80000302, 0x00000073, 0x80000302, 0x00000053,
+ 0x80000327, 0x00000073, 0x80000327, 0x00000053,
+ 0x8000030c, 0x00000073, 0x8000030c, 0x00000054,
+ 0x80000327, 0x00000074, 0x80000327, 0x00000054,
+ 0x8000030c, 0x00000074, 0x8000030c, 0x00000055,
+ 0x80000303, 0x00000075, 0x80000303, 0x00000055,
+ 0x80000304, 0x00000075, 0x80000304, 0x00000055,
+ 0x80000306, 0x00000075, 0x80000306, 0x00000055,
+ 0x8000030a, 0x00000075, 0x8000030a, 0x00000055,
+ 0x8000030b, 0x00000075, 0x8000030b, 0x00000055,
+ 0x80000328, 0x00000075, 0x80000328, 0x00000057,
+ 0x80000302, 0x00000077, 0x80000302, 0x00000059,
+ 0x80000302, 0x00000079, 0x80000302, 0x00000059,
+ 0x80000308, 0x0000005a, 0x80000301, 0x0000007a,
+ 0x80000301, 0x0000005a, 0x80000307, 0x0000007a,
+ 0x80000307, 0x0000005a, 0x8000030c, 0x0000007a,
+ 0x8000030c, 0x80000073, 0x0000004f, 0x8000031b,
+ 0x0000006f, 0x8000031b, 0x00000055, 0x8000031b,
+ 0x00000075, 0x8000031b, 0x00000044, 0x8000017d,
+ 0x00000044, 0x8000017e, 0x00000064, 0x8000017e,
+ 0x0000004c, 0x8000004a, 0x0000004c, 0x8000006a,
+ 0x0000006c, 0x8000006a, 0x0000004e, 0x8000004a,
+ 0x0000004e, 0x8000006a, 0x0000006e, 0x8000006a,
+ 0x00000041, 0x8000030c, 0x00000061, 0x8000030c,
+ 0x00000049, 0x8000030c, 0x00000069, 0x8000030c,
+ 0x0000004f, 0x8000030c, 0x0000006f, 0x8000030c,
+ 0x00000055, 0x8000030c, 0x00000075, 0x8000030c,
+ 0x000000dc, 0x80000304, 0x000000fc, 0x80000304,
+ 0x000000dc, 0x80000301, 0x000000fc, 0x80000301,
+ 0x000000dc, 0x8000030c, 0x000000fc, 0x8000030c,
+ 0x000000dc, 0x80000300, 0x000000fc, 0x80000300,
+ 0x000000c4, 0x80000304, 0x000000e4, 0x80000304,
+ 0x00000226, 0x80000304, 0x00000227, 0x80000304,
+ 0x000000c6, 0x80000304, 0x000000e6, 0x80000304,
+ 0x00000047, 0x8000030c, 0x00000067, 0x8000030c,
+ 0x0000004b, 0x8000030c, 0x0000006b, 0x8000030c,
+ 0x0000004f, 0x80000328, 0x0000006f, 0x80000328,
+ 0x000001ea, 0x80000304, 0x000001eb, 0x80000304,
+ 0x000001b7, 0x8000030c, 0x00000292, 0x8000030c,
+ 0x0000006a, 0x8000030c, 0x00000044, 0x8000005a,
+ 0x00000044, 0x8000007a, 0x00000064, 0x8000007a,
+ 0x00000047, 0x80000301, 0x00000067, 0x80000301,
+ 0x0000004e, 0x80000300, 0x0000006e, 0x80000300,
+ 0x000000c5, 0x80000301, 0x000000e5, 0x80000301,
+ 0x000000c6, 0x80000301, 0x000000e6, 0x80000301,
+ 0x000000d8, 0x80000301, 0x000000f8, 0x80000301,
+ 0x00000041, 0x8000030f, 0x00000061, 0x8000030f,
+ 0x00000041, 0x80000311, 0x00000061, 0x80000311,
+ 0x00000045, 0x8000030f, 0x00000065, 0x8000030f,
+ 0x00000045, 0x80000311, 0x00000065, 0x80000311,
+ 0x00000049, 0x8000030f, 0x00000069, 0x8000030f,
+ 0x00000049, 0x80000311, 0x00000069, 0x80000311,
+ 0x0000004f, 0x8000030f, 0x0000006f, 0x8000030f,
+ 0x0000004f, 0x80000311, 0x0000006f, 0x80000311,
+ 0x00000052, 0x8000030f, 0x00000072, 0x8000030f,
+ 0x00000052, 0x80000311, 0x00000072, 0x80000311,
+ 0x00000055, 0x8000030f, 0x00000075, 0x8000030f,
+ 0x00000055, 0x80000311, 0x00000075, 0x80000311,
+ 0x00000053, 0x80000326, 0x00000073, 0x80000326,
+ 0x00000054, 0x80000326, 0x00000074, 0x80000326,
+ 0x00000048, 0x8000030c, 0x00000068, 0x8000030c,
+ 0x00000041, 0x80000307, 0x00000061, 0x80000307,
+ 0x00000045, 0x80000327, 0x00000065, 0x80000327,
+ 0x000000d6, 0x80000304, 0x000000f6, 0x80000304,
+ 0x000000d5, 0x80000304, 0x000000f5, 0x80000304,
+ 0x0000004f, 0x80000307, 0x0000006f, 0x80000307,
+ 0x0000022e, 0x80000304, 0x0000022f, 0x80000304,
+ 0x00000059, 0x80000304, 0x00000079, 0x80000304,
+ 0x80000068, 0x80000266, 0x8000006a, 0x80000072,
+ 0x80000279, 0x8000027b, 0x80000281, 0x80000077,
+ 0x80000079, 0x00000020, 0x80000306, 0x00000020,
+ 0x80000307, 0x00000020, 0x8000030a, 0x00000020,
+ 0x80000328, 0x00000020, 0x80000303, 0x00000020,
+ 0x8000030b, 0x80000263, 0x8000006c, 0x80000073,
+ 0x80000078, 0x80000295, 0x80000300, 0x80000301,
+ 0x80000313, 0x00000308, 0x80000301, 0x800002b9,
+ 0x00000020, 0x80000345, 0x8000003b, 0x00000020,
+ 0x80000301, 0x000000a8, 0x80000301, 0x00000391,
+ 0x80000301, 0x800000b7, 0x00000395, 0x80000301,
+ 0x00000397, 0x80000301, 0x00000399, 0x80000301,
+ 0x0000039f, 0x80000301, 0x000003a5, 0x80000301,
+ 0x000003a9, 0x80000301, 0x000003ca, 0x80000301,
+ 0x00000399, 0x80000308, 0x000003a5, 0x80000308,
+ 0x000003b1, 0x80000301, 0x000003b5, 0x80000301,
+ 0x000003b7, 0x80000301, 0x000003b9, 0x80000301,
+ 0x000003cb, 0x80000301, 0x000003b9, 0x80000308,
+ 0x000003c5, 0x80000308, 0x000003bf, 0x80000301,
+ 0x000003c5, 0x80000301, 0x000003c9, 0x80000301,
+ 0x800003b2, 0x800003b8, 0x800003a5, 0x000003d2,
+ 0x80000301, 0x000003d2, 0x80000308, 0x800003c6,
+ 0x800003c0, 0x800003ba, 0x800003c1, 0x800003c2,
+ 0x80000398, 0x800003b5, 0x00000415, 0x80000300,
+ 0x00000415, 0x80000308, 0x00000413, 0x80000301,
+ 0x00000406, 0x80000308, 0x0000041a, 0x80000301,
+ 0x00000418, 0x80000300, 0x00000423, 0x80000306,
+ 0x00000418, 0x80000306, 0x00000438, 0x80000306,
+ 0x00000435, 0x80000300, 0x00000435, 0x80000308,
+ 0x00000433, 0x80000301, 0x00000456, 0x80000308,
+ 0x0000043a, 0x80000301, 0x00000438, 0x80000300,
+ 0x00000443, 0x80000306, 0x00000474, 0x8000030f,
+ 0x00000475, 0x8000030f, 0x00000416, 0x80000306,
+ 0x00000436, 0x80000306, 0x00000410, 0x80000306,
+ 0x00000430, 0x80000306, 0x00000410, 0x80000308,
+ 0x00000430, 0x80000308, 0x00000415, 0x80000306,
+ 0x00000435, 0x80000306, 0x000004d8, 0x80000308,
+ 0x000004d9, 0x80000308, 0x00000416, 0x80000308,
+ 0x00000436, 0x80000308, 0x00000417, 0x80000308,
+ 0x00000437, 0x80000308, 0x00000418, 0x80000304,
+ 0x00000438, 0x80000304, 0x00000418, 0x80000308,
+ 0x00000438, 0x80000308, 0x0000041e, 0x80000308,
+ 0x0000043e, 0x80000308, 0x000004e8, 0x80000308,
+ 0x000004e9, 0x80000308, 0x0000042d, 0x80000308,
+ 0x0000044d, 0x80000308, 0x00000423, 0x80000304,
+ 0x00000443, 0x80000304, 0x00000423, 0x80000308,
+ 0x00000443, 0x80000308, 0x00000423, 0x8000030b,
+ 0x00000443, 0x8000030b, 0x00000427, 0x80000308,
+ 0x00000447, 0x80000308, 0x0000042b, 0x80000308,
+ 0x0000044b, 0x80000308, 0x00000565, 0x80000582,
+ 0x00000627, 0x80000653, 0x00000627, 0x80000654,
+ 0x00000648, 0x80000654, 0x00000627, 0x80000655,
+ 0x0000064a, 0x80000654, 0x00000627, 0x80000674,
+ 0x00000648, 0x80000674, 0x000006c7, 0x80000674,
+ 0x0000064a, 0x80000674, 0x000006d5, 0x80000654,
+ 0x000006c1, 0x80000654, 0x000006d2, 0x80000654,
+ 0x00000928, 0x8000093c, 0x00000930, 0x8000093c,
+ 0x00000933, 0x8000093c, 0x00000915, 0x8000093c,
+ 0x00000916, 0x8000093c, 0x00000917, 0x8000093c,
+ 0x0000091c, 0x8000093c, 0x00000921, 0x8000093c,
+ 0x00000922, 0x8000093c, 0x0000092b, 0x8000093c,
+ 0x0000092f, 0x8000093c, 0x000009c7, 0x800009be,
+ 0x000009c7, 0x800009d7, 0x000009a1, 0x800009bc,
+ 0x000009a2, 0x800009bc, 0x000009af, 0x800009bc,
+ 0x00000a32, 0x80000a3c, 0x00000a38, 0x80000a3c,
+ 0x00000a16, 0x80000a3c, 0x00000a17, 0x80000a3c,
+ 0x00000a1c, 0x80000a3c, 0x00000a2b, 0x80000a3c,
+ 0x00000b47, 0x80000b56, 0x00000b47, 0x80000b3e,
+ 0x00000b47, 0x80000b57, 0x00000b21, 0x80000b3c,
+ 0x00000b22, 0x80000b3c, 0x00000b92, 0x80000bd7,
+ 0x00000bc6, 0x80000bbe, 0x00000bc7, 0x80000bbe,
+ 0x00000bc6, 0x80000bd7, 0x00000c46, 0x80000c56,
+ 0x00000cbf, 0x80000cd5, 0x00000cc6, 0x80000cd5,
+ 0x00000cc6, 0x80000cd6, 0x00000cc6, 0x80000cc2,
+ 0x00000cca, 0x80000cd5, 0x00000d46, 0x80000d3e,
+ 0x00000d47, 0x80000d3e, 0x00000d46, 0x80000d57,
+ 0x00000dd9, 0x80000dca, 0x00000dd9, 0x80000dcf,
+ 0x00000ddc, 0x80000dca, 0x00000dd9, 0x80000ddf,
+ 0x00000e4d, 0x80000e32, 0x00000ecd, 0x80000eb2,
+ 0x00000eab, 0x80000e99, 0x00000eab, 0x80000ea1,
+ 0x80000f0b, 0x00000f42, 0x80000fb7, 0x00000f4c,
+ 0x80000fb7, 0x00000f51, 0x80000fb7, 0x00000f56,
+ 0x80000fb7, 0x00000f5b, 0x80000fb7, 0x00000f40,
+ 0x80000fb5, 0x00000f71, 0x80000f72, 0x00000f71,
+ 0x80000f74, 0x00000fb2, 0x80000f80, 0x00000fb2,
+ 0x80000f81, 0x00000fb3, 0x80000f80, 0x00000fb3,
+ 0x80000f81, 0x00000f71, 0x80000f80, 0x00000f92,
+ 0x80000fb7, 0x00000f9c, 0x80000fb7, 0x00000fa1,
+ 0x80000fb7, 0x00000fa6, 0x80000fb7, 0x00000fab,
+ 0x80000fb7, 0x00000f90, 0x80000fb5, 0x00001025,
+ 0x8000102e, 0x00000041, 0x80000325, 0x00000061,
+ 0x80000325, 0x00000042, 0x80000307, 0x00000062,
+ 0x80000307, 0x00000042, 0x80000323, 0x00000062,
+ 0x80000323, 0x00000042, 0x80000331, 0x00000062,
+ 0x80000331, 0x000000c7, 0x80000301, 0x000000e7,
+ 0x80000301, 0x00000044, 0x80000307, 0x00000064,
+ 0x80000307, 0x00000044, 0x80000323, 0x00000064,
+ 0x80000323, 0x00000044, 0x80000331, 0x00000064,
+ 0x80000331, 0x00000044, 0x80000327, 0x00000064,
+ 0x80000327, 0x00000044, 0x8000032d, 0x00000064,
+ 0x8000032d, 0x00000112, 0x80000300, 0x00000113,
+ 0x80000300, 0x00000112, 0x80000301, 0x00000113,
+ 0x80000301, 0x00000045, 0x8000032d, 0x00000065,
+ 0x8000032d, 0x00000045, 0x80000330, 0x00000065,
+ 0x80000330, 0x00000228, 0x80000306, 0x00000229,
+ 0x80000306, 0x00000046, 0x80000307, 0x00000066,
+ 0x80000307, 0x00000047, 0x80000304, 0x00000067,
+ 0x80000304, 0x00000048, 0x80000307, 0x00000068,
+ 0x80000307, 0x00000048, 0x80000323, 0x00000068,
+ 0x80000323, 0x00000048, 0x80000308, 0x00000068,
+ 0x80000308, 0x00000048, 0x80000327, 0x00000068,
+ 0x80000327, 0x00000048, 0x8000032e, 0x00000068,
+ 0x8000032e, 0x00000049, 0x80000330, 0x00000069,
+ 0x80000330, 0x000000cf, 0x80000301, 0x000000ef,
+ 0x80000301, 0x0000004b, 0x80000301, 0x0000006b,
+ 0x80000301, 0x0000004b, 0x80000323, 0x0000006b,
+ 0x80000323, 0x0000004b, 0x80000331, 0x0000006b,
+ 0x80000331, 0x0000004c, 0x80000323, 0x0000006c,
+ 0x80000323, 0x00001e36, 0x80000304, 0x00001e37,
+ 0x80000304, 0x0000004c, 0x80000331, 0x0000006c,
+ 0x80000331, 0x0000004c, 0x8000032d, 0x0000006c,
+ 0x8000032d, 0x0000004d, 0x80000301, 0x0000006d,
+ 0x80000301, 0x0000004d, 0x80000307, 0x0000006d,
+ 0x80000307, 0x0000004d, 0x80000323, 0x0000006d,
+ 0x80000323, 0x0000004e, 0x80000307, 0x0000006e,
+ 0x80000307, 0x0000004e, 0x80000323, 0x0000006e,
+ 0x80000323, 0x0000004e, 0x80000331, 0x0000006e,
+ 0x80000331, 0x0000004e, 0x8000032d, 0x0000006e,
+ 0x8000032d, 0x000000d5, 0x80000301, 0x000000f5,
+ 0x80000301, 0x000000d5, 0x80000308, 0x000000f5,
+ 0x80000308, 0x0000014c, 0x80000300, 0x0000014d,
+ 0x80000300, 0x0000014c, 0x80000301, 0x0000014d,
+ 0x80000301, 0x00000050, 0x80000301, 0x00000070,
+ 0x80000301, 0x00000050, 0x80000307, 0x00000070,
+ 0x80000307, 0x00000052, 0x80000307, 0x00000072,
+ 0x80000307, 0x00000052, 0x80000323, 0x00000072,
+ 0x80000323, 0x00001e5a, 0x80000304, 0x00001e5b,
+ 0x80000304, 0x00000052, 0x80000331, 0x00000072,
+ 0x80000331, 0x00000053, 0x80000307, 0x00000073,
+ 0x80000307, 0x00000053, 0x80000323, 0x00000073,
+ 0x80000323, 0x0000015a, 0x80000307, 0x0000015b,
+ 0x80000307, 0x00000160, 0x80000307, 0x00000161,
+ 0x80000307, 0x00001e62, 0x80000307, 0x00001e63,
+ 0x80000307, 0x00000054, 0x80000307, 0x00000074,
+ 0x80000307, 0x00000054, 0x80000323, 0x00000074,
+ 0x80000323, 0x00000054, 0x80000331, 0x00000074,
+ 0x80000331, 0x00000054, 0x8000032d, 0x00000074,
+ 0x8000032d, 0x00000055, 0x80000324, 0x00000075,
+ 0x80000324, 0x00000055, 0x80000330, 0x00000075,
+ 0x80000330, 0x00000055, 0x8000032d, 0x00000075,
+ 0x8000032d, 0x00000168, 0x80000301, 0x00000169,
+ 0x80000301, 0x0000016a, 0x80000308, 0x0000016b,
+ 0x80000308, 0x00000056, 0x80000303, 0x00000076,
+ 0x80000303, 0x00000056, 0x80000323, 0x00000076,
+ 0x80000323, 0x00000057, 0x80000300, 0x00000077,
+ 0x80000300, 0x00000057, 0x80000301, 0x00000077,
+ 0x80000301, 0x00000057, 0x80000308, 0x00000077,
+ 0x80000308, 0x00000057, 0x80000307, 0x00000077,
+ 0x80000307, 0x00000057, 0x80000323, 0x00000077,
+ 0x80000323, 0x00000058, 0x80000307, 0x00000078,
+ 0x80000307, 0x00000058, 0x80000308, 0x00000078,
+ 0x80000308, 0x00000059, 0x80000307, 0x00000079,
+ 0x80000307, 0x0000005a, 0x80000302, 0x0000007a,
+ 0x80000302, 0x0000005a, 0x80000323, 0x0000007a,
+ 0x80000323, 0x0000005a, 0x80000331, 0x0000007a,
+ 0x80000331, 0x00000068, 0x80000331, 0x00000074,
+ 0x80000308, 0x00000077, 0x8000030a, 0x00000079,
+ 0x8000030a, 0x00000061, 0x800002be, 0x0000017f,
+ 0x80000307, 0x00000041, 0x80000323, 0x00000061,
+ 0x80000323, 0x00000041, 0x80000309, 0x00000061,
+ 0x80000309, 0x000000c2, 0x80000301, 0x000000e2,
+ 0x80000301, 0x000000c2, 0x80000300, 0x000000e2,
+ 0x80000300, 0x000000c2, 0x80000309, 0x000000e2,
+ 0x80000309, 0x000000c2, 0x80000303, 0x000000e2,
+ 0x80000303, 0x00001ea0, 0x80000302, 0x00001ea1,
+ 0x80000302, 0x00000102, 0x80000301, 0x00000103,
+ 0x80000301, 0x00000102, 0x80000300, 0x00000103,
+ 0x80000300, 0x00000102, 0x80000309, 0x00000103,
+ 0x80000309, 0x00000102, 0x80000303, 0x00000103,
+ 0x80000303, 0x00001ea0, 0x80000306, 0x00001ea1,
+ 0x80000306, 0x00000045, 0x80000323, 0x00000065,
+ 0x80000323, 0x00000045, 0x80000309, 0x00000065,
+ 0x80000309, 0x00000045, 0x80000303, 0x00000065,
+ 0x80000303, 0x000000ca, 0x80000301, 0x000000ea,
+ 0x80000301, 0x000000ca, 0x80000300, 0x000000ea,
+ 0x80000300, 0x000000ca, 0x80000309, 0x000000ea,
+ 0x80000309, 0x000000ca, 0x80000303, 0x000000ea,
+ 0x80000303, 0x00001eb8, 0x80000302, 0x00001eb9,
+ 0x80000302, 0x00000049, 0x80000309, 0x00000069,
+ 0x80000309, 0x00000049, 0x80000323, 0x00000069,
+ 0x80000323, 0x0000004f, 0x80000323, 0x0000006f,
+ 0x80000323, 0x0000004f, 0x80000309, 0x0000006f,
+ 0x80000309, 0x000000d4, 0x80000301, 0x000000f4,
+ 0x80000301, 0x000000d4, 0x80000300, 0x000000f4,
+ 0x80000300, 0x000000d4, 0x80000309, 0x000000f4,
+ 0x80000309, 0x000000d4, 0x80000303, 0x000000f4,
+ 0x80000303, 0x00001ecc, 0x80000302, 0x00001ecd,
+ 0x80000302, 0x000001a0, 0x80000301, 0x000001a1,
+ 0x80000301, 0x000001a0, 0x80000300, 0x000001a1,
+ 0x80000300, 0x000001a0, 0x80000309, 0x000001a1,
+ 0x80000309, 0x000001a0, 0x80000303, 0x000001a1,
+ 0x80000303, 0x000001a0, 0x80000323, 0x000001a1,
+ 0x80000323, 0x00000055, 0x80000323, 0x00000075,
+ 0x80000323, 0x00000055, 0x80000309, 0x00000075,
+ 0x80000309, 0x000001af, 0x80000301, 0x000001b0,
+ 0x80000301, 0x000001af, 0x80000300, 0x000001b0,
+ 0x80000300, 0x000001af, 0x80000309, 0x000001b0,
+ 0x80000309, 0x000001af, 0x80000303, 0x000001b0,
+ 0x80000303, 0x000001af, 0x80000323, 0x000001b0,
+ 0x80000323, 0x00000059, 0x80000300, 0x00000079,
+ 0x80000300, 0x00000059, 0x80000323, 0x00000079,
+ 0x80000323, 0x00000059, 0x80000309, 0x00000079,
+ 0x80000309, 0x00000059, 0x80000303, 0x00000079,
+ 0x80000303, 0x000003b1, 0x80000313, 0x000003b1,
+ 0x80000314, 0x00001f00, 0x80000300, 0x00001f01,
+ 0x80000300, 0x00001f00, 0x80000301, 0x00001f01,
+ 0x80000301, 0x00001f00, 0x80000342, 0x00001f01,
+ 0x80000342, 0x00000391, 0x80000313, 0x00000391,
+ 0x80000314, 0x00001f08, 0x80000300, 0x00001f09,
+ 0x80000300, 0x00001f08, 0x80000301, 0x00001f09,
+ 0x80000301, 0x00001f08, 0x80000342, 0x00001f09,
+ 0x80000342, 0x000003b5, 0x80000313, 0x000003b5,
+ 0x80000314, 0x00001f10, 0x80000300, 0x00001f11,
+ 0x80000300, 0x00001f10, 0x80000301, 0x00001f11,
+ 0x80000301, 0x00000395, 0x80000313, 0x00000395,
+ 0x80000314, 0x00001f18, 0x80000300, 0x00001f19,
+ 0x80000300, 0x00001f18, 0x80000301, 0x00001f19,
+ 0x80000301, 0x000003b7, 0x80000313, 0x000003b7,
+ 0x80000314, 0x00001f20, 0x80000300, 0x00001f21,
+ 0x80000300, 0x00001f20, 0x80000301, 0x00001f21,
+ 0x80000301, 0x00001f20, 0x80000342, 0x00001f21,
+ 0x80000342, 0x00000397, 0x80000313, 0x00000397,
+ 0x80000314, 0x00001f28, 0x80000300, 0x00001f29,
+ 0x80000300, 0x00001f28, 0x80000301, 0x00001f29,
+ 0x80000301, 0x00001f28, 0x80000342, 0x00001f29,
+ 0x80000342, 0x000003b9, 0x80000313, 0x000003b9,
+ 0x80000314, 0x00001f30, 0x80000300, 0x00001f31,
+ 0x80000300, 0x00001f30, 0x80000301, 0x00001f31,
+ 0x80000301, 0x00001f30, 0x80000342, 0x00001f31,
+ 0x80000342, 0x00000399, 0x80000313, 0x00000399,
+ 0x80000314, 0x00001f38, 0x80000300, 0x00001f39,
+ 0x80000300, 0x00001f38, 0x80000301, 0x00001f39,
+ 0x80000301, 0x00001f38, 0x80000342, 0x00001f39,
+ 0x80000342, 0x000003bf, 0x80000313, 0x000003bf,
+ 0x80000314, 0x00001f40, 0x80000300, 0x00001f41,
+ 0x80000300, 0x00001f40, 0x80000301, 0x00001f41,
+ 0x80000301, 0x0000039f, 0x80000313, 0x0000039f,
+ 0x80000314, 0x00001f48, 0x80000300, 0x00001f49,
+ 0x80000300, 0x00001f48, 0x80000301, 0x00001f49,
+ 0x80000301, 0x000003c5, 0x80000313, 0x000003c5,
+ 0x80000314, 0x00001f50, 0x80000300, 0x00001f51,
+ 0x80000300, 0x00001f50, 0x80000301, 0x00001f51,
+ 0x80000301, 0x00001f50, 0x80000342, 0x00001f51,
+ 0x80000342, 0x000003a5, 0x80000314, 0x00001f59,
+ 0x80000300, 0x00001f59, 0x80000301, 0x00001f59,
+ 0x80000342, 0x000003c9, 0x80000313, 0x000003c9,
+ 0x80000314, 0x00001f60, 0x80000300, 0x00001f61,
+ 0x80000300, 0x00001f60, 0x80000301, 0x00001f61,
+ 0x80000301, 0x00001f60, 0x80000342, 0x00001f61,
+ 0x80000342, 0x000003a9, 0x80000313, 0x000003a9,
+ 0x80000314, 0x00001f68, 0x80000300, 0x00001f69,
+ 0x80000300, 0x00001f68, 0x80000301, 0x00001f69,
+ 0x80000301, 0x00001f68, 0x80000342, 0x00001f69,
+ 0x80000342, 0x000003b1, 0x80000300, 0x800003ac,
+ 0x000003b5, 0x80000300, 0x800003ad, 0x000003b7,
+ 0x80000300, 0x800003ae, 0x000003b9, 0x80000300,
+ 0x800003af, 0x000003bf, 0x80000300, 0x800003cc,
+ 0x000003c5, 0x80000300, 0x800003cd, 0x000003c9,
+ 0x80000300, 0x800003ce, 0x00001f00, 0x80000345,
+ 0x00001f01, 0x80000345, 0x00001f02, 0x80000345,
+ 0x00001f03, 0x80000345, 0x00001f04, 0x80000345,
+ 0x00001f05, 0x80000345, 0x00001f06, 0x80000345,
+ 0x00001f07, 0x80000345, 0x00001f08, 0x80000345,
+ 0x00001f09, 0x80000345, 0x00001f0a, 0x80000345,
+ 0x00001f0b, 0x80000345, 0x00001f0c, 0x80000345,
+ 0x00001f0d, 0x80000345, 0x00001f0e, 0x80000345,
+ 0x00001f0f, 0x80000345, 0x00001f20, 0x80000345,
+ 0x00001f21, 0x80000345, 0x00001f22, 0x80000345,
+ 0x00001f23, 0x80000345, 0x00001f24, 0x80000345,
+ 0x00001f25, 0x80000345, 0x00001f26, 0x80000345,
+ 0x00001f27, 0x80000345, 0x00001f28, 0x80000345,
+ 0x00001f29, 0x80000345, 0x00001f2a, 0x80000345,
+ 0x00001f2b, 0x80000345, 0x00001f2c, 0x80000345,
+ 0x00001f2d, 0x80000345, 0x00001f2e, 0x80000345,
+ 0x00001f2f, 0x80000345, 0x00001f60, 0x80000345,
+ 0x00001f61, 0x80000345, 0x00001f62, 0x80000345,
+ 0x00001f63, 0x80000345, 0x00001f64, 0x80000345,
+ 0x00001f65, 0x80000345, 0x00001f66, 0x80000345,
+ 0x00001f67, 0x80000345, 0x00001f68, 0x80000345,
+ 0x00001f69, 0x80000345, 0x00001f6a, 0x80000345,
+ 0x00001f6b, 0x80000345, 0x00001f6c, 0x80000345,
+ 0x00001f6d, 0x80000345, 0x00001f6e, 0x80000345,
+ 0x00001f6f, 0x80000345, 0x000003b1, 0x80000306,
+ 0x000003b1, 0x80000304, 0x00001f70, 0x80000345,
+ 0x000003b1, 0x80000345, 0x000003ac, 0x80000345,
+ 0x000003b1, 0x80000342, 0x00001fb6, 0x80000345,
+ 0x00000391, 0x80000306, 0x00000391, 0x80000304,
+ 0x00000391, 0x80000300, 0x80000386, 0x00000391,
+ 0x80000345, 0x00000020, 0x80000313, 0x800003b9,
+ 0x00000020, 0x80000313, 0x00000020, 0x80000342,
+ 0x000000a8, 0x80000342, 0x00001f74, 0x80000345,
+ 0x000003b7, 0x80000345, 0x000003ae, 0x80000345,
+ 0x000003b7, 0x80000342, 0x00001fc6, 0x80000345,
+ 0x00000395, 0x80000300, 0x80000388, 0x00000397,
+ 0x80000300, 0x80000389, 0x00000397, 0x80000345,
+ 0x00001fbf, 0x80000300, 0x00001fbf, 0x80000301,
+ 0x00001fbf, 0x80000342, 0x000003b9, 0x80000306,
+ 0x000003b9, 0x80000304, 0x000003ca, 0x80000300,
+ 0x80000390, 0x000003b9, 0x80000342, 0x000003ca,
+ 0x80000342, 0x00000399, 0x80000306, 0x00000399,
+ 0x80000304, 0x00000399, 0x80000300, 0x8000038a,
+ 0x00001ffe, 0x80000300, 0x00001ffe, 0x80000301,
+ 0x00001ffe, 0x80000342, 0x000003c5, 0x80000306,
+ 0x000003c5, 0x80000304, 0x000003cb, 0x80000300,
+ 0x800003b0, 0x000003c1, 0x80000313, 0x000003c1,
+ 0x80000314, 0x000003c5, 0x80000342, 0x000003cb,
+ 0x80000342, 0x000003a5, 0x80000306, 0x000003a5,
+ 0x80000304, 0x000003a5, 0x80000300, 0x8000038e,
+ 0x000003a1, 0x80000314, 0x000000a8, 0x80000300,
+ 0x80000385, 0x80000060, 0x00001f7c, 0x80000345,
+ 0x000003c9, 0x80000345, 0x000003ce, 0x80000345,
+ 0x000003c9, 0x80000342, 0x00001ff6, 0x80000345,
+ 0x0000039f, 0x80000300, 0x8000038c, 0x000003a9,
+ 0x80000300, 0x8000038f, 0x000003a9, 0x80000345,
+ 0x800000b4, 0x00000020, 0x80000314, 0x80002002,
+ 0x80002003, 0x80000020, 0x80000020, 0x80000020,
+ 0x80000020, 0x80000020, 0x80000020, 0x80000020,
+ 0x80000020, 0x80000020, 0x80002010, 0x00000020,
+ 0x80000333, 0x8000002e, 0x0000002e, 0x8000002e,
+ 0x0000002e, 0x0000002e, 0x8000002e, 0x80000020,
+ 0x00002032, 0x80002032, 0x00002032, 0x00002032,
+ 0x80002032, 0x00002035, 0x80002035, 0x00002035,
+ 0x00002035, 0x80002035, 0x00000021, 0x80000021,
+ 0x00000020, 0x80000305, 0x0000003f, 0x8000003f,
+ 0x0000003f, 0x80000021, 0x00000021, 0x8000003f,
+ 0x00002032, 0x00002032, 0x00002032, 0x80002032,
+ 0x80000020, 0x80000030, 0x80000069, 0x80000034,
+ 0x80000035, 0x80000036, 0x80000037, 0x80000038,
+ 0x80000039, 0x8000002b, 0x80002212, 0x8000003d,
+ 0x80000028, 0x80000029, 0x8000006e, 0x80000030,
+ 0x80000031, 0x80000032, 0x80000033, 0x80000034,
+ 0x80000035, 0x80000036, 0x80000037, 0x80000038,
+ 0x80000039, 0x8000002b, 0x80002212, 0x8000003d,
+ 0x80000028, 0x80000029, 0x00000052, 0x80000073,
+ 0x00000061, 0x0000002f, 0x80000063, 0x00000061,
+ 0x0000002f, 0x80000073, 0x80000043, 0x000000b0,
+ 0x80000043, 0x00000063, 0x0000002f, 0x8000006f,
+ 0x00000063, 0x0000002f, 0x80000075, 0x80000190,
+ 0x000000b0, 0x80000046, 0x80000067, 0x80000048,
+ 0x80000048, 0x80000048, 0x80000068, 0x80000127,
+ 0x80000049, 0x80000049, 0x8000004c, 0x8000006c,
+ 0x8000004e, 0x0000004e, 0x8000006f, 0x80000050,
+ 0x80000051, 0x80000052, 0x80000052, 0x80000052,
+ 0x00000053, 0x8000004d, 0x00000054, 0x00000045,
+ 0x8000004c, 0x00000054, 0x8000004d, 0x8000005a,
+ 0x800003a9, 0x8000005a, 0x8000004b, 0x800000c5,
+ 0x80000042, 0x80000043, 0x80000065, 0x80000045,
+ 0x80000046, 0x8000004d, 0x8000006f, 0x800005d0,
+ 0x800005d1, 0x800005d2, 0x800005d3, 0x80000069,
+ 0x800003b3, 0x80000393, 0x800003a0, 0x80002211,
+ 0x80000044, 0x80000064, 0x80000065, 0x80000069,
+ 0x8000006a, 0x00000031, 0x00002044, 0x80000033,
+ 0x00000032, 0x00002044, 0x80000033, 0x00000031,
+ 0x00002044, 0x80000035, 0x00000032, 0x00002044,
+ 0x80000035, 0x00000033, 0x00002044, 0x80000035,
+ 0x00000034, 0x00002044, 0x80000035, 0x00000031,
+ 0x00002044, 0x80000036, 0x00000035, 0x00002044,
+ 0x80000036, 0x00000031, 0x00002044, 0x80000038,
+ 0x00000033, 0x00002044, 0x80000038, 0x00000035,
+ 0x00002044, 0x80000038, 0x00000037, 0x00002044,
+ 0x80000038, 0x00000031, 0x80002044, 0x80000049,
+ 0x00000049, 0x80000049, 0x00000049, 0x00000049,
+ 0x80000049, 0x00000049, 0x80000056, 0x80000056,
+ 0x00000056, 0x80000049, 0x00000056, 0x00000049,
+ 0x80000049, 0x00000056, 0x00000049, 0x00000049,
+ 0x80000049, 0x00000049, 0x80000058, 0x80000058,
+ 0x00000058, 0x80000049, 0x00000058, 0x00000049,
+ 0x80000049, 0x8000004c, 0x80000043, 0x80000044,
+ 0x8000004d, 0x80000069, 0x00000069, 0x80000069,
+ 0x00000069, 0x00000069, 0x80000069, 0x00000069,
+ 0x80000076, 0x80000076, 0x00000076, 0x80000069,
+ 0x00000076, 0x00000069, 0x80000069, 0x00000076,
+ 0x00000069, 0x00000069, 0x80000069, 0x00000069,
+ 0x80000078, 0x80000078, 0x00000078, 0x80000069,
+ 0x00000078, 0x00000069, 0x80000069, 0x8000006c,
+ 0x80000063, 0x80000064, 0x8000006d, 0x00002190,
+ 0x80000338, 0x00002192, 0x80000338, 0x00002194,
+ 0x80000338, 0x000021d0, 0x80000338, 0x000021d4,
+ 0x80000338, 0x000021d2, 0x80000338, 0x00002203,
+ 0x80000338, 0x00002208, 0x80000338, 0x0000220b,
+ 0x80000338, 0x00002223, 0x80000338, 0x00002225,
+ 0x80000338, 0x0000222b, 0x8000222b, 0x0000222b,
+ 0x0000222b, 0x8000222b, 0x0000222e, 0x8000222e,
+ 0x0000222e, 0x0000222e, 0x8000222e, 0x0000223c,
+ 0x80000338, 0x00002243, 0x80000338, 0x00002245,
+ 0x80000338, 0x00002248, 0x80000338, 0x0000003d,
+ 0x80000338, 0x00002261, 0x80000338, 0x0000224d,
+ 0x80000338, 0x0000003c, 0x80000338, 0x0000003e,
+ 0x80000338, 0x00002264, 0x80000338, 0x00002265,
+ 0x80000338, 0x00002272, 0x80000338, 0x00002273,
+ 0x80000338, 0x00002276, 0x80000338, 0x00002277,
+ 0x80000338, 0x0000227a, 0x80000338, 0x0000227b,
+ 0x80000338, 0x00002282, 0x80000338, 0x00002283,
+ 0x80000338, 0x00002286, 0x80000338, 0x00002287,
+ 0x80000338, 0x000022a2, 0x80000338, 0x000022a8,
+ 0x80000338, 0x000022a9, 0x80000338, 0x000022ab,
+ 0x80000338, 0x0000227c, 0x80000338, 0x0000227d,
+ 0x80000338, 0x00002291, 0x80000338, 0x00002292,
+ 0x80000338, 0x000022b2, 0x80000338, 0x000022b3,
+ 0x80000338, 0x000022b4, 0x80000338, 0x000022b5,
+ 0x80000338, 0x80003008, 0x80003009, 0x80000031,
+ 0x80000032, 0x80000033, 0x80000034, 0x80000035,
+ 0x80000036, 0x80000037, 0x80000038, 0x80000039,
+ 0x00000031, 0x80000030, 0x00000031, 0x80000031,
+ 0x00000031, 0x80000032, 0x00000031, 0x80000033,
+ 0x00000031, 0x80000034, 0x00000031, 0x80000035,
+ 0x00000031, 0x80000036, 0x00000031, 0x80000037,
+ 0x00000031, 0x80000038, 0x00000031, 0x80000039,
+ 0x00000032, 0x80000030, 0x00000028, 0x00000031,
+ 0x80000029, 0x00000028, 0x00000032, 0x80000029,
+ 0x00000028, 0x00000033, 0x80000029, 0x00000028,
+ 0x00000034, 0x80000029, 0x00000028, 0x00000035,
+ 0x80000029, 0x00000028, 0x00000036, 0x80000029,
+ 0x00000028, 0x00000037, 0x80000029, 0x00000028,
+ 0x00000038, 0x80000029, 0x00000028, 0x00000039,
+ 0x80000029, 0x00000028, 0x00000031, 0x00000030,
+ 0x80000029, 0x00000028, 0x00000031, 0x00000031,
+ 0x80000029, 0x00000028, 0x00000031, 0x00000032,
+ 0x80000029, 0x00000028, 0x00000031, 0x00000033,
+ 0x80000029, 0x00000028, 0x00000031, 0x00000034,
+ 0x80000029, 0x00000028, 0x00000031, 0x00000035,
+ 0x80000029, 0x00000028, 0x00000031, 0x00000036,
+ 0x80000029, 0x00000028, 0x00000031, 0x00000037,
+ 0x80000029, 0x00000028, 0x00000031, 0x00000038,
+ 0x80000029, 0x00000028, 0x00000031, 0x00000039,
+ 0x80000029, 0x00000028, 0x00000032, 0x00000030,
+ 0x80000029, 0x00000031, 0x8000002e, 0x00000032,
+ 0x8000002e, 0x00000033, 0x8000002e, 0x00000034,
+ 0x8000002e, 0x00000035, 0x8000002e, 0x00000036,
+ 0x8000002e, 0x00000037, 0x8000002e, 0x00000038,
+ 0x8000002e, 0x00000039, 0x8000002e, 0x00000031,
+ 0x00000030, 0x8000002e, 0x00000031, 0x00000031,
+ 0x8000002e, 0x00000031, 0x00000032, 0x8000002e,
+ 0x00000031, 0x00000033, 0x8000002e, 0x00000031,
+ 0x00000034, 0x8000002e, 0x00000031, 0x00000035,
+ 0x8000002e, 0x00000031, 0x00000036, 0x8000002e,
+ 0x00000031, 0x00000037, 0x8000002e, 0x00000031,
+ 0x00000038, 0x8000002e, 0x00000031, 0x00000039,
+ 0x8000002e, 0x00000032, 0x00000030, 0x8000002e,
+ 0x00000028, 0x00000061, 0x80000029, 0x00000028,
+ 0x00000062, 0x80000029, 0x00000028, 0x00000063,
+ 0x80000029, 0x00000028, 0x00000064, 0x80000029,
+ 0x00000028, 0x00000065, 0x80000029, 0x00000028,
+ 0x00000066, 0x80000029, 0x00000028, 0x00000067,
+ 0x80000029, 0x00000028, 0x00000068, 0x80000029,
+ 0x00000028, 0x00000069, 0x80000029, 0x00000028,
+ 0x0000006a, 0x80000029, 0x00000028, 0x0000006b,
+ 0x80000029, 0x00000028, 0x0000006c, 0x80000029,
+ 0x00000028, 0x0000006d, 0x80000029, 0x00000028,
+ 0x0000006e, 0x80000029, 0x00000028, 0x0000006f,
+ 0x80000029, 0x00000028, 0x00000070, 0x80000029,
+ 0x00000028, 0x00000071, 0x80000029, 0x00000028,
+ 0x00000072, 0x80000029, 0x00000028, 0x00000073,
+ 0x80000029, 0x00000028, 0x00000074, 0x80000029,
+ 0x00000028, 0x00000075, 0x80000029, 0x00000028,
+ 0x00000076, 0x80000029, 0x00000028, 0x00000077,
+ 0x80000029, 0x00000028, 0x00000078, 0x80000029,
+ 0x00000028, 0x00000079, 0x80000029, 0x00000028,
+ 0x0000007a, 0x80000029, 0x80000041, 0x80000042,
+ 0x80000043, 0x80000044, 0x80000045, 0x80000046,
+ 0x80000047, 0x80000048, 0x80000049, 0x8000004a,
+ 0x8000004b, 0x8000004c, 0x8000004d, 0x8000004e,
+ 0x8000004f, 0x80000050, 0x80000051, 0x80000052,
+ 0x80000053, 0x80000054, 0x80000055, 0x80000056,
+ 0x80000057, 0x80000058, 0x80000059, 0x8000005a,
+ 0x80000061, 0x80000062, 0x80000063, 0x80000064,
+ 0x80000065, 0x80000066, 0x80000067, 0x80000068,
+ 0x80000069, 0x8000006a, 0x8000006b, 0x8000006c,
+ 0x8000006d, 0x8000006e, 0x8000006f, 0x80000070,
+ 0x80000071, 0x80000072, 0x80000073, 0x80000074,
+ 0x80000075, 0x80000076, 0x80000077, 0x80000078,
+ 0x80000079, 0x8000007a, 0x80000030, 0x0000222b,
+ 0x0000222b, 0x0000222b, 0x8000222b, 0x0000003a,
+ 0x0000003a, 0x8000003d, 0x0000003d, 0x8000003d,
+ 0x0000003d, 0x0000003d, 0x8000003d, 0x00002add,
+ 0x80000338, 0x80006bcd, 0x80009f9f, 0x80004e00,
+ 0x80004e28, 0x80004e36, 0x80004e3f, 0x80004e59,
+ 0x80004e85, 0x80004e8c, 0x80004ea0, 0x80004eba,
+ 0x8000513f, 0x80005165, 0x8000516b, 0x80005182,
+ 0x80005196, 0x800051ab, 0x800051e0, 0x800051f5,
+ 0x80005200, 0x8000529b, 0x800052f9, 0x80005315,
+ 0x8000531a, 0x80005338, 0x80005341, 0x8000535c,
+ 0x80005369, 0x80005382, 0x800053b6, 0x800053c8,
+ 0x800053e3, 0x800056d7, 0x8000571f, 0x800058eb,
+ 0x80005902, 0x8000590a, 0x80005915, 0x80005927,
+ 0x80005973, 0x80005b50, 0x80005b80, 0x80005bf8,
+ 0x80005c0f, 0x80005c22, 0x80005c38, 0x80005c6e,
+ 0x80005c71, 0x80005ddb, 0x80005de5, 0x80005df1,
+ 0x80005dfe, 0x80005e72, 0x80005e7a, 0x80005e7f,
+ 0x80005ef4, 0x80005efe, 0x80005f0b, 0x80005f13,
+ 0x80005f50, 0x80005f61, 0x80005f73, 0x80005fc3,
+ 0x80006208, 0x80006236, 0x8000624b, 0x8000652f,
+ 0x80006534, 0x80006587, 0x80006597, 0x800065a4,
+ 0x800065b9, 0x800065e0, 0x800065e5, 0x800066f0,
+ 0x80006708, 0x80006728, 0x80006b20, 0x80006b62,
+ 0x80006b79, 0x80006bb3, 0x80006bcb, 0x80006bd4,
+ 0x80006bdb, 0x80006c0f, 0x80006c14, 0x80006c34,
+ 0x8000706b, 0x8000722a, 0x80007236, 0x8000723b,
+ 0x8000723f, 0x80007247, 0x80007259, 0x8000725b,
+ 0x800072ac, 0x80007384, 0x80007389, 0x800074dc,
+ 0x800074e6, 0x80007518, 0x8000751f, 0x80007528,
+ 0x80007530, 0x8000758b, 0x80007592, 0x80007676,
+ 0x8000767d, 0x800076ae, 0x800076bf, 0x800076ee,
+ 0x800077db, 0x800077e2, 0x800077f3, 0x8000793a,
+ 0x800079b8, 0x800079be, 0x80007a74, 0x80007acb,
+ 0x80007af9, 0x80007c73, 0x80007cf8, 0x80007f36,
+ 0x80007f51, 0x80007f8a, 0x80007fbd, 0x80008001,
+ 0x8000800c, 0x80008012, 0x80008033, 0x8000807f,
+ 0x80008089, 0x800081e3, 0x800081ea, 0x800081f3,
+ 0x800081fc, 0x8000820c, 0x8000821b, 0x8000821f,
+ 0x8000826e, 0x80008272, 0x80008278, 0x8000864d,
+ 0x8000866b, 0x80008840, 0x8000884c, 0x80008863,
+ 0x8000897e, 0x8000898b, 0x800089d2, 0x80008a00,
+ 0x80008c37, 0x80008c46, 0x80008c55, 0x80008c78,
+ 0x80008c9d, 0x80008d64, 0x80008d70, 0x80008db3,
+ 0x80008eab, 0x80008eca, 0x80008f9b, 0x80008fb0,
+ 0x80008fb5, 0x80009091, 0x80009149, 0x800091c6,
+ 0x800091cc, 0x800091d1, 0x80009577, 0x80009580,
+ 0x8000961c, 0x800096b6, 0x800096b9, 0x800096e8,
+ 0x80009751, 0x8000975e, 0x80009762, 0x80009769,
+ 0x800097cb, 0x800097ed, 0x800097f3, 0x80009801,
+ 0x800098a8, 0x800098db, 0x800098df, 0x80009996,
+ 0x80009999, 0x800099ac, 0x80009aa8, 0x80009ad8,
+ 0x80009adf, 0x80009b25, 0x80009b2f, 0x80009b32,
+ 0x80009b3c, 0x80009b5a, 0x80009ce5, 0x80009e75,
+ 0x80009e7f, 0x80009ea5, 0x80009ebb, 0x80009ec3,
+ 0x80009ecd, 0x80009ed1, 0x80009ef9, 0x80009efd,
+ 0x80009f0e, 0x80009f13, 0x80009f20, 0x80009f3b,
+ 0x80009f4a, 0x80009f52, 0x80009f8d, 0x80009f9c,
+ 0x80009fa0, 0x80000020, 0x80003012, 0x80005341,
+ 0x80005344, 0x80005345, 0x0000304b, 0x80003099,
+ 0x0000304d, 0x80003099, 0x0000304f, 0x80003099,
+ 0x00003051, 0x80003099, 0x00003053, 0x80003099,
+ 0x00003055, 0x80003099, 0x00003057, 0x80003099,
+ 0x00003059, 0x80003099, 0x0000305b, 0x80003099,
+ 0x0000305d, 0x80003099, 0x0000305f, 0x80003099,
+ 0x00003061, 0x80003099, 0x00003064, 0x80003099,
+ 0x00003066, 0x80003099, 0x00003068, 0x80003099,
+ 0x0000306f, 0x80003099, 0x0000306f, 0x8000309a,
+ 0x00003072, 0x80003099, 0x00003072, 0x8000309a,
+ 0x00003075, 0x80003099, 0x00003075, 0x8000309a,
+ 0x00003078, 0x80003099, 0x00003078, 0x8000309a,
+ 0x0000307b, 0x80003099, 0x0000307b, 0x8000309a,
+ 0x00003046, 0x80003099, 0x00000020, 0x80003099,
+ 0x00000020, 0x8000309a, 0x0000309d, 0x80003099,
+ 0x00003088, 0x8000308a, 0x000030ab, 0x80003099,
+ 0x000030ad, 0x80003099, 0x000030af, 0x80003099,
+ 0x000030b1, 0x80003099, 0x000030b3, 0x80003099,
+ 0x000030b5, 0x80003099, 0x000030b7, 0x80003099,
+ 0x000030b9, 0x80003099, 0x000030bb, 0x80003099,
+ 0x000030bd, 0x80003099, 0x000030bf, 0x80003099,
+ 0x000030c1, 0x80003099, 0x000030c4, 0x80003099,
+ 0x000030c6, 0x80003099, 0x000030c8, 0x80003099,
+ 0x000030cf, 0x80003099, 0x000030cf, 0x8000309a,
+ 0x000030d2, 0x80003099, 0x000030d2, 0x8000309a,
+ 0x000030d5, 0x80003099, 0x000030d5, 0x8000309a,
+ 0x000030d8, 0x80003099, 0x000030d8, 0x8000309a,
+ 0x000030db, 0x80003099, 0x000030db, 0x8000309a,
+ 0x000030a6, 0x80003099, 0x000030ef, 0x80003099,
+ 0x000030f0, 0x80003099, 0x000030f1, 0x80003099,
+ 0x000030f2, 0x80003099, 0x000030fd, 0x80003099,
+ 0x000030b3, 0x800030c8, 0x80001100, 0x80001101,
+ 0x800011aa, 0x80001102, 0x800011ac, 0x800011ad,
+ 0x80001103, 0x80001104, 0x80001105, 0x800011b0,
+ 0x800011b1, 0x800011b2, 0x800011b3, 0x800011b4,
+ 0x800011b5, 0x8000111a, 0x80001106, 0x80001107,
+ 0x80001108, 0x80001121, 0x80001109, 0x8000110a,
+ 0x8000110b, 0x8000110c, 0x8000110d, 0x8000110e,
+ 0x8000110f, 0x80001110, 0x80001111, 0x80001112,
+ 0x80001161, 0x80001162, 0x80001163, 0x80001164,
+ 0x80001165, 0x80001166, 0x80001167, 0x80001168,
+ 0x80001169, 0x8000116a, 0x8000116b, 0x8000116c,
+ 0x8000116d, 0x8000116e, 0x8000116f, 0x80001170,
+ 0x80001171, 0x80001172, 0x80001173, 0x80001174,
+ 0x80001175, 0x80001160, 0x80001114, 0x80001115,
+ 0x800011c7, 0x800011c8, 0x800011cc, 0x800011ce,
+ 0x800011d3, 0x800011d7, 0x800011d9, 0x8000111c,
+ 0x800011dd, 0x800011df, 0x8000111d, 0x8000111e,
+ 0x80001120, 0x80001122, 0x80001123, 0x80001127,
+ 0x80001129, 0x8000112b, 0x8000112c, 0x8000112d,
+ 0x8000112e, 0x8000112f, 0x80001132, 0x80001136,
+ 0x80001140, 0x80001147, 0x8000114c, 0x800011f1,
+ 0x800011f2, 0x80001157, 0x80001158, 0x80001159,
+ 0x80001184, 0x80001185, 0x80001188, 0x80001191,
+ 0x80001192, 0x80001194, 0x8000119e, 0x800011a1,
+ 0x80004e00, 0x80004e8c, 0x80004e09, 0x800056db,
+ 0x80004e0a, 0x80004e2d, 0x80004e0b, 0x80007532,
+ 0x80004e59, 0x80004e19, 0x80004e01, 0x80005929,
+ 0x80005730, 0x80004eba, 0x00000028, 0x00001100,
+ 0x80000029, 0x00000028, 0x00001102, 0x80000029,
+ 0x00000028, 0x00001103, 0x80000029, 0x00000028,
+ 0x00001105, 0x80000029, 0x00000028, 0x00001106,
+ 0x80000029, 0x00000028, 0x00001107, 0x80000029,
+ 0x00000028, 0x00001109, 0x80000029, 0x00000028,
+ 0x0000110b, 0x80000029, 0x00000028, 0x0000110c,
+ 0x80000029, 0x00000028, 0x0000110e, 0x80000029,
+ 0x00000028, 0x0000110f, 0x80000029, 0x00000028,
+ 0x00001110, 0x80000029, 0x00000028, 0x00001111,
+ 0x80000029, 0x00000028, 0x00001112, 0x80000029,
+ 0x00000028, 0x00001100, 0x00001161, 0x80000029,
+ 0x00000028, 0x00001102, 0x00001161, 0x80000029,
+ 0x00000028, 0x00001103, 0x00001161, 0x80000029,
+ 0x00000028, 0x00001105, 0x00001161, 0x80000029,
+ 0x00000028, 0x00001106, 0x00001161, 0x80000029,
+ 0x00000028, 0x00001107, 0x00001161, 0x80000029,
+ 0x00000028, 0x00001109, 0x00001161, 0x80000029,
+ 0x00000028, 0x0000110b, 0x00001161, 0x80000029,
+ 0x00000028, 0x0000110c, 0x00001161, 0x80000029,
+ 0x00000028, 0x0000110e, 0x00001161, 0x80000029,
+ 0x00000028, 0x0000110f, 0x00001161, 0x80000029,
+ 0x00000028, 0x00001110, 0x00001161, 0x80000029,
+ 0x00000028, 0x00001111, 0x00001161, 0x80000029,
+ 0x00000028, 0x00001112, 0x00001161, 0x80000029,
+ 0x00000028, 0x0000110c, 0x0000116e, 0x80000029,
+ 0x00000028, 0x00004e00, 0x80000029, 0x00000028,
+ 0x00004e8c, 0x80000029, 0x00000028, 0x00004e09,
+ 0x80000029, 0x00000028, 0x000056db, 0x80000029,
+ 0x00000028, 0x00004e94, 0x80000029, 0x00000028,
+ 0x0000516d, 0x80000029, 0x00000028, 0x00004e03,
+ 0x80000029, 0x00000028, 0x0000516b, 0x80000029,
+ 0x00000028, 0x00004e5d, 0x80000029, 0x00000028,
+ 0x00005341, 0x80000029, 0x00000028, 0x00006708,
+ 0x80000029, 0x00000028, 0x0000706b, 0x80000029,
+ 0x00000028, 0x00006c34, 0x80000029, 0x00000028,
+ 0x00006728, 0x80000029, 0x00000028, 0x000091d1,
+ 0x80000029, 0x00000028, 0x0000571f, 0x80000029,
+ 0x00000028, 0x000065e5, 0x80000029, 0x00000028,
+ 0x0000682a, 0x80000029, 0x00000028, 0x00006709,
+ 0x80000029, 0x00000028, 0x0000793e, 0x80000029,
+ 0x00000028, 0x0000540d, 0x80000029, 0x00000028,
+ 0x00007279, 0x80000029, 0x00000028, 0x00008ca1,
+ 0x80000029, 0x00000028, 0x0000795d, 0x80000029,
+ 0x00000028, 0x000052b4, 0x80000029, 0x00000028,
+ 0x00004ee3, 0x80000029, 0x00000028, 0x0000547c,
+ 0x80000029, 0x00000028, 0x00005b66, 0x80000029,
+ 0x00000028, 0x000076e3, 0x80000029, 0x00000028,
+ 0x00004f01, 0x80000029, 0x00000028, 0x00008cc7,
+ 0x80000029, 0x00000028, 0x00005354, 0x80000029,
+ 0x00000028, 0x0000796d, 0x80000029, 0x00000028,
+ 0x00004f11, 0x80000029, 0x00000028, 0x000081ea,
+ 0x80000029, 0x00000028, 0x000081f3, 0x80000029,
+ 0x00000032, 0x80000031, 0x00000032, 0x80000032,
+ 0x00000032, 0x80000033, 0x00000032, 0x80000034,
+ 0x00000032, 0x80000035, 0x00000032, 0x80000036,
+ 0x00000032, 0x80000037, 0x00000032, 0x80000038,
+ 0x00000032, 0x80000039, 0x00000033, 0x80000030,
+ 0x00000033, 0x80000031, 0x00000033, 0x80000032,
+ 0x00000033, 0x80000033, 0x00000033, 0x80000034,
+ 0x00000033, 0x80000035, 0x80001100, 0x80001102,
+ 0x80001103, 0x80001105, 0x80001106, 0x80001107,
+ 0x80001109, 0x8000110b, 0x8000110c, 0x8000110e,
+ 0x8000110f, 0x80001110, 0x80001111, 0x80001112,
+ 0x00001100, 0x80001161, 0x00001102, 0x80001161,
+ 0x00001103, 0x80001161, 0x00001105, 0x80001161,
+ 0x00001106, 0x80001161, 0x00001107, 0x80001161,
+ 0x00001109, 0x80001161, 0x0000110b, 0x80001161,
+ 0x0000110c, 0x80001161, 0x0000110e, 0x80001161,
+ 0x0000110f, 0x80001161, 0x00001110, 0x80001161,
+ 0x00001111, 0x80001161, 0x00001112, 0x80001161,
+ 0x80004e00, 0x80004e8c, 0x80004e09, 0x800056db,
+ 0x80004e94, 0x8000516d, 0x80004e03, 0x8000516b,
+ 0x80004e5d, 0x80005341, 0x80006708, 0x8000706b,
+ 0x80006c34, 0x80006728, 0x800091d1, 0x8000571f,
+ 0x800065e5, 0x8000682a, 0x80006709, 0x8000793e,
+ 0x8000540d, 0x80007279, 0x80008ca1, 0x8000795d,
+ 0x800052b4, 0x800079d8, 0x80007537, 0x80005973,
+ 0x80009069, 0x8000512a, 0x80005370, 0x80006ce8,
+ 0x80009805, 0x80004f11, 0x80005199, 0x80006b63,
+ 0x80004e0a, 0x80004e2d, 0x80004e0b, 0x80005de6,
+ 0x800053f3, 0x8000533b, 0x80005b97, 0x80005b66,
+ 0x800076e3, 0x80004f01, 0x80008cc7, 0x80005354,
+ 0x8000591c, 0x00000033, 0x80000036, 0x00000033,
+ 0x80000037, 0x00000033, 0x80000038, 0x00000033,
+ 0x80000039, 0x00000034, 0x80000030, 0x00000034,
+ 0x80000031, 0x00000034, 0x80000032, 0x00000034,
+ 0x80000033, 0x00000034, 0x80000034, 0x00000034,
+ 0x80000035, 0x00000034, 0x80000036, 0x00000034,
+ 0x80000037, 0x00000034, 0x80000038, 0x00000034,
+ 0x80000039, 0x00000035, 0x80000030, 0x00000031,
+ 0x80006708, 0x00000032, 0x80006708, 0x00000033,
+ 0x80006708, 0x00000034, 0x80006708, 0x00000035,
+ 0x80006708, 0x00000036, 0x80006708, 0x00000037,
+ 0x80006708, 0x00000038, 0x80006708, 0x00000039,
+ 0x80006708, 0x00000031, 0x00000030, 0x80006708,
+ 0x00000031, 0x00000031, 0x80006708, 0x00000031,
+ 0x00000032, 0x80006708, 0x800030a2, 0x800030a4,
+ 0x800030a6, 0x800030a8, 0x800030aa, 0x800030ab,
+ 0x800030ad, 0x800030af, 0x800030b1, 0x800030b3,
+ 0x800030b5, 0x800030b7, 0x800030b9, 0x800030bb,
+ 0x800030bd, 0x800030bf, 0x800030c1, 0x800030c4,
+ 0x800030c6, 0x800030c8, 0x800030ca, 0x800030cb,
+ 0x800030cc, 0x800030cd, 0x800030ce, 0x800030cf,
+ 0x800030d2, 0x800030d5, 0x800030d8, 0x800030db,
+ 0x800030de, 0x800030df, 0x800030e0, 0x800030e1,
+ 0x800030e2, 0x800030e4, 0x800030e6, 0x800030e8,
+ 0x800030e9, 0x800030ea, 0x800030eb, 0x800030ec,
+ 0x800030ed, 0x800030ef, 0x800030f0, 0x800030f1,
+ 0x800030f2, 0x000030a2, 0x000030d1, 0x000030fc,
+ 0x800030c8, 0x000030a2, 0x000030eb, 0x000030d5,
+ 0x800030a1, 0x000030a2, 0x000030f3, 0x000030da,
+ 0x800030a2, 0x000030a2, 0x000030fc, 0x800030eb,
+ 0x000030a4, 0x000030cb, 0x000030f3, 0x800030b0,
+ 0x000030a4, 0x000030f3, 0x800030c1, 0x000030a6,
+ 0x000030a9, 0x800030f3, 0x000030a8, 0x000030b9,
+ 0x000030af, 0x000030fc, 0x800030c9, 0x000030a8,
+ 0x000030fc, 0x000030ab, 0x800030fc, 0x000030aa,
+ 0x000030f3, 0x800030b9, 0x000030aa, 0x000030fc,
+ 0x800030e0, 0x000030ab, 0x000030a4, 0x800030ea,
+ 0x000030ab, 0x000030e9, 0x000030c3, 0x800030c8,
+ 0x000030ab, 0x000030ed, 0x000030ea, 0x800030fc,
+ 0x000030ac, 0x000030ed, 0x800030f3, 0x000030ac,
+ 0x000030f3, 0x800030de, 0x000030ae, 0x800030ac,
+ 0x000030ae, 0x000030cb, 0x800030fc, 0x000030ad,
+ 0x000030e5, 0x000030ea, 0x800030fc, 0x000030ae,
+ 0x000030eb, 0x000030c0, 0x800030fc, 0x000030ad,
+ 0x800030ed, 0x000030ad, 0x000030ed, 0x000030b0,
+ 0x000030e9, 0x800030e0, 0x000030ad, 0x000030ed,
+ 0x000030e1, 0x000030fc, 0x000030c8, 0x800030eb,
+ 0x000030ad, 0x000030ed, 0x000030ef, 0x000030c3,
+ 0x800030c8, 0x000030b0, 0x000030e9, 0x800030e0,
+ 0x000030b0, 0x000030e9, 0x000030e0, 0x000030c8,
+ 0x800030f3, 0x000030af, 0x000030eb, 0x000030bc,
+ 0x000030a4, 0x800030ed, 0x000030af, 0x000030ed,
+ 0x000030fc, 0x800030cd, 0x000030b1, 0x000030fc,
+ 0x800030b9, 0x000030b3, 0x000030eb, 0x800030ca,
+ 0x000030b3, 0x000030fc, 0x800030dd, 0x000030b5,
+ 0x000030a4, 0x000030af, 0x800030eb, 0x000030b5,
+ 0x000030f3, 0x000030c1, 0x000030fc, 0x800030e0,
+ 0x000030b7, 0x000030ea, 0x000030f3, 0x800030b0,
+ 0x000030bb, 0x000030f3, 0x800030c1, 0x000030bb,
+ 0x000030f3, 0x800030c8, 0x000030c0, 0x000030fc,
+ 0x800030b9, 0x000030c7, 0x800030b7, 0x000030c9,
+ 0x800030eb, 0x000030c8, 0x800030f3, 0x000030ca,
+ 0x800030ce, 0x000030ce, 0x000030c3, 0x800030c8,
+ 0x000030cf, 0x000030a4, 0x800030c4, 0x000030d1,
+ 0x000030fc, 0x000030bb, 0x000030f3, 0x800030c8,
+ 0x000030d1, 0x000030fc, 0x800030c4, 0x000030d0,
+ 0x000030fc, 0x000030ec, 0x800030eb, 0x000030d4,
+ 0x000030a2, 0x000030b9, 0x000030c8, 0x800030eb,
+ 0x000030d4, 0x000030af, 0x800030eb, 0x000030d4,
+ 0x800030b3, 0x000030d3, 0x800030eb, 0x000030d5,
+ 0x000030a1, 0x000030e9, 0x000030c3, 0x800030c9,
+ 0x000030d5, 0x000030a3, 0x000030fc, 0x800030c8,
+ 0x000030d6, 0x000030c3, 0x000030b7, 0x000030a7,
+ 0x800030eb, 0x000030d5, 0x000030e9, 0x800030f3,
+ 0x000030d8, 0x000030af, 0x000030bf, 0x000030fc,
+ 0x800030eb, 0x000030da, 0x800030bd, 0x000030da,
+ 0x000030cb, 0x800030d2, 0x000030d8, 0x000030eb,
+ 0x800030c4, 0x000030da, 0x000030f3, 0x800030b9,
+ 0x000030da, 0x000030fc, 0x800030b8, 0x000030d9,
+ 0x000030fc, 0x800030bf, 0x000030dd, 0x000030a4,
+ 0x000030f3, 0x800030c8, 0x000030dc, 0x000030eb,
+ 0x800030c8, 0x000030db, 0x800030f3, 0x000030dd,
+ 0x000030f3, 0x800030c9, 0x000030db, 0x000030fc,
+ 0x800030eb, 0x000030db, 0x000030fc, 0x800030f3,
+ 0x000030de, 0x000030a4, 0x000030af, 0x800030ed,
+ 0x000030de, 0x000030a4, 0x800030eb, 0x000030de,
+ 0x000030c3, 0x800030cf, 0x000030de, 0x000030eb,
+ 0x800030af, 0x000030de, 0x000030f3, 0x000030b7,
+ 0x000030e7, 0x800030f3, 0x000030df, 0x000030af,
+ 0x000030ed, 0x800030f3, 0x000030df, 0x800030ea,
+ 0x000030df, 0x000030ea, 0x000030d0, 0x000030fc,
+ 0x800030eb, 0x000030e1, 0x800030ac, 0x000030e1,
+ 0x000030ac, 0x000030c8, 0x800030f3, 0x000030e1,
+ 0x000030fc, 0x000030c8, 0x800030eb, 0x000030e4,
+ 0x000030fc, 0x800030c9, 0x000030e4, 0x000030fc,
+ 0x800030eb, 0x000030e6, 0x000030a2, 0x800030f3,
+ 0x000030ea, 0x000030c3, 0x000030c8, 0x800030eb,
+ 0x000030ea, 0x800030e9, 0x000030eb, 0x000030d4,
+ 0x800030fc, 0x000030eb, 0x000030fc, 0x000030d6,
+ 0x800030eb, 0x000030ec, 0x800030e0, 0x000030ec,
+ 0x000030f3, 0x000030c8, 0x000030b2, 0x800030f3,
+ 0x000030ef, 0x000030c3, 0x800030c8, 0x00000030,
+ 0x800070b9, 0x00000031, 0x800070b9, 0x00000032,
+ 0x800070b9, 0x00000033, 0x800070b9, 0x00000034,
+ 0x800070b9, 0x00000035, 0x800070b9, 0x00000036,
+ 0x800070b9, 0x00000037, 0x800070b9, 0x00000038,
+ 0x800070b9, 0x00000039, 0x800070b9, 0x00000031,
+ 0x00000030, 0x800070b9, 0x00000031, 0x00000031,
+ 0x800070b9, 0x00000031, 0x00000032, 0x800070b9,
+ 0x00000031, 0x00000033, 0x800070b9, 0x00000031,
+ 0x00000034, 0x800070b9, 0x00000031, 0x00000035,
+ 0x800070b9, 0x00000031, 0x00000036, 0x800070b9,
+ 0x00000031, 0x00000037, 0x800070b9, 0x00000031,
+ 0x00000038, 0x800070b9, 0x00000031, 0x00000039,
+ 0x800070b9, 0x00000032, 0x00000030, 0x800070b9,
+ 0x00000032, 0x00000031, 0x800070b9, 0x00000032,
+ 0x00000032, 0x800070b9, 0x00000032, 0x00000033,
+ 0x800070b9, 0x00000032, 0x00000034, 0x800070b9,
+ 0x00000068, 0x00000050, 0x80000061, 0x00000064,
+ 0x80000061, 0x00000041, 0x80000055, 0x00000062,
+ 0x00000061, 0x80000072, 0x0000006f, 0x80000056,
+ 0x00000070, 0x80000063, 0x00005e73, 0x80006210,
+ 0x0000662d, 0x8000548c, 0x00005927, 0x80006b63,
+ 0x0000660e, 0x80006cbb, 0x0000682a, 0x00005f0f,
+ 0x00004f1a, 0x8000793e, 0x00000070, 0x80000041,
+ 0x0000006e, 0x80000041, 0x000003bc, 0x80000041,
+ 0x0000006d, 0x80000041, 0x0000006b, 0x80000041,
+ 0x0000004b, 0x80000042, 0x0000004d, 0x80000042,
+ 0x00000047, 0x80000042, 0x00000063, 0x00000061,
+ 0x8000006c, 0x0000006b, 0x00000063, 0x00000061,
+ 0x8000006c, 0x00000070, 0x80000046, 0x0000006e,
+ 0x80000046, 0x000003bc, 0x80000046, 0x000003bc,
+ 0x80000067, 0x0000006d, 0x80000067, 0x0000006b,
+ 0x80000067, 0x00000048, 0x8000007a, 0x0000006b,
+ 0x00000048, 0x8000007a, 0x0000004d, 0x00000048,
+ 0x8000007a, 0x00000047, 0x00000048, 0x8000007a,
+ 0x00000054, 0x00000048, 0x8000007a, 0x000003bc,
+ 0x80002113, 0x0000006d, 0x80002113, 0x00000064,
+ 0x80002113, 0x0000006b, 0x80002113, 0x00000066,
+ 0x8000006d, 0x0000006e, 0x8000006d, 0x000003bc,
+ 0x8000006d, 0x0000006d, 0x8000006d, 0x00000063,
+ 0x8000006d, 0x0000006b, 0x8000006d, 0x0000006d,
+ 0x0000006d, 0x800000b2, 0x00000063, 0x0000006d,
+ 0x800000b2, 0x0000006d, 0x800000b2, 0x0000006b,
+ 0x0000006d, 0x800000b2, 0x0000006d, 0x0000006d,
+ 0x800000b3, 0x00000063, 0x0000006d, 0x800000b3,
+ 0x0000006d, 0x800000b3, 0x0000006b, 0x0000006d,
+ 0x800000b3, 0x0000006d, 0x00002215, 0x80000073,
+ 0x0000006d, 0x00002215, 0x00000073, 0x800000b2,
+ 0x00000050, 0x80000061, 0x0000006b, 0x00000050,
+ 0x80000061, 0x0000004d, 0x00000050, 0x80000061,
+ 0x00000047, 0x00000050, 0x80000061, 0x00000072,
+ 0x00000061, 0x80000064, 0x00000072, 0x00000061,
+ 0x00000064, 0x00002215, 0x80000073, 0x00000072,
+ 0x00000061, 0x00000064, 0x00002215, 0x00000073,
+ 0x800000b2, 0x00000070, 0x80000073, 0x0000006e,
+ 0x80000073, 0x000003bc, 0x80000073, 0x0000006d,
+ 0x80000073, 0x00000070, 0x80000056, 0x0000006e,
+ 0x80000056, 0x000003bc, 0x80000056, 0x0000006d,
+ 0x80000056, 0x0000006b, 0x80000056, 0x0000004d,
+ 0x80000056, 0x00000070, 0x80000057, 0x0000006e,
+ 0x80000057, 0x000003bc, 0x80000057, 0x0000006d,
+ 0x80000057, 0x0000006b, 0x80000057, 0x0000004d,
+ 0x80000057, 0x0000006b, 0x800003a9, 0x0000004d,
+ 0x800003a9, 0x00000061, 0x0000002e, 0x0000006d,
+ 0x8000002e, 0x00000042, 0x80000071, 0x00000063,
+ 0x80000063, 0x00000063, 0x80000064, 0x00000043,
+ 0x00002215, 0x0000006b, 0x80000067, 0x00000043,
+ 0x0000006f, 0x8000002e, 0x00000064, 0x80000042,
+ 0x00000047, 0x80000079, 0x00000068, 0x80000061,
+ 0x00000048, 0x80000050, 0x00000069, 0x8000006e,
+ 0x0000004b, 0x8000004b, 0x0000004b, 0x8000004d,
+ 0x0000006b, 0x80000074, 0x0000006c, 0x8000006d,
+ 0x0000006c, 0x8000006e, 0x0000006c, 0x0000006f,
+ 0x80000067, 0x0000006c, 0x80000078, 0x0000006d,
+ 0x80000062, 0x0000006d, 0x00000069, 0x8000006c,
+ 0x0000006d, 0x0000006f, 0x8000006c, 0x00000050,
+ 0x80000048, 0x00000070, 0x0000002e, 0x0000006d,
+ 0x8000002e, 0x00000050, 0x00000050, 0x8000004d,
+ 0x00000050, 0x80000052, 0x00000073, 0x80000072,
+ 0x00000053, 0x80000076, 0x00000057, 0x80000062,
+ 0x00000031, 0x800065e5, 0x00000032, 0x800065e5,
+ 0x00000033, 0x800065e5, 0x00000034, 0x800065e5,
+ 0x00000035, 0x800065e5, 0x00000036, 0x800065e5,
+ 0x00000037, 0x800065e5, 0x00000038, 0x800065e5,
+ 0x00000039, 0x800065e5, 0x00000031, 0x00000030,
+ 0x800065e5, 0x00000031, 0x00000031, 0x800065e5,
+ 0x00000031, 0x00000032, 0x800065e5, 0x00000031,
+ 0x00000033, 0x800065e5, 0x00000031, 0x00000034,
+ 0x800065e5, 0x00000031, 0x00000035, 0x800065e5,
+ 0x00000031, 0x00000036, 0x800065e5, 0x00000031,
+ 0x00000037, 0x800065e5, 0x00000031, 0x00000038,
+ 0x800065e5, 0x00000031, 0x00000039, 0x800065e5,
+ 0x00000032, 0x00000030, 0x800065e5, 0x00000032,
+ 0x00000031, 0x800065e5, 0x00000032, 0x00000032,
+ 0x800065e5, 0x00000032, 0x00000033, 0x800065e5,
+ 0x00000032, 0x00000034, 0x800065e5, 0x00000032,
+ 0x00000035, 0x800065e5, 0x00000032, 0x00000036,
+ 0x800065e5, 0x00000032, 0x00000037, 0x800065e5,
+ 0x00000032, 0x00000038, 0x800065e5, 0x00000032,
+ 0x00000039, 0x800065e5, 0x00000033, 0x00000030,
+ 0x800065e5, 0x00000033, 0x00000031, 0x800065e5,
+ 0x80008c48, 0x800066f4, 0x80008eca, 0x80008cc8,
+ 0x80006ed1, 0x80004e32, 0x800053e5, 0x80009f9c,
+ 0x80009f9c, 0x80005951, 0x800091d1, 0x80005587,
+ 0x80005948, 0x800061f6, 0x80007669, 0x80007f85,
+ 0x8000863f, 0x800087ba, 0x800088f8, 0x8000908f,
+ 0x80006a02, 0x80006d1b, 0x800070d9, 0x800073de,
+ 0x8000843d, 0x8000916a, 0x800099f1, 0x80004e82,
+ 0x80005375, 0x80006b04, 0x8000721b, 0x8000862d,
+ 0x80009e1e, 0x80005d50, 0x80006feb, 0x800085cd,
+ 0x80008964, 0x800062c9, 0x800081d8, 0x8000881f,
+ 0x80005eca, 0x80006717, 0x80006d6a, 0x800072fc,
+ 0x800090ce, 0x80004f86, 0x800051b7, 0x800052de,
+ 0x800064c4, 0x80006ad3, 0x80007210, 0x800076e7,
+ 0x80008001, 0x80008606, 0x8000865c, 0x80008def,
+ 0x80009732, 0x80009b6f, 0x80009dfa, 0x8000788c,
+ 0x8000797f, 0x80007da0, 0x800083c9, 0x80009304,
+ 0x80009e7f, 0x80008ad6, 0x800058df, 0x80005f04,
+ 0x80007c60, 0x8000807e, 0x80007262, 0x800078ca,
+ 0x80008cc2, 0x800096f7, 0x800058d8, 0x80005c62,
+ 0x80006a13, 0x80006dda, 0x80006f0f, 0x80007d2f,
+ 0x80007e37, 0x8000964b, 0x800052d2, 0x8000808b,
+ 0x800051dc, 0x800051cc, 0x80007a1c, 0x80007dbe,
+ 0x800083f1, 0x80009675, 0x80008b80, 0x800062cf,
+ 0x80006a02, 0x80008afe, 0x80004e39, 0x80005be7,
+ 0x80006012, 0x80007387, 0x80007570, 0x80005317,
+ 0x800078fb, 0x80004fbf, 0x80005fa9, 0x80004e0d,
+ 0x80006ccc, 0x80006578, 0x80007d22, 0x800053c3,
+ 0x8000585e, 0x80007701, 0x80008449, 0x80008aaa,
+ 0x80006bba, 0x80008fb0, 0x80006c88, 0x800062fe,
+ 0x800082e5, 0x800063a0, 0x80007565, 0x80004eae,
+ 0x80005169, 0x800051c9, 0x80006881, 0x80007ce7,
+ 0x8000826f, 0x80008ad2, 0x800091cf, 0x800052f5,
+ 0x80005442, 0x80005973, 0x80005eec, 0x800065c5,
+ 0x80006ffe, 0x8000792a, 0x800095ad, 0x80009a6a,
+ 0x80009e97, 0x80009ece, 0x8000529b, 0x800066c6,
+ 0x80006b77, 0x80008f62, 0x80005e74, 0x80006190,
+ 0x80006200, 0x8000649a, 0x80006f23, 0x80007149,
+ 0x80007489, 0x800079ca, 0x80007df4, 0x8000806f,
+ 0x80008f26, 0x800084ee, 0x80009023, 0x8000934a,
+ 0x80005217, 0x800052a3, 0x800054bd, 0x800070c8,
+ 0x800088c2, 0x80008aaa, 0x80005ec9, 0x80005ff5,
+ 0x8000637b, 0x80006bae, 0x80007c3e, 0x80007375,
+ 0x80004ee4, 0x800056f9, 0x80005be7, 0x80005dba,
+ 0x8000601c, 0x800073b2, 0x80007469, 0x80007f9a,
+ 0x80008046, 0x80009234, 0x800096f6, 0x80009748,
+ 0x80009818, 0x80004f8b, 0x800079ae, 0x800091b4,
+ 0x800096b8, 0x800060e1, 0x80004e86, 0x800050da,
+ 0x80005bee, 0x80005c3f, 0x80006599, 0x80006a02,
+ 0x800071ce, 0x80007642, 0x800084fc, 0x8000907c,
+ 0x80009f8d, 0x80006688, 0x8000962e, 0x80005289,
+ 0x8000677b, 0x800067f3, 0x80006d41, 0x80006e9c,
+ 0x80007409, 0x80007559, 0x8000786b, 0x80007d10,
+ 0x8000985e, 0x8000516d, 0x8000622e, 0x80009678,
+ 0x8000502b, 0x80005d19, 0x80006dea, 0x80008f2a,
+ 0x80005f8b, 0x80006144, 0x80006817, 0x80007387,
+ 0x80009686, 0x80005229, 0x8000540f, 0x80005c65,
+ 0x80006613, 0x8000674e, 0x800068a8, 0x80006ce5,
+ 0x80007406, 0x800075e2, 0x80007f79, 0x800088cf,
+ 0x800088e1, 0x800091cc, 0x800096e2, 0x8000533f,
+ 0x80006eba, 0x8000541d, 0x800071d0, 0x80007498,
+ 0x800085fa, 0x800096a3, 0x80009c57, 0x80009e9f,
+ 0x80006797, 0x80006dcb, 0x800081e8, 0x80007acb,
+ 0x80007b20, 0x80007c92, 0x800072c0, 0x80007099,
+ 0x80008b58, 0x80004ec0, 0x80008336, 0x8000523a,
+ 0x80005207, 0x80005ea6, 0x800062d3, 0x80007cd6,
+ 0x80005b85, 0x80006d1e, 0x800066b4, 0x80008f3b,
+ 0x8000884c, 0x8000964d, 0x8000898b, 0x80005ed3,
+ 0x80005140, 0x800055c0, 0x8000585a, 0x80006674,
+ 0x800051de, 0x8000732a, 0x800076ca, 0x8000793c,
+ 0x8000795e, 0x80007965, 0x8000798f, 0x80009756,
+ 0x80007cbe, 0x80007fbd, 0x80008612, 0x80008af8,
+ 0x80009038, 0x800090fd, 0x800098ef, 0x800098fc,
+ 0x80009928, 0x80009db4, 0x80004fae, 0x800050e7,
+ 0x8000514d, 0x800052c9, 0x800052e4, 0x80005351,
+ 0x8000559d, 0x80005606, 0x80005668, 0x80005840,
+ 0x800058a8, 0x80005c64, 0x80005c6e, 0x80006094,
+ 0x80006168, 0x8000618e, 0x800061f2, 0x8000654f,
+ 0x800065e2, 0x80006691, 0x80006885, 0x80006d77,
+ 0x80006e1a, 0x80006f22, 0x8000716e, 0x8000722b,
+ 0x80007422, 0x80007891, 0x8000793e, 0x80007949,
+ 0x80007948, 0x80007950, 0x80007956, 0x8000795d,
+ 0x8000798d, 0x8000798e, 0x80007a40, 0x80007a81,
+ 0x80007bc0, 0x80007df4, 0x80007e09, 0x80007e41,
+ 0x80007f72, 0x80008005, 0x800081ed, 0x80008279,
+ 0x80008279, 0x80008457, 0x80008910, 0x80008996,
+ 0x80008b01, 0x80008b39, 0x80008cd3, 0x80008d08,
+ 0x80008fb6, 0x80009038, 0x800096e3, 0x800097ff,
+ 0x8000983b, 0x00000066, 0x80000066, 0x00000066,
+ 0x80000069, 0x00000066, 0x8000006c, 0x00000066,
+ 0x00000066, 0x80000069, 0x00000066, 0x00000066,
+ 0x8000006c, 0x0000017f, 0x80000074, 0x00000073,
+ 0x80000074, 0x00000574, 0x80000576, 0x00000574,
+ 0x80000565, 0x00000574, 0x8000056b, 0x0000057e,
+ 0x80000576, 0x00000574, 0x8000056d, 0x000005d9,
+ 0x800005b4, 0x000005f2, 0x800005b7, 0x800005e2,
+ 0x800005d0, 0x800005d3, 0x800005d4, 0x800005db,
+ 0x800005dc, 0x800005dd, 0x800005e8, 0x800005ea,
+ 0x8000002b, 0x000005e9, 0x800005c1, 0x000005e9,
+ 0x800005c2, 0x0000fb49, 0x800005c1, 0x0000fb49,
+ 0x800005c2, 0x000005d0, 0x800005b7, 0x000005d0,
+ 0x800005b8, 0x000005d0, 0x800005bc, 0x000005d1,
+ 0x800005bc, 0x000005d2, 0x800005bc, 0x000005d3,
+ 0x800005bc, 0x000005d4, 0x800005bc, 0x000005d5,
+ 0x800005bc, 0x000005d6, 0x800005bc, 0x000005d8,
+ 0x800005bc, 0x000005d9, 0x800005bc, 0x000005da,
+ 0x800005bc, 0x000005db, 0x800005bc, 0x000005dc,
+ 0x800005bc, 0x000005de, 0x800005bc, 0x000005e0,
+ 0x800005bc, 0x000005e1, 0x800005bc, 0x000005e3,
+ 0x800005bc, 0x000005e4, 0x800005bc, 0x000005e6,
+ 0x800005bc, 0x000005e7, 0x800005bc, 0x000005e8,
+ 0x800005bc, 0x000005e9, 0x800005bc, 0x000005ea,
+ 0x800005bc, 0x000005d5, 0x800005b9, 0x000005d1,
+ 0x800005bf, 0x000005db, 0x800005bf, 0x000005e4,
+ 0x800005bf, 0x000005d0, 0x800005dc, 0x80000671,
+ 0x80000671, 0x8000067b, 0x8000067b, 0x8000067b,
+ 0x8000067b, 0x8000067e, 0x8000067e, 0x8000067e,
+ 0x8000067e, 0x80000680, 0x80000680, 0x80000680,
+ 0x80000680, 0x8000067a, 0x8000067a, 0x8000067a,
+ 0x8000067a, 0x8000067f, 0x8000067f, 0x8000067f,
+ 0x8000067f, 0x80000679, 0x80000679, 0x80000679,
+ 0x80000679, 0x800006a4, 0x800006a4, 0x800006a4,
+ 0x800006a4, 0x800006a6, 0x800006a6, 0x800006a6,
+ 0x800006a6, 0x80000684, 0x80000684, 0x80000684,
+ 0x80000684, 0x80000683, 0x80000683, 0x80000683,
+ 0x80000683, 0x80000686, 0x80000686, 0x80000686,
+ 0x80000686, 0x80000687, 0x80000687, 0x80000687,
+ 0x80000687, 0x8000068d, 0x8000068d, 0x8000068c,
+ 0x8000068c, 0x8000068e, 0x8000068e, 0x80000688,
+ 0x80000688, 0x80000698, 0x80000698, 0x80000691,
+ 0x80000691, 0x800006a9, 0x800006a9, 0x800006a9,
+ 0x800006a9, 0x800006af, 0x800006af, 0x800006af,
+ 0x800006af, 0x800006b3, 0x800006b3, 0x800006b3,
+ 0x800006b3, 0x800006b1, 0x800006b1, 0x800006b1,
+ 0x800006b1, 0x800006ba, 0x800006ba, 0x800006bb,
+ 0x800006bb, 0x800006bb, 0x800006bb, 0x800006c0,
+ 0x800006c0, 0x800006c1, 0x800006c1, 0x800006c1,
+ 0x800006c1, 0x800006be, 0x800006be, 0x800006be,
+ 0x800006be, 0x800006d2, 0x800006d2, 0x800006d3,
+ 0x800006d3, 0x800006ad, 0x800006ad, 0x800006ad,
+ 0x800006ad, 0x800006c7, 0x800006c7, 0x800006c6,
+ 0x800006c6, 0x800006c8, 0x800006c8, 0x80000677,
+ 0x800006cb, 0x800006cb, 0x800006c5, 0x800006c5,
+ 0x800006c9, 0x800006c9, 0x800006d0, 0x800006d0,
+ 0x800006d0, 0x800006d0, 0x80000649, 0x80000649,
+ 0x00000626, 0x80000627, 0x00000626, 0x80000627,
+ 0x00000626, 0x800006d5, 0x00000626, 0x800006d5,
+ 0x00000626, 0x80000648, 0x00000626, 0x80000648,
+ 0x00000626, 0x800006c7, 0x00000626, 0x800006c7,
+ 0x00000626, 0x800006c6, 0x00000626, 0x800006c6,
+ 0x00000626, 0x800006c8, 0x00000626, 0x800006c8,
+ 0x00000626, 0x800006d0, 0x00000626, 0x800006d0,
+ 0x00000626, 0x800006d0, 0x00000626, 0x80000649,
+ 0x00000626, 0x80000649, 0x00000626, 0x80000649,
+ 0x800006cc, 0x800006cc, 0x800006cc, 0x800006cc,
+ 0x00000626, 0x8000062c, 0x00000626, 0x8000062d,
+ 0x00000626, 0x80000645, 0x00000626, 0x80000649,
+ 0x00000626, 0x8000064a, 0x00000628, 0x8000062c,
+ 0x00000628, 0x8000062d, 0x00000628, 0x8000062e,
+ 0x00000628, 0x80000645, 0x00000628, 0x80000649,
+ 0x00000628, 0x8000064a, 0x0000062a, 0x8000062c,
+ 0x0000062a, 0x8000062d, 0x0000062a, 0x8000062e,
+ 0x0000062a, 0x80000645, 0x0000062a, 0x80000649,
+ 0x0000062a, 0x8000064a, 0x0000062b, 0x8000062c,
+ 0x0000062b, 0x80000645, 0x0000062b, 0x80000649,
+ 0x0000062b, 0x8000064a, 0x0000062c, 0x8000062d,
+ 0x0000062c, 0x80000645, 0x0000062d, 0x8000062c,
+ 0x0000062d, 0x80000645, 0x0000062e, 0x8000062c,
+ 0x0000062e, 0x8000062d, 0x0000062e, 0x80000645,
+ 0x00000633, 0x8000062c, 0x00000633, 0x8000062d,
+ 0x00000633, 0x8000062e, 0x00000633, 0x80000645,
+ 0x00000635, 0x8000062d, 0x00000635, 0x80000645,
+ 0x00000636, 0x8000062c, 0x00000636, 0x8000062d,
+ 0x00000636, 0x8000062e, 0x00000636, 0x80000645,
+ 0x00000637, 0x8000062d, 0x00000637, 0x80000645,
+ 0x00000638, 0x80000645, 0x00000639, 0x8000062c,
+ 0x00000639, 0x80000645, 0x0000063a, 0x8000062c,
+ 0x0000063a, 0x80000645, 0x00000641, 0x8000062c,
+ 0x00000641, 0x8000062d, 0x00000641, 0x8000062e,
+ 0x00000641, 0x80000645, 0x00000641, 0x80000649,
+ 0x00000641, 0x8000064a, 0x00000642, 0x8000062d,
+ 0x00000642, 0x80000645, 0x00000642, 0x80000649,
+ 0x00000642, 0x8000064a, 0x00000643, 0x80000627,
+ 0x00000643, 0x8000062c, 0x00000643, 0x8000062d,
+ 0x00000643, 0x8000062e, 0x00000643, 0x80000644,
+ 0x00000643, 0x80000645, 0x00000643, 0x80000649,
+ 0x00000643, 0x8000064a, 0x00000644, 0x8000062c,
+ 0x00000644, 0x8000062d, 0x00000644, 0x8000062e,
+ 0x00000644, 0x80000645, 0x00000644, 0x80000649,
+ 0x00000644, 0x8000064a, 0x00000645, 0x8000062c,
+ 0x00000645, 0x8000062d, 0x00000645, 0x8000062e,
+ 0x00000645, 0x80000645, 0x00000645, 0x80000649,
+ 0x00000645, 0x8000064a, 0x00000646, 0x8000062c,
+ 0x00000646, 0x8000062d, 0x00000646, 0x8000062e,
+ 0x00000646, 0x80000645, 0x00000646, 0x80000649,
+ 0x00000646, 0x8000064a, 0x00000647, 0x8000062c,
+ 0x00000647, 0x80000645, 0x00000647, 0x80000649,
+ 0x00000647, 0x8000064a, 0x0000064a, 0x8000062c,
+ 0x0000064a, 0x8000062d, 0x0000064a, 0x8000062e,
+ 0x0000064a, 0x80000645, 0x0000064a, 0x80000649,
+ 0x0000064a, 0x8000064a, 0x00000630, 0x80000670,
+ 0x00000631, 0x80000670, 0x00000649, 0x80000670,
+ 0x00000020, 0x0000064c, 0x80000651, 0x00000020,
+ 0x0000064d, 0x80000651, 0x00000020, 0x0000064e,
+ 0x80000651, 0x00000020, 0x0000064f, 0x80000651,
+ 0x00000020, 0x00000650, 0x80000651, 0x00000020,
+ 0x00000651, 0x80000670, 0x00000626, 0x80000631,
+ 0x00000626, 0x80000632, 0x00000626, 0x80000645,
+ 0x00000626, 0x80000646, 0x00000626, 0x80000649,
+ 0x00000626, 0x8000064a, 0x00000628, 0x80000631,
+ 0x00000628, 0x80000632, 0x00000628, 0x80000645,
+ 0x00000628, 0x80000646, 0x00000628, 0x80000649,
+ 0x00000628, 0x8000064a, 0x0000062a, 0x80000631,
+ 0x0000062a, 0x80000632, 0x0000062a, 0x80000645,
+ 0x0000062a, 0x80000646, 0x0000062a, 0x80000649,
+ 0x0000062a, 0x8000064a, 0x0000062b, 0x80000631,
+ 0x0000062b, 0x80000632, 0x0000062b, 0x80000645,
+ 0x0000062b, 0x80000646, 0x0000062b, 0x80000649,
+ 0x0000062b, 0x8000064a, 0x00000641, 0x80000649,
+ 0x00000641, 0x8000064a, 0x00000642, 0x80000649,
+ 0x00000642, 0x8000064a, 0x00000643, 0x80000627,
+ 0x00000643, 0x80000644, 0x00000643, 0x80000645,
+ 0x00000643, 0x80000649, 0x00000643, 0x8000064a,
+ 0x00000644, 0x80000645, 0x00000644, 0x80000649,
+ 0x00000644, 0x8000064a, 0x00000645, 0x80000627,
+ 0x00000645, 0x80000645, 0x00000646, 0x80000631,
+ 0x00000646, 0x80000632, 0x00000646, 0x80000645,
+ 0x00000646, 0x80000646, 0x00000646, 0x80000649,
+ 0x00000646, 0x8000064a, 0x00000649, 0x80000670,
+ 0x0000064a, 0x80000631, 0x0000064a, 0x80000632,
+ 0x0000064a, 0x80000645, 0x0000064a, 0x80000646,
+ 0x0000064a, 0x80000649, 0x0000064a, 0x8000064a,
+ 0x00000626, 0x8000062c, 0x00000626, 0x8000062d,
+ 0x00000626, 0x8000062e, 0x00000626, 0x80000645,
+ 0x00000626, 0x80000647, 0x00000628, 0x8000062c,
+ 0x00000628, 0x8000062d, 0x00000628, 0x8000062e,
+ 0x00000628, 0x80000645, 0x00000628, 0x80000647,
+ 0x0000062a, 0x8000062c, 0x0000062a, 0x8000062d,
+ 0x0000062a, 0x8000062e, 0x0000062a, 0x80000645,
+ 0x0000062a, 0x80000647, 0x0000062b, 0x80000645,
+ 0x0000062c, 0x8000062d, 0x0000062c, 0x80000645,
+ 0x0000062d, 0x8000062c, 0x0000062d, 0x80000645,
+ 0x0000062e, 0x8000062c, 0x0000062e, 0x80000645,
+ 0x00000633, 0x8000062c, 0x00000633, 0x8000062d,
+ 0x00000633, 0x8000062e, 0x00000633, 0x80000645,
+ 0x00000635, 0x8000062d, 0x00000635, 0x8000062e,
+ 0x00000635, 0x80000645, 0x00000636, 0x8000062c,
+ 0x00000636, 0x8000062d, 0x00000636, 0x8000062e,
+ 0x00000636, 0x80000645, 0x00000637, 0x8000062d,
+ 0x00000638, 0x80000645, 0x00000639, 0x8000062c,
+ 0x00000639, 0x80000645, 0x0000063a, 0x8000062c,
+ 0x0000063a, 0x80000645, 0x00000641, 0x8000062c,
+ 0x00000641, 0x8000062d, 0x00000641, 0x8000062e,
+ 0x00000641, 0x80000645, 0x00000642, 0x8000062d,
+ 0x00000642, 0x80000645, 0x00000643, 0x8000062c,
+ 0x00000643, 0x8000062d, 0x00000643, 0x8000062e,
+ 0x00000643, 0x80000644, 0x00000643, 0x80000645,
+ 0x00000644, 0x8000062c, 0x00000644, 0x8000062d,
+ 0x00000644, 0x8000062e, 0x00000644, 0x80000645,
+ 0x00000644, 0x80000647, 0x00000645, 0x8000062c,
+ 0x00000645, 0x8000062d, 0x00000645, 0x8000062e,
+ 0x00000645, 0x80000645, 0x00000646, 0x8000062c,
+ 0x00000646, 0x8000062d, 0x00000646, 0x8000062e,
+ 0x00000646, 0x80000645, 0x00000646, 0x80000647,
+ 0x00000647, 0x8000062c, 0x00000647, 0x80000645,
+ 0x00000647, 0x80000670, 0x0000064a, 0x8000062c,
+ 0x0000064a, 0x8000062d, 0x0000064a, 0x8000062e,
+ 0x0000064a, 0x80000645, 0x0000064a, 0x80000647,
+ 0x00000626, 0x80000645, 0x00000626, 0x80000647,
+ 0x00000628, 0x80000645, 0x00000628, 0x80000647,
+ 0x0000062a, 0x80000645, 0x0000062a, 0x80000647,
+ 0x0000062b, 0x80000645, 0x0000062b, 0x80000647,
+ 0x00000633, 0x80000645, 0x00000633, 0x80000647,
+ 0x00000634, 0x80000645, 0x00000634, 0x80000647,
+ 0x00000643, 0x80000644, 0x00000643, 0x80000645,
+ 0x00000644, 0x80000645, 0x00000646, 0x80000645,
+ 0x00000646, 0x80000647, 0x0000064a, 0x80000645,
+ 0x0000064a, 0x80000647, 0x00000640, 0x0000064e,
+ 0x80000651, 0x00000640, 0x0000064f, 0x80000651,
+ 0x00000640, 0x00000650, 0x80000651, 0x00000637,
+ 0x80000649, 0x00000637, 0x8000064a, 0x00000639,
+ 0x80000649, 0x00000639, 0x8000064a, 0x0000063a,
+ 0x80000649, 0x0000063a, 0x8000064a, 0x00000633,
+ 0x80000649, 0x00000633, 0x8000064a, 0x00000634,
+ 0x80000649, 0x00000634, 0x8000064a, 0x0000062d,
+ 0x80000649, 0x0000062d, 0x8000064a, 0x0000062c,
+ 0x80000649, 0x0000062c, 0x8000064a, 0x0000062e,
+ 0x80000649, 0x0000062e, 0x8000064a, 0x00000635,
+ 0x80000649, 0x00000635, 0x8000064a, 0x00000636,
+ 0x80000649, 0x00000636, 0x8000064a, 0x00000634,
+ 0x8000062c, 0x00000634, 0x8000062d, 0x00000634,
+ 0x8000062e, 0x00000634, 0x80000645, 0x00000634,
+ 0x80000631, 0x00000633, 0x80000631, 0x00000635,
+ 0x80000631, 0x00000636, 0x80000631, 0x00000637,
+ 0x80000649, 0x00000637, 0x8000064a, 0x00000639,
+ 0x80000649, 0x00000639, 0x8000064a, 0x0000063a,
+ 0x80000649, 0x0000063a, 0x8000064a, 0x00000633,
+ 0x80000649, 0x00000633, 0x8000064a, 0x00000634,
+ 0x80000649, 0x00000634, 0x8000064a, 0x0000062d,
+ 0x80000649, 0x0000062d, 0x8000064a, 0x0000062c,
+ 0x80000649, 0x0000062c, 0x8000064a, 0x0000062e,
+ 0x80000649, 0x0000062e, 0x8000064a, 0x00000635,
+ 0x80000649, 0x00000635, 0x8000064a, 0x00000636,
+ 0x80000649, 0x00000636, 0x8000064a, 0x00000634,
+ 0x8000062c, 0x00000634, 0x8000062d, 0x00000634,
+ 0x8000062e, 0x00000634, 0x80000645, 0x00000634,
+ 0x80000631, 0x00000633, 0x80000631, 0x00000635,
+ 0x80000631, 0x00000636, 0x80000631, 0x00000634,
+ 0x8000062c, 0x00000634, 0x8000062d, 0x00000634,
+ 0x8000062e, 0x00000634, 0x80000645, 0x00000633,
+ 0x80000647, 0x00000634, 0x80000647, 0x00000637,
+ 0x80000645, 0x00000633, 0x8000062c, 0x00000633,
+ 0x8000062d, 0x00000633, 0x8000062e, 0x00000634,
+ 0x8000062c, 0x00000634, 0x8000062d, 0x00000634,
+ 0x8000062e, 0x00000637, 0x80000645, 0x00000638,
+ 0x80000645, 0x00000627, 0x8000064b, 0x00000627,
+ 0x8000064b, 0x0000062a, 0x0000062c, 0x80000645,
+ 0x0000062a, 0x0000062d, 0x8000062c, 0x0000062a,
+ 0x0000062d, 0x8000062c, 0x0000062a, 0x0000062d,
+ 0x80000645, 0x0000062a, 0x0000062e, 0x80000645,
+ 0x0000062a, 0x00000645, 0x8000062c, 0x0000062a,
+ 0x00000645, 0x8000062d, 0x0000062a, 0x00000645,
+ 0x8000062e, 0x0000062c, 0x00000645, 0x8000062d,
+ 0x0000062c, 0x00000645, 0x8000062d, 0x0000062d,
+ 0x00000645, 0x8000064a, 0x0000062d, 0x00000645,
+ 0x80000649, 0x00000633, 0x0000062d, 0x8000062c,
+ 0x00000633, 0x0000062c, 0x8000062d, 0x00000633,
+ 0x0000062c, 0x80000649, 0x00000633, 0x00000645,
+ 0x8000062d, 0x00000633, 0x00000645, 0x8000062d,
+ 0x00000633, 0x00000645, 0x8000062c, 0x00000633,
+ 0x00000645, 0x80000645, 0x00000633, 0x00000645,
+ 0x80000645, 0x00000635, 0x0000062d, 0x8000062d,
+ 0x00000635, 0x0000062d, 0x8000062d, 0x00000635,
+ 0x00000645, 0x80000645, 0x00000634, 0x0000062d,
+ 0x80000645, 0x00000634, 0x0000062d, 0x80000645,
+ 0x00000634, 0x0000062c, 0x8000064a, 0x00000634,
+ 0x00000645, 0x8000062e, 0x00000634, 0x00000645,
+ 0x8000062e, 0x00000634, 0x00000645, 0x80000645,
+ 0x00000634, 0x00000645, 0x80000645, 0x00000636,
+ 0x0000062d, 0x80000649, 0x00000636, 0x0000062e,
+ 0x80000645, 0x00000636, 0x0000062e, 0x80000645,
+ 0x00000637, 0x00000645, 0x8000062d, 0x00000637,
+ 0x00000645, 0x8000062d, 0x00000637, 0x00000645,
+ 0x80000645, 0x00000637, 0x00000645, 0x8000064a,
+ 0x00000639, 0x0000062c, 0x80000645, 0x00000639,
+ 0x00000645, 0x80000645, 0x00000639, 0x00000645,
+ 0x80000645, 0x00000639, 0x00000645, 0x80000649,
+ 0x0000063a, 0x00000645, 0x80000645, 0x0000063a,
+ 0x00000645, 0x8000064a, 0x0000063a, 0x00000645,
+ 0x80000649, 0x00000641, 0x0000062e, 0x80000645,
+ 0x00000641, 0x0000062e, 0x80000645, 0x00000642,
+ 0x00000645, 0x8000062d, 0x00000642, 0x00000645,
+ 0x80000645, 0x00000644, 0x0000062d, 0x80000645,
+ 0x00000644, 0x0000062d, 0x8000064a, 0x00000644,
+ 0x0000062d, 0x80000649, 0x00000644, 0x0000062c,
+ 0x8000062c, 0x00000644, 0x0000062c, 0x8000062c,
+ 0x00000644, 0x0000062e, 0x80000645, 0x00000644,
+ 0x0000062e, 0x80000645, 0x00000644, 0x00000645,
+ 0x8000062d, 0x00000644, 0x00000645, 0x8000062d,
+ 0x00000645, 0x0000062d, 0x8000062c, 0x00000645,
+ 0x0000062d, 0x80000645, 0x00000645, 0x0000062d,
+ 0x8000064a, 0x00000645, 0x0000062c, 0x8000062d,
+ 0x00000645, 0x0000062c, 0x80000645, 0x00000645,
+ 0x0000062e, 0x8000062c, 0x00000645, 0x0000062e,
+ 0x80000645, 0x00000645, 0x0000062c, 0x8000062e,
+ 0x00000647, 0x00000645, 0x8000062c, 0x00000647,
+ 0x00000645, 0x80000645, 0x00000646, 0x0000062d,
+ 0x80000645, 0x00000646, 0x0000062d, 0x80000649,
+ 0x00000646, 0x0000062c, 0x80000645, 0x00000646,
+ 0x0000062c, 0x80000645, 0x00000646, 0x0000062c,
+ 0x80000649, 0x00000646, 0x00000645, 0x8000064a,
+ 0x00000646, 0x00000645, 0x80000649, 0x0000064a,
+ 0x00000645, 0x80000645, 0x0000064a, 0x00000645,
+ 0x80000645, 0x00000628, 0x0000062e, 0x8000064a,
+ 0x0000062a, 0x0000062c, 0x8000064a, 0x0000062a,
+ 0x0000062c, 0x80000649, 0x0000062a, 0x0000062e,
+ 0x8000064a, 0x0000062a, 0x0000062e, 0x80000649,
+ 0x0000062a, 0x00000645, 0x8000064a, 0x0000062a,
+ 0x00000645, 0x80000649, 0x0000062c, 0x00000645,
+ 0x8000064a, 0x0000062c, 0x0000062d, 0x80000649,
+ 0x0000062c, 0x00000645, 0x80000649, 0x00000633,
+ 0x0000062e, 0x80000649, 0x00000635, 0x0000062d,
+ 0x8000064a, 0x00000634, 0x0000062d, 0x8000064a,
+ 0x00000636, 0x0000062d, 0x8000064a, 0x00000644,
+ 0x0000062c, 0x8000064a, 0x00000644, 0x00000645,
+ 0x8000064a, 0x0000064a, 0x0000062d, 0x8000064a,
+ 0x0000064a, 0x0000062c, 0x8000064a, 0x0000064a,
+ 0x00000645, 0x8000064a, 0x00000645, 0x00000645,
+ 0x8000064a, 0x00000642, 0x00000645, 0x8000064a,
+ 0x00000646, 0x0000062d, 0x8000064a, 0x00000642,
+ 0x00000645, 0x8000062d, 0x00000644, 0x0000062d,
+ 0x80000645, 0x00000639, 0x00000645, 0x8000064a,
+ 0x00000643, 0x00000645, 0x8000064a, 0x00000646,
+ 0x0000062c, 0x8000062d, 0x00000645, 0x0000062e,
+ 0x8000064a, 0x00000644, 0x0000062c, 0x80000645,
+ 0x00000643, 0x00000645, 0x80000645, 0x00000644,
+ 0x0000062c, 0x80000645, 0x00000646, 0x0000062c,
+ 0x8000062d, 0x0000062c, 0x0000062d, 0x8000064a,
+ 0x0000062d, 0x0000062c, 0x8000064a, 0x00000645,
+ 0x0000062c, 0x8000064a, 0x00000641, 0x00000645,
+ 0x8000064a, 0x00000628, 0x0000062d, 0x8000064a,
+ 0x00000643, 0x00000645, 0x80000645, 0x00000639,
+ 0x0000062c, 0x80000645, 0x00000635, 0x00000645,
+ 0x80000645, 0x00000633, 0x0000062e, 0x8000064a,
+ 0x00000646, 0x0000062c, 0x8000064a, 0x00000635,
+ 0x00000644, 0x800006d2, 0x00000642, 0x00000644,
+ 0x800006d2, 0x00000627, 0x00000644, 0x00000644,
+ 0x80000647, 0x00000627, 0x00000643, 0x00000628,
+ 0x80000631, 0x00000645, 0x0000062d, 0x00000645,
+ 0x8000062f, 0x00000635, 0x00000644, 0x00000639,
+ 0x80000645, 0x00000631, 0x00000633, 0x00000648,
+ 0x80000644, 0x00000639, 0x00000644, 0x0000064a,
+ 0x80000647, 0x00000648, 0x00000633, 0x00000644,
+ 0x80000645, 0x00000635, 0x00000644, 0x80000649,
+ 0x00000635, 0x00000644, 0x00000649, 0x00000020,
+ 0x00000627, 0x00000644, 0x00000644, 0x00000647,
+ 0x00000020, 0x00000639, 0x00000644, 0x0000064a,
+ 0x00000647, 0x00000020, 0x00000648, 0x00000633,
+ 0x00000644, 0x80000645, 0x0000062c, 0x00000644,
+ 0x00000020, 0x0000062c, 0x00000644, 0x00000627,
+ 0x00000644, 0x80000647, 0x00000631, 0x000006cc,
+ 0x00000627, 0x80000644, 0x80002025, 0x80002014,
+ 0x80002013, 0x8000005f, 0x8000005f, 0x80000028,
+ 0x80000029, 0x8000007b, 0x8000007d, 0x80003014,
+ 0x80003015, 0x80003010, 0x80003011, 0x8000300a,
+ 0x8000300b, 0x80003008, 0x80003009, 0x8000300c,
+ 0x8000300d, 0x8000300e, 0x8000300f, 0x8000203e,
+ 0x8000203e, 0x8000203e, 0x8000203e, 0x8000005f,
+ 0x8000005f, 0x8000005f, 0x8000002c, 0x80003001,
+ 0x8000002e, 0x8000003b, 0x8000003a, 0x8000003f,
+ 0x80000021, 0x80002014, 0x80000028, 0x80000029,
+ 0x8000007b, 0x8000007d, 0x80003014, 0x80003015,
+ 0x80000023, 0x80000026, 0x8000002a, 0x8000002b,
+ 0x8000002d, 0x8000003c, 0x8000003e, 0x8000003d,
+ 0x8000005c, 0x80000024, 0x80000025, 0x80000040,
+ 0x00000020, 0x8000064b, 0x00000640, 0x8000064b,
+ 0x00000020, 0x8000064c, 0x00000020, 0x8000064d,
+ 0x00000020, 0x8000064e, 0x00000640, 0x8000064e,
+ 0x00000020, 0x8000064f, 0x00000640, 0x8000064f,
+ 0x00000020, 0x80000650, 0x00000640, 0x80000650,
+ 0x00000020, 0x80000651, 0x00000640, 0x80000651,
+ 0x00000020, 0x80000652, 0x00000640, 0x80000652,
+ 0x80000621, 0x80000622, 0x80000622, 0x80000623,
+ 0x80000623, 0x80000624, 0x80000624, 0x80000625,
+ 0x80000625, 0x80000626, 0x80000626, 0x80000626,
+ 0x80000626, 0x80000627, 0x80000627, 0x80000628,
+ 0x80000628, 0x80000628, 0x80000628, 0x80000629,
+ 0x80000629, 0x8000062a, 0x8000062a, 0x8000062a,
+ 0x8000062a, 0x8000062b, 0x8000062b, 0x8000062b,
+ 0x8000062b, 0x8000062c, 0x8000062c, 0x8000062c,
+ 0x8000062c, 0x8000062d, 0x8000062d, 0x8000062d,
+ 0x8000062d, 0x8000062e, 0x8000062e, 0x8000062e,
+ 0x8000062e, 0x8000062f, 0x8000062f, 0x80000630,
+ 0x80000630, 0x80000631, 0x80000631, 0x80000632,
+ 0x80000632, 0x80000633, 0x80000633, 0x80000633,
+ 0x80000633, 0x80000634, 0x80000634, 0x80000634,
+ 0x80000634, 0x80000635, 0x80000635, 0x80000635,
+ 0x80000635, 0x80000636, 0x80000636, 0x80000636,
+ 0x80000636, 0x80000637, 0x80000637, 0x80000637,
+ 0x80000637, 0x80000638, 0x80000638, 0x80000638,
+ 0x80000638, 0x80000639, 0x80000639, 0x80000639,
+ 0x80000639, 0x8000063a, 0x8000063a, 0x8000063a,
+ 0x8000063a, 0x80000641, 0x80000641, 0x80000641,
+ 0x80000641, 0x80000642, 0x80000642, 0x80000642,
+ 0x80000642, 0x80000643, 0x80000643, 0x80000643,
+ 0x80000643, 0x80000644, 0x80000644, 0x80000644,
+ 0x80000644, 0x80000645, 0x80000645, 0x80000645,
+ 0x80000645, 0x80000646, 0x80000646, 0x80000646,
+ 0x80000646, 0x80000647, 0x80000647, 0x80000647,
+ 0x80000647, 0x80000648, 0x80000648, 0x80000649,
+ 0x80000649, 0x8000064a, 0x8000064a, 0x8000064a,
+ 0x8000064a, 0x00000644, 0x80000622, 0x00000644,
+ 0x80000622, 0x00000644, 0x80000623, 0x00000644,
+ 0x80000623, 0x00000644, 0x80000625, 0x00000644,
+ 0x80000625, 0x00000644, 0x80000627, 0x00000644,
+ 0x80000627, 0x80000021, 0x80000022, 0x80000023,
+ 0x80000024, 0x80000025, 0x80000026, 0x80000027,
+ 0x80000028, 0x80000029, 0x8000002a, 0x8000002b,
+ 0x8000002c, 0x8000002d, 0x8000002e, 0x8000002f,
+ 0x80000030, 0x80000031, 0x80000032, 0x80000033,
+ 0x80000034, 0x80000035, 0x80000036, 0x80000037,
+ 0x80000038, 0x80000039, 0x8000003a, 0x8000003b,
+ 0x8000003c, 0x8000003d, 0x8000003e, 0x8000003f,
+ 0x80000040, 0x80000041, 0x80000042, 0x80000043,
+ 0x80000044, 0x80000045, 0x80000046, 0x80000047,
+ 0x80000048, 0x80000049, 0x8000004a, 0x8000004b,
+ 0x8000004c, 0x8000004d, 0x8000004e, 0x8000004f,
+ 0x80000050, 0x80000051, 0x80000052, 0x80000053,
+ 0x80000054, 0x80000055, 0x80000056, 0x80000057,
+ 0x80000058, 0x80000059, 0x8000005a, 0x8000005b,
+ 0x8000005c, 0x8000005d, 0x8000005e, 0x8000005f,
+ 0x80000060, 0x80000061, 0x80000062, 0x80000063,
+ 0x80000064, 0x80000065, 0x80000066, 0x80000067,
+ 0x80000068, 0x80000069, 0x8000006a, 0x8000006b,
+ 0x8000006c, 0x8000006d, 0x8000006e, 0x8000006f,
+ 0x80000070, 0x80000071, 0x80000072, 0x80000073,
+ 0x80000074, 0x80000075, 0x80000076, 0x80000077,
+ 0x80000078, 0x80000079, 0x8000007a, 0x8000007b,
+ 0x8000007c, 0x8000007d, 0x8000007e, 0x80002985,
+ 0x80002986, 0x80003002, 0x8000300c, 0x8000300d,
+ 0x80003001, 0x800030fb, 0x800030f2, 0x800030a1,
+ 0x800030a3, 0x800030a5, 0x800030a7, 0x800030a9,
+ 0x800030e3, 0x800030e5, 0x800030e7, 0x800030c3,
+ 0x800030fc, 0x800030a2, 0x800030a4, 0x800030a6,
+ 0x800030a8, 0x800030aa, 0x800030ab, 0x800030ad,
+ 0x800030af, 0x800030b1, 0x800030b3, 0x800030b5,
+ 0x800030b7, 0x800030b9, 0x800030bb, 0x800030bd,
+ 0x800030bf, 0x800030c1, 0x800030c4, 0x800030c6,
+ 0x800030c8, 0x800030ca, 0x800030cb, 0x800030cc,
+ 0x800030cd, 0x800030ce, 0x800030cf, 0x800030d2,
+ 0x800030d5, 0x800030d8, 0x800030db, 0x800030de,
+ 0x800030df, 0x800030e0, 0x800030e1, 0x800030e2,
+ 0x800030e4, 0x800030e6, 0x800030e8, 0x800030e9,
+ 0x800030ea, 0x800030eb, 0x800030ec, 0x800030ed,
+ 0x800030ef, 0x800030f3, 0x80003099, 0x8000309a,
+ 0x80003164, 0x80003131, 0x80003132, 0x80003133,
+ 0x80003134, 0x80003135, 0x80003136, 0x80003137,
+ 0x80003138, 0x80003139, 0x8000313a, 0x8000313b,
+ 0x8000313c, 0x8000313d, 0x8000313e, 0x8000313f,
+ 0x80003140, 0x80003141, 0x80003142, 0x80003143,
+ 0x80003144, 0x80003145, 0x80003146, 0x80003147,
+ 0x80003148, 0x80003149, 0x8000314a, 0x8000314b,
+ 0x8000314c, 0x8000314d, 0x8000314e, 0x8000314f,
+ 0x80003150, 0x80003151, 0x80003152, 0x80003153,
+ 0x80003154, 0x80003155, 0x80003156, 0x80003157,
+ 0x80003158, 0x80003159, 0x8000315a, 0x8000315b,
+ 0x8000315c, 0x8000315d, 0x8000315e, 0x8000315f,
+ 0x80003160, 0x80003161, 0x80003162, 0x80003163,
+ 0x800000a2, 0x800000a3, 0x800000ac, 0x800000af,
+ 0x800000a6, 0x800000a5, 0x800020a9, 0x80002502,
+ 0x80002190, 0x80002191, 0x80002192, 0x80002193,
+ 0x800025a0, 0x800025cb, 0x0001d157, 0x8001d165,
+ 0x0001d158, 0x8001d165, 0x0001d15f, 0x8001d16e,
+ 0x0001d15f, 0x8001d16f, 0x0001d15f, 0x8001d170,
+ 0x0001d15f, 0x8001d171, 0x0001d15f, 0x8001d172,
+ 0x0001d1b9, 0x8001d165, 0x0001d1ba, 0x8001d165,
+ 0x0001d1bb, 0x8001d16e, 0x0001d1bc, 0x8001d16e,
+ 0x0001d1bb, 0x8001d16f, 0x0001d1bc, 0x8001d16f,
+ 0x80000041, 0x80000042, 0x80000043, 0x80000044,
+ 0x80000045, 0x80000046, 0x80000047, 0x80000048,
+ 0x80000049, 0x8000004a, 0x8000004b, 0x8000004c,
+ 0x8000004d, 0x8000004e, 0x8000004f, 0x80000050,
+ 0x80000051, 0x80000052, 0x80000053, 0x80000054,
+ 0x80000055, 0x80000056, 0x80000057, 0x80000058,
+ 0x80000059, 0x8000005a, 0x80000061, 0x80000062,
+ 0x80000063, 0x80000064, 0x80000065, 0x80000066,
+ 0x80000067, 0x80000068, 0x80000069, 0x8000006a,
+ 0x8000006b, 0x8000006c, 0x8000006d, 0x8000006e,
+ 0x8000006f, 0x80000070, 0x80000071, 0x80000072,
+ 0x80000073, 0x80000074, 0x80000075, 0x80000076,
+ 0x80000077, 0x80000078, 0x80000079, 0x8000007a,
+ 0x80000041, 0x80000042, 0x80000043, 0x80000044,
+ 0x80000045, 0x80000046, 0x80000047, 0x80000048,
+ 0x80000049, 0x8000004a, 0x8000004b, 0x8000004c,
+ 0x8000004d, 0x8000004e, 0x8000004f, 0x80000050,
+ 0x80000051, 0x80000052, 0x80000053, 0x80000054,
+ 0x80000055, 0x80000056, 0x80000057, 0x80000058,
+ 0x80000059, 0x8000005a, 0x80000061, 0x80000062,
+ 0x80000063, 0x80000064, 0x80000065, 0x80000066,
+ 0x80000067, 0x80000069, 0x8000006a, 0x8000006b,
+ 0x8000006c, 0x8000006d, 0x8000006e, 0x8000006f,
+ 0x80000070, 0x80000071, 0x80000072, 0x80000073,
+ 0x80000074, 0x80000075, 0x80000076, 0x80000077,
+ 0x80000078, 0x80000079, 0x8000007a, 0x80000041,
+ 0x80000042, 0x80000043, 0x80000044, 0x80000045,
+ 0x80000046, 0x80000047, 0x80000048, 0x80000049,
+ 0x8000004a, 0x8000004b, 0x8000004c, 0x8000004d,
+ 0x8000004e, 0x8000004f, 0x80000050, 0x80000051,
+ 0x80000052, 0x80000053, 0x80000054, 0x80000055,
+ 0x80000056, 0x80000057, 0x80000058, 0x80000059,
+ 0x8000005a, 0x80000061, 0x80000062, 0x80000063,
+ 0x80000064, 0x80000065, 0x80000066, 0x80000067,
+ 0x80000068, 0x80000069, 0x8000006a, 0x8000006b,
+ 0x8000006c, 0x8000006d, 0x8000006e, 0x8000006f,
+ 0x80000070, 0x80000071, 0x80000072, 0x80000073,
+ 0x80000074, 0x80000075, 0x80000076, 0x80000077,
+ 0x80000078, 0x80000079, 0x8000007a, 0x80000041,
+ 0x80000043, 0x80000044, 0x80000047, 0x8000004a,
+ 0x8000004b, 0x8000004e, 0x8000004f, 0x80000050,
+ 0x80000051, 0x80000053, 0x80000054, 0x80000055,
+ 0x80000056, 0x80000057, 0x80000058, 0x80000059,
+ 0x8000005a, 0x80000061, 0x80000062, 0x80000063,
+ 0x80000064, 0x80000066, 0x80000068, 0x80000069,
+ 0x8000006a, 0x8000006b, 0x8000006d, 0x8000006e,
+ 0x80000070, 0x80000071, 0x80000072, 0x80000073,
+ 0x80000074, 0x80000075, 0x80000076, 0x80000077,
+ 0x80000078, 0x80000079, 0x8000007a, 0x80000041,
+ 0x80000042, 0x80000043, 0x80000044, 0x80000045,
+ 0x80000046, 0x80000047, 0x80000048, 0x80000049,
+ 0x8000004a, 0x8000004b, 0x8000004c, 0x8000004d,
+ 0x8000004e, 0x8000004f, 0x80000050, 0x80000051,
+ 0x80000052, 0x80000053, 0x80000054, 0x80000055,
+ 0x80000056, 0x80000057, 0x80000058, 0x80000059,
+ 0x8000005a, 0x80000061, 0x80000062, 0x80000063,
+ 0x80000064, 0x80000065, 0x80000066, 0x80000067,
+ 0x80000068, 0x80000069, 0x8000006a, 0x8000006b,
+ 0x8000006c, 0x8000006d, 0x8000006e, 0x8000006f,
+ 0x80000070, 0x80000071, 0x80000072, 0x80000073,
+ 0x80000074, 0x80000075, 0x80000076, 0x80000077,
+ 0x80000078, 0x80000079, 0x8000007a, 0x80000041,
+ 0x80000042, 0x80000044, 0x80000045, 0x80000046,
+ 0x80000047, 0x8000004a, 0x8000004b, 0x8000004c,
+ 0x8000004d, 0x8000004e, 0x8000004f, 0x80000050,
+ 0x80000051, 0x80000053, 0x80000054, 0x80000055,
+ 0x80000056, 0x80000057, 0x80000058, 0x80000059,
+ 0x80000061, 0x80000062, 0x80000063, 0x80000064,
+ 0x80000065, 0x80000066, 0x80000067, 0x80000068,
+ 0x80000069, 0x8000006a, 0x8000006b, 0x8000006c,
+ 0x8000006d, 0x8000006e, 0x8000006f, 0x80000070,
+ 0x80000071, 0x80000072, 0x80000073, 0x80000074,
+ 0x80000075, 0x80000076, 0x80000077, 0x80000078,
+ 0x80000079, 0x8000007a, 0x80000041, 0x80000042,
+ 0x80000044, 0x80000045, 0x80000046, 0x80000047,
+ 0x80000049, 0x8000004a, 0x8000004b, 0x8000004c,
+ 0x8000004d, 0x8000004f, 0x80000053, 0x80000054,
+ 0x80000055, 0x80000056, 0x80000057, 0x80000058,
+ 0x80000059, 0x80000061, 0x80000062, 0x80000063,
+ 0x80000064, 0x80000065, 0x80000066, 0x80000067,
+ 0x80000068, 0x80000069, 0x8000006a, 0x8000006b,
+ 0x8000006c, 0x8000006d, 0x8000006e, 0x8000006f,
+ 0x80000070, 0x80000071, 0x80000072, 0x80000073,
+ 0x80000074, 0x80000075, 0x80000076, 0x80000077,
+ 0x80000078, 0x80000079, 0x8000007a, 0x80000041,
+ 0x80000042, 0x80000043, 0x80000044, 0x80000045,
+ 0x80000046, 0x80000047, 0x80000048, 0x80000049,
+ 0x8000004a, 0x8000004b, 0x8000004c, 0x8000004d,
+ 0x8000004e, 0x8000004f, 0x80000050, 0x80000051,
+ 0x80000052, 0x80000053, 0x80000054, 0x80000055,
+ 0x80000056, 0x80000057, 0x80000058, 0x80000059,
+ 0x8000005a, 0x80000061, 0x80000062, 0x80000063,
+ 0x80000064, 0x80000065, 0x80000066, 0x80000067,
+ 0x80000068, 0x80000069, 0x8000006a, 0x8000006b,
+ 0x8000006c, 0x8000006d, 0x8000006e, 0x8000006f,
+ 0x80000070, 0x80000071, 0x80000072, 0x80000073,
+ 0x80000074, 0x80000075, 0x80000076, 0x80000077,
+ 0x80000078, 0x80000079, 0x8000007a, 0x80000041,
+ 0x80000042, 0x80000043, 0x80000044, 0x80000045,
+ 0x80000046, 0x80000047, 0x80000048, 0x80000049,
+ 0x8000004a, 0x8000004b, 0x8000004c, 0x8000004d,
+ 0x8000004e, 0x8000004f, 0x80000050, 0x80000051,
+ 0x80000052, 0x80000053, 0x80000054, 0x80000055,
+ 0x80000056, 0x80000057, 0x80000058, 0x80000059,
+ 0x8000005a, 0x80000061, 0x80000062, 0x80000063,
+ 0x80000064, 0x80000065, 0x80000066, 0x80000067,
+ 0x80000068, 0x80000069, 0x8000006a, 0x8000006b,
+ 0x8000006c, 0x8000006d, 0x8000006e, 0x8000006f,
+ 0x80000070, 0x80000071, 0x80000072, 0x80000073,
+ 0x80000074, 0x80000075, 0x80000076, 0x80000077,
+ 0x80000078, 0x80000079, 0x8000007a, 0x80000041,
+ 0x80000042, 0x80000043, 0x80000044, 0x80000045,
+ 0x80000046, 0x80000047, 0x80000048, 0x80000049,
+ 0x8000004a, 0x8000004b, 0x8000004c, 0x8000004d,
+ 0x8000004e, 0x8000004f, 0x80000050, 0x80000051,
+ 0x80000052, 0x80000053, 0x80000054, 0x80000055,
+ 0x80000056, 0x80000057, 0x80000058, 0x80000059,
+ 0x8000005a, 0x80000061, 0x80000062, 0x80000063,
+ 0x80000064, 0x80000065, 0x80000066, 0x80000067,
+ 0x80000068, 0x80000069, 0x8000006a, 0x8000006b,
+ 0x8000006c, 0x8000006d, 0x8000006e, 0x8000006f,
+ 0x80000070, 0x80000071, 0x80000072, 0x80000073,
+ 0x80000074, 0x80000075, 0x80000076, 0x80000077,
+ 0x80000078, 0x80000079, 0x8000007a, 0x80000041,
+ 0x80000042, 0x80000043, 0x80000044, 0x80000045,
+ 0x80000046, 0x80000047, 0x80000048, 0x80000049,
+ 0x8000004a, 0x8000004b, 0x8000004c, 0x8000004d,
+ 0x8000004e, 0x8000004f, 0x80000050, 0x80000051,
+ 0x80000052, 0x80000053, 0x80000054, 0x80000055,
+ 0x80000056, 0x80000057, 0x80000058, 0x80000059,
+ 0x8000005a, 0x80000061, 0x80000062, 0x80000063,
+ 0x80000064, 0x80000065, 0x80000066, 0x80000067,
+ 0x80000068, 0x80000069, 0x8000006a, 0x8000006b,
+ 0x8000006c, 0x8000006d, 0x8000006e, 0x8000006f,
+ 0x80000070, 0x80000071, 0x80000072, 0x80000073,
+ 0x80000074, 0x80000075, 0x80000076, 0x80000077,
+ 0x80000078, 0x80000079, 0x8000007a, 0x80000041,
+ 0x80000042, 0x80000043, 0x80000044, 0x80000045,
+ 0x80000046, 0x80000047, 0x80000048, 0x80000049,
+ 0x8000004a, 0x8000004b, 0x8000004c, 0x8000004d,
+ 0x8000004e, 0x8000004f, 0x80000050, 0x80000051,
+ 0x80000052, 0x80000053, 0x80000054, 0x80000055,
+ 0x80000056, 0x80000057, 0x80000058, 0x80000059,
+ 0x8000005a, 0x80000061, 0x80000062, 0x80000063,
+ 0x80000064, 0x80000065, 0x80000066, 0x80000067,
+ 0x80000068, 0x80000069, 0x8000006a, 0x8000006b,
+ 0x8000006c, 0x8000006d, 0x8000006e, 0x8000006f,
+ 0x80000070, 0x80000071, 0x80000072, 0x80000073,
+ 0x80000074, 0x80000075, 0x80000076, 0x80000077,
+ 0x80000078, 0x80000079, 0x8000007a, 0x80000041,
+ 0x80000042, 0x80000043, 0x80000044, 0x80000045,
+ 0x80000046, 0x80000047, 0x80000048, 0x80000049,
+ 0x8000004a, 0x8000004b, 0x8000004c, 0x8000004d,
+ 0x8000004e, 0x8000004f, 0x80000050, 0x80000051,
+ 0x80000052, 0x80000053, 0x80000054, 0x80000055,
+ 0x80000056, 0x80000057, 0x80000058, 0x80000059,
+ 0x8000005a, 0x80000061, 0x80000062, 0x80000063,
+ 0x80000064, 0x80000065, 0x80000066, 0x80000067,
+ 0x80000068, 0x80000069, 0x8000006a, 0x8000006b,
+ 0x8000006c, 0x8000006d, 0x8000006e, 0x8000006f,
+ 0x80000070, 0x80000071, 0x80000072, 0x80000073,
+ 0x80000074, 0x80000075, 0x80000076, 0x80000077,
+ 0x80000078, 0x80000079, 0x8000007a, 0x80000391,
+ 0x80000392, 0x80000393, 0x80000394, 0x80000395,
+ 0x80000396, 0x80000397, 0x80000398, 0x80000399,
+ 0x8000039a, 0x8000039b, 0x8000039c, 0x8000039d,
+ 0x8000039e, 0x8000039f, 0x800003a0, 0x800003a1,
+ 0x800003f4, 0x800003a3, 0x800003a4, 0x800003a5,
+ 0x800003a6, 0x800003a7, 0x800003a8, 0x800003a9,
+ 0x80002207, 0x800003b1, 0x800003b2, 0x800003b3,
+ 0x800003b4, 0x800003b5, 0x800003b6, 0x800003b7,
+ 0x800003b8, 0x800003b9, 0x800003ba, 0x800003bb,
+ 0x800003bc, 0x800003bd, 0x800003be, 0x800003bf,
+ 0x800003c0, 0x800003c1, 0x800003c2, 0x800003c3,
+ 0x800003c4, 0x800003c5, 0x800003c6, 0x800003c7,
+ 0x800003c8, 0x800003c9, 0x80002202, 0x800003f5,
+ 0x800003d1, 0x800003f0, 0x800003d5, 0x800003f1,
+ 0x800003d6, 0x80000391, 0x80000392, 0x80000393,
+ 0x80000394, 0x80000395, 0x80000396, 0x80000397,
+ 0x80000398, 0x80000399, 0x8000039a, 0x8000039b,
+ 0x8000039c, 0x8000039d, 0x8000039e, 0x8000039f,
+ 0x800003a0, 0x800003a1, 0x800003f4, 0x800003a3,
+ 0x800003a4, 0x800003a5, 0x800003a6, 0x800003a7,
+ 0x800003a8, 0x800003a9, 0x80002207, 0x800003b1,
+ 0x800003b2, 0x800003b3, 0x800003b4, 0x800003b5,
+ 0x800003b6, 0x800003b7, 0x800003b8, 0x800003b9,
+ 0x800003ba, 0x800003bb, 0x800003bc, 0x800003bd,
+ 0x800003be, 0x800003bf, 0x800003c0, 0x800003c1,
+ 0x800003c2, 0x800003c3, 0x800003c4, 0x800003c5,
+ 0x800003c6, 0x800003c7, 0x800003c8, 0x800003c9,
+ 0x80002202, 0x800003f5, 0x800003d1, 0x800003f0,
+ 0x800003d5, 0x800003f1, 0x800003d6, 0x80000391,
+ 0x80000392, 0x80000393, 0x80000394, 0x80000395,
+ 0x80000396, 0x80000397, 0x80000398, 0x80000399,
+ 0x8000039a, 0x8000039b, 0x8000039c, 0x8000039d,
+ 0x8000039e, 0x8000039f, 0x800003a0, 0x800003a1,
+ 0x800003f4, 0x800003a3, 0x800003a4, 0x800003a5,
+ 0x800003a6, 0x800003a7, 0x800003a8, 0x800003a9,
+ 0x80002207, 0x800003b1, 0x800003b2, 0x800003b3,
+ 0x800003b4, 0x800003b5, 0x800003b6, 0x800003b7,
+ 0x800003b8, 0x800003b9, 0x800003ba, 0x800003bb,
+ 0x800003bc, 0x800003bd, 0x800003be, 0x800003bf,
+ 0x800003c0, 0x800003c1, 0x800003c2, 0x800003c3,
+ 0x800003c4, 0x800003c5, 0x800003c6, 0x800003c7,
+ 0x800003c8, 0x800003c9, 0x80002202, 0x800003f5,
+ 0x800003d1, 0x800003f0, 0x800003d5, 0x800003f1,
+ 0x800003d6, 0x80000391, 0x80000392, 0x80000393,
+ 0x80000394, 0x80000395, 0x80000396, 0x80000397,
+ 0x80000398, 0x80000399, 0x8000039a, 0x8000039b,
+ 0x8000039c, 0x8000039d, 0x8000039e, 0x8000039f,
+ 0x800003a0, 0x800003a1, 0x800003f4, 0x800003a3,
+ 0x800003a4, 0x800003a5, 0x800003a6, 0x800003a7,
+ 0x800003a8, 0x800003a9, 0x80002207, 0x800003b1,
+ 0x800003b2, 0x800003b3, 0x800003b4, 0x800003b5,
+ 0x800003b6, 0x800003b7, 0x800003b8, 0x800003b9,
+ 0x800003ba, 0x800003bb, 0x800003bc, 0x800003bd,
+ 0x800003be, 0x800003bf, 0x800003c0, 0x800003c1,
+ 0x800003c2, 0x800003c3, 0x800003c4, 0x800003c5,
+ 0x800003c6, 0x800003c7, 0x800003c8, 0x800003c9,
+ 0x80002202, 0x800003f5, 0x800003d1, 0x800003f0,
+ 0x800003d5, 0x800003f1, 0x800003d6, 0x80000391,
+ 0x80000392, 0x80000393, 0x80000394, 0x80000395,
+ 0x80000396, 0x80000397, 0x80000398, 0x80000399,
+ 0x8000039a, 0x8000039b, 0x8000039c, 0x8000039d,
+ 0x8000039e, 0x8000039f, 0x800003a0, 0x800003a1,
+ 0x800003f4, 0x800003a3, 0x800003a4, 0x800003a5,
+ 0x800003a6, 0x800003a7, 0x800003a8, 0x800003a9,
+ 0x80002207, 0x800003b1, 0x800003b2, 0x800003b3,
+ 0x800003b4, 0x800003b5, 0x800003b6, 0x800003b7,
+ 0x800003b8, 0x800003b9, 0x800003ba, 0x800003bb,
+ 0x800003bc, 0x800003bd, 0x800003be, 0x800003bf,
+ 0x800003c0, 0x800003c1, 0x800003c2, 0x800003c3,
+ 0x800003c4, 0x800003c5, 0x800003c6, 0x800003c7,
+ 0x800003c8, 0x800003c9, 0x80002202, 0x800003f5,
+ 0x800003d1, 0x800003f0, 0x800003d5, 0x800003f1,
+ 0x800003d6, 0x80000030, 0x80000031, 0x80000032,
+ 0x80000033, 0x80000034, 0x80000035, 0x80000036,
+ 0x80000037, 0x80000038, 0x80000039, 0x80000030,
+ 0x80000031, 0x80000032, 0x80000033, 0x80000034,
+ 0x80000035, 0x80000036, 0x80000037, 0x80000038,
+ 0x80000039, 0x80000030, 0x80000031, 0x80000032,
+ 0x80000033, 0x80000034, 0x80000035, 0x80000036,
+ 0x80000037, 0x80000038, 0x80000039, 0x80000030,
+ 0x80000031, 0x80000032, 0x80000033, 0x80000034,
+ 0x80000035, 0x80000036, 0x80000037, 0x80000038,
+ 0x80000039, 0x80000030, 0x80000031, 0x80000032,
+ 0x80000033, 0x80000034, 0x80000035, 0x80000036,
+ 0x80000037, 0x80000038, 0x80000039, 0x80004e3d,
+ 0x80004e38, 0x80004e41, 0x80020122, 0x80004f60,
+ 0x80004fae, 0x80004fbb, 0x80005002, 0x8000507a,
+ 0x80005099, 0x800050e7, 0x800050cf, 0x8000349e,
+ 0x8002063a, 0x8000514d, 0x80005154, 0x80005164,
+ 0x80005177, 0x8002051c, 0x800034b9, 0x80005167,
+ 0x8000518d, 0x8002054b, 0x80005197, 0x800051a4,
+ 0x80004ecc, 0x800051ac, 0x800051b5, 0x800291df,
+ 0x800051f5, 0x80005203, 0x800034df, 0x8000523b,
+ 0x80005246, 0x80005272, 0x80005277, 0x80003515,
+ 0x800052c7, 0x800052c9, 0x800052e4, 0x800052fa,
+ 0x80005305, 0x80005306, 0x80005317, 0x80005349,
+ 0x80005351, 0x8000535a, 0x80005373, 0x8000537d,
+ 0x8000537f, 0x8000537f, 0x8000537f, 0x80020a2c,
+ 0x80007070, 0x800053ca, 0x800053df, 0x80020b63,
+ 0x800053eb, 0x800053f1, 0x80005406, 0x8000549e,
+ 0x80005438, 0x80005448, 0x80005468, 0x800054a2,
+ 0x800054f6, 0x80005510, 0x80005553, 0x80005563,
+ 0x80005584, 0x80005584, 0x80005599, 0x800055ab,
+ 0x800055b3, 0x800055c2, 0x80005716, 0x80005606,
+ 0x80005717, 0x80005651, 0x80005674, 0x80005207,
+ 0x800058ee, 0x800057ce, 0x800057f4, 0x8000580d,
+ 0x8000578b, 0x80005832, 0x80005831, 0x800058ac,
+ 0x800214e4, 0x800058f2, 0x800058f7, 0x80005906,
+ 0x8000591a, 0x80005922, 0x80005962, 0x800216a8,
+ 0x800216ea, 0x800059ec, 0x80005a1b, 0x80005a27,
+ 0x800059d8, 0x80005a66, 0x800036ee, 0x8002136a,
+ 0x80005b08, 0x80005b3e, 0x80005b3e, 0x800219c8,
+ 0x80005bc3, 0x80005bd8, 0x80005be7, 0x80005bf3,
+ 0x80021b18, 0x80005bff, 0x80005c06, 0x80005f33,
+ 0x80005c22, 0x80003781, 0x80005c60, 0x80005c6e,
+ 0x80005cc0, 0x80005c8d, 0x80021de4, 0x80005d43,
+ 0x80021de6, 0x80005d6e, 0x80005d6b, 0x80005d7c,
+ 0x80005de1, 0x80005de2, 0x8000382f, 0x80005dfd,
+ 0x80005e28, 0x80005e3d, 0x80005e69, 0x80003862,
+ 0x80022183, 0x8000387c, 0x80005eb0, 0x80005eb3,
+ 0x80005eb6, 0x80005eca, 0x8002a392, 0x80005efe,
+ 0x80022331, 0x80022331, 0x80008201, 0x80005f22,
+ 0x80005f22, 0x800038c7, 0x800232b8, 0x800261da,
+ 0x80005f62, 0x80005f6b, 0x800038e3, 0x80005f9a,
+ 0x80005fcd, 0x80005fd7, 0x80005ff9, 0x80006081,
+ 0x8000393a, 0x8000391c, 0x80006094, 0x800226d4,
+ 0x800060c7, 0x80006148, 0x8000614c, 0x8000614e,
+ 0x8000614c, 0x8000617a, 0x8000618e, 0x800061b2,
+ 0x800061a4, 0x800061af, 0x800061de, 0x800061f2,
+ 0x800061f6, 0x80006210, 0x8000621b, 0x8000625d,
+ 0x800062b1, 0x800062d4, 0x80006350, 0x80022b0c,
+ 0x8000633d, 0x800062fc, 0x80006368, 0x80006383,
+ 0x800063e4, 0x80022bf1, 0x80006422, 0x800063c5,
+ 0x800063a9, 0x80003a2e, 0x80006469, 0x8000647e,
+ 0x8000649d, 0x80006477, 0x80003a6c, 0x8000654f,
+ 0x8000656c, 0x8002300a, 0x800065e3, 0x800066f8,
+ 0x80006649, 0x80003b19, 0x80006691, 0x80003b08,
+ 0x80003ae4, 0x80005192, 0x80005195, 0x80006700,
+ 0x8000669c, 0x800080ad, 0x800043d9, 0x80006717,
+ 0x8000671b, 0x80006721, 0x8000675e, 0x80006753,
+ 0x800233c3, 0x80003b49, 0x800067fa, 0x80006785,
+ 0x80006852, 0x80006885, 0x8002346d, 0x8000688e,
+ 0x8000681f, 0x80006914, 0x80003b9d, 0x80006942,
+ 0x800069a3, 0x800069ea, 0x80006aa8, 0x800236a3,
+ 0x80006adb, 0x80003c18, 0x80006b21, 0x800238a7,
+ 0x80006b54, 0x80003c4e, 0x80006b72, 0x80006b9f,
+ 0x80006bba, 0x80006bbb, 0x80023a8d, 0x80021d0b,
+ 0x80023afa, 0x80006c4e, 0x80023cbc, 0x80006cbf,
+ 0x80006ccd, 0x80006c67, 0x80006d16, 0x80006d3e,
+ 0x80006d77, 0x80006d41, 0x80006d69, 0x80006d78,
+ 0x80006d85, 0x80023d1e, 0x80006d34, 0x80006e2f,
+ 0x80006e6e, 0x80003d33, 0x80006ecb, 0x80006ec7,
+ 0x80023ed1, 0x80006df9, 0x80006f6e, 0x80023f5e,
+ 0x80023f8e, 0x80006fc6, 0x80007039, 0x8000701e,
+ 0x8000701b, 0x80003d96, 0x8000704a, 0x8000707d,
+ 0x80007077, 0x800070ad, 0x80020525, 0x80007145,
+ 0x80024263, 0x8000719c, 0x800043ab, 0x80007228,
+ 0x80007235, 0x80007250, 0x80024608, 0x80007280,
+ 0x80007295, 0x80024735, 0x80024814, 0x8000737a,
+ 0x8000738b, 0x80003eac, 0x800073a5, 0x80003eb8,
+ 0x80003eb8, 0x80007447, 0x8000745c, 0x80007471,
+ 0x80007485, 0x800074ca, 0x80003f1b, 0x80007524,
+ 0x80024c36, 0x8000753e, 0x80024c92, 0x80007570,
+ 0x8002219f, 0x80007610, 0x80024fa1, 0x80024fb8,
+ 0x80025044, 0x80003ffc, 0x80004008, 0x800076f4,
+ 0x800250f3, 0x800250f2, 0x80025119, 0x80025133,
+ 0x8000771e, 0x8000771f, 0x8000771f, 0x8000774a,
+ 0x80004039, 0x8000778b, 0x80004046, 0x80004096,
+ 0x8002541d, 0x8000784e, 0x8000788c, 0x800078cc,
+ 0x800040e3, 0x80025626, 0x80007956, 0x8002569a,
+ 0x800256c5, 0x8000798f, 0x800079eb, 0x8000412f,
+ 0x80007a40, 0x80007a4a, 0x80007a4f, 0x8002597c,
+ 0x80025aa7, 0x80025aa7, 0x80007aae, 0x80004202,
+ 0x80025bab, 0x80007bc6, 0x80007bc9, 0x80004227,
+ 0x80025c80, 0x80007cd2, 0x800042a0, 0x80007ce8,
+ 0x80007ce3, 0x80007d00, 0x80025f86, 0x80007d63,
+ 0x80004301, 0x80007dc7, 0x80007e02, 0x80007e45,
+ 0x80004334, 0x80026228, 0x80026247, 0x80004359,
+ 0x800262d9, 0x80007f7a, 0x8002633e, 0x80007f95,
+ 0x80007ffa, 0x80008005, 0x800264da, 0x80026523,
+ 0x80008060, 0x800265a8, 0x80008070, 0x8002335f,
+ 0x800043d5, 0x800080b2, 0x80008103, 0x8000440b,
+ 0x8000813e, 0x80005ab5, 0x800267a7, 0x800267b5,
+ 0x80023393, 0x8002339c, 0x80008201, 0x80008204,
+ 0x80008f9e, 0x8000446b, 0x80008291, 0x8000828b,
+ 0x8000829d, 0x800052b3, 0x800082b1, 0x800082b3,
+ 0x800082bd, 0x800082e6, 0x80026b3c, 0x800082e5,
+ 0x8000831d, 0x80008363, 0x800083ad, 0x80008323,
+ 0x800083bd, 0x800083e7, 0x80008457, 0x80008353,
+ 0x800083ca, 0x800083cc, 0x800083dc, 0x80026c36,
+ 0x80026d6b, 0x80026cd5, 0x8000452b, 0x800084f1,
+ 0x800084f3, 0x80008516, 0x800273ca, 0x80008564,
+ 0x80026f2c, 0x8000455d, 0x80004561, 0x80026fb1,
+ 0x800270d2, 0x8000456b, 0x80008650, 0x8000865c,
+ 0x80008667, 0x80008669, 0x800086a9, 0x80008688,
+ 0x8000870e, 0x800086e2, 0x80008779, 0x80008728,
+ 0x8000876b, 0x80008786, 0x80004d57, 0x800087e1,
+ 0x80008801, 0x800045f9, 0x80008860, 0x80008863,
+ 0x80027667, 0x800088d7, 0x800088de, 0x80004635,
+ 0x800088fa, 0x800034bb, 0x800278ae, 0x80027966,
+ 0x800046be, 0x800046c7, 0x80008aa0, 0x80008aed,
+ 0x80008b8a, 0x80008c55, 0x80027ca8, 0x80008cab,
+ 0x80008cc1, 0x80008d1b, 0x80008d77, 0x80027f2f,
+ 0x80020804, 0x80008dcb, 0x80008dbc, 0x80008df0,
+ 0x800208de, 0x80008ed4, 0x80008f38, 0x800285d2,
+ 0x800285ed, 0x80009094, 0x800090f1, 0x80009111,
+ 0x8002872e, 0x8000911b, 0x80009238, 0x800092d7,
+ 0x800092d8, 0x8000927c, 0x800093f9, 0x80009415,
+ 0x80028bfa, 0x8000958b, 0x80004995, 0x800095b7,
+ 0x80028d77, 0x800049e6, 0x800096c3, 0x80005db2,
+ 0x80009723, 0x80029145, 0x8002921a, 0x80004a6e,
+ 0x80004a76, 0x800097e0, 0x8002940a, 0x80004ab2,
+ 0x80029496, 0x8000980b, 0x8000980b, 0x80009829,
+ 0x800295b6, 0x800098e2, 0x80004b33, 0x80009929,
+ 0x800099a7, 0x800099c2, 0x800099fe, 0x80004bce,
+ 0x80029b30, 0x80009b12, 0x80009c40, 0x80009cfd,
+ 0x80004cce, 0x80004ced, 0x80009d67, 0x8002a0ce,
+ 0x80004cf8, 0x8002a105, 0x8002a20e, 0x8002a291,
+ 0x80009ebb, 0x80004d56, 0x80009ef9, 0x80009efe,
+ 0x80009f05, 0x80009f0f, 0x80009f16, 0x80009f3b,
+ 0x8002a600,
+};
+
+
+/*
+ * Lowercase <-> Uppercase mapping
+ */
+
+/*
+ * Flags for special case mapping.
+ */
+#define CMF_FINAL 1
+#define CMF_NONFINAL 2
+#define CMF_LAST 16
+#define CMF_CTXDEP (CMF_FINAL|CMF_NONFINAL)
+
+#define CASEMAP_BITS_0 9
+#define CASEMAP_BITS_1 7
+#define CASEMAP_BITS_2 5
+
+static const unsigned short v320_toupper_imap[] = {
+ 272, 400, 528, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 784,
+ 912, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 0, 0, 0, 1, 0, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12,
+ 13, 14, 15, 16, 17, 0, 0, 0,
+ 0, 0, 18, 0, 19, 20, 21, 22,
+ 0, 23, 24, 25, 26, 27, 28, 29,
+ 30, 0, 0, 31, 32, 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, 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, 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, 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, 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, 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, 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, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 33, 34, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 49, 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, 50, 51,
+ 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, 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, 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, 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,
+ 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, 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, 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, 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,
+ 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, 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, 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, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 52, 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, 0, 0, 0, 0, 0,
+ 0, 0, 53, 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, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 54, 55, 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, 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, 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, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+static const struct {
+ unsigned short tbl[32];
+} v320_toupper_table[] = {
+ {{
+ 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, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19,
+ 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41,
+ 43, 45, 47, 49, 51, 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, 53,
+ 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, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 55,
+ }},
+ {{
+ 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
+ 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100,
+ 102, 0, 104, 106, 108, 110, 112, 114, 116, 118,
+ }},
+ {{
+ 0, 120, 0, 122, 0, 124, 0, 126, 0, 128, 0,
+ 130, 0, 132, 0, 134, 0, 136, 0, 138, 0, 140,
+ 0, 142, 0, 144, 0, 146, 0, 148, 0, 150,
+ }},
+ {{
+ 0, 152, 0, 154, 0, 156, 0, 158, 0, 160, 0,
+ 162, 0, 164, 0, 166, 0, 168, 0, 170, 0, 172,
+ 0, 174, 0, 0, 176, 0, 178, 0, 180, 0,
+ }},
+ {{
+ 182, 0, 184, 0, 186, 0, 188, 0, 190, 192, 0,
+ 195, 0, 197, 0, 199, 0, 201, 0, 203, 0, 205,
+ 0, 207, 0, 209, 0, 211, 0, 213, 0, 215,
+ }},
+ {{
+ 0, 217, 0, 219, 0, 221, 0, 223, 0, 225, 0,
+ 227, 0, 229, 0, 231, 0, 233, 0, 235, 0, 237,
+ 0, 239, 0, 0, 241, 0, 243, 0, 245, 247,
+ }},
+ {{
+ 0, 0, 0, 249, 0, 251, 0, 0, 253, 0, 0,
+ 0, 255, 0, 0, 0, 0, 0, 257, 0, 0, 259,
+ 0, 0, 0, 261, 0, 0, 0, 0, 263, 0,
+ }},
+ {{
+ 0, 265, 0, 267, 0, 269, 0, 0, 271, 0, 0,
+ 0, 0, 273, 0, 0, 275, 0, 0, 0, 277, 0,
+ 279, 0, 0, 281, 0, 0, 0, 283, 0, 285,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 287, 289, 0, 291, 293, 0,
+ 295, 297, 0, 299, 0, 301, 0, 303, 0, 305, 0,
+ 307, 0, 309, 0, 311, 0, 313, 315, 0, 317,
+ }},
+ {{
+ 0, 319, 0, 321, 0, 323, 0, 325, 0, 327, 0,
+ 329, 0, 331, 0, 333, 335, 0, 338, 340, 0, 342,
+ 0, 0, 0, 344, 0, 346, 0, 348, 0, 350,
+ }},
+ {{
+ 0, 352, 0, 354, 0, 356, 0, 358, 0, 360, 0,
+ 362, 0, 364, 0, 366, 0, 368, 0, 370, 0, 372,
+ 0, 374, 0, 376, 0, 378, 0, 380, 0, 382,
+ }},
+ {{
+ 0, 0, 0, 384, 0, 386, 0, 388, 0, 390, 0,
+ 392, 0, 394, 0, 396, 0, 398, 0, 400, 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, 0, 0, 0, 0, 0, 402, 404, 0,
+ 406, 408, 0, 410, 0, 412, 0, 0, 0, 0,
+ }},
+ {{
+ 414, 0, 0, 416, 0, 0, 0, 0, 418, 420, 0,
+ 0, 0, 0, 0, 422, 0, 0, 424, 0, 0, 426,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 428, 0, 0, 430, 0, 0, 0, 0, 432, 0, 434,
+ 436, 0, 0, 0, 0, 0, 0, 438, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 440, 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,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 442, 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,
+ 0, 446, 448, 450, 452, 454, 458, 460, 462, 464, 466,
+ 468, 470, 472, 474, 476, 478, 480, 482, 484, 486,
+ }},
+ {{
+ 488, 490, 492, 494, 496, 498, 500, 502, 504, 506, 508,
+ 510, 512, 514, 516, 0, 518, 520, 0, 0, 0, 522,
+ 524, 0, 0, 526, 0, 528, 0, 530, 0, 532,
+ }},
+ {{
+ 0, 534, 0, 536, 0, 538, 0, 540, 0, 542, 0,
+ 544, 0, 546, 0, 548, 550, 552, 554, 0, 0, 556,
+ 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, 558, 560, 562, 564, 566, 568,
+ 570, 572, 574, 576, 578, 580, 582, 584, 586, 588,
+ }},
+ {{
+ 590, 592, 594, 596, 598, 600, 602, 604, 606, 608, 610,
+ 612, 614, 616, 618, 620, 622, 624, 626, 628, 630, 632,
+ 634, 636, 638, 640, 642, 644, 646, 648, 650, 652,
+ }},
+ {{
+ 0, 654, 0, 656, 0, 658, 0, 660, 0, 662, 0,
+ 664, 0, 666, 0, 668, 0, 670, 0, 672, 0, 674,
+ 0, 676, 0, 678, 0, 680, 0, 682, 0, 684,
+ }},
+ {{
+ 0, 686, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 688, 0, 690, 0, 692, 0, 694, 0, 696, 0, 698,
+ 0, 700, 0, 702, 0, 704, 0, 706, 0, 708,
+ }},
+ {{
+ 0, 710, 0, 712, 0, 714, 0, 716, 0, 718, 0,
+ 720, 0, 722, 0, 724, 0, 726, 0, 728, 0, 730,
+ 0, 732, 0, 734, 0, 736, 0, 738, 0, 740,
+ }},
+ {{
+ 0, 0, 742, 0, 744, 0, 746, 0, 748, 0, 750,
+ 0, 752, 0, 754, 0, 0, 756, 0, 758, 0, 760,
+ 0, 762, 0, 764, 0, 766, 0, 768, 0, 770,
+ }},
+ {{
+ 0, 772, 0, 774, 0, 776, 0, 778, 0, 780, 0,
+ 782, 0, 784, 0, 786, 0, 788, 0, 790, 0, 792,
+ 0, 0, 0, 794, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 796, 0, 798, 0, 800, 0, 802, 0, 804, 0,
+ 806, 0, 808, 0, 810, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 812, 814, 816, 818, 820, 822, 824, 826, 828, 830,
+ 832, 834, 836, 838, 840, 842, 844, 846, 848, 850, 852,
+ 854, 856, 858, 860, 862, 864, 866, 868, 870, 872,
+ }},
+ {{
+ 874, 876, 878, 880, 882, 884, 886, 888, 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, 891, 0, 893, 0, 895, 0, 897, 0, 899, 0,
+ 901, 0, 903, 0, 905, 0, 907, 0, 909, 0, 911,
+ 0, 913, 0, 915, 0, 917, 0, 919, 0, 921,
+ }},
+ {{
+ 0, 923, 0, 925, 0, 927, 0, 929, 0, 931, 0,
+ 933, 0, 935, 0, 937, 0, 939, 0, 941, 0, 943,
+ 0, 945, 0, 947, 0, 949, 0, 951, 0, 953,
+ }},
+ {{
+ 0, 955, 0, 957, 0, 959, 0, 961, 0, 963, 0,
+ 965, 0, 967, 0, 969, 0, 971, 0, 973, 0, 975,
+ 0, 977, 0, 979, 0, 981, 0, 983, 0, 985,
+ }},
+ {{
+ 0, 987, 0, 989, 0, 991, 0, 993, 0, 995, 0,
+ 997, 0, 999, 0, 1001, 0, 1003, 0, 1005, 0, 1007,
+ 0, 1009, 0, 1011, 0, 1013, 0, 1015, 0, 1017,
+ }},
+ {{
+ 0, 1019, 0, 1021, 0, 1023, 0, 1025, 0, 1027, 0,
+ 1029, 0, 1031, 0, 1033, 0, 1035, 0, 1037, 0, 1039,
+ 1041, 1044, 1047, 1050, 1053, 1056, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 1058, 0, 1060, 0, 1062, 0, 1064, 0, 1066, 0,
+ 1068, 0, 1070, 0, 1072, 0, 1074, 0, 1076, 0, 1078,
+ 0, 1080, 0, 1082, 0, 1084, 0, 1086, 0, 1088,
+ }},
+ {{
+ 0, 1090, 0, 1092, 0, 1094, 0, 1096, 0, 1098, 0,
+ 1100, 0, 1102, 0, 1104, 0, 1106, 0, 1108, 0, 1110,
+ 0, 1112, 0, 1114, 0, 1116, 0, 1118, 0, 1120,
+ }},
+ {{
+ 0, 1122, 0, 1124, 0, 1126, 0, 1128, 0, 1130, 0,
+ 1132, 0, 1134, 0, 1136, 0, 1138, 0, 1140, 0, 1142,
+ 0, 1144, 0, 1146, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1148, 1150, 1152, 1154, 1156, 1158, 1160, 1162, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1164, 1166, 1168, 1170, 1172, 1174,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1176, 1178, 1180, 1182, 1184, 1186, 1188, 1190, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1192, 1194, 1196, 1198, 1200, 1202,
+ 1204, 1206, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1208, 1210, 1212, 1214, 1216, 1218, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1220, 1223, 1225, 1229, 1231, 1235,
+ 1237, 1241, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1243, 1245, 1247, 1249, 1251, 1253, 1255, 1257, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1259, 1261, 1263, 1265, 1267, 1269,
+ 1271, 1273, 1275, 1277, 1279, 1281, 1283, 1285, 0, 0,
+ }},
+ {{
+ 1287, 1292, 1297, 1302, 1307, 1312, 1317, 1322, 1327, 1330, 1333,
+ 1336, 1339, 1342, 1345, 1348, 1351, 1356, 1361, 1366, 1371, 1376,
+ 1381, 1386, 1391, 1394, 1397, 1400, 1403, 1406, 1409, 1412,
+ }},
+ {{
+ 1415, 1420, 1425, 1430, 1435, 1440, 1445, 1450, 1455, 1458, 1461,
+ 1464, 1467, 1470, 1473, 1476, 1479, 1481, 1483, 1486, 1491, 0,
+ 1494, 1497, 0, 0, 0, 0, 1501, 0, 1504, 0,
+ }},
+ {{
+ 0, 0, 1506, 1509, 1514, 0, 1517, 1520, 0, 0, 0,
+ 0, 1524, 0, 0, 0, 1527, 1529, 1531, 1535, 0, 0,
+ 1539, 1542, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1546, 1548, 1550, 1554, 1558, 1561, 1563, 1566, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1570, 1573, 1578, 0,
+ 1581, 1584, 0, 0, 0, 0, 1588, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1591, 1593, 1595, 1597, 1599, 1601,
+ 1603, 1605, 1607, 1609, 1611, 1613, 1615, 1617, 1619, 1621,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1623, 1625, 1627, 1629, 1631, 1633,
+ 1635, 1637, 1639, 1641, 1643, 1645, 1647, 1649, 1651, 1653,
+ }},
+ {{
+ 1655, 1657, 1659, 1661, 1663, 1665, 1667, 1669, 1671, 1673, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1675, 1678, 1681, 1684, 1688, 1692, 1695, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1698, 1701, 1704,
+ 1707, 1710, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 1713, 1715, 1717, 1719, 1721, 1723, 1725, 1727, 1729, 1731,
+ 1733, 1735, 1737, 1739, 1741, 1743, 1745, 1747, 1749, 1751, 1753,
+ 1755, 1757, 1759, 1761, 1763, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 1765, 1767, 1769,
+ 1771, 1773, 1775, 1777, 1779, 1781, 1783, 1785, 1787, 1789, 1791,
+ 1793, 1795, 1797, 1799, 1801, 1803, 1805, 1807, 1809, 1811,
+ }},
+ {{
+ 1813, 1815, 1817, 1819, 1821, 1823, 1825, 1827, 1829, 1831, 1833,
+ 1835, 1837, 1839, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+};
+static const unsigned short v320_tolower_imap[] = {
+ 272, 400, 528, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 784,
+ 912, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 0, 0, 1, 0, 0, 0, 2, 0,
+ 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 13, 14, 15, 16,
+ 17, 18, 0, 19, 20, 21, 22, 23,
+ 24, 25, 26, 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, 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, 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, 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, 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, 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, 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, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 40, 41, 42,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 43, 0, 44, 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, 45, 46, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 47, 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, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 48, 49, 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, 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, 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,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+static const struct {
+ unsigned short tbl[32];
+} v320_tolower_table[] = {
+ {{
+ 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, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19,
+ 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41,
+ 43, 45, 47, 49, 51, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73,
+ 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95,
+ 97, 0, 99, 101, 103, 105, 107, 109, 111, 0,
+ }},
+ {{
+ 113, 0, 115, 0, 117, 0, 119, 0, 121, 0, 123,
+ 0, 125, 0, 127, 0, 129, 0, 131, 0, 133, 0,
+ 135, 0, 137, 0, 139, 0, 141, 0, 143, 0,
+ }},
+ {{
+ 145, 0, 147, 0, 149, 0, 151, 0, 153, 0, 155,
+ 0, 157, 0, 159, 0, 161, 0, 165, 0, 167, 0,
+ 169, 0, 0, 171, 0, 173, 0, 175, 0, 177,
+ }},
+ {{
+ 0, 179, 0, 181, 0, 183, 0, 185, 0, 0, 187,
+ 0, 189, 0, 191, 0, 193, 0, 195, 0, 197, 0,
+ 199, 0, 201, 0, 203, 0, 205, 0, 207, 0,
+ }},
+ {{
+ 209, 0, 211, 0, 213, 0, 215, 0, 217, 0, 219,
+ 0, 221, 0, 223, 0, 225, 0, 227, 0, 229, 0,
+ 231, 0, 233, 235, 0, 237, 0, 239, 0, 0,
+ }},
+ {{
+ 0, 241, 243, 0, 245, 0, 247, 249, 0, 251, 253,
+ 255, 0, 0, 257, 259, 261, 263, 0, 265, 267, 0,
+ 269, 271, 273, 0, 0, 0, 275, 277, 0, 279,
+ }},
+ {{
+ 281, 0, 283, 0, 285, 0, 287, 289, 0, 291, 0,
+ 0, 293, 0, 295, 297, 0, 299, 301, 303, 0, 305,
+ 0, 307, 309, 0, 0, 0, 311, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 313, 315, 0, 317, 319, 0, 321,
+ 323, 0, 325, 0, 327, 0, 329, 0, 331, 0, 333,
+ 0, 335, 0, 337, 0, 339, 0, 0, 341, 0,
+ }},
+ {{
+ 343, 0, 345, 0, 347, 0, 349, 0, 351, 0, 353,
+ 0, 355, 0, 357, 0, 0, 359, 361, 0, 363, 0,
+ 365, 367, 369, 0, 371, 0, 373, 0, 375, 0,
+ }},
+ {{
+ 377, 0, 379, 0, 381, 0, 383, 0, 385, 0, 387,
+ 0, 389, 0, 391, 0, 393, 0, 395, 0, 397, 0,
+ 399, 0, 401, 0, 403, 0, 405, 0, 407, 0,
+ }},
+ {{
+ 409, 0, 411, 0, 413, 0, 415, 0, 417, 0, 419,
+ 0, 421, 0, 423, 0, 425, 0, 427, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 429, 0, 431, 433, 435,
+ 0, 437, 0, 439, 441, 0, 443, 445, 447, 449, 451,
+ 453, 455, 457, 459, 461, 463, 465, 467, 469, 471,
+ }},
+ {{
+ 473, 475, 0, 477, 479, 481, 483, 485, 487, 489, 491,
+ 493, 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, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 495, 0, 497, 0, 499, 0, 501, 0,
+ }},
+ {{
+ 503, 0, 505, 0, 507, 0, 509, 0, 511, 0, 513,
+ 0, 515, 0, 517, 0, 0, 0, 0, 0, 519, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 521, 523, 525, 527, 529, 531, 533, 535, 537, 539, 541,
+ 543, 545, 547, 549, 551, 553, 555, 557, 559, 561, 563,
+ 565, 567, 569, 571, 573, 575, 577, 579, 581, 583,
+ }},
+ {{
+ 585, 587, 589, 591, 593, 595, 597, 599, 601, 603, 605,
+ 607, 609, 611, 613, 615, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 617, 0, 619, 0, 621, 0, 623, 0, 625, 0, 627,
+ 0, 629, 0, 631, 0, 633, 0, 635, 0, 637, 0,
+ 639, 0, 641, 0, 643, 0, 645, 0, 647, 0,
+ }},
+ {{
+ 649, 0, 0, 0, 0, 0, 0, 0, 0, 0, 651,
+ 0, 653, 0, 655, 0, 657, 0, 659, 0, 661, 0,
+ 663, 0, 665, 0, 667, 0, 669, 0, 671, 0,
+ }},
+ {{
+ 673, 0, 675, 0, 677, 0, 679, 0, 681, 0, 683,
+ 0, 685, 0, 687, 0, 689, 0, 691, 0, 693, 0,
+ 695, 0, 697, 0, 699, 0, 701, 0, 703, 0,
+ }},
+ {{
+ 0, 705, 0, 707, 0, 709, 0, 711, 0, 713, 0,
+ 715, 0, 717, 0, 0, 719, 0, 721, 0, 723, 0,
+ 725, 0, 727, 0, 729, 0, 731, 0, 733, 0,
+ }},
+ {{
+ 735, 0, 737, 0, 739, 0, 741, 0, 743, 0, 745,
+ 0, 747, 0, 749, 0, 751, 0, 753, 0, 755, 0,
+ 0, 0, 757, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 759, 0, 761, 0, 763, 0, 765, 0, 767, 0, 769,
+ 0, 771, 0, 773, 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, 0, 0,
+ 0, 0, 0, 0, 0, 0, 775, 777, 779, 781, 783,
+ 785, 787, 789, 791, 793, 795, 797, 799, 801, 803,
+ }},
+ {{
+ 805, 807, 809, 811, 813, 815, 817, 819, 821, 823, 825,
+ 827, 829, 831, 833, 835, 837, 839, 841, 843, 845, 847,
+ 849, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 851, 0, 853, 0, 855, 0, 857, 0, 859, 0, 861,
+ 0, 863, 0, 865, 0, 867, 0, 869, 0, 871, 0,
+ 873, 0, 875, 0, 877, 0, 879, 0, 881, 0,
+ }},
+ {{
+ 883, 0, 885, 0, 887, 0, 889, 0, 891, 0, 893,
+ 0, 895, 0, 897, 0, 899, 0, 901, 0, 903, 0,
+ 905, 0, 907, 0, 909, 0, 911, 0, 913, 0,
+ }},
+ {{
+ 915, 0, 917, 0, 919, 0, 921, 0, 923, 0, 925,
+ 0, 927, 0, 929, 0, 931, 0, 933, 0, 935, 0,
+ 937, 0, 939, 0, 941, 0, 943, 0, 945, 0,
+ }},
+ {{
+ 947, 0, 949, 0, 951, 0, 953, 0, 955, 0, 957,
+ 0, 959, 0, 961, 0, 963, 0, 965, 0, 967, 0,
+ 969, 0, 971, 0, 973, 0, 975, 0, 977, 0,
+ }},
+ {{
+ 979, 0, 981, 0, 983, 0, 985, 0, 987, 0, 989,
+ 0, 991, 0, 993, 0, 995, 0, 997, 0, 999, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1001, 0, 1003, 0, 1005, 0, 1007, 0, 1009, 0, 1011,
+ 0, 1013, 0, 1015, 0, 1017, 0, 1019, 0, 1021, 0,
+ 1023, 0, 1025, 0, 1027, 0, 1029, 0, 1031, 0,
+ }},
+ {{
+ 1033, 0, 1035, 0, 1037, 0, 1039, 0, 1041, 0, 1043,
+ 0, 1045, 0, 1047, 0, 1049, 0, 1051, 0, 1053, 0,
+ 1055, 0, 1057, 0, 1059, 0, 1061, 0, 1063, 0,
+ }},
+ {{
+ 1065, 0, 1067, 0, 1069, 0, 1071, 0, 1073, 0, 1075,
+ 0, 1077, 0, 1079, 0, 1081, 0, 1083, 0, 1085, 0,
+ 1087, 0, 1089, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 1091, 1093, 1095,
+ 1097, 1099, 1101, 1103, 1105, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1107, 1109, 1111, 1113, 1115, 1117, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 1119, 1121, 1123,
+ 1125, 1127, 1129, 1131, 1133, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1135, 1137, 1139, 1141, 1143, 1145, 1147, 1149,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 1151, 1153, 1155,
+ 1157, 1159, 1161, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1163, 0, 1165, 0, 1167, 0, 1169,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 1171, 1173, 1175,
+ 1177, 1179, 1181, 1183, 1185, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 1187, 1191, 1195,
+ 1199, 1203, 1207, 1211, 1215, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1219, 1223, 1227, 1231, 1235, 1239, 1243, 1247,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 1251, 1255, 1259,
+ 1263, 1267, 1271, 1275, 1279, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1283, 1285, 1287, 1289, 1291, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 1295, 1297, 1299,
+ 1301, 1303, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1307, 1309, 1311, 1313, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 1315, 1317, 1319,
+ 1321, 1323, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1325, 1327, 1329, 1331, 1333, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 1337, 0, 0, 0, 1339,
+ 1341, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1343, 1345, 1347, 1349, 1351, 1353, 1355, 1357, 1359, 1361, 1363,
+ 1365, 1367, 1369, 1371, 1373, 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, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1375, 1377, 1379, 1381, 1383, 1385, 1387, 1389, 1391, 1393,
+ }},
+ {{
+ 1395, 1397, 1399, 1401, 1403, 1405, 1407, 1409, 1411, 1413, 1415,
+ 1417, 1419, 1421, 1423, 1425, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 1427, 1429, 1431, 1433, 1435, 1437, 1439, 1441, 1443, 1445,
+ 1447, 1449, 1451, 1453, 1455, 1457, 1459, 1461, 1463, 1465, 1467,
+ 1469, 1471, 1473, 1475, 1477, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1479, 1481, 1483, 1485, 1487, 1489, 1491, 1493, 1495, 1497, 1499,
+ 1501, 1503, 1505, 1507, 1509, 1511, 1513, 1515, 1517, 1519, 1521,
+ 1523, 1525, 1527, 1529, 1531, 1533, 1535, 1537, 1539, 1541,
+ }},
+ {{
+ 1543, 1545, 1547, 1549, 1551, 1553, 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,
+ }},
+};
+static const unsigned long v320_toupper_seq[] = {
+ 0x00000000, 0x00000010, 0x80000041, 0x00000010,
+ 0x80000042, 0x00000010, 0x80000043, 0x00000010,
+ 0x80000044, 0x00000010, 0x80000045, 0x00000010,
+ 0x80000046, 0x00000010, 0x80000047, 0x00000010,
+ 0x80000048, 0x00000010, 0x80000049, 0x00000010,
+ 0x8000004a, 0x00000010, 0x8000004b, 0x00000010,
+ 0x8000004c, 0x00000010, 0x8000004d, 0x00000010,
+ 0x8000004e, 0x00000010, 0x8000004f, 0x00000010,
+ 0x80000050, 0x00000010, 0x80000051, 0x00000010,
+ 0x80000052, 0x00000010, 0x80000053, 0x00000010,
+ 0x80000054, 0x00000010, 0x80000055, 0x00000010,
+ 0x80000056, 0x00000010, 0x80000057, 0x00000010,
+ 0x80000058, 0x00000010, 0x80000059, 0x00000010,
+ 0x8000005a, 0x00000010, 0x8000039c, 0x00000010,
+ 0x00000053, 0x80000053, 0x00000010, 0x800000c0,
+ 0x00000010, 0x800000c1, 0x00000010, 0x800000c2,
+ 0x00000010, 0x800000c3, 0x00000010, 0x800000c4,
+ 0x00000010, 0x800000c5, 0x00000010, 0x800000c6,
+ 0x00000010, 0x800000c7, 0x00000010, 0x800000c8,
+ 0x00000010, 0x800000c9, 0x00000010, 0x800000ca,
+ 0x00000010, 0x800000cb, 0x00000010, 0x800000cc,
+ 0x00000010, 0x800000cd, 0x00000010, 0x800000ce,
+ 0x00000010, 0x800000cf, 0x00000010, 0x800000d0,
+ 0x00000010, 0x800000d1, 0x00000010, 0x800000d2,
+ 0x00000010, 0x800000d3, 0x00000010, 0x800000d4,
+ 0x00000010, 0x800000d5, 0x00000010, 0x800000d6,
+ 0x00000010, 0x800000d8, 0x00000010, 0x800000d9,
+ 0x00000010, 0x800000da, 0x00000010, 0x800000db,
+ 0x00000010, 0x800000dc, 0x00000010, 0x800000dd,
+ 0x00000010, 0x800000de, 0x00000010, 0x80000178,
+ 0x00000010, 0x80000100, 0x00000010, 0x80000102,
+ 0x00000010, 0x80000104, 0x00000010, 0x80000106,
+ 0x00000010, 0x80000108, 0x00000010, 0x8000010a,
+ 0x00000010, 0x8000010c, 0x00000010, 0x8000010e,
+ 0x00000010, 0x80000110, 0x00000010, 0x80000112,
+ 0x00000010, 0x80000114, 0x00000010, 0x80000116,
+ 0x00000010, 0x80000118, 0x00000010, 0x8000011a,
+ 0x00000010, 0x8000011c, 0x00000010, 0x8000011e,
+ 0x00000010, 0x80000120, 0x00000010, 0x80000122,
+ 0x00000010, 0x80000124, 0x00000010, 0x80000126,
+ 0x00000010, 0x80000128, 0x00000010, 0x8000012a,
+ 0x00000010, 0x8000012c, 0x00000010, 0x8000012e,
+ 0x00000010, 0x80000049, 0x00000010, 0x80000132,
+ 0x00000010, 0x80000134, 0x00000010, 0x80000136,
+ 0x00000010, 0x80000139, 0x00000010, 0x8000013b,
+ 0x00000010, 0x8000013d, 0x00000010, 0x8000013f,
+ 0x00000010, 0x80000141, 0x00000010, 0x80000143,
+ 0x00000010, 0x80000145, 0x00000010, 0x80000147,
+ 0x00000010, 0x000002bc, 0x8000004e, 0x00000010,
+ 0x8000014a, 0x00000010, 0x8000014c, 0x00000010,
+ 0x8000014e, 0x00000010, 0x80000150, 0x00000010,
+ 0x80000152, 0x00000010, 0x80000154, 0x00000010,
+ 0x80000156, 0x00000010, 0x80000158, 0x00000010,
+ 0x8000015a, 0x00000010, 0x8000015c, 0x00000010,
+ 0x8000015e, 0x00000010, 0x80000160, 0x00000010,
+ 0x80000162, 0x00000010, 0x80000164, 0x00000010,
+ 0x80000166, 0x00000010, 0x80000168, 0x00000010,
+ 0x8000016a, 0x00000010, 0x8000016c, 0x00000010,
+ 0x8000016e, 0x00000010, 0x80000170, 0x00000010,
+ 0x80000172, 0x00000010, 0x80000174, 0x00000010,
+ 0x80000176, 0x00000010, 0x80000179, 0x00000010,
+ 0x8000017b, 0x00000010, 0x8000017d, 0x00000010,
+ 0x80000053, 0x00000010, 0x80000182, 0x00000010,
+ 0x80000184, 0x00000010, 0x80000187, 0x00000010,
+ 0x8000018b, 0x00000010, 0x80000191, 0x00000010,
+ 0x800001f6, 0x00000010, 0x80000198, 0x00000010,
+ 0x80000220, 0x00000010, 0x800001a0, 0x00000010,
+ 0x800001a2, 0x00000010, 0x800001a4, 0x00000010,
+ 0x800001a7, 0x00000010, 0x800001ac, 0x00000010,
+ 0x800001af, 0x00000010, 0x800001b3, 0x00000010,
+ 0x800001b5, 0x00000010, 0x800001b8, 0x00000010,
+ 0x800001bc, 0x00000010, 0x800001f7, 0x00000010,
+ 0x800001c4, 0x00000010, 0x800001c4, 0x00000010,
+ 0x800001c7, 0x00000010, 0x800001c7, 0x00000010,
+ 0x800001ca, 0x00000010, 0x800001ca, 0x00000010,
+ 0x800001cd, 0x00000010, 0x800001cf, 0x00000010,
+ 0x800001d1, 0x00000010, 0x800001d3, 0x00000010,
+ 0x800001d5, 0x00000010, 0x800001d7, 0x00000010,
+ 0x800001d9, 0x00000010, 0x800001db, 0x00000010,
+ 0x8000018e, 0x00000010, 0x800001de, 0x00000010,
+ 0x800001e0, 0x00000010, 0x800001e2, 0x00000010,
+ 0x800001e4, 0x00000010, 0x800001e6, 0x00000010,
+ 0x800001e8, 0x00000010, 0x800001ea, 0x00000010,
+ 0x800001ec, 0x00000010, 0x800001ee, 0x00000010,
+ 0x0000004a, 0x8000030c, 0x00000010, 0x800001f1,
+ 0x00000010, 0x800001f1, 0x00000010, 0x800001f4,
+ 0x00000010, 0x800001f8, 0x00000010, 0x800001fa,
+ 0x00000010, 0x800001fc, 0x00000010, 0x800001fe,
+ 0x00000010, 0x80000200, 0x00000010, 0x80000202,
+ 0x00000010, 0x80000204, 0x00000010, 0x80000206,
+ 0x00000010, 0x80000208, 0x00000010, 0x8000020a,
+ 0x00000010, 0x8000020c, 0x00000010, 0x8000020e,
+ 0x00000010, 0x80000210, 0x00000010, 0x80000212,
+ 0x00000010, 0x80000214, 0x00000010, 0x80000216,
+ 0x00000010, 0x80000218, 0x00000010, 0x8000021a,
+ 0x00000010, 0x8000021c, 0x00000010, 0x8000021e,
+ 0x00000010, 0x80000222, 0x00000010, 0x80000224,
+ 0x00000010, 0x80000226, 0x00000010, 0x80000228,
+ 0x00000010, 0x8000022a, 0x00000010, 0x8000022c,
+ 0x00000010, 0x8000022e, 0x00000010, 0x80000230,
+ 0x00000010, 0x80000232, 0x00000010, 0x80000181,
+ 0x00000010, 0x80000186, 0x00000010, 0x80000189,
+ 0x00000010, 0x8000018a, 0x00000010, 0x8000018f,
+ 0x00000010, 0x80000190, 0x00000010, 0x80000193,
+ 0x00000010, 0x80000194, 0x00000010, 0x80000197,
+ 0x00000010, 0x80000196, 0x00000010, 0x8000019c,
+ 0x00000010, 0x8000019d, 0x00000010, 0x8000019f,
+ 0x00000010, 0x800001a6, 0x00000010, 0x800001a9,
+ 0x00000010, 0x800001ae, 0x00000010, 0x800001b1,
+ 0x00000010, 0x800001b2, 0x00000010, 0x800001b7,
+ 0x00000010, 0x80000399, 0x00000010, 0x00000399,
+ 0x00000308, 0x80000301, 0x00000010, 0x80000386,
+ 0x00000010, 0x80000388, 0x00000010, 0x80000389,
+ 0x00000010, 0x8000038a, 0x00000010, 0x000003a5,
+ 0x00000308, 0x80000301, 0x00000010, 0x80000391,
+ 0x00000010, 0x80000392, 0x00000010, 0x80000393,
+ 0x00000010, 0x80000394, 0x00000010, 0x80000395,
+ 0x00000010, 0x80000396, 0x00000010, 0x80000397,
+ 0x00000010, 0x80000398, 0x00000010, 0x80000399,
+ 0x00000010, 0x8000039a, 0x00000010, 0x8000039b,
+ 0x00000010, 0x8000039c, 0x00000010, 0x8000039d,
+ 0x00000010, 0x8000039e, 0x00000010, 0x8000039f,
+ 0x00000010, 0x800003a0, 0x00000010, 0x800003a1,
+ 0x00000010, 0x800003a3, 0x00000010, 0x800003a3,
+ 0x00000010, 0x800003a4, 0x00000010, 0x800003a5,
+ 0x00000010, 0x800003a6, 0x00000010, 0x800003a7,
+ 0x00000010, 0x800003a8, 0x00000010, 0x800003a9,
+ 0x00000010, 0x800003aa, 0x00000010, 0x800003ab,
+ 0x00000010, 0x8000038c, 0x00000010, 0x8000038e,
+ 0x00000010, 0x8000038f, 0x00000010, 0x80000392,
+ 0x00000010, 0x80000398, 0x00000010, 0x800003a6,
+ 0x00000010, 0x800003a0, 0x00000010, 0x800003d8,
+ 0x00000010, 0x800003da, 0x00000010, 0x800003dc,
+ 0x00000010, 0x800003de, 0x00000010, 0x800003e0,
+ 0x00000010, 0x800003e2, 0x00000010, 0x800003e4,
+ 0x00000010, 0x800003e6, 0x00000010, 0x800003e8,
+ 0x00000010, 0x800003ea, 0x00000010, 0x800003ec,
+ 0x00000010, 0x800003ee, 0x00000010, 0x8000039a,
+ 0x00000010, 0x800003a1, 0x00000010, 0x800003a3,
+ 0x00000010, 0x80000395, 0x00000010, 0x80000410,
+ 0x00000010, 0x80000411, 0x00000010, 0x80000412,
+ 0x00000010, 0x80000413, 0x00000010, 0x80000414,
+ 0x00000010, 0x80000415, 0x00000010, 0x80000416,
+ 0x00000010, 0x80000417, 0x00000010, 0x80000418,
+ 0x00000010, 0x80000419, 0x00000010, 0x8000041a,
+ 0x00000010, 0x8000041b, 0x00000010, 0x8000041c,
+ 0x00000010, 0x8000041d, 0x00000010, 0x8000041e,
+ 0x00000010, 0x8000041f, 0x00000010, 0x80000420,
+ 0x00000010, 0x80000421, 0x00000010, 0x80000422,
+ 0x00000010, 0x80000423, 0x00000010, 0x80000424,
+ 0x00000010, 0x80000425, 0x00000010, 0x80000426,
+ 0x00000010, 0x80000427, 0x00000010, 0x80000428,
+ 0x00000010, 0x80000429, 0x00000010, 0x8000042a,
+ 0x00000010, 0x8000042b, 0x00000010, 0x8000042c,
+ 0x00000010, 0x8000042d, 0x00000010, 0x8000042e,
+ 0x00000010, 0x8000042f, 0x00000010, 0x80000400,
+ 0x00000010, 0x80000401, 0x00000010, 0x80000402,
+ 0x00000010, 0x80000403, 0x00000010, 0x80000404,
+ 0x00000010, 0x80000405, 0x00000010, 0x80000406,
+ 0x00000010, 0x80000407, 0x00000010, 0x80000408,
+ 0x00000010, 0x80000409, 0x00000010, 0x8000040a,
+ 0x00000010, 0x8000040b, 0x00000010, 0x8000040c,
+ 0x00000010, 0x8000040d, 0x00000010, 0x8000040e,
+ 0x00000010, 0x8000040f, 0x00000010, 0x80000460,
+ 0x00000010, 0x80000462, 0x00000010, 0x80000464,
+ 0x00000010, 0x80000466, 0x00000010, 0x80000468,
+ 0x00000010, 0x8000046a, 0x00000010, 0x8000046c,
+ 0x00000010, 0x8000046e, 0x00000010, 0x80000470,
+ 0x00000010, 0x80000472, 0x00000010, 0x80000474,
+ 0x00000010, 0x80000476, 0x00000010, 0x80000478,
+ 0x00000010, 0x8000047a, 0x00000010, 0x8000047c,
+ 0x00000010, 0x8000047e, 0x00000010, 0x80000480,
+ 0x00000010, 0x8000048a, 0x00000010, 0x8000048c,
+ 0x00000010, 0x8000048e, 0x00000010, 0x80000490,
+ 0x00000010, 0x80000492, 0x00000010, 0x80000494,
+ 0x00000010, 0x80000496, 0x00000010, 0x80000498,
+ 0x00000010, 0x8000049a, 0x00000010, 0x8000049c,
+ 0x00000010, 0x8000049e, 0x00000010, 0x800004a0,
+ 0x00000010, 0x800004a2, 0x00000010, 0x800004a4,
+ 0x00000010, 0x800004a6, 0x00000010, 0x800004a8,
+ 0x00000010, 0x800004aa, 0x00000010, 0x800004ac,
+ 0x00000010, 0x800004ae, 0x00000010, 0x800004b0,
+ 0x00000010, 0x800004b2, 0x00000010, 0x800004b4,
+ 0x00000010, 0x800004b6, 0x00000010, 0x800004b8,
+ 0x00000010, 0x800004ba, 0x00000010, 0x800004bc,
+ 0x00000010, 0x800004be, 0x00000010, 0x800004c1,
+ 0x00000010, 0x800004c3, 0x00000010, 0x800004c5,
+ 0x00000010, 0x800004c7, 0x00000010, 0x800004c9,
+ 0x00000010, 0x800004cb, 0x00000010, 0x800004cd,
+ 0x00000010, 0x800004d0, 0x00000010, 0x800004d2,
+ 0x00000010, 0x800004d4, 0x00000010, 0x800004d6,
+ 0x00000010, 0x800004d8, 0x00000010, 0x800004da,
+ 0x00000010, 0x800004dc, 0x00000010, 0x800004de,
+ 0x00000010, 0x800004e0, 0x00000010, 0x800004e2,
+ 0x00000010, 0x800004e4, 0x00000010, 0x800004e6,
+ 0x00000010, 0x800004e8, 0x00000010, 0x800004ea,
+ 0x00000010, 0x800004ec, 0x00000010, 0x800004ee,
+ 0x00000010, 0x800004f0, 0x00000010, 0x800004f2,
+ 0x00000010, 0x800004f4, 0x00000010, 0x800004f8,
+ 0x00000010, 0x80000500, 0x00000010, 0x80000502,
+ 0x00000010, 0x80000504, 0x00000010, 0x80000506,
+ 0x00000010, 0x80000508, 0x00000010, 0x8000050a,
+ 0x00000010, 0x8000050c, 0x00000010, 0x8000050e,
+ 0x00000010, 0x80000531, 0x00000010, 0x80000532,
+ 0x00000010, 0x80000533, 0x00000010, 0x80000534,
+ 0x00000010, 0x80000535, 0x00000010, 0x80000536,
+ 0x00000010, 0x80000537, 0x00000010, 0x80000538,
+ 0x00000010, 0x80000539, 0x00000010, 0x8000053a,
+ 0x00000010, 0x8000053b, 0x00000010, 0x8000053c,
+ 0x00000010, 0x8000053d, 0x00000010, 0x8000053e,
+ 0x00000010, 0x8000053f, 0x00000010, 0x80000540,
+ 0x00000010, 0x80000541, 0x00000010, 0x80000542,
+ 0x00000010, 0x80000543, 0x00000010, 0x80000544,
+ 0x00000010, 0x80000545, 0x00000010, 0x80000546,
+ 0x00000010, 0x80000547, 0x00000010, 0x80000548,
+ 0x00000010, 0x80000549, 0x00000010, 0x8000054a,
+ 0x00000010, 0x8000054b, 0x00000010, 0x8000054c,
+ 0x00000010, 0x8000054d, 0x00000010, 0x8000054e,
+ 0x00000010, 0x8000054f, 0x00000010, 0x80000550,
+ 0x00000010, 0x80000551, 0x00000010, 0x80000552,
+ 0x00000010, 0x80000553, 0x00000010, 0x80000554,
+ 0x00000010, 0x80000555, 0x00000010, 0x80000556,
+ 0x00000010, 0x00000535, 0x80000552, 0x00000010,
+ 0x80001e00, 0x00000010, 0x80001e02, 0x00000010,
+ 0x80001e04, 0x00000010, 0x80001e06, 0x00000010,
+ 0x80001e08, 0x00000010, 0x80001e0a, 0x00000010,
+ 0x80001e0c, 0x00000010, 0x80001e0e, 0x00000010,
+ 0x80001e10, 0x00000010, 0x80001e12, 0x00000010,
+ 0x80001e14, 0x00000010, 0x80001e16, 0x00000010,
+ 0x80001e18, 0x00000010, 0x80001e1a, 0x00000010,
+ 0x80001e1c, 0x00000010, 0x80001e1e, 0x00000010,
+ 0x80001e20, 0x00000010, 0x80001e22, 0x00000010,
+ 0x80001e24, 0x00000010, 0x80001e26, 0x00000010,
+ 0x80001e28, 0x00000010, 0x80001e2a, 0x00000010,
+ 0x80001e2c, 0x00000010, 0x80001e2e, 0x00000010,
+ 0x80001e30, 0x00000010, 0x80001e32, 0x00000010,
+ 0x80001e34, 0x00000010, 0x80001e36, 0x00000010,
+ 0x80001e38, 0x00000010, 0x80001e3a, 0x00000010,
+ 0x80001e3c, 0x00000010, 0x80001e3e, 0x00000010,
+ 0x80001e40, 0x00000010, 0x80001e42, 0x00000010,
+ 0x80001e44, 0x00000010, 0x80001e46, 0x00000010,
+ 0x80001e48, 0x00000010, 0x80001e4a, 0x00000010,
+ 0x80001e4c, 0x00000010, 0x80001e4e, 0x00000010,
+ 0x80001e50, 0x00000010, 0x80001e52, 0x00000010,
+ 0x80001e54, 0x00000010, 0x80001e56, 0x00000010,
+ 0x80001e58, 0x00000010, 0x80001e5a, 0x00000010,
+ 0x80001e5c, 0x00000010, 0x80001e5e, 0x00000010,
+ 0x80001e60, 0x00000010, 0x80001e62, 0x00000010,
+ 0x80001e64, 0x00000010, 0x80001e66, 0x00000010,
+ 0x80001e68, 0x00000010, 0x80001e6a, 0x00000010,
+ 0x80001e6c, 0x00000010, 0x80001e6e, 0x00000010,
+ 0x80001e70, 0x00000010, 0x80001e72, 0x00000010,
+ 0x80001e74, 0x00000010, 0x80001e76, 0x00000010,
+ 0x80001e78, 0x00000010, 0x80001e7a, 0x00000010,
+ 0x80001e7c, 0x00000010, 0x80001e7e, 0x00000010,
+ 0x80001e80, 0x00000010, 0x80001e82, 0x00000010,
+ 0x80001e84, 0x00000010, 0x80001e86, 0x00000010,
+ 0x80001e88, 0x00000010, 0x80001e8a, 0x00000010,
+ 0x80001e8c, 0x00000010, 0x80001e8e, 0x00000010,
+ 0x80001e90, 0x00000010, 0x80001e92, 0x00000010,
+ 0x80001e94, 0x00000010, 0x00000048, 0x80000331,
+ 0x00000010, 0x00000054, 0x80000308, 0x00000010,
+ 0x00000057, 0x8000030a, 0x00000010, 0x00000059,
+ 0x8000030a, 0x00000010, 0x00000041, 0x800002be,
+ 0x00000010, 0x80001e60, 0x00000010, 0x80001ea0,
+ 0x00000010, 0x80001ea2, 0x00000010, 0x80001ea4,
+ 0x00000010, 0x80001ea6, 0x00000010, 0x80001ea8,
+ 0x00000010, 0x80001eaa, 0x00000010, 0x80001eac,
+ 0x00000010, 0x80001eae, 0x00000010, 0x80001eb0,
+ 0x00000010, 0x80001eb2, 0x00000010, 0x80001eb4,
+ 0x00000010, 0x80001eb6, 0x00000010, 0x80001eb8,
+ 0x00000010, 0x80001eba, 0x00000010, 0x80001ebc,
+ 0x00000010, 0x80001ebe, 0x00000010, 0x80001ec0,
+ 0x00000010, 0x80001ec2, 0x00000010, 0x80001ec4,
+ 0x00000010, 0x80001ec6, 0x00000010, 0x80001ec8,
+ 0x00000010, 0x80001eca, 0x00000010, 0x80001ecc,
+ 0x00000010, 0x80001ece, 0x00000010, 0x80001ed0,
+ 0x00000010, 0x80001ed2, 0x00000010, 0x80001ed4,
+ 0x00000010, 0x80001ed6, 0x00000010, 0x80001ed8,
+ 0x00000010, 0x80001eda, 0x00000010, 0x80001edc,
+ 0x00000010, 0x80001ede, 0x00000010, 0x80001ee0,
+ 0x00000010, 0x80001ee2, 0x00000010, 0x80001ee4,
+ 0x00000010, 0x80001ee6, 0x00000010, 0x80001ee8,
+ 0x00000010, 0x80001eea, 0x00000010, 0x80001eec,
+ 0x00000010, 0x80001eee, 0x00000010, 0x80001ef0,
+ 0x00000010, 0x80001ef2, 0x00000010, 0x80001ef4,
+ 0x00000010, 0x80001ef6, 0x00000010, 0x80001ef8,
+ 0x00000010, 0x80001f08, 0x00000010, 0x80001f09,
+ 0x00000010, 0x80001f0a, 0x00000010, 0x80001f0b,
+ 0x00000010, 0x80001f0c, 0x00000010, 0x80001f0d,
+ 0x00000010, 0x80001f0e, 0x00000010, 0x80001f0f,
+ 0x00000010, 0x80001f18, 0x00000010, 0x80001f19,
+ 0x00000010, 0x80001f1a, 0x00000010, 0x80001f1b,
+ 0x00000010, 0x80001f1c, 0x00000010, 0x80001f1d,
+ 0x00000010, 0x80001f28, 0x00000010, 0x80001f29,
+ 0x00000010, 0x80001f2a, 0x00000010, 0x80001f2b,
+ 0x00000010, 0x80001f2c, 0x00000010, 0x80001f2d,
+ 0x00000010, 0x80001f2e, 0x00000010, 0x80001f2f,
+ 0x00000010, 0x80001f38, 0x00000010, 0x80001f39,
+ 0x00000010, 0x80001f3a, 0x00000010, 0x80001f3b,
+ 0x00000010, 0x80001f3c, 0x00000010, 0x80001f3d,
+ 0x00000010, 0x80001f3e, 0x00000010, 0x80001f3f,
+ 0x00000010, 0x80001f48, 0x00000010, 0x80001f49,
+ 0x00000010, 0x80001f4a, 0x00000010, 0x80001f4b,
+ 0x00000010, 0x80001f4c, 0x00000010, 0x80001f4d,
+ 0x00000010, 0x000003a5, 0x80000313, 0x00000010,
+ 0x80001f59, 0x00000010, 0x000003a5, 0x00000313,
+ 0x80000300, 0x00000010, 0x80001f5b, 0x00000010,
+ 0x000003a5, 0x00000313, 0x80000301, 0x00000010,
+ 0x80001f5d, 0x00000010, 0x000003a5, 0x00000313,
+ 0x80000342, 0x00000010, 0x80001f5f, 0x00000010,
+ 0x80001f68, 0x00000010, 0x80001f69, 0x00000010,
+ 0x80001f6a, 0x00000010, 0x80001f6b, 0x00000010,
+ 0x80001f6c, 0x00000010, 0x80001f6d, 0x00000010,
+ 0x80001f6e, 0x00000010, 0x80001f6f, 0x00000010,
+ 0x80001fba, 0x00000010, 0x80001fbb, 0x00000010,
+ 0x80001fc8, 0x00000010, 0x80001fc9, 0x00000010,
+ 0x80001fca, 0x00000010, 0x80001fcb, 0x00000010,
+ 0x80001fda, 0x00000010, 0x80001fdb, 0x00000010,
+ 0x80001ff8, 0x00000010, 0x80001ff9, 0x00000010,
+ 0x80001fea, 0x00000010, 0x80001feb, 0x00000010,
+ 0x80001ffa, 0x00000010, 0x80001ffb, 0x00000000,
+ 0x00001f08, 0x80000399, 0x00000010, 0x80001f88,
+ 0x00000000, 0x00001f09, 0x80000399, 0x00000010,
+ 0x80001f89, 0x00000000, 0x00001f0a, 0x80000399,
+ 0x00000010, 0x80001f8a, 0x00000000, 0x00001f0b,
+ 0x80000399, 0x00000010, 0x80001f8b, 0x00000000,
+ 0x00001f0c, 0x80000399, 0x00000010, 0x80001f8c,
+ 0x00000000, 0x00001f0d, 0x80000399, 0x00000010,
+ 0x80001f8d, 0x00000000, 0x00001f0e, 0x80000399,
+ 0x00000010, 0x80001f8e, 0x00000000, 0x00001f0f,
+ 0x80000399, 0x00000010, 0x80001f8f, 0x00000010,
+ 0x00001f08, 0x80000399, 0x00000010, 0x00001f09,
+ 0x80000399, 0x00000010, 0x00001f0a, 0x80000399,
+ 0x00000010, 0x00001f0b, 0x80000399, 0x00000010,
+ 0x00001f0c, 0x80000399, 0x00000010, 0x00001f0d,
+ 0x80000399, 0x00000010, 0x00001f0e, 0x80000399,
+ 0x00000010, 0x00001f0f, 0x80000399, 0x00000000,
+ 0x00001f28, 0x80000399, 0x00000010, 0x80001f98,
+ 0x00000000, 0x00001f29, 0x80000399, 0x00000010,
+ 0x80001f99, 0x00000000, 0x00001f2a, 0x80000399,
+ 0x00000010, 0x80001f9a, 0x00000000, 0x00001f2b,
+ 0x80000399, 0x00000010, 0x80001f9b, 0x00000000,
+ 0x00001f2c, 0x80000399, 0x00000010, 0x80001f9c,
+ 0x00000000, 0x00001f2d, 0x80000399, 0x00000010,
+ 0x80001f9d, 0x00000000, 0x00001f2e, 0x80000399,
+ 0x00000010, 0x80001f9e, 0x00000000, 0x00001f2f,
+ 0x80000399, 0x00000010, 0x80001f9f, 0x00000010,
+ 0x00001f28, 0x80000399, 0x00000010, 0x00001f29,
+ 0x80000399, 0x00000010, 0x00001f2a, 0x80000399,
+ 0x00000010, 0x00001f2b, 0x80000399, 0x00000010,
+ 0x00001f2c, 0x80000399, 0x00000010, 0x00001f2d,
+ 0x80000399, 0x00000010, 0x00001f2e, 0x80000399,
+ 0x00000010, 0x00001f2f, 0x80000399, 0x00000000,
+ 0x00001f68, 0x80000399, 0x00000010, 0x80001fa8,
+ 0x00000000, 0x00001f69, 0x80000399, 0x00000010,
+ 0x80001fa9, 0x00000000, 0x00001f6a, 0x80000399,
+ 0x00000010, 0x80001faa, 0x00000000, 0x00001f6b,
+ 0x80000399, 0x00000010, 0x80001fab, 0x00000000,
+ 0x00001f6c, 0x80000399, 0x00000010, 0x80001fac,
+ 0x00000000, 0x00001f6d, 0x80000399, 0x00000010,
+ 0x80001fad, 0x00000000, 0x00001f6e, 0x80000399,
+ 0x00000010, 0x80001fae, 0x00000000, 0x00001f6f,
+ 0x80000399, 0x00000010, 0x80001faf, 0x00000010,
+ 0x00001f68, 0x80000399, 0x00000010, 0x00001f69,
+ 0x80000399, 0x00000010, 0x00001f6a, 0x80000399,
+ 0x00000010, 0x00001f6b, 0x80000399, 0x00000010,
+ 0x00001f6c, 0x80000399, 0x00000010, 0x00001f6d,
+ 0x80000399, 0x00000010, 0x00001f6e, 0x80000399,
+ 0x00000010, 0x00001f6f, 0x80000399, 0x00000010,
+ 0x80001fb8, 0x00000010, 0x80001fb9, 0x00000010,
+ 0x00001fba, 0x80000399, 0x00000000, 0x00000391,
+ 0x80000399, 0x00000010, 0x80001fbc, 0x00000010,
+ 0x00000386, 0x80000399, 0x00000010, 0x00000391,
+ 0x80000342, 0x00000010, 0x00000391, 0x00000342,
+ 0x80000399, 0x00000010, 0x00000391, 0x80000399,
+ 0x00000010, 0x80000399, 0x00000010, 0x00001fca,
+ 0x80000399, 0x00000000, 0x00000397, 0x80000399,
+ 0x00000010, 0x80001fcc, 0x00000010, 0x00000389,
+ 0x80000399, 0x00000010, 0x00000397, 0x80000342,
+ 0x00000010, 0x00000397, 0x00000342, 0x80000399,
+ 0x00000010, 0x00000397, 0x80000399, 0x00000010,
+ 0x80001fd8, 0x00000010, 0x80001fd9, 0x00000010,
+ 0x00000399, 0x00000308, 0x80000300, 0x00000010,
+ 0x00000399, 0x00000308, 0x80000301, 0x00000010,
+ 0x00000399, 0x80000342, 0x00000010, 0x00000399,
+ 0x00000308, 0x80000342, 0x00000010, 0x80001fe8,
+ 0x00000010, 0x80001fe9, 0x00000010, 0x000003a5,
+ 0x00000308, 0x80000300, 0x00000010, 0x000003a5,
+ 0x00000308, 0x80000301, 0x00000010, 0x000003a1,
+ 0x80000313, 0x00000010, 0x80001fec, 0x00000010,
+ 0x000003a5, 0x80000342, 0x00000010, 0x000003a5,
+ 0x00000308, 0x80000342, 0x00000010, 0x00001ffa,
+ 0x80000399, 0x00000000, 0x000003a9, 0x80000399,
+ 0x00000010, 0x80001ffc, 0x00000010, 0x0000038f,
+ 0x80000399, 0x00000010, 0x000003a9, 0x80000342,
+ 0x00000010, 0x000003a9, 0x00000342, 0x80000399,
+ 0x00000010, 0x000003a9, 0x80000399, 0x00000010,
+ 0x80002160, 0x00000010, 0x80002161, 0x00000010,
+ 0x80002162, 0x00000010, 0x80002163, 0x00000010,
+ 0x80002164, 0x00000010, 0x80002165, 0x00000010,
+ 0x80002166, 0x00000010, 0x80002167, 0x00000010,
+ 0x80002168, 0x00000010, 0x80002169, 0x00000010,
+ 0x8000216a, 0x00000010, 0x8000216b, 0x00000010,
+ 0x8000216c, 0x00000010, 0x8000216d, 0x00000010,
+ 0x8000216e, 0x00000010, 0x8000216f, 0x00000010,
+ 0x800024b6, 0x00000010, 0x800024b7, 0x00000010,
+ 0x800024b8, 0x00000010, 0x800024b9, 0x00000010,
+ 0x800024ba, 0x00000010, 0x800024bb, 0x00000010,
+ 0x800024bc, 0x00000010, 0x800024bd, 0x00000010,
+ 0x800024be, 0x00000010, 0x800024bf, 0x00000010,
+ 0x800024c0, 0x00000010, 0x800024c1, 0x00000010,
+ 0x800024c2, 0x00000010, 0x800024c3, 0x00000010,
+ 0x800024c4, 0x00000010, 0x800024c5, 0x00000010,
+ 0x800024c6, 0x00000010, 0x800024c7, 0x00000010,
+ 0x800024c8, 0x00000010, 0x800024c9, 0x00000010,
+ 0x800024ca, 0x00000010, 0x800024cb, 0x00000010,
+ 0x800024cc, 0x00000010, 0x800024cd, 0x00000010,
+ 0x800024ce, 0x00000010, 0x800024cf, 0x00000010,
+ 0x00000046, 0x80000046, 0x00000010, 0x00000046,
+ 0x80000049, 0x00000010, 0x00000046, 0x8000004c,
+ 0x00000010, 0x00000046, 0x00000046, 0x80000049,
+ 0x00000010, 0x00000046, 0x00000046, 0x8000004c,
+ 0x00000010, 0x00000053, 0x80000054, 0x00000010,
+ 0x00000053, 0x80000054, 0x00000010, 0x00000544,
+ 0x80000546, 0x00000010, 0x00000544, 0x80000535,
+ 0x00000010, 0x00000544, 0x8000053b, 0x00000010,
+ 0x0000054e, 0x80000546, 0x00000010, 0x00000544,
+ 0x8000053d, 0x00000010, 0x8000ff21, 0x00000010,
+ 0x8000ff22, 0x00000010, 0x8000ff23, 0x00000010,
+ 0x8000ff24, 0x00000010, 0x8000ff25, 0x00000010,
+ 0x8000ff26, 0x00000010, 0x8000ff27, 0x00000010,
+ 0x8000ff28, 0x00000010, 0x8000ff29, 0x00000010,
+ 0x8000ff2a, 0x00000010, 0x8000ff2b, 0x00000010,
+ 0x8000ff2c, 0x00000010, 0x8000ff2d, 0x00000010,
+ 0x8000ff2e, 0x00000010, 0x8000ff2f, 0x00000010,
+ 0x8000ff30, 0x00000010, 0x8000ff31, 0x00000010,
+ 0x8000ff32, 0x00000010, 0x8000ff33, 0x00000010,
+ 0x8000ff34, 0x00000010, 0x8000ff35, 0x00000010,
+ 0x8000ff36, 0x00000010, 0x8000ff37, 0x00000010,
+ 0x8000ff38, 0x00000010, 0x8000ff39, 0x00000010,
+ 0x8000ff3a, 0x00000010, 0x80010400, 0x00000010,
+ 0x80010401, 0x00000010, 0x80010402, 0x00000010,
+ 0x80010403, 0x00000010, 0x80010404, 0x00000010,
+ 0x80010405, 0x00000010, 0x80010406, 0x00000010,
+ 0x80010407, 0x00000010, 0x80010408, 0x00000010,
+ 0x80010409, 0x00000010, 0x8001040a, 0x00000010,
+ 0x8001040b, 0x00000010, 0x8001040c, 0x00000010,
+ 0x8001040d, 0x00000010, 0x8001040e, 0x00000010,
+ 0x8001040f, 0x00000010, 0x80010410, 0x00000010,
+ 0x80010411, 0x00000010, 0x80010412, 0x00000010,
+ 0x80010413, 0x00000010, 0x80010414, 0x00000010,
+ 0x80010415, 0x00000010, 0x80010416, 0x00000010,
+ 0x80010417, 0x00000010, 0x80010418, 0x00000010,
+ 0x80010419, 0x00000010, 0x8001041a, 0x00000010,
+ 0x8001041b, 0x00000010, 0x8001041c, 0x00000010,
+ 0x8001041d, 0x00000010, 0x8001041e, 0x00000010,
+ 0x8001041f, 0x00000010, 0x80010420, 0x00000010,
+ 0x80010421, 0x00000010, 0x80010422, 0x00000010,
+ 0x80010423, 0x00000010, 0x80010424, 0x00000010,
+ 0x80010425,
+};
+
+static const unsigned long v320_tolower_seq[] = {
+ 0x00000000, 0x00000010, 0x80000061, 0x00000010,
+ 0x80000062, 0x00000010, 0x80000063, 0x00000010,
+ 0x80000064, 0x00000010, 0x80000065, 0x00000010,
+ 0x80000066, 0x00000010, 0x80000067, 0x00000010,
+ 0x80000068, 0x00000010, 0x80000069, 0x00000010,
+ 0x8000006a, 0x00000010, 0x8000006b, 0x00000010,
+ 0x8000006c, 0x00000010, 0x8000006d, 0x00000010,
+ 0x8000006e, 0x00000010, 0x8000006f, 0x00000010,
+ 0x80000070, 0x00000010, 0x80000071, 0x00000010,
+ 0x80000072, 0x00000010, 0x80000073, 0x00000010,
+ 0x80000074, 0x00000010, 0x80000075, 0x00000010,
+ 0x80000076, 0x00000010, 0x80000077, 0x00000010,
+ 0x80000078, 0x00000010, 0x80000079, 0x00000010,
+ 0x8000007a, 0x00000010, 0x800000e0, 0x00000010,
+ 0x800000e1, 0x00000010, 0x800000e2, 0x00000010,
+ 0x800000e3, 0x00000010, 0x800000e4, 0x00000010,
+ 0x800000e5, 0x00000010, 0x800000e6, 0x00000010,
+ 0x800000e7, 0x00000010, 0x800000e8, 0x00000010,
+ 0x800000e9, 0x00000010, 0x800000ea, 0x00000010,
+ 0x800000eb, 0x00000010, 0x800000ec, 0x00000010,
+ 0x800000ed, 0x00000010, 0x800000ee, 0x00000010,
+ 0x800000ef, 0x00000010, 0x800000f0, 0x00000010,
+ 0x800000f1, 0x00000010, 0x800000f2, 0x00000010,
+ 0x800000f3, 0x00000010, 0x800000f4, 0x00000010,
+ 0x800000f5, 0x00000010, 0x800000f6, 0x00000010,
+ 0x800000f8, 0x00000010, 0x800000f9, 0x00000010,
+ 0x800000fa, 0x00000010, 0x800000fb, 0x00000010,
+ 0x800000fc, 0x00000010, 0x800000fd, 0x00000010,
+ 0x800000fe, 0x00000010, 0x80000101, 0x00000010,
+ 0x80000103, 0x00000010, 0x80000105, 0x00000010,
+ 0x80000107, 0x00000010, 0x80000109, 0x00000010,
+ 0x8000010b, 0x00000010, 0x8000010d, 0x00000010,
+ 0x8000010f, 0x00000010, 0x80000111, 0x00000010,
+ 0x80000113, 0x00000010, 0x80000115, 0x00000010,
+ 0x80000117, 0x00000010, 0x80000119, 0x00000010,
+ 0x8000011b, 0x00000010, 0x8000011d, 0x00000010,
+ 0x8000011f, 0x00000010, 0x80000121, 0x00000010,
+ 0x80000123, 0x00000010, 0x80000125, 0x00000010,
+ 0x80000127, 0x00000010, 0x80000129, 0x00000010,
+ 0x8000012b, 0x00000010, 0x8000012d, 0x00000010,
+ 0x8000012f, 0x00000000, 0x80000069, 0x00000010,
+ 0x80000069, 0x00000010, 0x80000133, 0x00000010,
+ 0x80000135, 0x00000010, 0x80000137, 0x00000010,
+ 0x8000013a, 0x00000010, 0x8000013c, 0x00000010,
+ 0x8000013e, 0x00000010, 0x80000140, 0x00000010,
+ 0x80000142, 0x00000010, 0x80000144, 0x00000010,
+ 0x80000146, 0x00000010, 0x80000148, 0x00000010,
+ 0x8000014b, 0x00000010, 0x8000014d, 0x00000010,
+ 0x8000014f, 0x00000010, 0x80000151, 0x00000010,
+ 0x80000153, 0x00000010, 0x80000155, 0x00000010,
+ 0x80000157, 0x00000010, 0x80000159, 0x00000010,
+ 0x8000015b, 0x00000010, 0x8000015d, 0x00000010,
+ 0x8000015f, 0x00000010, 0x80000161, 0x00000010,
+ 0x80000163, 0x00000010, 0x80000165, 0x00000010,
+ 0x80000167, 0x00000010, 0x80000169, 0x00000010,
+ 0x8000016b, 0x00000010, 0x8000016d, 0x00000010,
+ 0x8000016f, 0x00000010, 0x80000171, 0x00000010,
+ 0x80000173, 0x00000010, 0x80000175, 0x00000010,
+ 0x80000177, 0x00000010, 0x800000ff, 0x00000010,
+ 0x8000017a, 0x00000010, 0x8000017c, 0x00000010,
+ 0x8000017e, 0x00000010, 0x80000253, 0x00000010,
+ 0x80000183, 0x00000010, 0x80000185, 0x00000010,
+ 0x80000254, 0x00000010, 0x80000188, 0x00000010,
+ 0x80000256, 0x00000010, 0x80000257, 0x00000010,
+ 0x8000018c, 0x00000010, 0x800001dd, 0x00000010,
+ 0x80000259, 0x00000010, 0x8000025b, 0x00000010,
+ 0x80000192, 0x00000010, 0x80000260, 0x00000010,
+ 0x80000263, 0x00000010, 0x80000269, 0x00000010,
+ 0x80000268, 0x00000010, 0x80000199, 0x00000010,
+ 0x8000026f, 0x00000010, 0x80000272, 0x00000010,
+ 0x80000275, 0x00000010, 0x800001a1, 0x00000010,
+ 0x800001a3, 0x00000010, 0x800001a5, 0x00000010,
+ 0x80000280, 0x00000010, 0x800001a8, 0x00000010,
+ 0x80000283, 0x00000010, 0x800001ad, 0x00000010,
+ 0x80000288, 0x00000010, 0x800001b0, 0x00000010,
+ 0x8000028a, 0x00000010, 0x8000028b, 0x00000010,
+ 0x800001b4, 0x00000010, 0x800001b6, 0x00000010,
+ 0x80000292, 0x00000010, 0x800001b9, 0x00000010,
+ 0x800001bd, 0x00000010, 0x800001c6, 0x00000010,
+ 0x800001c6, 0x00000010, 0x800001c9, 0x00000010,
+ 0x800001c9, 0x00000010, 0x800001cc, 0x00000010,
+ 0x800001cc, 0x00000010, 0x800001ce, 0x00000010,
+ 0x800001d0, 0x00000010, 0x800001d2, 0x00000010,
+ 0x800001d4, 0x00000010, 0x800001d6, 0x00000010,
+ 0x800001d8, 0x00000010, 0x800001da, 0x00000010,
+ 0x800001dc, 0x00000010, 0x800001df, 0x00000010,
+ 0x800001e1, 0x00000010, 0x800001e3, 0x00000010,
+ 0x800001e5, 0x00000010, 0x800001e7, 0x00000010,
+ 0x800001e9, 0x00000010, 0x800001eb, 0x00000010,
+ 0x800001ed, 0x00000010, 0x800001ef, 0x00000010,
+ 0x800001f3, 0x00000010, 0x800001f3, 0x00000010,
+ 0x800001f5, 0x00000010, 0x80000195, 0x00000010,
+ 0x800001bf, 0x00000010, 0x800001f9, 0x00000010,
+ 0x800001fb, 0x00000010, 0x800001fd, 0x00000010,
+ 0x800001ff, 0x00000010, 0x80000201, 0x00000010,
+ 0x80000203, 0x00000010, 0x80000205, 0x00000010,
+ 0x80000207, 0x00000010, 0x80000209, 0x00000010,
+ 0x8000020b, 0x00000010, 0x8000020d, 0x00000010,
+ 0x8000020f, 0x00000010, 0x80000211, 0x00000010,
+ 0x80000213, 0x00000010, 0x80000215, 0x00000010,
+ 0x80000217, 0x00000010, 0x80000219, 0x00000010,
+ 0x8000021b, 0x00000010, 0x8000021d, 0x00000010,
+ 0x8000021f, 0x00000010, 0x8000019e, 0x00000010,
+ 0x80000223, 0x00000010, 0x80000225, 0x00000010,
+ 0x80000227, 0x00000010, 0x80000229, 0x00000010,
+ 0x8000022b, 0x00000010, 0x8000022d, 0x00000010,
+ 0x8000022f, 0x00000010, 0x80000231, 0x00000010,
+ 0x80000233, 0x00000010, 0x800003ac, 0x00000010,
+ 0x800003ad, 0x00000010, 0x800003ae, 0x00000010,
+ 0x800003af, 0x00000010, 0x800003cc, 0x00000010,
+ 0x800003cd, 0x00000010, 0x800003ce, 0x00000010,
+ 0x800003b1, 0x00000010, 0x800003b2, 0x00000010,
+ 0x800003b3, 0x00000010, 0x800003b4, 0x00000010,
+ 0x800003b5, 0x00000010, 0x800003b6, 0x00000010,
+ 0x800003b7, 0x00000010, 0x800003b8, 0x00000010,
+ 0x800003b9, 0x00000010, 0x800003ba, 0x00000010,
+ 0x800003bb, 0x00000010, 0x800003bc, 0x00000010,
+ 0x800003bd, 0x00000010, 0x800003be, 0x00000010,
+ 0x800003bf, 0x00000010, 0x800003c0, 0x00000010,
+ 0x800003c1, 0x00000010, 0x800003c3, 0x00000010,
+ 0x800003c4, 0x00000010, 0x800003c5, 0x00000010,
+ 0x800003c6, 0x00000010, 0x800003c7, 0x00000010,
+ 0x800003c8, 0x00000010, 0x800003c9, 0x00000010,
+ 0x800003ca, 0x00000010, 0x800003cb, 0x00000010,
+ 0x800003d9, 0x00000010, 0x800003db, 0x00000010,
+ 0x800003dd, 0x00000010, 0x800003df, 0x00000010,
+ 0x800003e1, 0x00000010, 0x800003e3, 0x00000010,
+ 0x800003e5, 0x00000010, 0x800003e7, 0x00000010,
+ 0x800003e9, 0x00000010, 0x800003eb, 0x00000010,
+ 0x800003ed, 0x00000010, 0x800003ef, 0x00000010,
+ 0x800003b8, 0x00000010, 0x80000450, 0x00000010,
+ 0x80000451, 0x00000010, 0x80000452, 0x00000010,
+ 0x80000453, 0x00000010, 0x80000454, 0x00000010,
+ 0x80000455, 0x00000010, 0x80000456, 0x00000010,
+ 0x80000457, 0x00000010, 0x80000458, 0x00000010,
+ 0x80000459, 0x00000010, 0x8000045a, 0x00000010,
+ 0x8000045b, 0x00000010, 0x8000045c, 0x00000010,
+ 0x8000045d, 0x00000010, 0x8000045e, 0x00000010,
+ 0x8000045f, 0x00000010, 0x80000430, 0x00000010,
+ 0x80000431, 0x00000010, 0x80000432, 0x00000010,
+ 0x80000433, 0x00000010, 0x80000434, 0x00000010,
+ 0x80000435, 0x00000010, 0x80000436, 0x00000010,
+ 0x80000437, 0x00000010, 0x80000438, 0x00000010,
+ 0x80000439, 0x00000010, 0x8000043a, 0x00000010,
+ 0x8000043b, 0x00000010, 0x8000043c, 0x00000010,
+ 0x8000043d, 0x00000010, 0x8000043e, 0x00000010,
+ 0x8000043f, 0x00000010, 0x80000440, 0x00000010,
+ 0x80000441, 0x00000010, 0x80000442, 0x00000010,
+ 0x80000443, 0x00000010, 0x80000444, 0x00000010,
+ 0x80000445, 0x00000010, 0x80000446, 0x00000010,
+ 0x80000447, 0x00000010, 0x80000448, 0x00000010,
+ 0x80000449, 0x00000010, 0x8000044a, 0x00000010,
+ 0x8000044b, 0x00000010, 0x8000044c, 0x00000010,
+ 0x8000044d, 0x00000010, 0x8000044e, 0x00000010,
+ 0x8000044f, 0x00000010, 0x80000461, 0x00000010,
+ 0x80000463, 0x00000010, 0x80000465, 0x00000010,
+ 0x80000467, 0x00000010, 0x80000469, 0x00000010,
+ 0x8000046b, 0x00000010, 0x8000046d, 0x00000010,
+ 0x8000046f, 0x00000010, 0x80000471, 0x00000010,
+ 0x80000473, 0x00000010, 0x80000475, 0x00000010,
+ 0x80000477, 0x00000010, 0x80000479, 0x00000010,
+ 0x8000047b, 0x00000010, 0x8000047d, 0x00000010,
+ 0x8000047f, 0x00000010, 0x80000481, 0x00000010,
+ 0x8000048b, 0x00000010, 0x8000048d, 0x00000010,
+ 0x8000048f, 0x00000010, 0x80000491, 0x00000010,
+ 0x80000493, 0x00000010, 0x80000495, 0x00000010,
+ 0x80000497, 0x00000010, 0x80000499, 0x00000010,
+ 0x8000049b, 0x00000010, 0x8000049d, 0x00000010,
+ 0x8000049f, 0x00000010, 0x800004a1, 0x00000010,
+ 0x800004a3, 0x00000010, 0x800004a5, 0x00000010,
+ 0x800004a7, 0x00000010, 0x800004a9, 0x00000010,
+ 0x800004ab, 0x00000010, 0x800004ad, 0x00000010,
+ 0x800004af, 0x00000010, 0x800004b1, 0x00000010,
+ 0x800004b3, 0x00000010, 0x800004b5, 0x00000010,
+ 0x800004b7, 0x00000010, 0x800004b9, 0x00000010,
+ 0x800004bb, 0x00000010, 0x800004bd, 0x00000010,
+ 0x800004bf, 0x00000010, 0x800004c2, 0x00000010,
+ 0x800004c4, 0x00000010, 0x800004c6, 0x00000010,
+ 0x800004c8, 0x00000010, 0x800004ca, 0x00000010,
+ 0x800004cc, 0x00000010, 0x800004ce, 0x00000010,
+ 0x800004d1, 0x00000010, 0x800004d3, 0x00000010,
+ 0x800004d5, 0x00000010, 0x800004d7, 0x00000010,
+ 0x800004d9, 0x00000010, 0x800004db, 0x00000010,
+ 0x800004dd, 0x00000010, 0x800004df, 0x00000010,
+ 0x800004e1, 0x00000010, 0x800004e3, 0x00000010,
+ 0x800004e5, 0x00000010, 0x800004e7, 0x00000010,
+ 0x800004e9, 0x00000010, 0x800004eb, 0x00000010,
+ 0x800004ed, 0x00000010, 0x800004ef, 0x00000010,
+ 0x800004f1, 0x00000010, 0x800004f3, 0x00000010,
+ 0x800004f5, 0x00000010, 0x800004f9, 0x00000010,
+ 0x80000501, 0x00000010, 0x80000503, 0x00000010,
+ 0x80000505, 0x00000010, 0x80000507, 0x00000010,
+ 0x80000509, 0x00000010, 0x8000050b, 0x00000010,
+ 0x8000050d, 0x00000010, 0x8000050f, 0x00000010,
+ 0x80000561, 0x00000010, 0x80000562, 0x00000010,
+ 0x80000563, 0x00000010, 0x80000564, 0x00000010,
+ 0x80000565, 0x00000010, 0x80000566, 0x00000010,
+ 0x80000567, 0x00000010, 0x80000568, 0x00000010,
+ 0x80000569, 0x00000010, 0x8000056a, 0x00000010,
+ 0x8000056b, 0x00000010, 0x8000056c, 0x00000010,
+ 0x8000056d, 0x00000010, 0x8000056e, 0x00000010,
+ 0x8000056f, 0x00000010, 0x80000570, 0x00000010,
+ 0x80000571, 0x00000010, 0x80000572, 0x00000010,
+ 0x80000573, 0x00000010, 0x80000574, 0x00000010,
+ 0x80000575, 0x00000010, 0x80000576, 0x00000010,
+ 0x80000577, 0x00000010, 0x80000578, 0x00000010,
+ 0x80000579, 0x00000010, 0x8000057a, 0x00000010,
+ 0x8000057b, 0x00000010, 0x8000057c, 0x00000010,
+ 0x8000057d, 0x00000010, 0x8000057e, 0x00000010,
+ 0x8000057f, 0x00000010, 0x80000580, 0x00000010,
+ 0x80000581, 0x00000010, 0x80000582, 0x00000010,
+ 0x80000583, 0x00000010, 0x80000584, 0x00000010,
+ 0x80000585, 0x00000010, 0x80000586, 0x00000010,
+ 0x80001e01, 0x00000010, 0x80001e03, 0x00000010,
+ 0x80001e05, 0x00000010, 0x80001e07, 0x00000010,
+ 0x80001e09, 0x00000010, 0x80001e0b, 0x00000010,
+ 0x80001e0d, 0x00000010, 0x80001e0f, 0x00000010,
+ 0x80001e11, 0x00000010, 0x80001e13, 0x00000010,
+ 0x80001e15, 0x00000010, 0x80001e17, 0x00000010,
+ 0x80001e19, 0x00000010, 0x80001e1b, 0x00000010,
+ 0x80001e1d, 0x00000010, 0x80001e1f, 0x00000010,
+ 0x80001e21, 0x00000010, 0x80001e23, 0x00000010,
+ 0x80001e25, 0x00000010, 0x80001e27, 0x00000010,
+ 0x80001e29, 0x00000010, 0x80001e2b, 0x00000010,
+ 0x80001e2d, 0x00000010, 0x80001e2f, 0x00000010,
+ 0x80001e31, 0x00000010, 0x80001e33, 0x00000010,
+ 0x80001e35, 0x00000010, 0x80001e37, 0x00000010,
+ 0x80001e39, 0x00000010, 0x80001e3b, 0x00000010,
+ 0x80001e3d, 0x00000010, 0x80001e3f, 0x00000010,
+ 0x80001e41, 0x00000010, 0x80001e43, 0x00000010,
+ 0x80001e45, 0x00000010, 0x80001e47, 0x00000010,
+ 0x80001e49, 0x00000010, 0x80001e4b, 0x00000010,
+ 0x80001e4d, 0x00000010, 0x80001e4f, 0x00000010,
+ 0x80001e51, 0x00000010, 0x80001e53, 0x00000010,
+ 0x80001e55, 0x00000010, 0x80001e57, 0x00000010,
+ 0x80001e59, 0x00000010, 0x80001e5b, 0x00000010,
+ 0x80001e5d, 0x00000010, 0x80001e5f, 0x00000010,
+ 0x80001e61, 0x00000010, 0x80001e63, 0x00000010,
+ 0x80001e65, 0x00000010, 0x80001e67, 0x00000010,
+ 0x80001e69, 0x00000010, 0x80001e6b, 0x00000010,
+ 0x80001e6d, 0x00000010, 0x80001e6f, 0x00000010,
+ 0x80001e71, 0x00000010, 0x80001e73, 0x00000010,
+ 0x80001e75, 0x00000010, 0x80001e77, 0x00000010,
+ 0x80001e79, 0x00000010, 0x80001e7b, 0x00000010,
+ 0x80001e7d, 0x00000010, 0x80001e7f, 0x00000010,
+ 0x80001e81, 0x00000010, 0x80001e83, 0x00000010,
+ 0x80001e85, 0x00000010, 0x80001e87, 0x00000010,
+ 0x80001e89, 0x00000010, 0x80001e8b, 0x00000010,
+ 0x80001e8d, 0x00000010, 0x80001e8f, 0x00000010,
+ 0x80001e91, 0x00000010, 0x80001e93, 0x00000010,
+ 0x80001e95, 0x00000010, 0x80001ea1, 0x00000010,
+ 0x80001ea3, 0x00000010, 0x80001ea5, 0x00000010,
+ 0x80001ea7, 0x00000010, 0x80001ea9, 0x00000010,
+ 0x80001eab, 0x00000010, 0x80001ead, 0x00000010,
+ 0x80001eaf, 0x00000010, 0x80001eb1, 0x00000010,
+ 0x80001eb3, 0x00000010, 0x80001eb5, 0x00000010,
+ 0x80001eb7, 0x00000010, 0x80001eb9, 0x00000010,
+ 0x80001ebb, 0x00000010, 0x80001ebd, 0x00000010,
+ 0x80001ebf, 0x00000010, 0x80001ec1, 0x00000010,
+ 0x80001ec3, 0x00000010, 0x80001ec5, 0x00000010,
+ 0x80001ec7, 0x00000010, 0x80001ec9, 0x00000010,
+ 0x80001ecb, 0x00000010, 0x80001ecd, 0x00000010,
+ 0x80001ecf, 0x00000010, 0x80001ed1, 0x00000010,
+ 0x80001ed3, 0x00000010, 0x80001ed5, 0x00000010,
+ 0x80001ed7, 0x00000010, 0x80001ed9, 0x00000010,
+ 0x80001edb, 0x00000010, 0x80001edd, 0x00000010,
+ 0x80001edf, 0x00000010, 0x80001ee1, 0x00000010,
+ 0x80001ee3, 0x00000010, 0x80001ee5, 0x00000010,
+ 0x80001ee7, 0x00000010, 0x80001ee9, 0x00000010,
+ 0x80001eeb, 0x00000010, 0x80001eed, 0x00000010,
+ 0x80001eef, 0x00000010, 0x80001ef1, 0x00000010,
+ 0x80001ef3, 0x00000010, 0x80001ef5, 0x00000010,
+ 0x80001ef7, 0x00000010, 0x80001ef9, 0x00000010,
+ 0x80001f00, 0x00000010, 0x80001f01, 0x00000010,
+ 0x80001f02, 0x00000010, 0x80001f03, 0x00000010,
+ 0x80001f04, 0x00000010, 0x80001f05, 0x00000010,
+ 0x80001f06, 0x00000010, 0x80001f07, 0x00000010,
+ 0x80001f10, 0x00000010, 0x80001f11, 0x00000010,
+ 0x80001f12, 0x00000010, 0x80001f13, 0x00000010,
+ 0x80001f14, 0x00000010, 0x80001f15, 0x00000010,
+ 0x80001f20, 0x00000010, 0x80001f21, 0x00000010,
+ 0x80001f22, 0x00000010, 0x80001f23, 0x00000010,
+ 0x80001f24, 0x00000010, 0x80001f25, 0x00000010,
+ 0x80001f26, 0x00000010, 0x80001f27, 0x00000010,
+ 0x80001f30, 0x00000010, 0x80001f31, 0x00000010,
+ 0x80001f32, 0x00000010, 0x80001f33, 0x00000010,
+ 0x80001f34, 0x00000010, 0x80001f35, 0x00000010,
+ 0x80001f36, 0x00000010, 0x80001f37, 0x00000010,
+ 0x80001f40, 0x00000010, 0x80001f41, 0x00000010,
+ 0x80001f42, 0x00000010, 0x80001f43, 0x00000010,
+ 0x80001f44, 0x00000010, 0x80001f45, 0x00000010,
+ 0x80001f51, 0x00000010, 0x80001f53, 0x00000010,
+ 0x80001f55, 0x00000010, 0x80001f57, 0x00000010,
+ 0x80001f60, 0x00000010, 0x80001f61, 0x00000010,
+ 0x80001f62, 0x00000010, 0x80001f63, 0x00000010,
+ 0x80001f64, 0x00000010, 0x80001f65, 0x00000010,
+ 0x80001f66, 0x00000010, 0x80001f67, 0x00000000,
+ 0x80001f80, 0x00000010, 0x80001f80, 0x00000000,
+ 0x80001f81, 0x00000010, 0x80001f81, 0x00000000,
+ 0x80001f82, 0x00000010, 0x80001f82, 0x00000000,
+ 0x80001f83, 0x00000010, 0x80001f83, 0x00000000,
+ 0x80001f84, 0x00000010, 0x80001f84, 0x00000000,
+ 0x80001f85, 0x00000010, 0x80001f85, 0x00000000,
+ 0x80001f86, 0x00000010, 0x80001f86, 0x00000000,
+ 0x80001f87, 0x00000010, 0x80001f87, 0x00000000,
+ 0x80001f90, 0x00000010, 0x80001f90, 0x00000000,
+ 0x80001f91, 0x00000010, 0x80001f91, 0x00000000,
+ 0x80001f92, 0x00000010, 0x80001f92, 0x00000000,
+ 0x80001f93, 0x00000010, 0x80001f93, 0x00000000,
+ 0x80001f94, 0x00000010, 0x80001f94, 0x00000000,
+ 0x80001f95, 0x00000010, 0x80001f95, 0x00000000,
+ 0x80001f96, 0x00000010, 0x80001f96, 0x00000000,
+ 0x80001f97, 0x00000010, 0x80001f97, 0x00000000,
+ 0x80001fa0, 0x00000010, 0x80001fa0, 0x00000000,
+ 0x80001fa1, 0x00000010, 0x80001fa1, 0x00000000,
+ 0x80001fa2, 0x00000010, 0x80001fa2, 0x00000000,
+ 0x80001fa3, 0x00000010, 0x80001fa3, 0x00000000,
+ 0x80001fa4, 0x00000010, 0x80001fa4, 0x00000000,
+ 0x80001fa5, 0x00000010, 0x80001fa5, 0x00000000,
+ 0x80001fa6, 0x00000010, 0x80001fa6, 0x00000000,
+ 0x80001fa7, 0x00000010, 0x80001fa7, 0x00000010,
+ 0x80001fb0, 0x00000010, 0x80001fb1, 0x00000010,
+ 0x80001f70, 0x00000010, 0x80001f71, 0x00000000,
+ 0x80001fb3, 0x00000010, 0x80001fb3, 0x00000010,
+ 0x80001f72, 0x00000010, 0x80001f73, 0x00000010,
+ 0x80001f74, 0x00000010, 0x80001f75, 0x00000000,
+ 0x80001fc3, 0x00000010, 0x80001fc3, 0x00000010,
+ 0x80001fd0, 0x00000010, 0x80001fd1, 0x00000010,
+ 0x80001f76, 0x00000010, 0x80001f77, 0x00000010,
+ 0x80001fe0, 0x00000010, 0x80001fe1, 0x00000010,
+ 0x80001f7a, 0x00000010, 0x80001f7b, 0x00000010,
+ 0x80001fe5, 0x00000010, 0x80001f78, 0x00000010,
+ 0x80001f79, 0x00000010, 0x80001f7c, 0x00000010,
+ 0x80001f7d, 0x00000000, 0x80001ff3, 0x00000010,
+ 0x80001ff3, 0x00000010, 0x800003c9, 0x00000010,
+ 0x8000006b, 0x00000010, 0x800000e5, 0x00000010,
+ 0x80002170, 0x00000010, 0x80002171, 0x00000010,
+ 0x80002172, 0x00000010, 0x80002173, 0x00000010,
+ 0x80002174, 0x00000010, 0x80002175, 0x00000010,
+ 0x80002176, 0x00000010, 0x80002177, 0x00000010,
+ 0x80002178, 0x00000010, 0x80002179, 0x00000010,
+ 0x8000217a, 0x00000010, 0x8000217b, 0x00000010,
+ 0x8000217c, 0x00000010, 0x8000217d, 0x00000010,
+ 0x8000217e, 0x00000010, 0x8000217f, 0x00000010,
+ 0x800024d0, 0x00000010, 0x800024d1, 0x00000010,
+ 0x800024d2, 0x00000010, 0x800024d3, 0x00000010,
+ 0x800024d4, 0x00000010, 0x800024d5, 0x00000010,
+ 0x800024d6, 0x00000010, 0x800024d7, 0x00000010,
+ 0x800024d8, 0x00000010, 0x800024d9, 0x00000010,
+ 0x800024da, 0x00000010, 0x800024db, 0x00000010,
+ 0x800024dc, 0x00000010, 0x800024dd, 0x00000010,
+ 0x800024de, 0x00000010, 0x800024df, 0x00000010,
+ 0x800024e0, 0x00000010, 0x800024e1, 0x00000010,
+ 0x800024e2, 0x00000010, 0x800024e3, 0x00000010,
+ 0x800024e4, 0x00000010, 0x800024e5, 0x00000010,
+ 0x800024e6, 0x00000010, 0x800024e7, 0x00000010,
+ 0x800024e8, 0x00000010, 0x800024e9, 0x00000010,
+ 0x8000ff41, 0x00000010, 0x8000ff42, 0x00000010,
+ 0x8000ff43, 0x00000010, 0x8000ff44, 0x00000010,
+ 0x8000ff45, 0x00000010, 0x8000ff46, 0x00000010,
+ 0x8000ff47, 0x00000010, 0x8000ff48, 0x00000010,
+ 0x8000ff49, 0x00000010, 0x8000ff4a, 0x00000010,
+ 0x8000ff4b, 0x00000010, 0x8000ff4c, 0x00000010,
+ 0x8000ff4d, 0x00000010, 0x8000ff4e, 0x00000010,
+ 0x8000ff4f, 0x00000010, 0x8000ff50, 0x00000010,
+ 0x8000ff51, 0x00000010, 0x8000ff52, 0x00000010,
+ 0x8000ff53, 0x00000010, 0x8000ff54, 0x00000010,
+ 0x8000ff55, 0x00000010, 0x8000ff56, 0x00000010,
+ 0x8000ff57, 0x00000010, 0x8000ff58, 0x00000010,
+ 0x8000ff59, 0x00000010, 0x8000ff5a, 0x00000010,
+ 0x80010428, 0x00000010, 0x80010429, 0x00000010,
+ 0x8001042a, 0x00000010, 0x8001042b, 0x00000010,
+ 0x8001042c, 0x00000010, 0x8001042d, 0x00000010,
+ 0x8001042e, 0x00000010, 0x8001042f, 0x00000010,
+ 0x80010430, 0x00000010, 0x80010431, 0x00000010,
+ 0x80010432, 0x00000010, 0x80010433, 0x00000010,
+ 0x80010434, 0x00000010, 0x80010435, 0x00000010,
+ 0x80010436, 0x00000010, 0x80010437, 0x00000010,
+ 0x80010438, 0x00000010, 0x80010439, 0x00000010,
+ 0x8001043a, 0x00000010, 0x8001043b, 0x00000010,
+ 0x8001043c, 0x00000010, 0x8001043d, 0x00000010,
+ 0x8001043e, 0x00000010, 0x8001043f, 0x00000010,
+ 0x80010440, 0x00000010, 0x80010441, 0x00000010,
+ 0x80010442, 0x00000010, 0x80010443, 0x00000010,
+ 0x80010444, 0x00000010, 0x80010445, 0x00000010,
+ 0x80010446, 0x00000010, 0x80010447, 0x00000010,
+ 0x80010448, 0x00000010, 0x80010449, 0x00000010,
+ 0x8001044a, 0x00000010, 0x8001044b, 0x00000010,
+ 0x8001044c, 0x00000010, 0x8001044d,
+};
+
+
+/*
+ * Cased characters and non-spacing marks (for casemap context)
+ */
+
+#define CASEMAP_CTX_BITS_0 9
+#define CASEMAP_CTX_BITS_1 7
+#define CASEMAP_CTX_BITS_2 5
+
+#define CTX_CASED 1
+#define CTX_NSM 2
+
+static const unsigned short v320_casemap_ctx_imap[] = {
+ 272, 400, 528, 656, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 912,
+ 1040, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 1168, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 784, 784, 784, 784, 784, 784, 784, 784,
+ 0, 0, 1, 1, 0, 2, 3, 3,
+ 4, 4, 4, 4, 4, 5, 6, 4,
+ 4, 7, 8, 4, 4, 9, 0, 0,
+ 10, 10, 11, 11, 12, 13, 14, 15,
+ 4, 4, 4, 4, 16, 4, 14, 17,
+ 18, 19, 20, 21, 22, 23, 24, 0,
+ 0, 0, 25, 26, 0, 0, 27, 28,
+ 29, 30, 31, 0, 0, 32, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 33, 34, 35, 36, 37, 34, 38, 36,
+ 39, 34, 40, 41, 33, 34, 42, 0,
+ 37, 43, 44, 0, 39, 0, 45, 0,
+ 0, 46, 47, 0, 0, 48, 49, 0,
+ 0, 0, 50, 0, 0, 0, 51, 0,
+ 0, 52, 53, 0, 0, 54, 55, 0,
+ 56, 57, 0, 58, 59, 60, 61, 0,
+ 0, 62, 56, 0, 0, 4, 63, 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, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 64, 64, 65, 65, 0, 66, 67, 0,
+ 68, 0, 0, 0, 0, 69, 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,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 4, 4, 4, 4, 70, 4, 4, 71,
+ 72, 4, 73, 74, 4, 75, 76, 77,
+ 0, 0, 0, 78, 0, 0, 79, 80,
+ 81, 82, 83, 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, 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, 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, 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, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 84, 0, 0, 85, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0,
+ 86, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 11, 87, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 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, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 4, 88, 9, 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, 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, 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, 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, 89, 90, 91, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 4, 4, 92, 4, 93, 94, 95, 4,
+ 96, 97, 98, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 99, 100, 5,
+ 92, 92, 14, 14, 101, 101, 102, 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, 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, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+static const struct {
+ unsigned char tbl[32];
+} v320_casemap_ctx_table[] = {
+ {{
+ 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, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1,
+ }},
+ {{
+ 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 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, 0, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1, 1, 0, 2, 2, 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 0, 2,
+ }},
+ {{
+ 0, 2, 2, 0, 2, 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, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 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, 2,
+ 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, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 0, 0, 2, 2, 0, 2, 2, 2, 2, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 2, 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, 0, 0, 0, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 2, 2, 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, 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, 0, 0, 0, 0, 0, 2, 0, 0, 0,
+ }},
+ {{
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 0, 0, 0,
+ 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 2, 2, 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, 0, 0,
+ }},
+ {{
+ 0, 2, 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, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 2, 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, 0, 0, 0,
+ }},
+ {{
+ 0, 2, 2, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2, 2, 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, 0, 0, 0, 0, 0, 0, 0, 0, 2,
+ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 2, 2, 2, 2, 2, 0, 2, 2, 0, 0, 0, 0, 2, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2,
+ }},
+ {{
+ 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2,
+ }},
+ {{
+ 2, 0, 0, 0, 0, 0, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0, 0,
+ 0, 0, 0, 0, 2, 2, 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,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 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, 0, 0, 2, 0, 0, 0, 0, 0, 0,
+ 0, 2, 2, 2, 0, 2, 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,
+ 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 2, 2, 2, 2, 2, 2, 0, 2, 2, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 2, 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, 0, 2, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 2, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2,
+ 0, 2, 0, 0, 0, 2, 2, 0, 2, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 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,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 2, 2, 2, 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, 0, 0,
+ 0, 2, 2, 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, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 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, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0,
+ }},
+ {{
+ 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1,
+ 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
+ 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0,
+ }},
+ {{
+ 0, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1,
+ 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 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, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 2, 0,
+ }},
+ {{
+ 2, 2, 2, 2, 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, 0, 0,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2,
+ }},
+ {{
+ 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 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, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1,
+ }},
+ {{
+ 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1,
+ }},
+ {{
+ 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1,
+ 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }},
+ {{
+ 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+};
+
+/*
+ * Case Folding
+ */
+
+#define CASE_FOLDING_BITS_0 9
+#define CASE_FOLDING_BITS_1 7
+#define CASE_FOLDING_BITS_2 5
+
+static const unsigned short v320_case_folding_imap[] = {
+ 272, 400, 528, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 784,
+ 912, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 656, 656, 656, 656, 656, 656, 656, 656,
+ 0, 0, 1, 0, 0, 2, 3, 0,
+ 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 0, 0, 0, 0, 0, 0,
+ 0, 0, 14, 0, 15, 16, 17, 18,
+ 19, 20, 0, 21, 22, 23, 24, 25,
+ 26, 27, 28, 0, 29, 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, 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, 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, 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, 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, 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, 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, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, 40, 41, 42, 43, 44, 45,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 46, 0, 47, 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, 48, 49, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 50, 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, 0, 0, 0, 0, 0,
+ 0, 51, 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, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 52, 53, 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, 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, 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,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+static const struct {
+ unsigned short tbl[32];
+} v320_case_folding_table[] = {
+ {{
+ 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, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 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, 28,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+ 51, 0, 52, 53, 54, 55, 56, 57, 58, 59,
+ }},
+ {{
+ 61, 0, 62, 0, 63, 0, 64, 0, 65, 0, 66,
+ 0, 67, 0, 68, 0, 69, 0, 70, 0, 71, 0,
+ 72, 0, 73, 0, 74, 0, 75, 0, 76, 0,
+ }},
+ {{
+ 77, 0, 78, 0, 79, 0, 80, 0, 81, 0, 82,
+ 0, 83, 0, 84, 0, 87, 0, 88, 0, 89, 0,
+ 90, 0, 0, 91, 0, 92, 0, 93, 0, 94,
+ }},
+ {{
+ 0, 95, 0, 96, 0, 97, 0, 98, 0, 99, 101,
+ 0, 102, 0, 103, 0, 104, 0, 105, 0, 106, 0,
+ 107, 0, 108, 0, 109, 0, 110, 0, 111, 0,
+ }},
+ {{
+ 112, 0, 113, 0, 114, 0, 115, 0, 116, 0, 117,
+ 0, 118, 0, 119, 0, 120, 0, 121, 0, 122, 0,
+ 123, 0, 124, 125, 0, 126, 0, 127, 0, 128,
+ }},
+ {{
+ 0, 129, 130, 0, 131, 0, 132, 133, 0, 134, 135,
+ 136, 0, 0, 137, 138, 139, 140, 0, 141, 142, 0,
+ 143, 144, 145, 0, 0, 0, 146, 147, 0, 148,
+ }},
+ {{
+ 149, 0, 150, 0, 151, 0, 152, 153, 0, 154, 0,
+ 0, 155, 0, 156, 157, 0, 158, 159, 160, 0, 161,
+ 0, 162, 163, 0, 0, 0, 164, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 165, 166, 0, 167, 168, 0, 169,
+ 170, 0, 171, 0, 172, 0, 173, 0, 174, 0, 175,
+ 0, 176, 0, 177, 0, 178, 0, 0, 179, 0,
+ }},
+ {{
+ 180, 0, 181, 0, 182, 0, 183, 0, 184, 0, 185,
+ 0, 186, 0, 187, 0, 188, 190, 191, 0, 192, 0,
+ 193, 194, 195, 0, 196, 0, 197, 0, 198, 0,
+ }},
+ {{
+ 199, 0, 200, 0, 201, 0, 202, 0, 203, 0, 204,
+ 0, 205, 0, 206, 0, 207, 0, 208, 0, 209, 0,
+ 210, 0, 211, 0, 212, 0, 213, 0, 214, 0,
+ }},
+ {{
+ 215, 0, 216, 0, 217, 0, 218, 0, 219, 0, 220,
+ 0, 221, 0, 222, 0, 223, 0, 224, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 225, 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,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 226, 0, 227, 228, 229,
+ 0, 230, 0, 231, 232, 233, 236, 237, 238, 239, 240,
+ 241, 242, 243, 244, 245, 246, 247, 248, 249, 250,
+ }},
+ {{
+ 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260,
+ 261, 0, 0, 0, 0, 262, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 265, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 266, 267, 0, 0, 0, 268,
+ 269, 0, 270, 0, 271, 0, 272, 0, 273, 0,
+ }},
+ {{
+ 274, 0, 275, 0, 276, 0, 277, 0, 278, 0, 279,
+ 0, 280, 0, 281, 0, 282, 283, 284, 0, 285, 286,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297,
+ 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308,
+ 309, 310, 311, 312, 313, 314, 315, 316, 317, 318,
+ }},
+ {{
+ 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329,
+ 330, 331, 332, 333, 334, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 335, 0, 336, 0, 337, 0, 338, 0, 339, 0, 340,
+ 0, 341, 0, 342, 0, 343, 0, 344, 0, 345, 0,
+ 346, 0, 347, 0, 348, 0, 349, 0, 350, 0,
+ }},
+ {{
+ 351, 0, 0, 0, 0, 0, 0, 0, 0, 0, 352,
+ 0, 353, 0, 354, 0, 355, 0, 356, 0, 357, 0,
+ 358, 0, 359, 0, 360, 0, 361, 0, 362, 0,
+ }},
+ {{
+ 363, 0, 364, 0, 365, 0, 366, 0, 367, 0, 368,
+ 0, 369, 0, 370, 0, 371, 0, 372, 0, 373, 0,
+ 374, 0, 375, 0, 376, 0, 377, 0, 378, 0,
+ }},
+ {{
+ 0, 379, 0, 380, 0, 381, 0, 382, 0, 383, 0,
+ 384, 0, 385, 0, 0, 386, 0, 387, 0, 388, 0,
+ 389, 0, 390, 0, 391, 0, 392, 0, 393, 0,
+ }},
+ {{
+ 394, 0, 395, 0, 396, 0, 397, 0, 398, 0, 399,
+ 0, 400, 0, 401, 0, 402, 0, 403, 0, 404, 0,
+ 0, 0, 405, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 406, 0, 407, 0, 408, 0, 409, 0, 410, 0, 411,
+ 0, 412, 0, 413, 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, 0, 0,
+ 0, 0, 0, 0, 0, 0, 414, 415, 416, 417, 418,
+ 419, 420, 421, 422, 423, 424, 425, 426, 427, 428,
+ }},
+ {{
+ 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439,
+ 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450,
+ 451, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 452, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 454, 0, 455, 0, 456, 0, 457, 0, 458, 0, 459,
+ 0, 460, 0, 461, 0, 462, 0, 463, 0, 464, 0,
+ 465, 0, 466, 0, 467, 0, 468, 0, 469, 0,
+ }},
+ {{
+ 470, 0, 471, 0, 472, 0, 473, 0, 474, 0, 475,
+ 0, 476, 0, 477, 0, 478, 0, 479, 0, 480, 0,
+ 481, 0, 482, 0, 483, 0, 484, 0, 485, 0,
+ }},
+ {{
+ 486, 0, 487, 0, 488, 0, 489, 0, 490, 0, 491,
+ 0, 492, 0, 493, 0, 494, 0, 495, 0, 496, 0,
+ 497, 0, 498, 0, 499, 0, 500, 0, 501, 0,
+ }},
+ {{
+ 502, 0, 503, 0, 504, 0, 505, 0, 506, 0, 507,
+ 0, 508, 0, 509, 0, 510, 0, 511, 0, 512, 0,
+ 513, 0, 514, 0, 515, 0, 516, 0, 517, 0,
+ }},
+ {{
+ 518, 0, 519, 0, 520, 0, 521, 0, 522, 0, 523,
+ 0, 524, 0, 525, 0, 526, 0, 527, 0, 528, 0,
+ 529, 531, 533, 535, 537, 539, 0, 0, 0, 0,
+ }},
+ {{
+ 540, 0, 541, 0, 542, 0, 543, 0, 544, 0, 545,
+ 0, 546, 0, 547, 0, 548, 0, 549, 0, 550, 0,
+ 551, 0, 552, 0, 553, 0, 554, 0, 555, 0,
+ }},
+ {{
+ 556, 0, 557, 0, 558, 0, 559, 0, 560, 0, 561,
+ 0, 562, 0, 563, 0, 564, 0, 565, 0, 566, 0,
+ 567, 0, 568, 0, 569, 0, 570, 0, 571, 0,
+ }},
+ {{
+ 572, 0, 573, 0, 574, 0, 575, 0, 576, 0, 577,
+ 0, 578, 0, 579, 0, 580, 0, 581, 0, 582, 0,
+ 583, 0, 584, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 585, 586, 587,
+ 588, 589, 590, 591, 592, 0, 0, 0, 0, 0, 0,
+ 0, 0, 593, 594, 595, 596, 597, 598, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 599, 600, 601,
+ 602, 603, 604, 605, 606, 0, 0, 0, 0, 0, 0,
+ 0, 0, 607, 608, 609, 610, 611, 612, 613, 614,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 615, 616, 617,
+ 618, 619, 620, 0, 0, 621, 0, 623, 0, 626, 0,
+ 629, 0, 0, 632, 0, 633, 0, 634, 0, 635,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 636, 637, 638,
+ 639, 640, 641, 642, 643, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 644, 646, 648, 650, 652, 654, 656, 658, 662, 665, 668,
+ 671, 674, 677, 680, 683, 684, 686, 688, 690, 692, 694,
+ 696, 698, 702, 705, 708, 711, 714, 717, 720, 723,
+ }},
+ {{
+ 724, 726, 728, 730, 732, 734, 736, 738, 742, 745, 748,
+ 751, 754, 757, 760, 763, 0, 0, 764, 766, 768, 0,
+ 770, 772, 775, 776, 777, 778, 781, 0, 782, 0,
+ }},
+ {{
+ 0, 0, 783, 785, 787, 0, 789, 791, 794, 795, 796,
+ 797, 800, 0, 0, 0, 0, 0, 801, 804, 0, 0,
+ 807, 809, 812, 813, 814, 815, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 816, 819, 822, 0, 824, 826, 829, 830, 831,
+ 832, 833, 0, 0, 0, 0, 0, 834, 836, 838, 0,
+ 840, 842, 845, 846, 847, 848, 851, 0, 0, 0,
+ }},
+ {{
+ 0, 0, 0, 0, 0, 0, 852, 0, 0, 0, 853,
+ 854, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865,
+ 866, 867, 868, 869, 870, 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, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 871, 872, 873, 874, 875, 876, 877, 878, 879, 880,
+ }},
+ {{
+ 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891,
+ 892, 893, 894, 895, 896, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 897, 899, 901, 903, 906, 909, 911, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 913, 915, 917,
+ 919, 921, 0, 0, 0, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 0, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932,
+ 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943,
+ 944, 945, 946, 947, 948, 0, 0, 0, 0, 0,
+ }},
+ {{
+ 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959,
+ 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970,
+ 971, 972, 973, 974, 975, 976, 977, 978, 979, 980,
+ }},
+ {{
+ 981, 982, 983, 984, 985, 986, 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,
+ }},
+};
+static const unsigned long v320_case_folding_seq[] = {
+ 0x00000000, 0x80000061, 0x80000062, 0x80000063,
+ 0x80000064, 0x80000065, 0x80000066, 0x80000067,
+ 0x80000068, 0x80000069, 0x80000131, 0x8000006a,
+ 0x8000006b, 0x8000006c, 0x8000006d, 0x8000006e,
+ 0x8000006f, 0x80000070, 0x80000071, 0x80000072,
+ 0x80000073, 0x80000074, 0x80000075, 0x80000076,
+ 0x80000077, 0x80000078, 0x80000079, 0x8000007a,
+ 0x800003bc, 0x800000e0, 0x800000e1, 0x800000e2,
+ 0x800000e3, 0x800000e4, 0x800000e5, 0x800000e6,
+ 0x800000e7, 0x800000e8, 0x800000e9, 0x800000ea,
+ 0x800000eb, 0x800000ec, 0x800000ed, 0x800000ee,
+ 0x800000ef, 0x800000f0, 0x800000f1, 0x800000f2,
+ 0x800000f3, 0x800000f4, 0x800000f5, 0x800000f6,
+ 0x800000f8, 0x800000f9, 0x800000fa, 0x800000fb,
+ 0x800000fc, 0x800000fd, 0x800000fe, 0x00000073,
+ 0x80000073, 0x80000101, 0x80000103, 0x80000105,
+ 0x80000107, 0x80000109, 0x8000010b, 0x8000010d,
+ 0x8000010f, 0x80000111, 0x80000113, 0x80000115,
+ 0x80000117, 0x80000119, 0x8000011b, 0x8000011d,
+ 0x8000011f, 0x80000121, 0x80000123, 0x80000125,
+ 0x80000127, 0x80000129, 0x8000012b, 0x8000012d,
+ 0x8000012f, 0x00000069, 0x80000307, 0x80000069,
+ 0x80000133, 0x80000135, 0x80000137, 0x8000013a,
+ 0x8000013c, 0x8000013e, 0x80000140, 0x80000142,
+ 0x80000144, 0x80000146, 0x80000148, 0x000002bc,
+ 0x8000006e, 0x8000014b, 0x8000014d, 0x8000014f,
+ 0x80000151, 0x80000153, 0x80000155, 0x80000157,
+ 0x80000159, 0x8000015b, 0x8000015d, 0x8000015f,
+ 0x80000161, 0x80000163, 0x80000165, 0x80000167,
+ 0x80000169, 0x8000016b, 0x8000016d, 0x8000016f,
+ 0x80000171, 0x80000173, 0x80000175, 0x80000177,
+ 0x800000ff, 0x8000017a, 0x8000017c, 0x8000017e,
+ 0x80000073, 0x80000253, 0x80000183, 0x80000185,
+ 0x80000254, 0x80000188, 0x80000256, 0x80000257,
+ 0x8000018c, 0x800001dd, 0x80000259, 0x8000025b,
+ 0x80000192, 0x80000260, 0x80000263, 0x80000269,
+ 0x80000268, 0x80000199, 0x8000026f, 0x80000272,
+ 0x80000275, 0x800001a1, 0x800001a3, 0x800001a5,
+ 0x80000280, 0x800001a8, 0x80000283, 0x800001ad,
+ 0x80000288, 0x800001b0, 0x8000028a, 0x8000028b,
+ 0x800001b4, 0x800001b6, 0x80000292, 0x800001b9,
+ 0x800001bd, 0x800001c6, 0x800001c6, 0x800001c9,
+ 0x800001c9, 0x800001cc, 0x800001cc, 0x800001ce,
+ 0x800001d0, 0x800001d2, 0x800001d4, 0x800001d6,
+ 0x800001d8, 0x800001da, 0x800001dc, 0x800001df,
+ 0x800001e1, 0x800001e3, 0x800001e5, 0x800001e7,
+ 0x800001e9, 0x800001eb, 0x800001ed, 0x800001ef,
+ 0x0000006a, 0x8000030c, 0x800001f3, 0x800001f3,
+ 0x800001f5, 0x80000195, 0x800001bf, 0x800001f9,
+ 0x800001fb, 0x800001fd, 0x800001ff, 0x80000201,
+ 0x80000203, 0x80000205, 0x80000207, 0x80000209,
+ 0x8000020b, 0x8000020d, 0x8000020f, 0x80000211,
+ 0x80000213, 0x80000215, 0x80000217, 0x80000219,
+ 0x8000021b, 0x8000021d, 0x8000021f, 0x8000019e,
+ 0x80000223, 0x80000225, 0x80000227, 0x80000229,
+ 0x8000022b, 0x8000022d, 0x8000022f, 0x80000231,
+ 0x80000233, 0x800003b9, 0x800003ac, 0x800003ad,
+ 0x800003ae, 0x800003af, 0x800003cc, 0x800003cd,
+ 0x800003ce, 0x000003b9, 0x00000308, 0x80000301,
+ 0x800003b1, 0x800003b2, 0x800003b3, 0x800003b4,
+ 0x800003b5, 0x800003b6, 0x800003b7, 0x800003b8,
+ 0x800003b9, 0x800003ba, 0x800003bb, 0x800003bc,
+ 0x800003bd, 0x800003be, 0x800003bf, 0x800003c0,
+ 0x800003c1, 0x800003c3, 0x800003c4, 0x800003c5,
+ 0x800003c6, 0x800003c7, 0x800003c8, 0x800003c9,
+ 0x800003ca, 0x800003cb, 0x000003c5, 0x00000308,
+ 0x80000301, 0x800003c3, 0x800003b2, 0x800003b8,
+ 0x800003c6, 0x800003c0, 0x800003d9, 0x800003db,
+ 0x800003dd, 0x800003df, 0x800003e1, 0x800003e3,
+ 0x800003e5, 0x800003e7, 0x800003e9, 0x800003eb,
+ 0x800003ed, 0x800003ef, 0x800003ba, 0x800003c1,
+ 0x800003c3, 0x800003b8, 0x800003b5, 0x80000450,
+ 0x80000451, 0x80000452, 0x80000453, 0x80000454,
+ 0x80000455, 0x80000456, 0x80000457, 0x80000458,
+ 0x80000459, 0x8000045a, 0x8000045b, 0x8000045c,
+ 0x8000045d, 0x8000045e, 0x8000045f, 0x80000430,
+ 0x80000431, 0x80000432, 0x80000433, 0x80000434,
+ 0x80000435, 0x80000436, 0x80000437, 0x80000438,
+ 0x80000439, 0x8000043a, 0x8000043b, 0x8000043c,
+ 0x8000043d, 0x8000043e, 0x8000043f, 0x80000440,
+ 0x80000441, 0x80000442, 0x80000443, 0x80000444,
+ 0x80000445, 0x80000446, 0x80000447, 0x80000448,
+ 0x80000449, 0x8000044a, 0x8000044b, 0x8000044c,
+ 0x8000044d, 0x8000044e, 0x8000044f, 0x80000461,
+ 0x80000463, 0x80000465, 0x80000467, 0x80000469,
+ 0x8000046b, 0x8000046d, 0x8000046f, 0x80000471,
+ 0x80000473, 0x80000475, 0x80000477, 0x80000479,
+ 0x8000047b, 0x8000047d, 0x8000047f, 0x80000481,
+ 0x8000048b, 0x8000048d, 0x8000048f, 0x80000491,
+ 0x80000493, 0x80000495, 0x80000497, 0x80000499,
+ 0x8000049b, 0x8000049d, 0x8000049f, 0x800004a1,
+ 0x800004a3, 0x800004a5, 0x800004a7, 0x800004a9,
+ 0x800004ab, 0x800004ad, 0x800004af, 0x800004b1,
+ 0x800004b3, 0x800004b5, 0x800004b7, 0x800004b9,
+ 0x800004bb, 0x800004bd, 0x800004bf, 0x800004c2,
+ 0x800004c4, 0x800004c6, 0x800004c8, 0x800004ca,
+ 0x800004cc, 0x800004ce, 0x800004d1, 0x800004d3,
+ 0x800004d5, 0x800004d7, 0x800004d9, 0x800004db,
+ 0x800004dd, 0x800004df, 0x800004e1, 0x800004e3,
+ 0x800004e5, 0x800004e7, 0x800004e9, 0x800004eb,
+ 0x800004ed, 0x800004ef, 0x800004f1, 0x800004f3,
+ 0x800004f5, 0x800004f9, 0x80000501, 0x80000503,
+ 0x80000505, 0x80000507, 0x80000509, 0x8000050b,
+ 0x8000050d, 0x8000050f, 0x80000561, 0x80000562,
+ 0x80000563, 0x80000564, 0x80000565, 0x80000566,
+ 0x80000567, 0x80000568, 0x80000569, 0x8000056a,
+ 0x8000056b, 0x8000056c, 0x8000056d, 0x8000056e,
+ 0x8000056f, 0x80000570, 0x80000571, 0x80000572,
+ 0x80000573, 0x80000574, 0x80000575, 0x80000576,
+ 0x80000577, 0x80000578, 0x80000579, 0x8000057a,
+ 0x8000057b, 0x8000057c, 0x8000057d, 0x8000057e,
+ 0x8000057f, 0x80000580, 0x80000581, 0x80000582,
+ 0x80000583, 0x80000584, 0x80000585, 0x80000586,
+ 0x00000565, 0x80000582, 0x80001e01, 0x80001e03,
+ 0x80001e05, 0x80001e07, 0x80001e09, 0x80001e0b,
+ 0x80001e0d, 0x80001e0f, 0x80001e11, 0x80001e13,
+ 0x80001e15, 0x80001e17, 0x80001e19, 0x80001e1b,
+ 0x80001e1d, 0x80001e1f, 0x80001e21, 0x80001e23,
+ 0x80001e25, 0x80001e27, 0x80001e29, 0x80001e2b,
+ 0x80001e2d, 0x80001e2f, 0x80001e31, 0x80001e33,
+ 0x80001e35, 0x80001e37, 0x80001e39, 0x80001e3b,
+ 0x80001e3d, 0x80001e3f, 0x80001e41, 0x80001e43,
+ 0x80001e45, 0x80001e47, 0x80001e49, 0x80001e4b,
+ 0x80001e4d, 0x80001e4f, 0x80001e51, 0x80001e53,
+ 0x80001e55, 0x80001e57, 0x80001e59, 0x80001e5b,
+ 0x80001e5d, 0x80001e5f, 0x80001e61, 0x80001e63,
+ 0x80001e65, 0x80001e67, 0x80001e69, 0x80001e6b,
+ 0x80001e6d, 0x80001e6f, 0x80001e71, 0x80001e73,
+ 0x80001e75, 0x80001e77, 0x80001e79, 0x80001e7b,
+ 0x80001e7d, 0x80001e7f, 0x80001e81, 0x80001e83,
+ 0x80001e85, 0x80001e87, 0x80001e89, 0x80001e8b,
+ 0x80001e8d, 0x80001e8f, 0x80001e91, 0x80001e93,
+ 0x80001e95, 0x00000068, 0x80000331, 0x00000074,
+ 0x80000308, 0x00000077, 0x8000030a, 0x00000079,
+ 0x8000030a, 0x00000061, 0x800002be, 0x80001e61,
+ 0x80001ea1, 0x80001ea3, 0x80001ea5, 0x80001ea7,
+ 0x80001ea9, 0x80001eab, 0x80001ead, 0x80001eaf,
+ 0x80001eb1, 0x80001eb3, 0x80001eb5, 0x80001eb7,
+ 0x80001eb9, 0x80001ebb, 0x80001ebd, 0x80001ebf,
+ 0x80001ec1, 0x80001ec3, 0x80001ec5, 0x80001ec7,
+ 0x80001ec9, 0x80001ecb, 0x80001ecd, 0x80001ecf,
+ 0x80001ed1, 0x80001ed3, 0x80001ed5, 0x80001ed7,
+ 0x80001ed9, 0x80001edb, 0x80001edd, 0x80001edf,
+ 0x80001ee1, 0x80001ee3, 0x80001ee5, 0x80001ee7,
+ 0x80001ee9, 0x80001eeb, 0x80001eed, 0x80001eef,
+ 0x80001ef1, 0x80001ef3, 0x80001ef5, 0x80001ef7,
+ 0x80001ef9, 0x80001f00, 0x80001f01, 0x80001f02,
+ 0x80001f03, 0x80001f04, 0x80001f05, 0x80001f06,
+ 0x80001f07, 0x80001f10, 0x80001f11, 0x80001f12,
+ 0x80001f13, 0x80001f14, 0x80001f15, 0x80001f20,
+ 0x80001f21, 0x80001f22, 0x80001f23, 0x80001f24,
+ 0x80001f25, 0x80001f26, 0x80001f27, 0x80001f30,
+ 0x80001f31, 0x80001f32, 0x80001f33, 0x80001f34,
+ 0x80001f35, 0x80001f36, 0x80001f37, 0x80001f40,
+ 0x80001f41, 0x80001f42, 0x80001f43, 0x80001f44,
+ 0x80001f45, 0x000003c5, 0x80000313, 0x000003c5,
+ 0x00000313, 0x80000300, 0x000003c5, 0x00000313,
+ 0x80000301, 0x000003c5, 0x00000313, 0x80000342,
+ 0x80001f51, 0x80001f53, 0x80001f55, 0x80001f57,
+ 0x80001f60, 0x80001f61, 0x80001f62, 0x80001f63,
+ 0x80001f64, 0x80001f65, 0x80001f66, 0x80001f67,
+ 0x00001f00, 0x800003b9, 0x00001f01, 0x800003b9,
+ 0x00001f02, 0x800003b9, 0x00001f03, 0x800003b9,
+ 0x00001f04, 0x800003b9, 0x00001f05, 0x800003b9,
+ 0x00001f06, 0x800003b9, 0x00001f07, 0x800003b9,
+ 0x00001f00, 0x800003b9, 0x80001f80, 0x00001f01,
+ 0x800003b9, 0x80001f81, 0x00001f02, 0x800003b9,
+ 0x80001f82, 0x00001f03, 0x800003b9, 0x80001f83,
+ 0x00001f04, 0x800003b9, 0x80001f84, 0x00001f05,
+ 0x800003b9, 0x80001f85, 0x00001f06, 0x800003b9,
+ 0x80001f86, 0x00001f07, 0x800003b9, 0x80001f87,
+ 0x00001f20, 0x800003b9, 0x00001f21, 0x800003b9,
+ 0x00001f22, 0x800003b9, 0x00001f23, 0x800003b9,
+ 0x00001f24, 0x800003b9, 0x00001f25, 0x800003b9,
+ 0x00001f26, 0x800003b9, 0x00001f27, 0x800003b9,
+ 0x00001f20, 0x800003b9, 0x80001f90, 0x00001f21,
+ 0x800003b9, 0x80001f91, 0x00001f22, 0x800003b9,
+ 0x80001f92, 0x00001f23, 0x800003b9, 0x80001f93,
+ 0x00001f24, 0x800003b9, 0x80001f94, 0x00001f25,
+ 0x800003b9, 0x80001f95, 0x00001f26, 0x800003b9,
+ 0x80001f96, 0x00001f27, 0x800003b9, 0x80001f97,
+ 0x00001f60, 0x800003b9, 0x00001f61, 0x800003b9,
+ 0x00001f62, 0x800003b9, 0x00001f63, 0x800003b9,
+ 0x00001f64, 0x800003b9, 0x00001f65, 0x800003b9,
+ 0x00001f66, 0x800003b9, 0x00001f67, 0x800003b9,
+ 0x00001f60, 0x800003b9, 0x80001fa0, 0x00001f61,
+ 0x800003b9, 0x80001fa1, 0x00001f62, 0x800003b9,
+ 0x80001fa2, 0x00001f63, 0x800003b9, 0x80001fa3,
+ 0x00001f64, 0x800003b9, 0x80001fa4, 0x00001f65,
+ 0x800003b9, 0x80001fa5, 0x00001f66, 0x800003b9,
+ 0x80001fa6, 0x00001f67, 0x800003b9, 0x80001fa7,
+ 0x00001f70, 0x800003b9, 0x000003b1, 0x800003b9,
+ 0x000003ac, 0x800003b9, 0x000003b1, 0x80000342,
+ 0x000003b1, 0x00000342, 0x800003b9, 0x80001fb0,
+ 0x80001fb1, 0x80001f70, 0x80001f71, 0x000003b1,
+ 0x800003b9, 0x80001fb3, 0x800003b9, 0x00001f74,
+ 0x800003b9, 0x000003b7, 0x800003b9, 0x000003ae,
+ 0x800003b9, 0x000003b7, 0x80000342, 0x000003b7,
+ 0x00000342, 0x800003b9, 0x80001f72, 0x80001f73,
+ 0x80001f74, 0x80001f75, 0x000003b7, 0x800003b9,
+ 0x80001fc3, 0x000003b9, 0x00000308, 0x80000300,
+ 0x000003b9, 0x00000308, 0x80000301, 0x000003b9,
+ 0x80000342, 0x000003b9, 0x00000308, 0x80000342,
+ 0x80001fd0, 0x80001fd1, 0x80001f76, 0x80001f77,
+ 0x000003c5, 0x00000308, 0x80000300, 0x000003c5,
+ 0x00000308, 0x80000301, 0x000003c1, 0x80000313,
+ 0x000003c5, 0x80000342, 0x000003c5, 0x00000308,
+ 0x80000342, 0x80001fe0, 0x80001fe1, 0x80001f7a,
+ 0x80001f7b, 0x80001fe5, 0x00001f7c, 0x800003b9,
+ 0x000003c9, 0x800003b9, 0x000003ce, 0x800003b9,
+ 0x000003c9, 0x80000342, 0x000003c9, 0x00000342,
+ 0x800003b9, 0x80001f78, 0x80001f79, 0x80001f7c,
+ 0x80001f7d, 0x000003c9, 0x800003b9, 0x80001ff3,
+ 0x800003c9, 0x8000006b, 0x800000e5, 0x80002170,
+ 0x80002171, 0x80002172, 0x80002173, 0x80002174,
+ 0x80002175, 0x80002176, 0x80002177, 0x80002178,
+ 0x80002179, 0x8000217a, 0x8000217b, 0x8000217c,
+ 0x8000217d, 0x8000217e, 0x8000217f, 0x800024d0,
+ 0x800024d1, 0x800024d2, 0x800024d3, 0x800024d4,
+ 0x800024d5, 0x800024d6, 0x800024d7, 0x800024d8,
+ 0x800024d9, 0x800024da, 0x800024db, 0x800024dc,
+ 0x800024dd, 0x800024de, 0x800024df, 0x800024e0,
+ 0x800024e1, 0x800024e2, 0x800024e3, 0x800024e4,
+ 0x800024e5, 0x800024e6, 0x800024e7, 0x800024e8,
+ 0x800024e9, 0x00000066, 0x80000066, 0x00000066,
+ 0x80000069, 0x00000066, 0x8000006c, 0x00000066,
+ 0x00000066, 0x80000069, 0x00000066, 0x00000066,
+ 0x8000006c, 0x00000073, 0x80000074, 0x00000073,
+ 0x80000074, 0x00000574, 0x80000576, 0x00000574,
+ 0x80000565, 0x00000574, 0x8000056b, 0x0000057e,
+ 0x80000576, 0x00000574, 0x8000056d, 0x8000ff41,
+ 0x8000ff42, 0x8000ff43, 0x8000ff44, 0x8000ff45,
+ 0x8000ff46, 0x8000ff47, 0x8000ff48, 0x8000ff49,
+ 0x8000ff4a, 0x8000ff4b, 0x8000ff4c, 0x8000ff4d,
+ 0x8000ff4e, 0x8000ff4f, 0x8000ff50, 0x8000ff51,
+ 0x8000ff52, 0x8000ff53, 0x8000ff54, 0x8000ff55,
+ 0x8000ff56, 0x8000ff57, 0x8000ff58, 0x8000ff59,
+ 0x8000ff5a, 0x80010428, 0x80010429, 0x8001042a,
+ 0x8001042b, 0x8001042c, 0x8001042d, 0x8001042e,
+ 0x8001042f, 0x80010430, 0x80010431, 0x80010432,
+ 0x80010433, 0x80010434, 0x80010435, 0x80010436,
+ 0x80010437, 0x80010438, 0x80010439, 0x8001043a,
+ 0x8001043b, 0x8001043c, 0x8001043d, 0x8001043e,
+ 0x8001043f, 0x80010440, 0x80010441, 0x80010442,
+ 0x80010443, 0x80010444, 0x80010445, 0x80010446,
+ 0x80010447, 0x80010448, 0x80010449, 0x8001044a,
+ 0x8001044b, 0x8001044c, 0x8001044d,
+};
+
diff --git a/contrib/idn/idnkit-1.0-src/lib/unormalize.c b/contrib/idn/idnkit-1.0-src/lib/unormalize.c
new file mode 100644
index 0000000..f741724
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/unormalize.c
@@ -0,0 +1,413 @@
+#ifndef lint
+static char *rcsid = "$Id: unormalize.c,v 1.1.1.1 2003/06/04 00:26:43 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000,2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <idn/result.h>
+#include <idn/assert.h>
+#include <idn/logmacro.h>
+#include <idn/ucs4.h>
+#include <idn/unicode.h>
+#include <idn/unormalize.h>
+#include <idn/debug.h>
+
+#if !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY)
+#define memmove(a,b,c) bcopy((char *)(b),(char *)(a),(int)(c))
+#endif
+
+#define WORKBUF_SIZE 128
+#define WORKBUF_SIZE_MAX 10000
+
+typedef struct {
+ idn__unicode_version_t version; /* Unicode version */
+ int cur; /* pointing now processing character */
+ int last; /* pointing just after the last character */
+ int size; /* size of UCS and CLASS array */
+ unsigned long *ucs4; /* UCS-4 characters */
+ int *class; /* and their canonical classes */
+ unsigned long ucs4_buf[WORKBUF_SIZE]; /* local buffer */
+ int class_buf[WORKBUF_SIZE]; /* ditto */
+} workbuf_t;
+
+static idn_result_t normalize(idn__unicode_version_t version,
+ int do_composition, int compat,
+ const unsigned long *from,
+ unsigned long *to, size_t tolen);
+static idn_result_t decompose(workbuf_t *wb, unsigned long c, int compat);
+static void get_class(workbuf_t *wb);
+static void reorder(workbuf_t *wb);
+static void compose(workbuf_t *wb);
+static idn_result_t flush_before_cur(workbuf_t *wb,
+ unsigned long **top, size_t *tolenp);
+static void workbuf_init(workbuf_t *wb);
+static void workbuf_free(workbuf_t *wb);
+static idn_result_t workbuf_extend(workbuf_t *wb);
+static idn_result_t workbuf_append(workbuf_t *wb, unsigned long c);
+static void workbuf_shift(workbuf_t *wb, int shift);
+static void workbuf_removevoid(workbuf_t *wb);
+
+idn_result_t
+idn__unormalize_formkc(idn__unicode_version_t version,
+ const unsigned long *from, unsigned long *to,
+ size_t tolen) {
+ assert(version != NULL && from != NULL && to != NULL && tolen >= 0);
+ TRACE(("idn__unormalize_formkc(from=\"%s\", tolen=%d)\n",
+ idn__debug_ucs4xstring(from, 50), tolen));
+ return (normalize(version, 1, 1, from, to, tolen));
+}
+
+static idn_result_t
+normalize(idn__unicode_version_t version, int do_composition, int compat,
+ const unsigned long *from, unsigned long *to, size_t tolen) {
+ workbuf_t wb;
+ idn_result_t r = idn_success;
+
+ /*
+ * Initialize working buffer.
+ */
+ workbuf_init(&wb);
+ wb.version = version;
+
+ while (*from != '\0') {
+ unsigned long c;
+
+ assert(wb.cur == wb.last);
+
+ /*
+ * Get one character from 'from'.
+ */
+ c = *from++;
+
+ /*
+ * Decompose it.
+ */
+ if ((r = decompose(&wb, c, compat)) != idn_success)
+ goto ret;
+
+ /*
+ * Get canonical class.
+ */
+ get_class(&wb);
+
+ /*
+ * Reorder & compose.
+ */
+ for (; wb.cur < wb.last; wb.cur++) {
+ if (wb.cur == 0) {
+ continue;
+ } else if (wb.class[wb.cur] > 0) {
+ /*
+ * This is not a starter. Try reordering.
+ * Note that characters up to it are
+ * already in canonical order.
+ */
+ reorder(&wb);
+ continue;
+ }
+
+ /*
+ * This is a starter character, and there are
+ * some characters before it. Those characters
+ * have been reordered properly, and
+ * ready for composition.
+ */
+ if (do_composition && wb.class[0] == 0)
+ compose(&wb);
+
+ /*
+ * If CUR points to a starter character,
+ * then process of characters before CUR are
+ * already finished, because any further
+ * reordering/composition for them are blocked
+ * by the starter CUR points.
+ */
+ if (wb.cur > 0 && wb.class[wb.cur] == 0) {
+ /* Flush everything before CUR. */
+ r = flush_before_cur(&wb, &to, &tolen);
+ if (r != idn_success)
+ goto ret;
+ }
+ }
+ }
+
+ if (r == idn_success) {
+ if (do_composition && wb.cur > 0 && wb.class[0] == 0) {
+ /*
+ * There is some characters left in WB.
+ * They are ordered, but not composed yet.
+ * Now CUR points just after the last character in WB,
+ * and since compose() tries to compose characters
+ * between top and CUR inclusive, we must make CUR
+ * one character back during compose().
+ */
+ wb.cur--;
+ compose(&wb);
+ wb.cur++;
+ }
+ /*
+ * Call this even when WB.CUR == 0, to make TO
+ * NUL-terminated.
+ */
+ r = flush_before_cur(&wb, &to, &tolen);
+ if (r != idn_success)
+ goto ret;
+ }
+
+ if (tolen <= 0) {
+ r = idn_buffer_overflow;
+ goto ret;
+ }
+ *to = '\0';
+
+ret:
+ workbuf_free(&wb);
+ return (r);
+}
+
+static idn_result_t
+decompose(workbuf_t *wb, unsigned long c, int compat) {
+ idn_result_t r;
+ int dec_len;
+
+again:
+ r = idn__unicode_decompose(wb->version, compat, wb->ucs4 + wb->last,
+ wb->size - wb->last, c, &dec_len);
+ switch (r) {
+ case idn_success:
+ wb->last += dec_len;
+ return (idn_success);
+ case idn_notfound:
+ return (workbuf_append(wb, c));
+ case idn_buffer_overflow:
+ if ((r = workbuf_extend(wb)) != idn_success)
+ return (r);
+ if (wb->size > WORKBUF_SIZE_MAX) {
+ WARNING(("idn__unormalize_form*: "
+ "working buffer too large\n"));
+ return (idn_nomemory);
+ }
+ goto again;
+ default:
+ return (r);
+ }
+ /* NOTREACHED */
+}
+
+static void
+get_class(workbuf_t *wb) {
+ int i;
+
+ for (i = wb->cur; i < wb->last; i++)
+ wb->class[i] = idn__unicode_canonicalclass(wb->version,
+ wb->ucs4[i]);
+}
+
+static void
+reorder(workbuf_t *wb) {
+ unsigned long c;
+ int i;
+ int class;
+
+ assert(wb != NULL);
+
+ i = wb->cur;
+ c = wb->ucs4[i];
+ class = wb->class[i];
+
+ while (i > 0 && wb->class[i - 1] > class) {
+ wb->ucs4[i] = wb->ucs4[i - 1];
+ wb->class[i] =wb->class[i - 1];
+ i--;
+ wb->ucs4[i] = c;
+ wb->class[i] = class;
+ }
+}
+
+static void
+compose(workbuf_t *wb) {
+ int cur;
+ unsigned long *ucs4;
+ int *class;
+ int last_class;
+ int nvoids;
+ int i;
+ idn__unicode_version_t ver;
+
+ assert(wb != NULL && wb->class[0] == 0);
+
+ cur = wb->cur;
+ ucs4 = wb->ucs4;
+ class = wb->class;
+ ver = wb->version;
+
+ /*
+ * If there are no decomposition sequence that begins with
+ * the top character, composition is impossible.
+ */
+ if (!idn__unicode_iscompositecandidate(ver, ucs4[0]))
+ return;
+
+ last_class = 0;
+ nvoids = 0;
+ for (i = 1; i <= cur; i++) {
+ unsigned long c;
+ int cl = class[i];
+
+ if ((last_class < cl || cl == 0) &&
+ idn__unicode_compose(ver, ucs4[0], ucs4[i],
+ &c) == idn_success) {
+ /*
+ * Replace the top character with the composed one.
+ */
+ ucs4[0] = c;
+ class[0] = idn__unicode_canonicalclass(ver, c);
+
+ class[i] = -1; /* void this character */
+ nvoids++;
+ } else {
+ last_class = cl;
+ }
+ }
+
+ /* Purge void characters, if any. */
+ if (nvoids > 0)
+ workbuf_removevoid(wb);
+}
+
+static idn_result_t
+flush_before_cur(workbuf_t *wb, unsigned long **top, size_t *tolenp) {
+ if (*tolenp < wb->cur)
+ return (idn_buffer_overflow);
+
+ memcpy(*top, wb->ucs4, sizeof(**top) * wb->cur);
+ *top += wb->cur;
+ *tolenp -= wb->cur;
+ workbuf_shift(wb, wb->cur);
+
+ return (idn_success);
+}
+
+static void
+workbuf_init(workbuf_t *wb) {
+ wb->cur = 0;
+ wb->last = 0;
+ wb->size = WORKBUF_SIZE;
+ wb->ucs4 = wb->ucs4_buf;
+ wb->class = wb->class_buf;
+}
+
+static void
+workbuf_free(workbuf_t *wb) {
+ if (wb->ucs4 != wb->ucs4_buf) {
+ free(wb->ucs4);
+ free(wb->class);
+ }
+}
+
+static idn_result_t
+workbuf_extend(workbuf_t *wb) {
+ int newsize = wb->size * 3;
+
+ if (wb->ucs4 == wb->ucs4_buf) {
+ wb->ucs4 = malloc(sizeof(wb->ucs4[0]) * newsize);
+ wb->class = malloc(sizeof(wb->class[0]) * newsize);
+ } else {
+ wb->ucs4 = realloc(wb->ucs4, sizeof(wb->ucs4[0]) * newsize);
+ wb->class = realloc(wb->class, sizeof(wb->class[0]) * newsize);
+ }
+ if (wb->ucs4 == NULL || wb->class == NULL)
+ return (idn_nomemory);
+ else
+ return (idn_success);
+}
+
+static idn_result_t
+workbuf_append(workbuf_t *wb, unsigned long c) {
+ idn_result_t r;
+
+ if (wb->last >= wb->size && (r = workbuf_extend(wb)) != idn_success)
+ return (r);
+ wb->ucs4[wb->last++] = c;
+ return (idn_success);
+}
+
+static void
+workbuf_shift(workbuf_t *wb, int shift) {
+ int nmove;
+
+ assert(wb != NULL && wb->cur >= shift);
+
+ nmove = wb->last - shift;
+ (void)memmove(&wb->ucs4[0], &wb->ucs4[shift],
+ nmove * sizeof(wb->ucs4[0]));
+ (void)memmove(&wb->class[0], &wb->class[shift],
+ nmove * sizeof(wb->class[0]));
+ wb->cur -= shift;
+ wb->last -= shift;
+}
+
+static void
+workbuf_removevoid(workbuf_t *wb) {
+ int i, j;
+ int last = wb->last;
+
+ for (i = j = 0; i < last; i++) {
+ if (wb->class[i] >= 0) {
+ if (j < i) {
+ wb->ucs4[j] = wb->ucs4[i];
+ wb->class[j] = wb->class[i];
+ }
+ j++;
+ }
+ }
+ wb->cur -= last - j;
+ wb->last = j;
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/utf8.c b/contrib/idn/idnkit-1.0-src/lib/utf8.c
new file mode 100644
index 0000000..7a9acd6
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/utf8.c
@@ -0,0 +1,276 @@
+#ifndef lint
+static char *rcsid = "$Id: utf8.c,v 1.1.1.1 2003/06/04 00:26:44 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+
+#include <idn/assert.h>
+#include <idn/logmacro.h>
+#include <idn/utf8.h>
+#include <idn/debug.h>
+
+#define UTF8_WIDTH(c) \
+ (((c) < 0x80) ? 1 : \
+ ((c) < 0xc0) ? 0 : \
+ ((c) < 0xe0) ? 2 : \
+ ((c) < 0xf0) ? 3 : \
+ ((c) < 0xf8) ? 4 : \
+ ((c) < 0xfc) ? 5 : \
+ ((c) < 0xfe) ? 6 : 0)
+
+#define VALID_CONT_BYTE(c) (0x80 <= (c) && (c) < 0xc0)
+
+int
+idn_utf8_mblen(const char *s) {
+ int c = *(unsigned char *)s;
+
+ assert(s != NULL);
+
+#if 0
+ TRACE(("idn_utf8_mblen(s=<%s>)\n", idn__debug_hexstring(s, 6)));
+#endif
+
+ return UTF8_WIDTH(c);
+}
+
+int
+idn_utf8_getmb(const char *s, size_t len, char *buf) {
+ /* buf must be at least 7-bytes long */
+ const unsigned char *p = (const unsigned char *)s;
+ unsigned char *q = (unsigned char *)buf;
+ int width = UTF8_WIDTH(*p);
+ int w;
+
+ assert(s != NULL);
+
+#if 0
+ TRACE(("idn_utf8_getmb(s=<%s>,len=%d)\n",
+ idn__debug_hexstring(s, 6), len));
+#endif
+
+ if (width == 0 || len < width)
+ return (0);
+
+ /* Copy the first byte. */
+ *q++ = *p++;
+
+ /* .. and the rest. */
+ w = width;
+ while (--w > 0) {
+ if (!VALID_CONT_BYTE(*p))
+ return (0);
+ *q++ = *p++;
+ }
+ return (width);
+}
+
+int
+idn_utf8_getwc(const char *s, size_t len, unsigned long *vp) {
+ unsigned long v;
+ unsigned long min;
+ const unsigned char *p = (const unsigned char *)s;
+ int c;
+ int width;
+ int rest;
+
+ assert(s != NULL);
+
+#if 0
+ TRACE(("idn_utf8_getwc(s=<%s>,len=%d)\n",
+ idn__debug_hexstring(s, 10), len));
+#endif
+
+ c = *p++;
+ width = UTF8_WIDTH(c);
+
+ switch (width) {
+ case 0:
+ return (0);
+ case 1:
+ v = c;
+ min = 0;
+ break;
+ case 2:
+ v = c & 0x1f;
+ min = 0x80;
+ break;
+ case 3:
+ v = c & 0xf;
+ min = 0x800;
+ break;
+ case 4:
+ v = c & 0x7;
+ min = 0x10000;
+ break;
+ case 5:
+ v = c & 3;
+ min = 0x200000;
+ break;
+ case 6:
+ v = c & 1;
+ min = 0x4000000;
+ break;
+ default:
+ FATAL(("idn_utf8_getint: internal error\n"));
+ return (0);
+ }
+
+ if (len < width)
+ return (0);
+
+ rest = width - 1;
+ while (rest-- > 0) {
+ if (!VALID_CONT_BYTE(*p))
+ return (0);
+ v = (v << 6) | (*p & 0x3f);
+ p++;
+ }
+
+ if (v < min)
+ return (0);
+
+ *vp = v;
+ return (width);
+}
+
+int
+idn_utf8_putwc(char *s, size_t len, unsigned long v) {
+ unsigned char *p = (unsigned char *)s;
+ int mask;
+ int off;
+ int l;
+
+ assert(s != NULL);
+
+#if 0
+ TRACE(("idn_utf8_putwc(v=%lx)\n", v));
+#endif
+
+ if (v < 0x80) {
+ mask = 0;
+ l = 1;
+ } else if (v < 0x800) {
+ mask = 0xc0;
+ l = 2;
+ } else if (v < 0x10000) {
+ mask = 0xe0;
+ l = 3;
+ } else if (v < 0x200000) {
+ mask = 0xf0;
+ l = 4;
+ } else if (v < 0x4000000) {
+ mask = 0xf8;
+ l = 5;
+ } else if (v < 0x80000000) {
+ mask = 0xfc;
+ l = 6;
+ } else {
+ return (0);
+ }
+
+ if (len < l)
+ return (0);
+
+ off = 6 * (l - 1);
+ *p++ = (v >> off) | mask;
+ mask = 0x80;
+ while (off > 0) {
+ off -= 6;
+ *p++ = ((v >> off) & 0x3f) | mask;
+ }
+ return l;
+}
+
+int
+idn_utf8_isvalidchar(const char *s) {
+ unsigned long dummy;
+
+ TRACE(("idn_utf8_isvalidchar(s=<%s>)\n",
+ idn__debug_hexstring(s, 6)));
+
+ return (idn_utf8_getwc(s, 6, &dummy) > 0);
+}
+
+int
+idn_utf8_isvalidstring(const char *s) {
+ unsigned long dummy;
+ int width;
+
+ assert(s != NULL);
+
+ TRACE(("idn_utf8_isvalidstring(s=<%s>)\n",
+ idn__debug_hexstring(s, 20)));
+
+ while (*s != '\0') {
+ width = idn_utf8_getwc(s, 6, &dummy);
+ if (width == 0)
+ return (0);
+ s += width;
+ }
+ return (1);
+}
+
+char *
+idn_utf8_findfirstbyte(const char *s, const char *known_top) {
+ const unsigned char *p = (const unsigned char *)s;
+ const unsigned char *t = (const unsigned char *)known_top;
+
+ assert(s != NULL && known_top != NULL && known_top <= s);
+
+ TRACE(("idn_utf8_findfirstbyte(s=<%s>)\n",
+ idn__debug_hexstring(s, 8)));
+
+ while (p >= t) {
+ if (!VALID_CONT_BYTE(*p))
+ break;
+ p--;
+ }
+ if (p < t || UTF8_WIDTH(*p) == 0)
+ return (NULL);
+
+ return ((char *)p);
+}
diff --git a/contrib/idn/idnkit-1.0-src/lib/util.c b/contrib/idn/idnkit-1.0-src/lib/util.c
new file mode 100644
index 0000000..a2d315a
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/util.c
@@ -0,0 +1,162 @@
+#ifndef lint
+static char *rcsid = "$Id: util.c,v 1.1.1.1 2003/06/04 00:26:45 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#ifdef WIN32
+#include <windows.h>
+#undef ERROR
+#endif
+
+#include <stddef.h>
+
+#include <idn/assert.h>
+#include <idn/result.h>
+#include <idn/logmacro.h>
+#include <idn/util.h>
+#include <idn/ucs4.h>
+
+#ifdef WIN32
+#define IDNKEY_IDNKIT "Software\\JPNIC\\IDN"
+#endif
+
+/*
+ * ASCII ctype macros.
+ * Note that these macros evaluate the argument multiple times. Be careful.
+ */
+#define ASCII_ISDIGIT(c) \
+ ('0' <= (c) && (c) <= '9')
+#define ASCII_ISUPPER(c) \
+ ('A' <= (c) && (c) <= 'Z')
+#define ASCII_ISLOWER(c) \
+ ('a' <= (c) && (c) <= 'z')
+#define ASCII_ISALPHA(c) \
+ (ASCII_ISUPPER(c) || ASCII_ISLOWER(c))
+#define ASCII_ISALNUM(c) \
+ (ASCII_ISDIGIT(c) || ASCII_ISUPPER(c) || ASCII_ISLOWER(c))
+
+#define ASCII_TOUPPER(c) \
+ (('a' <= (c) && (c) <= 'z') ? ((c) - 'a' + 'A') : (c))
+#define ASCII_TOLOWER(c) \
+ (('A' <= (c) && (c) <= 'Z') ? ((c) - 'A' + 'a') : (c))
+
+int
+idn__util_asciihaveaceprefix(const char *str, const char *prefix) {
+ assert(str != NULL && prefix != NULL);
+
+ while (*prefix != '\0') {
+ if (ASCII_TOLOWER(*str) != ASCII_TOLOWER(*prefix))
+ return 0;
+ str++;
+ prefix++;
+ }
+
+ return (1);
+}
+
+int
+idn__util_ucs4haveaceprefix(const unsigned long *str, const char *prefix) {
+ assert(str != NULL && prefix != NULL);
+
+ while (*prefix != '\0') {
+ if (ASCII_TOLOWER(*str) != ASCII_TOLOWER(*prefix))
+ return 0;
+ str++;
+ prefix++;
+ }
+
+ return (1);
+}
+
+int
+idn__util_ucs4isasciirange(const unsigned long *str) {
+ while (*str != '\0') {
+ if (*str > 0x7f)
+ return (0);
+ str++;
+ }
+
+ return (1);
+}
+
+#ifdef WIN32
+int
+idn__util_getregistrystring(idn__util_hkey_t topkey, const char *name,
+ char *str, size_t length)
+{
+ HKEY top;
+ LONG stat;
+ HKEY hk;
+ DWORD len, type;
+
+ assert((topkey == idn__util_hkey_currentuser ||
+ topkey == idn__util_hkey_localmachine) &&
+ name != NULL && str != NULL);
+
+ if (topkey == idn__util_hkey_currentuser) {
+ top= HKEY_CURRENT_USER;
+ } else { /* idn__util_hkey_localmachine */
+ top = HKEY_LOCAL_MACHINE;
+ }
+
+ stat = RegOpenKeyEx(top, IDNKEY_IDNKIT, 0, KEY_READ, &hk);
+ if (stat != ERROR_SUCCESS) {
+ return (0);
+ }
+
+ len = (DWORD)length;
+ stat = RegQueryValueEx(hk, (LPCTSTR)name, NULL,
+ &type, (LPBYTE)str, &len);
+ RegCloseKey(hk);
+
+ if (stat != ERROR_SUCCESS || type != REG_SZ) {
+ return (0);
+ }
+
+ return (1);
+}
+#endif /* WIN32 */
diff --git a/contrib/idn/idnkit-1.0-src/lib/version.c b/contrib/idn/idnkit-1.0-src/lib/version.c
new file mode 100644
index 0000000..31fdba7
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/lib/version.c
@@ -0,0 +1,54 @@
+#ifndef lint
+static char *rcsid = "$Id: version.c,v 1.1.1.1 2003/06/04 00:26:45 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <idn/version.h>
+
+const char *
+idn_version_getstring(void) {
+ return IDNKIT_VERSION;
+}
diff --git a/contrib/idn/idnkit-1.0-src/ltconfig b/contrib/idn/idnkit-1.0-src/ltconfig
new file mode 100755
index 0000000..c1cb8c0
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/ltconfig
@@ -0,0 +1,3114 @@
+#! /bin/sh
+
+# ltconfig - Create a system-specific libtool.
+# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A lot of this script is taken from autoconf-2.10.
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+echo=echo
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell.
+ exec "$SHELL" "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit 0
+fi
+
+# Find the correct PATH separator. Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+ UNAME=${UNAME-`uname 2>/dev/null`}
+ case X$UNAME in
+ *-DOS) PATH_SEPARATOR=';' ;;
+ *) PATH_SEPARATOR=':' ;;
+ esac
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test "X${echo_test_string+set}" != Xset; then
+ # find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+ echo_test_string="`eval $cmd`" &&
+ (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then
+ break
+ fi
+ done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" != 'X\t' ||
+ test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for dir in $PATH /usr/ucb; do
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ echo="$dir/echo"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+
+ if test "X$echo" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ echo='print -r'
+ elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running ltconfig again with it.
+ ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}"
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"}
+ else
+ # Try using printf.
+ echo='printf "%s\n"'
+ if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL"
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ echo="$CONFIG_SHELL $0 --fallback-echo"
+ elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ echo="$CONFIG_SHELL $0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+ if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "$0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ echo=echo
+ fi
+ fi
+ fi
+ fi
+fi
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# The name of this program.
+progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'`
+
+# Constants:
+PROGRAM=ltconfig
+PACKAGE=libtool
+VERSION=1.3.5
+TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)"
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+rm="rm -f"
+
+help="Try \`$progname --help' for more information."
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+enable_shared=yes
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+enable_static=yes
+enable_fast_install=yes
+enable_dlopen=unknown
+enable_win32_dll=no
+ltmain=
+silent=
+srcdir=
+ac_config_guess=
+ac_config_sub=
+host=
+nonopt=
+ofile="$default_ofile"
+verify_host=yes
+with_gcc=no
+with_gnu_ld=no
+need_locks=yes
+ac_ext=c
+objext=o
+libext=a
+exeext=
+cache_file=
+
+old_AR="$AR"
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+old_CPPFLAGS="$CPPFLAGS"
+old_LDFLAGS="$LDFLAGS"
+old_LD="$LD"
+old_LN_S="$LN_S"
+old_LIBS="$LIBS"
+old_NM="$NM"
+old_RANLIB="$RANLIB"
+old_DLLTOOL="$DLLTOOL"
+old_OBJDUMP="$OBJDUMP"
+old_AS="$AS"
+
+# Parse the command line options.
+args=
+prev=
+for option
+do
+ case "$option" in
+ -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ eval "$prev=\$option"
+ prev=
+ continue
+ fi
+
+ case "$option" in
+ --help) cat <<EOM
+Usage: $progname [OPTION]... [HOST [LTMAIN]]
+
+Generate a system-specific libtool script.
+
+ --debug enable verbose shell tracing
+ --disable-shared do not build shared libraries
+ --disable-static do not build static libraries
+ --disable-fast-install do not optimize for fast installation
+ --enable-dlopen enable dlopen support
+ --enable-win32-dll enable building dlls on win32 hosts
+ --help display this help and exit
+ --no-verify do not verify that HOST is a valid host type
+-o, --output=FILE specify the output file [default=$default_ofile]
+ --quiet same as \`--silent'
+ --silent do not print informational messages
+ --srcdir=DIR find \`config.guess' in DIR
+ --version output version information and exit
+ --with-gcc assume that the GNU C compiler will be used
+ --with-gnu-ld assume that the C compiler uses the GNU linker
+ --disable-lock disable file locking
+ --cache-file=FILE configure cache file
+
+LTMAIN is the \`ltmain.sh' shell script fragment or \`ltmain.c' program
+that provides basic libtool functionality.
+
+HOST is the canonical host system name [default=guessed].
+EOM
+ exit 0
+ ;;
+
+ --debug)
+ echo "$progname: enabling shell trace mode"
+ set -x
+ ;;
+
+ --disable-shared) enable_shared=no ;;
+
+ --disable-static) enable_static=no ;;
+
+ --disable-fast-install) enable_fast_install=no ;;
+
+ --enable-dlopen) enable_dlopen=yes ;;
+
+ --enable-win32-dll) enable_win32_dll=yes ;;
+
+ --quiet | --silent) silent=yes ;;
+
+ --srcdir) prev=srcdir ;;
+ --srcdir=*) srcdir="$optarg" ;;
+
+ --no-verify) verify_host=no ;;
+
+ --output | -o) prev=ofile ;;
+ --output=*) ofile="$optarg" ;;
+
+ --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"; exit 0 ;;
+
+ --with-gcc) with_gcc=yes ;;
+ --with-gnu-ld) with_gnu_ld=yes ;;
+
+ --disable-lock) need_locks=no ;;
+
+ --cache-file=*) cache_file="$optarg" ;;
+
+ -*)
+ echo "$progname: unrecognized option \`$option'" 1>&2
+ echo "$help" 1>&2
+ exit 1
+ ;;
+
+ *)
+ if test -z "$ltmain"; then
+ ltmain="$option"
+ elif test -z "$host"; then
+# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1
+# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then
+# echo "$progname: warning \`$option' is not a valid host type" 1>&2
+# fi
+ host="$option"
+ else
+ echo "$progname: too many arguments" 1>&2
+ echo "$help" 1>&2
+ exit 1
+ fi ;;
+ esac
+done
+
+if test -z "$ltmain"; then
+ echo "$progname: you must specify a LTMAIN file" 1>&2
+ echo "$help" 1>&2
+ exit 1
+fi
+
+if test ! -f "$ltmain"; then
+ echo "$progname: \`$ltmain' does not exist" 1>&2
+ echo "$help" 1>&2
+ exit 1
+fi
+
+# Quote any args containing shell metacharacters.
+ltconfig_args=
+for arg
+do
+ case "$arg" in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ltconfig_args="$ltconfig_args '$arg'" ;;
+ *) ltconfig_args="$ltconfig_args $arg" ;;
+ esac
+done
+
+# A relevant subset of AC_INIT.
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 5 compiler messages saved in config.log
+# 6 checking for... messages and results
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>>./config.log
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi
+if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi
+
+if test -n "$cache_file" && test -r "$cache_file"; then
+ echo "loading cache $cache_file within ltconfig"
+ . $cache_file
+fi
+
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+if test -z "$srcdir"; then
+ # Assume the source directory is the same one as the path to LTMAIN.
+ srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'`
+ test "$srcdir" = "$ltmain" && srcdir=.
+fi
+
+trap "$rm conftest*; exit 1" 1 2 15
+if test "$verify_host" = yes; then
+ # Check for config.guess and config.sub.
+ ac_aux_dir=
+ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/config.guess; then
+ ac_aux_dir=$ac_dir
+ break
+ fi
+ done
+ if test -z "$ac_aux_dir"; then
+ echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2
+ echo "$help" 1>&2
+ exit 1
+ fi
+ ac_config_guess=$ac_aux_dir/config.guess
+ ac_config_sub=$ac_aux_dir/config.sub
+
+ # Make sure we can run config.sub.
+ if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then :
+ else
+ echo "$progname: cannot run $ac_config_sub" 1>&2
+ echo "$help" 1>&2
+ exit 1
+ fi
+
+ echo $ac_n "checking host system type""... $ac_c" 1>&6
+
+ host_alias=$host
+ case "$host_alias" in
+ "")
+ if host_alias=`$SHELL $ac_config_guess`; then :
+ else
+ echo "$progname: cannot guess host type; you must specify one" 1>&2
+ echo "$help" 1>&2
+ exit 1
+ fi ;;
+ esac
+ host=`$SHELL $ac_config_sub $host_alias`
+ echo "$ac_t$host" 1>&6
+
+ # Make sure the host verified.
+ test -z "$host" && exit 1
+
+elif test -z "$host"; then
+ echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2
+ echo "$help" 1>&2
+ exit 1
+else
+ host_alias=$host
+fi
+
+# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+case "$host_os" in
+linux-gnu*) ;;
+linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+esac
+
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+case "$host_os" in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR cru $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+# Set a sane default for `AR'.
+test -z "$AR" && AR=ar
+
+# Set a sane default for `OBJDUMP'.
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+# If RANLIB is not set, then run the test.
+if test "${RANLIB+set}" != "set"; then
+ result=no
+
+ echo $ac_n "checking for ranlib... $ac_c" 1>&6
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for dir in $PATH; do
+ test -z "$dir" && dir=.
+ if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then
+ RANLIB="ranlib"
+ result="ranlib"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+
+ echo "$ac_t$result" 1>&6
+fi
+
+if test -n "$RANLIB"; then
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+ old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+fi
+
+# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin.
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$AS" && AS=as
+
+# Check to see if we are using GCC.
+if test "$with_gcc" != yes || test -z "$CC"; then
+ # If CC is not set, then try to find GCC or a usable CC.
+ if test -z "$CC"; then
+ echo $ac_n "checking for gcc... $ac_c" 1>&6
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for dir in $PATH; do
+ test -z "$dir" && dir=.
+ if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then
+ CC="gcc"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+
+ if test -n "$CC"; then
+ echo "$ac_t$CC" 1>&6
+ else
+ echo "$ac_t"no 1>&6
+ fi
+ fi
+
+ # Not "gcc", so try "cc", rejecting "/usr/ucb/cc".
+ if test -z "$CC"; then
+ echo $ac_n "checking for cc... $ac_c" 1>&6
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ cc_rejected=no
+ for dir in $PATH; do
+ test -z "$dir" && dir=.
+ if test -f $dir/cc || test -f $dir/cc$ac_exeext; then
+ if test "$dir/cc" = "/usr/ucb/cc"; then
+ cc_rejected=yes
+ continue
+ fi
+ CC="cc"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+ if test $cc_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same name, so the bogon will be chosen
+ # first if we set CC to just the name; use the full file name.
+ shift
+ set dummy "$dir/cc" "$@"
+ shift
+ CC="$@"
+ fi
+ fi
+
+ if test -n "$CC"; then
+ echo "$ac_t$CC" 1>&6
+ else
+ echo "$ac_t"no 1>&6
+ fi
+
+ if test -z "$CC"; then
+ echo "$progname: error: no acceptable cc found in \$PATH" 1>&2
+ exit 1
+ fi
+ fi
+
+ # Now see if the compiler is really GCC.
+ with_gcc=no
+ echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6
+ echo "$progname:581: checking whether we are using GNU C" >&5
+
+ $rm conftest.c
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+ if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:589: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ with_gcc=yes
+ fi
+ $rm conftest.c
+ echo "$ac_t$with_gcc" 1>&6
+fi
+
+# Allow CC to be a program name with arguments.
+set dummy $CC
+compiler="$2"
+
+echo $ac_n "checking for object suffix... $ac_c" 1>&6
+$rm conftest*
+echo 'int i = 1;' > conftest.c
+echo "$progname:603: checking for object suffix" >& 5
+if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
+ # Append any warnings to the config.log.
+ cat conftest.err 1>&5
+
+ for ac_file in conftest.*; do
+ case $ac_file in
+ *.c) ;;
+ *) objext=`echo $ac_file | sed -e s/conftest.//` ;;
+ esac
+ done
+else
+ cat conftest.err 1>&5
+ echo "$progname: failed program was:" >&5
+ cat conftest.c >&5
+fi
+$rm conftest*
+echo "$ac_t$objext" 1>&6
+
+echo $ac_n "checking for executable suffix... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_exeext="no"
+ $rm conftest*
+ echo 'main () { return 0; }' > conftest.c
+ echo "$progname:629: checking for executable suffix" >& 5
+ if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then
+ # Append any warnings to the config.log.
+ cat conftest.err 1>&5
+
+ for ac_file in conftest.*; do
+ case $ac_file in
+ *.c | *.err | *.$objext ) ;;
+ *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;;
+ esac
+ done
+ else
+ cat conftest.err 1>&5
+ echo "$progname: failed program was:" >&5
+ cat conftest.c >&5
+ fi
+ $rm conftest*
+fi
+if test "X$ac_cv_exeext" = Xno; then
+ exeext=""
+else
+ exeext="$ac_cv_exeext"
+fi
+echo "$ac_t$ac_cv_exeext" 1>&6
+
+echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
+pic_flag=
+special_shlib_compile_flags=
+wl=
+link_static_flag=
+no_builtin_flag=
+
+if test "$with_gcc" = yes; then
+ wl='-Wl,'
+ link_static_flag='-static'
+
+ case "$host_os" in
+ beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ aix*)
+ # Below there is a dirty hack to force normal static linking with -ldl
+ # The problem is because libdl dynamically linked with both libc and
+ # libC (AIX C++ library), which obviously doesn't included in libraries
+ # list by gcc. This cause undefined symbols with -static flags.
+ # This hack allows C programs to be linked with "-static -ldl", but
+ # we not sure about C++ programs.
+ link_static_flag="$link_static_flag ${wl}-lC"
+ ;;
+ cygwin* | mingw* | os2*)
+ # We can build DLLs from non-PIC.
+ ;;
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ pic_flag='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ pic_flag=-Kconform_pic
+ fi
+ ;;
+ *)
+ pic_flag='-fPIC'
+ ;;
+ esac
+else
+ # PORTME Check for PIC flags for the system compiler.
+ case "$host_os" in
+ aix3* | aix4*)
+ # All AIX code is PIC.
+ link_static_flag='-bnso -bI:/lib/syscalls.exp'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ # Is there a better link_static_flag that works with the bundled CC?
+ wl='-Wl,'
+ link_static_flag="${wl}-a ${wl}archive"
+ pic_flag='+Z'
+ ;;
+
+ irix5* | irix6*)
+ wl='-Wl,'
+ link_static_flag='-non_shared'
+ # PIC (with -KPIC) is the default.
+ ;;
+
+ cygwin* | mingw* | os2*)
+ # We can build DLLs from non-PIC.
+ ;;
+
+ osf3* | osf4* | osf5*)
+ # All OSF/1 code is PIC.
+ wl='-Wl,'
+ link_static_flag='-non_shared'
+ ;;
+
+ sco3.2v5*)
+ pic_flag='-Kpic'
+ link_static_flag='-dn'
+ special_shlib_compile_flags='-belf'
+ ;;
+
+ solaris*)
+ pic_flag='-KPIC'
+ link_static_flag='-Bstatic'
+ wl='-Wl,'
+ ;;
+
+ sunos4*)
+ pic_flag='-PIC'
+ link_static_flag='-Bstatic'
+ wl='-Qoption ld '
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ pic_flag='-KPIC'
+ link_static_flag='-Bstatic'
+ wl='-Wl,'
+ ;;
+
+ uts4*)
+ pic_flag='-pic'
+ link_static_flag='-Bstatic'
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ pic_flag='-Kconform_pic'
+ link_static_flag='-Bstatic'
+ fi
+ ;;
+ *)
+ can_build_shared=no
+ ;;
+ esac
+fi
+
+if test -n "$pic_flag"; then
+ echo "$ac_t$pic_flag" 1>&6
+
+ # Check to make sure the pic_flag actually works.
+ echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6
+ $rm conftest*
+ echo "int some_variable = 0;" > conftest.c
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $pic_flag -DPIC"
+ echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5
+ if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then
+ # Append any warnings to the config.log.
+ cat conftest.err 1>&5
+
+ case "$host_os" in
+ hpux9* | hpux10* | hpux11*)
+ # On HP-UX, both CC and GCC only warn that PIC is supported... then they
+ # create non-PIC objects. So, if there were any warnings, we assume that
+ # PIC is not supported.
+ if test -s conftest.err; then
+ echo "$ac_t"no 1>&6
+ can_build_shared=no
+ pic_flag=
+ else
+ echo "$ac_t"yes 1>&6
+ pic_flag=" $pic_flag"
+ fi
+ ;;
+ *)
+ echo "$ac_t"yes 1>&6
+ pic_flag=" $pic_flag"
+ ;;
+ esac
+ else
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ can_build_shared=no
+ pic_flag=
+ echo "$ac_t"no 1>&6
+ fi
+ CFLAGS="$save_CFLAGS"
+ $rm conftest*
+else
+ echo "$ac_t"none 1>&6
+fi
+
+# Check to see if options -o and -c are simultaneously supported by compiler
+echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6
+$rm -r conftest 2>/dev/null
+mkdir conftest
+cd conftest
+$rm conftest*
+echo "int some_variable = 0;" > conftest.c
+mkdir out
+# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
+# that will create temporary files in the current directory regardless of
+# the output directory. Thus, making CWD read-only will cause this test
+# to fail, enabling locking or at least warning the user not to do parallel
+# builds.
+chmod -w .
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -o out/conftest2.o"
+echo "$progname:829: checking if $compiler supports -c -o file.o" >&5
+if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then
+
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s out/conftest.err; then
+ echo "$ac_t"no 1>&6
+ compiler_c_o=no
+ else
+ echo "$ac_t"yes 1>&6
+ compiler_c_o=yes
+ fi
+else
+ # Append any errors to the config.log.
+ cat out/conftest.err 1>&5
+ compiler_c_o=no
+ echo "$ac_t"no 1>&6
+fi
+CFLAGS="$save_CFLAGS"
+chmod u+w .
+$rm conftest* out/*
+rmdir out
+cd ..
+rmdir conftest
+$rm -r conftest 2>/dev/null
+
+if test x"$compiler_c_o" = x"yes"; then
+ # Check to see if we can write to a .lo
+ echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6
+ $rm conftest*
+ echo "int some_variable = 0;" > conftest.c
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -c -o conftest.lo"
+ echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5
+if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then
+
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ echo "$ac_t"no 1>&6
+ compiler_o_lo=no
+ else
+ echo "$ac_t"yes 1>&6
+ compiler_o_lo=yes
+ fi
+ else
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ compiler_o_lo=no
+ echo "$ac_t"no 1>&6
+ fi
+ CFLAGS="$save_CFLAGS"
+ $rm conftest*
+else
+ compiler_o_lo=no
+fi
+
+# Check to see if we can do hard links to lock some files if needed
+hard_links="nottested"
+if test "$compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ echo "$ac_t$hard_links" 1>&6
+ $rm conftest*
+ if test "$hard_links" = no; then
+ echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+if test "$with_gcc" = yes; then
+ # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
+ echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6
+ $rm conftest*
+ echo "int some_variable = 0;" > conftest.c
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c"
+ echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+ if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then
+
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ echo "$ac_t"no 1>&6
+ compiler_rtti_exceptions=no
+ else
+ echo "$ac_t"yes 1>&6
+ compiler_rtti_exceptions=yes
+ fi
+ else
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ compiler_rtti_exceptions=no
+ echo "$ac_t"no 1>&6
+ fi
+ CFLAGS="$save_CFLAGS"
+ $rm conftest*
+
+ if test "$compiler_rtti_exceptions" = "yes"; then
+ no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
+ else
+ no_builtin_flag=' -fno-builtin'
+ fi
+
+fi
+
+# Check for any special shared library compilation flags.
+if test -n "$special_shlib_compile_flags"; then
+ echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2
+ if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then :
+ else
+ echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2
+ can_build_shared=no
+ fi
+fi
+
+echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6
+$rm conftest*
+echo 'main(){return(0);}' > conftest.c
+save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS $link_static_flag"
+echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5
+if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ echo "$ac_t$link_static_flag" 1>&6
+else
+ echo "$ac_t"none 1>&6
+ link_static_flag=
+fi
+LDFLAGS="$save_LDFLAGS"
+$rm conftest*
+
+if test -z "$LN_S"; then
+ # Check to see if we can use ln -s, or we need hard links.
+ echo $ac_n "checking whether ln -s works... $ac_c" 1>&6
+ $rm conftest.dat
+ if ln -s X conftest.dat 2>/dev/null; then
+ $rm conftest.dat
+ LN_S="ln -s"
+ else
+ LN_S=ln
+ fi
+ if test "$LN_S" = "ln -s"; then
+ echo "$ac_t"yes 1>&6
+ else
+ echo "$ac_t"no 1>&6
+ fi
+fi
+
+# Make sure LD is an absolute path.
+if test -z "$LD"; then
+ ac_prog=ld
+ if test "$with_gcc" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6
+ echo "$progname:991: checking for ld used by GCC" >&5
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+ # Accept absolute paths.
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we are not using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+ elif test "$with_gnu_ld" = yes; then
+ echo $ac_n "checking for GNU ld... $ac_c" 1>&6
+ echo "$progname:1015: checking for GNU ld" >&5
+ else
+ echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+ echo "$progname:1018: checking for non-GNU ld" >&5
+ fi
+
+ if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ fi
+
+ if test -n "$LD"; then
+ echo "$ac_t$LD" 1>&6
+ else
+ echo "$ac_t"no 1>&6
+ fi
+
+ if test -z "$LD"; then
+ echo "$progname: error: no acceptable ld found in \$PATH" 1>&2
+ exit 1
+ fi
+fi
+
+# Check to see if it really is or is not GNU ld.
+echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6
+# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+echo "$ac_t$with_gnu_ld" 1>&6
+
+# See if the linker supports building shared libraries.
+echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6
+
+allow_undefined_flag=
+no_undefined_flag=
+need_lib_prefix=unknown
+need_version=unknown
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+archive_cmds=
+archive_expsym_cmds=
+old_archive_from_new_cmds=
+export_dynamic_flag_spec=
+whole_archive_flag_spec=
+thread_safe_flag_spec=
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+hardcode_shlibpath_var=unsupported
+runpath_var=
+always_export_symbols=no
+export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
+# include_expsyms should be a list of space-separated symbols to be *always*
+# included in the symbol list
+include_expsyms=
+# exclude_expsyms can be an egrep regular expression of symbols to exclude
+# it will be wrapped by ` (' and `)$', so one must not match beginning or
+# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+# as well as any symbol that contains `d'.
+exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+# platforms (ab)use it in PIC code, but their linkers get confused if
+# the symbol is explicitly referenced. Since portable code cannot
+# rely on this symbol name, it's probably fine to never include it in
+# preloaded symbol tables.
+
+case "$host_os" in
+cygwin* | mingw*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$with_gcc" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # See if GNU ld supports shared libraries.
+ case "$host_os" in
+ aix3* | aix4*)
+ # On AIX, the GNU linker is very broken
+ ld_shlibs=no
+ cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+ ;;
+
+ amigaos*)
+ archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can use
+ # them.
+ ld_shlibs=no
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw*)
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+
+ # Extract the symbol export list from an `--export-all' def file,
+ # then regenerate the def file from the symbol export list, so that
+ # the compiled dll only exports the symbol export list.
+ # Be careful not to strip the DATA tag left by newer dlltools.
+ export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
+ test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
+ $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~
+ sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $objdir/$soname-def > $export_symbols'
+
+ # If DATA tags from a recent dlltool are present, honour them!
+ archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~
+ _lt_hint=1;
+ cat $export_symbols | while read symbol; do
+ set dummy \$symbol;
+ case \$# in
+ 2) echo " \$2 @ \$_lt_hint ; " >> $objdir/$soname-def;;
+ *) echo " \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;;
+ esac;
+ _lt_hint=`expr 1 + \$_lt_hint`;
+ done~
+ test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
+ test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
+ $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
+ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
+ $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
+ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
+ $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts'
+
+ old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a'
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib'
+ # can we support soname and/or expsyms with a.out? -oliva
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris* | sysv5*)
+ if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+ elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = yes; then
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ case $host_os in
+ cygwin* | mingw*)
+ # dlltool doesn't understand --whole-archive et. al.
+ whole_archive_flag_spec=
+ ;;
+ *)
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ ;;
+ esac
+ fi
+else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case "$host_os" in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$with_gcc" = yes && test -z "$link_static_flag"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix4*)
+ hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib'
+ hardcode_libdir_separator=':'
+ if test "$with_gcc" = yes; then
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ hardcode_direct=yes
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ shared_flag='-shared'
+ else
+ shared_flag='${wl}-bM:SRE'
+ hardcode_direct=yes
+ fi
+ allow_undefined_flag=' ${wl}-berok'
+ archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}'
+ archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}'
+ case "$host_os" in aix4.[01]|aix4.[01].*)
+ # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on
+ always_export_symbols=yes ;;
+ esac
+ ;;
+
+ amigaos*)
+ archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
+ ;;
+
+ cygwin* | mingw*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_from_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib /OUT:$oldlib$oldobjs'
+ fix_srcfile_path='`cygpath -w $srcfile`'
+ ;;
+
+ freebsd1*)
+ ld_shlibs=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd*)
+ archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ case "$host_os" in
+ hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;;
+ *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;;
+ esac
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ hardcode_minus_L=yes # Not in the search PATH, but as the default
+ # location of the library.
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ irix5* | irix6*)
+ if test "$with_gcc" = yes; then
+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+ else
+ archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF
+ fi
+ hardcode_libdir_flag_spec='${wl}-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ openbsd*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def'
+ old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$with_gcc" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # As osf3* with the addition of the -msym flag
+ if test "$with_gcc" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ rhapsody*)
+ archive_cmds='$CC -bundle -undefined suppress -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flags_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sco3.2v5*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ;;
+
+ solaris*)
+ no_undefined_flag=' -z text'
+ # $CC -shared without GNU ld will not create a library from C++
+ # object files and a static libstdc++, better avoid it by now
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts'
+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case "$host_os" in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $linkopts'
+ else
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ fi
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv5*)
+ no_undefined_flag=' -z text'
+ # $CC -shared without GNU ld will not create a library from C++
+ # object files and a static libstdc++, better avoid it by now
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts'
+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
+ hardcode_libdir_flag_spec=
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4.2uw2*)
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts'
+ hardcode_direct=yes
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=no
+ hardcode_runpath_var=yes
+ runpath_var=LD_RUN_PATH
+ ;;
+
+ unixware7*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+fi
+echo "$ac_t$ld_shlibs" 1>&6
+test "$ld_shlibs" = no && can_build_shared=no
+
+if test -z "$NM"; then
+ echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6
+ case "$NM" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path.
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ NM="$ac_dir/nm -B"
+ break
+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ NM="$ac_dir/nm -p"
+ break
+ else
+ NM=${NM="$ac_dir/nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$NM" && NM=nm
+ ;;
+ esac
+ echo "$ac_t$NM" 1>&6
+fi
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
+
+# Define system-specific variables.
+case "$host_os" in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*) # Its linker distinguishes data from code symbols
+ global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
+ ;;
+irix*)
+ symcode='[BCDEGRST]'
+ ;;
+solaris*)
+ symcode='[BDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
+ symcode='[ABCDGISTW]'
+fi
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Write the raw and C identifiers.
+ global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+ $rm conftest*
+ cat > conftest.c <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+ echo "$progname:1653: checking if global_symbol_pipe works" >&5
+ if { (eval echo $progname:1654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { echo "$progname:1657: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
+
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if egrep ' nm_test_var$' "$nlist" >/dev/null; then
+ if egrep ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<EOF > conftest.c
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+ # Now generate the symbol file.
+ eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c'
+
+ cat <<EOF >> conftest.c
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+ sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c
+ cat <<\EOF >> conftest.c
+ {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+ # Now try linking the two files.
+ mv conftest.$objext conftstm.$objext
+ save_LIBS="$LIBS"
+ save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$objext"
+ CFLAGS="$CFLAGS$no_builtin_flag"
+ if { (eval echo $progname:1709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ pipe_works=yes
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.c >&5
+ fi
+ LIBS="$save_LIBS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.c >&5
+ fi
+ $rm conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ global_symbol_pipe=
+ fi
+done
+if test "$pipe_works" = yes; then
+ echo "${ac_t}ok" 1>&6
+else
+ echo "${ac_t}failed" 1>&6
+fi
+
+if test -z "$global_symbol_pipe"; then
+ global_symbol_to_cdecl=
+fi
+
+# Check hardcoding attributes.
+echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+ test -n "$runpath_var"; then
+
+ # We can hardcode non-existant directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$hardcode_shlibpath_var" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+echo "$ac_t$hardcode_action" 1>&6
+
+
+reload_flag=
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6
+# PORTME Some linkers may need a different reload flag.
+reload_flag='-r'
+echo "$ac_t$reload_flag" 1>&6
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+
+# PORTME Fill in your ld.so characteristics
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+file_magic_cmd=
+file_magic_test_file=
+deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [regex]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
+case "$host_os" in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}.so$major'
+ ;;
+
+aix4*)
+ version_type=linux
+ # AIX has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ # We preserve .a as extension for shared libraries though AIX4.2
+ # and later linker supports .so
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a'
+ shlibpath_var=LIBPATH
+ deplibs_check_method=pass_all
+ ;;
+
+amigaos*)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
+ ;;
+
+beos*)
+ library_names_spec='${libname}.so'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ deplibs_check_method=pass_all
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+bsdi4*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=/shlib/libc.so
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ export_dynamic_flag_spec=-rdynamic
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw*)
+ version_type=windows
+ need_version=no
+ need_lib_prefix=no
+ if test "$with_gcc" = yes; then
+ library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a'
+ else
+ library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib'
+ fi
+ dynamic_linker='Win32 ld.exe'
+ deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ file_magic_cmd='${OBJDUMP} -f'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+ version_type=freebsd-$objformat
+ case "$version_type" in
+ freebsd-elf*)
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=`echo /usr/lib/libc.so*`
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ deplibs_check_method=unknown
+ library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case "$host_os" in
+ freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ *) # from 3.2 on
+ shlibpath_overrides_runpath=no
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ dynamic_linker="$host_os dld.sl"
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
+ soname_spec='${libname}${release}.sl$major'
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ case "$host_os" in
+ hpux10.20*)
+ # TODO: Does this work for hpux-11 too?
+ deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+irix5* | irix6*)
+ version_type=irix
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}.so.$major'
+ library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so'
+ case "$host_os" in
+ irix5*)
+ libsuff= shlibsuff=
+ # this will be overridden with pass_all, but let us keep it just in case
+ deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+ ;;
+ *)
+ case "$LD" in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+ deplibs_check_method='pass_all'
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ deplibs_check_method=pass_all
+
+ if test -f /lib/ld.so.1; then
+ dynamic_linker='GNU ld.so'
+ else
+ # Only the GNU ld.so supports shared libraries on MkLinux.
+ case "$host_cpu" in
+ powerpc*) dynamic_linker=no ;;
+ *) dynamic_linker='Linux ld.so' ;;
+ esac
+ fi
+ ;;
+
+netbsd*)
+ version_type=sunos
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
+ soname_spec='${libname}${release}.so$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+openbsd*)
+ version_type=sunos
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ need_version=no
+ fi
+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+os2*)
+ libname_spec='$name'
+ need_lib_prefix=no
+ library_names_spec='$libname.dll $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_version=no
+ soname_spec='${libname}${release}.so'
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+ shlibpath_var=LD_LIBRARY_PATH
+ # this will be overridden with pass_all, but let us keep it just in case
+ deplibs_check_method='file_magic COFF format alpha shared library'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=/shlib/libc.so
+ deplibs_check_method='pass_all'
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rhapsody*)
+ version_type=sunos
+ library_names_spec='${libname}.so'
+ soname_spec='${libname}.so'
+ shlibpath_var=DYLD_LIBRARY_PATH
+ deplibs_check_method=pass_all
+ ;;
+
+sco3.2v5*)
+ version_type=osf
+ soname_spec='${libname}${release}.so$major'
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib"
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=/lib/libc.so
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case "$host_vendor" in
+ sequent)
+ file_magic_cmd='/bin/file'
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+ ;;
+ ncr)
+ deplibs_check_method='pass_all'
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ esac
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
+ soname_spec='$libname.so.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+echo "$ac_t$dynamic_linker" 1>&6
+test "$dynamic_linker" = no && can_build_shared=no
+
+# Report the final consequences.
+echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6
+
+# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in
+# configure.in, otherwise build static only libraries.
+case "$host_os" in
+cygwin* | mingw* | os2*)
+ if test x$can_build_shared = xyes; then
+ test x$enable_win32_dll = xno && can_build_shared=no
+ echo "checking if package supports dlls... $can_build_shared" 1>&6
+ fi
+;;
+esac
+
+if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then
+ case "$deplibs_check_method" in
+ "file_magic "*)
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ egrep "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+fi
+
+echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+aix4*)
+ test "$enable_shared" = yes && enable_static=no
+ ;;
+esac
+
+echo "$ac_t$enable_shared" 1>&6
+
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+
+echo "checking whether to build static libraries... $enable_static" 1>&6
+
+if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+echo $ac_n "checking for objdir... $ac_c" 1>&6
+rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+echo "$ac_t$objdir" 1>&6
+
+if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then
+ lt_cv_dlopen=no lt_cv_dlopen_libs=
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "$progname:2248: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2256 "ltconfig"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo $progname:2269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen""... $ac_c" 1>&6
+echo "$progname:2288: checking for dlopen" >&5
+if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2293 "ltconfig"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char dlopen(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+dlopen();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo $progname:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_dlopen=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_dlopen=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="dlopen"
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
+echo "$progname:2335: checking for dld_link in -ldld" >&5
+ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldld $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2343 "ltconfig"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link();
+
+int main() {
+dld_link()
+; return 0; }
+EOF
+if { (eval echo $progname:2356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for shl_load""... $ac_c" 1>&6
+echo "$progname:2375: checking for shl_load" >&5
+if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2380 "ltconfig"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char shl_load(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
+choke me
+#else
+shl_load();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo $progname:2405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_shl_load=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_shl_load=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="shl_load"
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
+echo "$progname:2423: checking for shl_load in -ldld" >&5
+ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldld $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2431 "ltconfig"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load();
+
+int main() {
+shl_load()
+; return 0; }
+EOF
+if { (eval echo $progname:2445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+fi
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ fi
+
+ case "$lt_cv_dlopen" in
+ dlopen)
+for ac_hdr in dlfcn.h; do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "$progname:2488: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2493 "ltconfig"
+#include <$ac_hdr>
+int fnord = 0;
+EOF
+ac_try="$ac_compile >/dev/null 2>conftest.out"
+{ (eval echo $progname:2498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ if test "x$ac_cv_header_dlfcn_h" = xyes; then
+ CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+ fi
+ eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
+echo "$progname:2526: checking whether a program can dlopen itself" >&5
+if test "${lt_cv_dlopen_self+set}" = set; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ lt_cv_dlopen_self=cross
+ else
+ cat > conftest.c <<EOF
+#line 2534 "ltconfig"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LTDL_GLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LTDL_GLOBAL DL_GLOBAL
+# else
+# define LTDL_GLOBAL 0
+# endif
+#endif
+
+/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LTDL_LAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LTDL_LAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LTDL_LAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LTDL_LAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LTDL_LAZY_OR_NOW DL_NOW
+# else
+# define LTDL_LAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+fnord() { int i=42;}
+main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
+ if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
+ if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); }
+
+EOF
+if { (eval echo $progname:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ lt_cv_dlopen_self=yes
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ lt_cv_dlopen_self=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$lt_cv_dlopen_self" 1>&6
+
+ if test "$lt_cv_dlopen_self" = yes; then
+ LDFLAGS="$LDFLAGS $link_static_flag"
+ echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
+echo "$progname:2599: checking whether a statically linked program can dlopen itself" >&5
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ lt_cv_dlopen_self_static=cross
+ else
+ cat > conftest.c <<EOF
+#line 2607 "ltconfig"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LTDL_GLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LTDL_GLOBAL DL_GLOBAL
+# else
+# define LTDL_GLOBAL 0
+# endif
+#endif
+
+/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LTDL_LAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LTDL_LAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LTDL_LAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LTDL_LAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LTDL_LAZY_OR_NOW DL_NOW
+# else
+# define LTDL_LAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+fnord() { int i=42;}
+main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
+ if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
+ if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); }
+
+EOF
+if { (eval echo $progname:2653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ lt_cv_dlopen_self_static=yes
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ lt_cv_dlopen_self_static=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6
+fi
+ ;;
+ esac
+
+ case "$lt_cv_dlopen_self" in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case "$lt_cv_dlopen_self_static" in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+
+# Copy echo and quote the copy, instead of the original, because it is
+# used later.
+ltecho="$echo"
+if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+ ltecho="$CONFIG_SHELL \$0 --fallback-echo"
+fi
+LTSHELL="$SHELL"
+
+LTCONFIG_VERSION="$VERSION"
+
+# Only quote variables if we're using ltmain.sh.
+case "$ltmain" in
+*.sh)
+ # Now quote all the things that may contain metacharacters.
+ for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \
+ old_LD old_LDFLAGS old_LIBS \
+ old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \
+ AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \
+ reload_flag reload_cmds wl \
+ pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
+ thread_safe_flag_spec whole_archive_flag_spec libname_spec \
+ library_names_spec soname_spec \
+ RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
+ old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \
+ file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \
+ finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
+ hardcode_libdir_flag_spec hardcode_libdir_separator \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
+
+ case "$var" in
+ reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case "$ltecho" in
+ *'\$0 --fallback-echo"')
+ ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+
+ trap "$rm \"$ofile\"; exit 1" 1 2 15
+ echo "creating $ofile"
+ $rm "$ofile"
+ cat <<EOF > "$ofile"
+#! $SHELL
+
+# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh.
+#
+# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="sed -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+### BEGIN LIBTOOL CONFIG
+EOF
+ cfgfile="$ofile"
+ ;;
+
+*)
+ # Double-quote the variables that need it (for aesthetics).
+ for var in old_CC old_CFLAGS old_CPPFLAGS \
+ old_LD old_LDFLAGS old_LIBS \
+ old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do
+ eval "$var=\\\"\$var\\\""
+ done
+
+ # Just create a config file.
+ cfgfile="$ofile.cfg"
+ trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+ echo "creating $cfgfile"
+ $rm "$cfgfile"
+ cat <<EOF > "$cfgfile"
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+EOF
+ ;;
+esac
+
+cat <<EOF >> "$cfgfile"
+# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\
+# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\
+# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\
+# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\
+# $0$ltconfig_args
+#
+# Compiler and other test output produced by $progname, useful for
+# debugging $progname, is in ./config.log if it exists.
+
+# The version of $progname that generated this script.
+LTCONFIG_VERSION=$LTCONFIG_VERSION
+
+# Shell to use when invoking shell scripts.
+SHELL=$LTSHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$ltecho
+
+# The archiver.
+AR=$AR
+
+# The default C compiler.
+CC=$CC
+
+# The linker used to build libraries.
+LD=$LD
+
+# Whether we need hard or soft links.
+LN_S=$LN_S
+
+# A BSD-compatible nm program.
+NM=$NM
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$reload_flag
+reload_cmds=$reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$wl
+
+# Object file suffix (normally "o").
+objext="$objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$pic_flag
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$compiler_c_o
+
+# Can we write directly to a .lo ?
+compiler_o_lo=$compiler_o_lo
+
+# Must we lock files when doing compilation ?
+need_locks=$need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$link_static_flag
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$RANLIB
+old_archive_cmds=$old_archive_cmds
+old_postinstall_cmds=$old_postinstall_cmds
+old_postuninstall_cmds=$old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$old_archive_from_new_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$archive_cmds
+archive_expsym_cmds=$archive_expsym_cmds
+postinstall_cmds=$postinstall_cmds
+postuninstall_cmds=$postuninstall_cmds
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$global_symbol_to_cdecl
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$include_expsyms
+
+EOF
+
+case "$ltmain" in
+*.sh)
+ echo '### END LIBTOOL CONFIG' >> "$ofile"
+ echo >> "$ofile"
+ case "$host_os" in
+ aix3*)
+ cat <<\EOF >> "$ofile"
+
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+EOF
+ ;;
+ esac
+
+ # Append the ltmain.sh script.
+ sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1)
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+
+ chmod +x "$ofile"
+ ;;
+
+*)
+ # Compile the libtool program.
+ echo "FIXME: would compile $ltmain"
+ ;;
+esac
+
+test -n "$cache_file" || exit 0
+
+# AC_CACHE_SAVE
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+exit 0
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/contrib/idn/idnkit-1.0-src/ltmain.sh b/contrib/idn/idnkit-1.0-src/ltmain.sh
new file mode 100644
index 0000000..766732d
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/ltmain.sh
@@ -0,0 +1,4024 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun ltconfig.
+#
+# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell, and then maybe $echo will work.
+ exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit 0
+fi
+
+# The name of this program.
+progname=`$echo "$0" | sed 's%^.*/%%'`
+modename="$progname"
+
+# Constants.
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.3.5
+TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)"
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+SP2NL='tr \040 \012'
+NL2SP='tr \015\012 \040\040'
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+if test "${LC_ALL+set}" = set; then
+ save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+fi
+if test "${LANG+set}" = set; then
+ save_LANG="$LANG"; LANG=C; export LANG
+fi
+
+if test "$LTCONFIG_VERSION" != "$VERSION"; then
+ echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+fi
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ echo "$modename: not configured to build any kind of library" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+
+# Parse our command line options once, thoroughly.
+while test $# -gt 0
+do
+ arg="$1"
+ shift
+
+ case "$arg" in
+ -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case "$prev" in
+ execute_dlfiles)
+ eval "$prev=\"\$$prev \$arg\""
+ ;;
+ *)
+ eval "$prev=\$arg"
+ ;;
+ esac
+
+ prev=
+ prevopt=
+ continue
+ fi
+
+ # Have we seen a non-optional argument yet?
+ case "$arg" in
+ --help)
+ show_help=yes
+ ;;
+
+ --version)
+ echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+ exit 0
+ ;;
+
+ --config)
+ sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
+ exit 0
+ ;;
+
+ --debug)
+ echo "$progname: enabling shell trace mode"
+ set -x
+ ;;
+
+ --dry-run | -n)
+ run=:
+ ;;
+
+ --features)
+ echo "host: $host"
+ if test "$build_libtool_libs" = yes; then
+ echo "enable shared libraries"
+ else
+ echo "disable shared libraries"
+ fi
+ if test "$build_old_libs" = yes; then
+ echo "enable static libraries"
+ else
+ echo "disable static libraries"
+ fi
+ exit 0
+ ;;
+
+ --finish) mode="finish" ;;
+
+ --mode) prevopt="--mode" prev=mode ;;
+ --mode=*) mode="$optarg" ;;
+
+ --quiet | --silent)
+ show=:
+ ;;
+
+ -dlopen)
+ prevopt="-dlopen"
+ prev=execute_dlfiles
+ ;;
+
+ -*)
+ $echo "$modename: unrecognized option \`$arg'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+
+ *)
+ nonopt="$arg"
+ break
+ ;;
+ esac
+done
+
+if test -n "$prevopt"; then
+ $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+fi
+
+if test -z "$show_help"; then
+
+ # Infer the operation mode.
+ if test -z "$mode"; then
+ case "$nonopt" in
+ *cc | *++ | gcc* | *-gcc*)
+ mode=link
+ for arg
+ do
+ case "$arg" in
+ -c)
+ mode=compile
+ break
+ ;;
+ esac
+ done
+ ;;
+ *db | *dbx | *strace | *truss)
+ mode=execute
+ ;;
+ *install*|cp|mv)
+ mode=install
+ ;;
+ *rm)
+ mode=uninstall
+ ;;
+ *)
+ # If we have no mode, but dlfiles were specified, then do execute mode.
+ test -n "$execute_dlfiles" && mode=execute
+
+ # Just use the default operation mode.
+ if test -z "$mode"; then
+ if test -n "$nonopt"; then
+ $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+ else
+ $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+ fi
+ fi
+ ;;
+ esac
+ fi
+
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$execute_dlfiles" && test "$mode" != execute; then
+ $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$modename --help --mode=$mode' for more information."
+
+ # These modes are in order of execution frequency so that they run quickly.
+ case "$mode" in
+ # libtool compile mode
+ compile)
+ modename="$modename: compile"
+ # Get the compilation command and the source file.
+ base_compile=
+ lastarg=
+ srcfile="$nonopt"
+ suppress_output=
+
+ user_target=no
+ for arg
+ do
+ # Accept any command-line options.
+ case "$arg" in
+ -o)
+ if test "$user_target" != "no"; then
+ $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+ exit 1
+ fi
+ user_target=next
+ ;;
+
+ -static)
+ build_old_libs=yes
+ continue
+ ;;
+ esac
+
+ case "$user_target" in
+ next)
+ # The next one is the -o target name
+ user_target=yes
+ continue
+ ;;
+ yes)
+ # We got the output file
+ user_target=set
+ libobj="$arg"
+ continue
+ ;;
+ esac
+
+ # Accept the current argument as the source file.
+ lastarg="$srcfile"
+ srcfile="$arg"
+
+ # Aesthetically quote the previous argument.
+
+ # Backslashify any backslashes, double quotes, and dollar signs.
+ # These are the only characters that are still specially
+ # interpreted inside of double-quoted scrings.
+ lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly in scan
+ # sets, so we specify it separately.
+ case "$lastarg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ lastarg="\"$lastarg\""
+ ;;
+ esac
+
+ # Add the previous argument to base_compile.
+ if test -z "$base_compile"; then
+ base_compile="$lastarg"
+ else
+ base_compile="$base_compile $lastarg"
+ fi
+ done
+
+ case "$user_target" in
+ set)
+ ;;
+ no)
+ # Get the name of the library object.
+ libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+ ;;
+ *)
+ $echo "$modename: you must specify a target with \`-o'" 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Recognize several different file suffixes.
+ # If the user specifies -o file.o, it is replaced with file.lo
+ xform='[cCFSfmso]'
+ case "$libobj" in
+ *.ada) xform=ada ;;
+ *.adb) xform=adb ;;
+ *.ads) xform=ads ;;
+ *.asm) xform=asm ;;
+ *.c++) xform=c++ ;;
+ *.cc) xform=cc ;;
+ *.cpp) xform=cpp ;;
+ *.cxx) xform=cxx ;;
+ *.f90) xform=f90 ;;
+ *.for) xform=for ;;
+ esac
+
+ libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+ case "$libobj" in
+ *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+ *)
+ $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+ exit 1
+ ;;
+ esac
+
+ if test -z "$base_compile"; then
+ $echo "$modename: you must specify a compilation command" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Delete any leftover library objects.
+ if test "$build_old_libs" = yes; then
+ removelist="$obj $libobj"
+ else
+ removelist="$libobj"
+ fi
+
+ $run $rm $removelist
+ trap "$run $rm $removelist; exit 1" 1 2 15
+
+ # Calculate the filename of the output object if compiler does
+ # not support -o with -c
+ if test "$compiler_c_o" = no; then
+ output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
+ lockfile="$output_obj.lock"
+ removelist="$removelist $output_obj $lockfile"
+ trap "$run $rm $removelist; exit 1" 1 2 15
+ else
+ need_locks=no
+ lockfile=
+ fi
+
+ # Lock this critical section if it is needed
+ # We use this script file to make the link, it avoids creating a new file
+ if test "$need_locks" = yes; then
+ until ln "$0" "$lockfile" 2>/dev/null; do
+ $show "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ elif test "$need_locks" = warn; then
+ if test -f "$lockfile"; then
+ echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+ echo $srcfile > "$lockfile"
+ fi
+
+ if test -n "$fix_srcfile_path"; then
+ eval srcfile=\"$fix_srcfile_path\"
+ fi
+
+ # Only build a PIC object if we are building libtool libraries.
+ if test "$build_libtool_libs" = yes; then
+ # Without this assignment, base_compile gets emptied.
+ fbsd_hideous_sh_bug=$base_compile
+
+ # All platforms use -DPIC, to notify preprocessed assembler code.
+ command="$base_compile $srcfile $pic_flag -DPIC"
+ if test "$build_old_libs" = yes; then
+ lo_libobj="$libobj"
+ dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$libobj"; then
+ dir="$objdir"
+ else
+ dir="$dir/$objdir"
+ fi
+ libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+
+ if test -d "$dir"; then
+ $show "$rm $libobj"
+ $run $rm $libobj
+ else
+ $show "$mkdir $dir"
+ $run $mkdir $dir
+ status=$?
+ if test $status -ne 0 && test ! -d $dir; then
+ exit $status
+ fi
+ fi
+ fi
+ if test "$compiler_o_lo" = yes; then
+ output_obj="$libobj"
+ command="$command -o $output_obj"
+ elif test "$compiler_c_o" = yes; then
+ output_obj="$obj"
+ command="$command -o $output_obj"
+ fi
+
+ $run $rm "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ test -n "$output_obj" && $run $rm $removelist
+ exit 1
+ fi
+
+ if test "$need_locks" = warn &&
+ test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
+ echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+
+ # Just move the object if needed, then go on to compile the next one
+ if test x"$output_obj" != x"$libobj"; then
+ $show "$mv $output_obj $libobj"
+ if $run $mv $output_obj $libobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # If we have no pic_flag, then copy the object into place and finish.
+ if test -z "$pic_flag" && test "$build_old_libs" = yes; then
+ # Rename the .lo from within objdir to obj
+ if test -f $obj; then
+ $show $rm $obj
+ $run $rm $obj
+ fi
+
+ $show "$mv $libobj $obj"
+ if $run $mv $libobj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
+ libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+ # Now arrange that obj and lo_libobj become the same file
+ $show "(cd $xdir && $LN_S $baseobj $libobj)"
+ if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
+ exit 0
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Allow error messages only from the first compilation.
+ suppress_output=' >/dev/null 2>&1'
+ fi
+
+ # Only build a position-dependent object if we build old libraries.
+ if test "$build_old_libs" = yes; then
+ command="$base_compile $srcfile"
+ if test "$compiler_c_o" = yes; then
+ command="$command -o $obj"
+ output_obj="$obj"
+ fi
+
+ # Suppress compiler output if we already did a PIC compilation.
+ command="$command$suppress_output"
+ $run $rm "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ $run $rm $removelist
+ exit 1
+ fi
+
+ if test "$need_locks" = warn &&
+ test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
+ echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+
+ # Just move the object if needed
+ if test x"$output_obj" != x"$obj"; then
+ $show "$mv $output_obj $obj"
+ if $run $mv $output_obj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we do not
+ # accidentally link it into a program.
+ if test "$build_libtool_libs" != yes; then
+ $show "echo timestamp > $libobj"
+ $run eval "echo timestamp > \$libobj" || exit $?
+ else
+ # Move the .lo from within objdir
+ $show "$mv $libobj $lo_libobj"
+ if $run $mv $libobj $lo_libobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+ fi
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ $rm "$lockfile"
+ fi
+
+ exit 0
+ ;;
+
+ # libtool link mode
+ link)
+ modename="$modename: link"
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2*)
+ # It is impossible to link a dll without this setting, and
+ # we shouldn't force the makefile maintainer to figure out
+ # which system we are compiling for in order to pass an extra
+ # flag for every libtool invokation.
+ # allow_undefined=no
+
+ # FIXME: Unfortunately, there are problems with the above when trying
+ # to make a dll which has undefined symbols, in which case not
+ # even a static library is built. For now, we need to specify
+ # -no-undefined on the libtool link line when we can be certain
+ # that all symbols are satisfied, otherwise we get a static library.
+ allow_undefined=yes
+
+ # This is a source program that is used to create dlls on Windows
+ # Don't remove nor modify the starting and closing comments
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# # ifdef __CYGWIN32__
+# # define __CYGWIN__ __CYGWIN32__
+# # endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+# __hDllInstance_base = hInst;
+# return TRUE;
+# }
+# /* ltdll.c ends here */
+ # This is a source program that is used to create import libraries
+ # on Windows for dlls which lack them. Don't remove nor modify the
+ # starting and closing comments
+# /* impgen.c starts here */
+# /* Copyright (C) 1999 Free Software Foundation, Inc.
+#
+# This file is part of GNU libtool.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# */
+#
+# #include <stdio.h> /* for printf() */
+# #include <unistd.h> /* for open(), lseek(), read() */
+# #include <fcntl.h> /* for O_RDONLY, O_BINARY */
+# #include <string.h> /* for strdup() */
+#
+# static unsigned int
+# pe_get16 (fd, offset)
+# int fd;
+# int offset;
+# {
+# unsigned char b[2];
+# lseek (fd, offset, SEEK_SET);
+# read (fd, b, 2);
+# return b[0] + (b[1]<<8);
+# }
+#
+# static unsigned int
+# pe_get32 (fd, offset)
+# int fd;
+# int offset;
+# {
+# unsigned char b[4];
+# lseek (fd, offset, SEEK_SET);
+# read (fd, b, 4);
+# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# static unsigned int
+# pe_as32 (ptr)
+# void *ptr;
+# {
+# unsigned char *b = ptr;
+# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# int
+# main (argc, argv)
+# int argc;
+# char *argv[];
+# {
+# int dll;
+# unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
+# unsigned long export_rva, export_size, nsections, secptr, expptr;
+# unsigned long name_rvas, nexp;
+# unsigned char *expdata, *erva;
+# char *filename, *dll_name;
+#
+# filename = argv[1];
+#
+# dll = open(filename, O_RDONLY|O_BINARY);
+# if (!dll)
+# return 1;
+#
+# dll_name = filename;
+#
+# for (i=0; filename[i]; i++)
+# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
+# dll_name = filename + i +1;
+#
+# pe_header_offset = pe_get32 (dll, 0x3c);
+# opthdr_ofs = pe_header_offset + 4 + 20;
+# num_entries = pe_get32 (dll, opthdr_ofs + 92);
+#
+# if (num_entries < 1) /* no exports */
+# return 1;
+#
+# export_rva = pe_get32 (dll, opthdr_ofs + 96);
+# export_size = pe_get32 (dll, opthdr_ofs + 100);
+# nsections = pe_get16 (dll, pe_header_offset + 4 +2);
+# secptr = (pe_header_offset + 4 + 20 +
+# pe_get16 (dll, pe_header_offset + 4 + 16));
+#
+# expptr = 0;
+# for (i = 0; i < nsections; i++)
+# {
+# char sname[8];
+# unsigned long secptr1 = secptr + 40 * i;
+# unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
+# unsigned long vsize = pe_get32 (dll, secptr1 + 16);
+# unsigned long fptr = pe_get32 (dll, secptr1 + 20);
+# lseek(dll, secptr1, SEEK_SET);
+# read(dll, sname, 8);
+# if (vaddr <= export_rva && vaddr+vsize > export_rva)
+# {
+# expptr = fptr + (export_rva - vaddr);
+# if (export_rva + export_size > vaddr + vsize)
+# export_size = vsize - (export_rva - vaddr);
+# break;
+# }
+# }
+#
+# expdata = (unsigned char*)malloc(export_size);
+# lseek (dll, expptr, SEEK_SET);
+# read (dll, expdata, export_size);
+# erva = expdata - export_rva;
+#
+# nexp = pe_as32 (expdata+24);
+# name_rvas = pe_as32 (expdata+32);
+#
+# printf ("EXPORTS\n");
+# for (i = 0; i<nexp; i++)
+# {
+# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
+# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
+# }
+#
+# return 0;
+# }
+# /* impgen.c ends here */
+ ;;
+ *)
+ allow_undefined=yes
+ ;;
+ esac
+ compile_command="$nonopt"
+ finalize_command="$nonopt"
+
+ compile_rpath=
+ finalize_rpath=
+ compile_shlibpath=
+ finalize_shlibpath=
+ convenience=
+ old_convenience=
+ deplibs=
+ linkopts=
+
+ if test -n "$shlibpath_var"; then
+ # get the directories listed in $shlibpath_var
+ eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+ else
+ lib_search_path=
+ fi
+ # now prepend the system-specific ones
+ eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
+ eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+ avoid_version=no
+ dlfiles=
+ dlprefiles=
+ dlself=no
+ export_dynamic=no
+ export_symbols=
+ export_symbols_regex=
+ generated=
+ libobjs=
+ link_against_libtool_libs=
+ ltlibs=
+ module=no
+ objs=
+ prefer_static_libs=no
+ preload=no
+ prev=
+ prevarg=
+ release=
+ rpath=
+ xrpath=
+ perm_rpath=
+ temp_rpath=
+ thread_safe=no
+ vinfo=
+
+ # We need to know -static, to get the right output filenames.
+ for arg
+ do
+ case "$arg" in
+ -all-static | -static)
+ if test "X$arg" = "X-all-static"; then
+ if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+ $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+ fi
+ if test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ else
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ fi
+ build_libtool_libs=no
+ build_old_libs=yes
+ prefer_static_libs=yes
+ break
+ ;;
+ esac
+ done
+
+ # See if our shared archives depend on static archives.
+ test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+ # Go through the arguments, transforming them on the way.
+ while test $# -gt 0; do
+ arg="$1"
+ shift
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case "$prev" in
+ output)
+ compile_command="$compile_command @OUTPUT@"
+ finalize_command="$finalize_command @OUTPUT@"
+ ;;
+ esac
+
+ case "$prev" in
+ dlfiles|dlprefiles)
+ if test "$preload" = no; then
+ # Add the symbol object into the linking commands.
+ compile_command="$compile_command @SYMFILE@"
+ finalize_command="$finalize_command @SYMFILE@"
+ preload=yes
+ fi
+ case "$arg" in
+ *.la | *.lo) ;; # We handle these cases below.
+ force)
+ if test "$dlself" = no; then
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+ elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+ dlself=yes
+ else
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ else
+ dlprefiles="$dlprefiles $arg"
+ fi
+ prev=
+ ;;
+ esac
+ ;;
+ expsyms)
+ export_symbols="$arg"
+ if test ! -f "$arg"; then
+ $echo "$modename: symbol file \`$arg' does not exist"
+ exit 1
+ fi
+ prev=
+ continue
+ ;;
+ expsyms_regex)
+ export_symbols_regex="$arg"
+ prev=
+ continue
+ ;;
+ release)
+ release="-$arg"
+ prev=
+ continue
+ ;;
+ rpath | xrpath)
+ # We need an absolute path.
+ case "$arg" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit 1
+ ;;
+ esac
+ if test "$prev" = rpath; then
+ case "$rpath " in
+ *" $arg "*) ;;
+ *) rpath="$rpath $arg" ;;
+ esac
+ else
+ case "$xrpath " in
+ *" $arg "*) ;;
+ *) xrpath="$xrpath $arg" ;;
+ esac
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ eval "$prev=\"\$arg\""
+ prev=
+ continue
+ ;;
+ esac
+ fi
+
+ prevarg="$arg"
+
+ case "$arg" in
+ -all-static)
+ if test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -allow-undefined)
+ # FIXME: remove this flag sometime in the future.
+ $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+ continue
+ ;;
+
+ -avoid-version)
+ avoid_version=yes
+ continue
+ ;;
+
+ -dlopen)
+ prev=dlfiles
+ continue
+ ;;
+
+ -dlpreopen)
+ prev=dlprefiles
+ continue
+ ;;
+
+ -export-dynamic)
+ export_dynamic=yes
+ continue
+ ;;
+
+ -export-symbols | -export-symbols-regex)
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: not more than one -exported-symbols argument allowed"
+ exit 1
+ fi
+ if test "X$arg" = "X-export-symbols"; then
+ prev=expsyms
+ else
+ prev=expsyms_regex
+ fi
+ continue
+ ;;
+
+ -L*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+ # We need an absolute path.
+ case "$dir" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+ $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+ absdir="$dir"
+ fi
+ dir="$absdir"
+ ;;
+ esac
+ case " $deplibs " in
+ *" $arg "*) ;;
+ *) deplibs="$deplibs $arg";;
+ esac
+ case " $lib_search_path " in
+ *" $dir "*) ;;
+ *) lib_search_path="$lib_search_path $dir";;
+ esac
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2*)
+ dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
+ case ":$dllsearchpath:" in
+ ::) dllsearchpath="$dllsearchdir";;
+ *":$dllsearchdir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
+ esac
+ ;;
+ esac
+ ;;
+
+ -l*)
+ if test "$arg" = "-lc"; then
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
+ # These systems don't actually have c library (as such)
+ continue
+ ;;
+ esac
+ elif test "$arg" = "-lm"; then
+ case "$host" in
+ *-*-cygwin* | *-*-beos*)
+ # These systems don't actually have math library (as such)
+ continue
+ ;;
+ esac
+ fi
+ deplibs="$deplibs $arg"
+ ;;
+
+ -module)
+ module=yes
+ continue
+ ;;
+
+ -no-undefined)
+ allow_undefined=no
+ continue
+ ;;
+
+ -o) prev=output ;;
+
+ -release)
+ prev=release
+ continue
+ ;;
+
+ -rpath)
+ prev=rpath
+ continue
+ ;;
+
+ -R)
+ prev=xrpath
+ continue
+ ;;
+
+ -R*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+ # We need an absolute path.
+ case "$dir" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit 1
+ ;;
+ esac
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) xrpath="$xrpath $dir" ;;
+ esac
+ continue
+ ;;
+
+ -static)
+ # If we have no pic_flag, then this is the same as -all-static.
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -thread-safe)
+ thread_safe=yes
+ continue
+ ;;
+
+ -version-info)
+ prev=vinfo
+ continue
+ ;;
+
+ # Some other compiler flag.
+ -* | +*)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+
+ *.o | *.obj | *.a | *.lib)
+ # A standard object.
+ objs="$objs $arg"
+ ;;
+
+ *.lo)
+ # A library object.
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
+ prev=
+ fi
+ libobjs="$libobjs $arg"
+ ;;
+
+ *.la)
+ # A libtool-controlled library.
+
+ dlname=
+ libdir=
+ library_names=
+ old_library=
+
+ # Check to see that this really is a libtool archive.
+ if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+
+ # If the library was installed with an old release of libtool,
+ # it will not redefine variable installed.
+ installed=yes
+
+ # Read the .la file
+ # If there is no directory component, then add one.
+ case "$arg" in
+ */* | *\\*) . $arg ;;
+ *) . ./$arg ;;
+ esac
+
+ # Get the name of the library we link against.
+ linklib=
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
+
+ if test -z "$linklib"; then
+ $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
+ exit 1
+ fi
+
+ # Find the relevant object directory and library name.
+ name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
+
+ if test "X$installed" = Xyes; then
+ dir="$libdir"
+ else
+ dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$arg"; then
+ dir="$objdir"
+ else
+ dir="$dir/$objdir"
+ fi
+ fi
+
+ if test -n "$dependency_libs"; then
+ # Extract -R and -L from dependency_libs
+ temp_deplibs=
+ for deplib in $dependency_libs; do
+ case "$deplib" in
+ -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+ case " $rpath $xrpath " in
+ *" $temp_xrpath "*) ;;
+ *) xrpath="$xrpath $temp_xrpath";;
+ esac;;
+ -L*) case "$compile_command $temp_deplibs " in
+ *" $deplib "*) ;;
+ *) temp_deplibs="$temp_deplibs $deplib";;
+ esac
+ temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ case " $lib_search_path " in
+ *" $temp_dir "*) ;;
+ *) lib_search_path="$lib_search_path $temp_dir";;
+ esac
+ ;;
+ *) temp_deplibs="$temp_deplibs $deplib";;
+ esac
+ done
+ dependency_libs="$temp_deplibs"
+ fi
+
+ if test -z "$libdir"; then
+ # It is a libtool convenience library, so add in its objects.
+ convenience="$convenience $dir/$old_library"
+ old_convenience="$old_convenience $dir/$old_library"
+ deplibs="$deplibs$dependency_libs"
+ compile_command="$compile_command $dir/$old_library$dependency_libs"
+ finalize_command="$finalize_command $dir/$old_library$dependency_libs"
+ continue
+ fi
+
+ # This library was specified with -dlopen.
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlname, no dlopen support or we're linking statically,
+ # we need to preload.
+ prev=dlprefiles
+ else
+ # We should not create a dependency on this library, but we
+ # may need any libraries it requires.
+ compile_command="$compile_command$dependency_libs"
+ finalize_command="$finalize_command$dependency_libs"
+ prev=
+ continue
+ fi
+ fi
+
+ # The library was specified with -dlpreopen.
+ if test "$prev" = dlprefiles; then
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ dlprefiles="$dlprefiles $dir/$old_library"
+ else
+ dlprefiles="$dlprefiles $dir/$linklib"
+ fi
+ prev=
+ fi
+
+ if test -n "$library_names" &&
+ { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+ link_against_libtool_libs="$link_against_libtool_libs $arg"
+ if test -n "$shlibpath_var"; then
+ # Make sure the rpath contains only unique directories.
+ case "$temp_rpath " in
+ *" $dir "*) ;;
+ *) temp_rpath="$temp_rpath $dir" ;;
+ esac
+ fi
+
+ # We need an absolute path.
+ case "$dir" in
+ [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+ $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+ absdir="$dir"
+ fi
+ ;;
+ esac
+
+ # This is the magic to use -rpath.
+ # Skip directories that are in the system default run-time
+ # search path, unless they have been requested with -R.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) compile_rpath="$compile_rpath $absdir"
+ esac
+ ;;
+ esac
+
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
+ esac
+ ;;
+ esac
+
+ lib_linked=yes
+ case "$hardcode_action" in
+ immediate | unsupported)
+ if test "$hardcode_direct" = no; then
+ compile_command="$compile_command $dir/$linklib"
+ deplibs="$deplibs $dir/$linklib"
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2*)
+ dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
+ if test -n "$dllsearchpath"; then
+ dllsearchpath="$dllsearchpath:$dllsearchdir"
+ else
+ dllsearchpath="$dllsearchdir"
+ fi
+ ;;
+ esac
+ elif test "$hardcode_minus_L" = no; then
+ case "$host" in
+ *-*-sunos*)
+ compile_shlibpath="$compile_shlibpath$dir:"
+ ;;
+ esac
+ case "$compile_command " in
+ *" -L$dir "*) ;;
+ *) compile_command="$compile_command -L$dir";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -L$dir -l$name"
+ elif test "$hardcode_shlibpath_var" = no; then
+ case ":$compile_shlibpath:" in
+ *":$dir:"*) ;;
+ *) compile_shlibpath="$compile_shlibpath$dir:";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+
+ relink)
+ if test "$hardcode_direct" = yes; then
+ compile_command="$compile_command $absdir/$linklib"
+ deplibs="$deplibs $absdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ case "$compile_command " in
+ *" -L$absdir "*) ;;
+ *) compile_command="$compile_command -L$absdir";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -L$absdir -l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case ":$compile_shlibpath:" in
+ *":$absdir:"*) ;;
+ *) compile_shlibpath="$compile_shlibpath$absdir:";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+
+ *)
+ lib_linked=no
+ ;;
+ esac
+
+ if test "$lib_linked" != yes; then
+ $echo "$modename: configuration error: unsupported hardcode properties"
+ exit 1
+ fi
+
+ # Finalize command for both is simple: just hardcode it.
+ if test "$hardcode_direct" = yes; then
+ finalize_command="$finalize_command $libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ case "$finalize_command " in
+ *" -L$libdir "*) ;;
+ *) finalize_command="$finalize_command -L$libdir";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case ":$finalize_shlibpath:" in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ case "$finalize_command " in
+ *" -L$dir "*) ;;
+ *) finalize_command="$finalize_command -L$libdir";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ fi
+ else
+ # Transform directly to old archives if we don't build new libraries.
+ if test -n "$pic_flag" && test -z "$old_library"; then
+ $echo "$modename: cannot find static library for \`$arg'" 1>&2
+ exit 1
+ fi
+
+ # Here we assume that one of hardcode_direct or hardcode_minus_L
+ # is not unsupported. This is valid on all known static and
+ # shared platforms.
+ if test "$hardcode_direct" != unsupported; then
+ test -n "$old_library" && linklib="$old_library"
+ compile_command="$compile_command $dir/$linklib"
+ finalize_command="$finalize_command $dir/$linklib"
+ else
+ case "$compile_command " in
+ *" -L$dir "*) ;;
+ *) compile_command="$compile_command -L$dir";;
+ esac
+ compile_command="$compile_command -l$name"
+ case "$finalize_command " in
+ *" -L$dir "*) ;;
+ *) finalize_command="$finalize_command -L$dir";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ fi
+ fi
+
+ # Add in any libraries that this one depends upon.
+ compile_command="$compile_command$dependency_libs"
+ finalize_command="$finalize_command$dependency_libs"
+ continue
+ ;;
+
+ # Some other compiler argument.
+ *)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+ esac
+
+ # Now actually substitute the argument into the commands.
+ if test -n "$arg"; then
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+ done
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+ eval arg=\"$export_dynamic_flag_spec\"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+
+ oldlibs=
+ # calculate the name of the file, without its directory
+ outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+ libobjs_save="$libobjs"
+
+ case "$output" in
+ "")
+ $echo "$modename: you must specify an output file" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+
+ *.a | *.lib)
+ if test -n "$link_against_libtool_libs"; then
+ $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
+ exit 1
+ fi
+
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+ fi
+
+ # Now set the variables for building old libraries.
+ build_libtool_libs=no
+ oldlibs="$output"
+ ;;
+
+ *.la)
+ # Make sure we only generate libraries of the form `libNAME.la'.
+ case "$outputname" in
+ lib*)
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+ eval libname=\"$libname_spec\"
+ ;;
+ *)
+ if test "$module" = no; then
+ $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+ if test "$need_lib_prefix" != no; then
+ # Add the "lib" prefix for modules if required
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ eval libname=\"$libname_spec\"
+ else
+ libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ fi
+ ;;
+ esac
+
+ output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$output_objdir" = "X$output"; then
+ output_objdir="$objdir"
+ else
+ output_objdir="$output_objdir/$objdir"
+ fi
+
+ if test -n "$objs"; then
+ $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
+ exit 1
+ fi
+
+ # How the heck are we supposed to write a wrapper for a shared library?
+ if test -n "$link_against_libtool_libs"; then
+ $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
+ exit 1
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
+ fi
+
+ set dummy $rpath
+ if test $# -gt 2; then
+ $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+ fi
+ install_libdir="$2"
+
+ oldlibs=
+ if test -z "$rpath"; then
+ if test "$build_libtool_libs" = yes; then
+ # Building a libtool convenience library.
+ libext=al
+ oldlibs="$output_objdir/$libname.$libext $oldlibs"
+ build_libtool_libs=convenience
+ build_old_libs=yes
+ fi
+ dependency_libs="$deplibs"
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+ fi
+ else
+
+ # Parse the version information argument.
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
+ set dummy $vinfo 0 0 0
+ IFS="$save_ifs"
+
+ if test -n "$8"; then
+ $echo "$modename: too many parameters to \`-version-info'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ current="$2"
+ revision="$3"
+ age="$4"
+
+ # Check that each of the things are valid numbers.
+ case "$current" in
+ 0 | [1-9] | [1-9][0-9]*) ;;
+ *)
+ $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case "$revision" in
+ 0 | [1-9] | [1-9][0-9]*) ;;
+ *)
+ $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case "$age" in
+ 0 | [1-9] | [1-9][0-9]*) ;;
+ *)
+ $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ if test $age -gt $current; then
+ $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ fi
+
+ # Calculate the version variables.
+ major=
+ versuffix=
+ verstring=
+ case "$version_type" in
+ none) ;;
+
+ irix)
+ major=`expr $current - $age + 1`
+ versuffix="$major.$revision"
+ verstring="sgi$major.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$revision
+ while test $loop != 0; do
+ iface=`expr $revision - $loop`
+ loop=`expr $loop - 1`
+ verstring="sgi$major.$iface:$verstring"
+ done
+ ;;
+
+ linux)
+ major=.`expr $current - $age`
+ versuffix="$major.$age.$revision"
+ ;;
+
+ osf)
+ major=`expr $current - $age`
+ versuffix=".$current.$age.$revision"
+ verstring="$current.$age.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$age
+ while test $loop != 0; do
+ iface=`expr $current - $loop`
+ loop=`expr $loop - 1`
+ verstring="$verstring:${iface}.0"
+ done
+
+ # Make executables depend on our current version.
+ verstring="$verstring:${current}.0"
+ ;;
+
+ sunos)
+ major=".$current"
+ versuffix=".$current.$revision"
+ ;;
+
+ freebsd-aout)
+ major=".$current"
+ versuffix=".$current.$revision";
+ ;;
+
+ freebsd-elf)
+ major=".$current"
+ versuffix=".$current";
+ ;;
+
+ windows)
+ # Like Linux, but with '-' rather than '.', since we only
+ # want one extension on Windows 95.
+ major=`expr $current - $age`
+ versuffix="-$major-$age-$revision"
+ ;;
+
+ *)
+ $echo "$modename: unknown library version type \`$version_type'" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Clear the version info if we defaulted, and they specified a release.
+ if test -z "$vinfo" && test -n "$release"; then
+ major=
+ verstring="0.0"
+ if test "$need_version" = no; then
+ versuffix=
+ else
+ versuffix=".0.0"
+ fi
+ fi
+
+ # Remove version info from name if versioning should be avoided
+ if test "$avoid_version" = yes && test "$need_version" = no; then
+ major=
+ versuffix=
+ verstring=""
+ fi
+
+ # Check to see if the archive will have undefined symbols.
+ if test "$allow_undefined" = yes; then
+ if test "$allow_undefined_flag" = unsupported; then
+ $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+ build_libtool_libs=no
+ build_old_libs=yes
+ fi
+ else
+ # Don't allow undefined symbols.
+ allow_undefined_flag="$no_undefined_flag"
+ fi
+
+ dependency_libs="$deplibs"
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
+ # these systems don't actually have a c library (as such)!
+ ;;
+ *-*-rhapsody*)
+ # rhapsody is a little odd...
+ deplibs="$deplibs -framework System"
+ ;;
+ *)
+ # Add libc to deplibs on all other systems.
+ deplibs="$deplibs -lc"
+ ;;
+ esac
+ fi
+
+ # Create the output directory, or remove our outputs if we need to.
+ if test -d $output_objdir; then
+ $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
+ $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
+ else
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ status=$?
+ if test $status -ne 0 && test ! -d $output_objdir; then
+ exit $status
+ fi
+ fi
+
+ # Now set the variables for building old libraries.
+ if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+ oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+ # Transform .lo files to .o files.
+ oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+ fi
+
+ if test "$build_libtool_libs" = yes; then
+ # Transform deplibs into only deplibs that can be linked in shared.
+ name_save=$name
+ libname_save=$libname
+ release_save=$release
+ versuffix_save=$versuffix
+ major_save=$major
+ # I'm not sure if I'm treating the release correctly. I think
+ # release should show up in the -l (ie -lgmp5) so we don't want to
+ # add it in twice. Is that correct?
+ release=""
+ versuffix=""
+ major=""
+ newdeplibs=
+ droppeddeps=no
+ case "$deplibs_check_method" in
+ pass_all)
+ # Don't check for shared/static. Everything works.
+ # This might be a little naive. We might want to check
+ # whether the library exists or not. But this is on
+ # osf3 & osf4 and I'm not really sure... Just
+ # implementing what was already the behaviour.
+ newdeplibs=$deplibs
+ ;;
+ test_compile)
+ # This code stresses the "libraries are programs" paradigm to its
+ # limits. Maybe even breaks it. We compile a program, linking it
+ # against the deplibs as a proxy for the library. Then we can check
+ # whether they linked in statically or dynamically with ldd.
+ $rm conftest.c
+ cat > conftest.c <<EOF
+ int main() { return 0; }
+EOF
+ $rm conftest
+ $CC -o conftest conftest.c $deplibs
+ if test $? -eq 0 ; then
+ ldd_output=`ldd conftest`
+ for i in $deplibs; do
+ name="`expr $i : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning: This library needs some functionality provided by $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ else
+ # Error occured in the first compile. Let's try to salvage the situation:
+ # Compile a seperate program for each library.
+ for i in $deplibs; do
+ name="`expr $i : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" ; then
+ $rm conftest
+ $CC -o conftest conftest.c $i
+ # Did it work?
+ if test $? -eq 0 ; then
+ ldd_output=`ldd conftest`
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning: This library needs some functionality provided by $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ fi
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning! Library $i is needed by this library but I was not able to"
+ echo "*** make it link in! You will probably need to install it or some"
+ echo "*** library that it depends on before this library will be fully"
+ echo "*** functional. Installing it before continuing would be even better."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ fi
+ ;;
+ file_magic*)
+ set dummy $deplibs_check_method
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
+ for a_deplib in $deplibs; do
+ name="`expr $a_deplib : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ for i in $lib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ # Follow soft links.
+ if ls -lLd "$potent_lib" 2>/dev/null \
+ | grep " -> " >/dev/null; then
+ continue
+ fi
+ # The statement above tries to avoid entering an
+ # endless loop below, in case of cyclic links.
+ # We might still enter an endless loop, since a link
+ # loop can be closed while we follow links,
+ # but so what?
+ potlib="$potent_lib"
+ while test -h "$potlib" 2>/dev/null; do
+ potliblink=`ls -ld $potlib | sed 's/.* -> //'`
+ case "$potliblink" in
+ [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+ *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+ esac
+ done
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+ | sed 10q \
+ | egrep "$file_magic_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ echo "*** Warning: This library needs some functionality provided by $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ none | unknown | *)
+ newdeplibs=""
+ if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+ -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
+ grep . >/dev/null; then
+ echo
+ if test "X$deplibs_check_method" = "Xnone"; then
+ echo "*** Warning: inter-library dependencies are not supported in this platform."
+ else
+ echo "*** Warning: inter-library dependencies are not known to be supported."
+ fi
+ echo "*** All declared inter-library dependencies are being dropped."
+ droppeddeps=yes
+ fi
+ ;;
+ esac
+ versuffix=$versuffix_save
+ major=$major_save
+ release=$release_save
+ libname=$libname_save
+ name=$name_save
+
+ if test "$droppeddeps" = yes; then
+ if test "$module" = yes; then
+ echo
+ echo "*** Warning: libtool could not satisfy all declared inter-library"
+ echo "*** dependencies of module $libname. Therefore, libtool will create"
+ echo "*** a static module, that should work as long as the dlopening"
+ echo "*** application is linked with the -dlopen flag."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ else
+ echo "*** The inter-library dependencies that have been dropped here will be"
+ echo "*** automatically added whenever a program is linked with this library"
+ echo "*** or is declared to -dlopen it."
+ fi
+ fi
+ # Done checking deplibs!
+ deplibs=$newdeplibs
+ fi
+
+ # All the library-specific variables (install_libdir is set above).
+ library_names=
+ old_library=
+ dlname=
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+ # Get the real and link names of the library.
+ eval library_names=\"$library_names_spec\"
+ set dummy $library_names
+ realname="$2"
+ shift; shift
+
+ if test -n "$soname_spec"; then
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+
+ lib="$output_objdir/$realname"
+ for link
+ do
+ linknames="$linknames $link"
+ done
+
+ # Ensure that we have .o objects for linkers which dislike .lo
+ # (e.g. aix) in case we are running --disable-static
+ for obj in $libobjs; do
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+ if test ! -f $xdir/$oldobj; then
+ $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
+ $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
+ fi
+ done
+
+ # Use standard objects if they are pic
+ test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+ $show "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $run $rm $export_symbols
+ eval cmds=\"$export_symbols_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ if test -n "$export_symbols_regex"; then
+ $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+ $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+ $run eval '$mv "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+ fi
+
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+ fi
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${outputname}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ for xlib in $convenience; do
+ # Extract the objects.
+ case "$xlib" in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+ fi
+
+ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+ eval flag=\"$thread_safe_flag_spec\"
+ linkopts="$linkopts $flag"
+ fi
+
+ # Do each of the archive commands.
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval cmds=\"$archive_expsym_cmds\"
+ else
+ eval cmds=\"$archive_cmds\"
+ fi
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Create links to the real library.
+ for linkname in $linknames; do
+ if test "$realname" != "$linkname"; then
+ $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+ fi
+ done
+
+ # If -module or -export-dynamic was specified, set the dlname.
+ if test "$module" = yes || test "$export_dynamic" = yes; then
+ # On all known operating systems, these are identical.
+ dlname="$soname"
+ fi
+ fi
+ ;;
+
+ *.lo | *.o | *.obj)
+ if test -n "$link_against_libtool_libs"; then
+ $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
+ exit 1
+ fi
+
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+ fi
+
+ case "$output" in
+ *.lo)
+ if test -n "$objs"; then
+ $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+ exit 1
+ fi
+ libobj="$output"
+ obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+ ;;
+ *)
+ libobj=
+ obj="$output"
+ ;;
+ esac
+
+ # Delete the old objects.
+ $run $rm $obj $libobj
+
+ # Objects from convenience libraries. This assumes
+ # single-version convenience libraries. Whenever we create
+ # different ones for PIC/non-PIC, this we'll have to duplicate
+ # the extraction.
+ reload_conv_objs=
+ gentop=
+ # reload_cmds runs $LD directly, so let us get rid of
+ # -Wl from whole_archive_flag_spec
+ wl=
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${obj}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ for xlib in $convenience; do
+ # Extract the objects.
+ case "$xlib" in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+ fi
+
+ # Create the old-style object.
+ reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
+
+ output="$obj"
+ eval cmds=\"$reload_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Exit if we aren't doing a library object file.
+ if test -z "$libobj"; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit 0
+ fi
+
+ if test "$build_libtool_libs" != yes; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we don't
+ # accidentally link it into a program.
+ $show "echo timestamp > $libobj"
+ $run eval "echo timestamp > $libobj" || exit $?
+ exit 0
+ fi
+
+ if test -n "$pic_flag"; then
+ # Only do commands if we really have different PIC objects.
+ reload_objs="$libobjs $reload_conv_objs"
+ output="$libobj"
+ eval cmds=\"$reload_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ else
+ # Just create a symlink.
+ $show $rm $libobj
+ $run $rm $libobj
+ xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$libobj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+ oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+ $show "(cd $xdir && $LN_S $oldobj $baseobj)"
+ $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
+ fi
+
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit 0
+ ;;
+
+ # Anything else should be a program.
+ *)
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+ fi
+
+ if test "$preload" = yes; then
+ if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
+ test "$dlopen_self_static" = unknown; then
+ $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+ fi
+ fi
+
+ if test -n "$rpath$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ for libdir in $rpath $xrpath; do
+ # This is the magic to use -rpath.
+ case "$compile_rpath " in
+ *" $libdir "*) ;;
+ *) compile_rpath="$compile_rpath $libdir" ;;
+ esac
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+ fi
+
+ # Now hardcode the library paths
+ rpath=
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ compile_rpath="$rpath"
+
+ rpath=
+ hardcode_libdirs=
+ for libdir in $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$finalize_perm_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ finalize_rpath="$rpath"
+
+ output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$output_objdir" = "X$output"; then
+ output_objdir="$objdir"
+ else
+ output_objdir="$output_objdir/$objdir"
+ fi
+
+ # Create the binary in the object directory, then wrap it.
+ if test ! -d $output_objdir; then
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ status=$?
+ if test $status -ne 0 && test ! -d $output_objdir; then
+ exit $status
+ fi
+ fi
+
+ if test -n "$libobjs" && test "$build_old_libs" = yes; then
+ # Transform all the library objects into standard objects.
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ fi
+
+ dlsyms=
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ dlsyms="${outputname}S.c"
+ else
+ $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+ fi
+ fi
+
+ if test -n "$dlsyms"; then
+ case "$dlsyms" in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${outputname}.nm"
+
+ $show "$rm $nlist ${nlist}S ${nlist}T"
+ $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+ # Parse the name list into a source file.
+ $show "creating $output_objdir/$dlsyms"
+
+ test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ $show "generating symbol list for \`$output'"
+
+ test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+ # Add our own program objects to the symbol list.
+ progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ for arg in $progfiles; do
+ $show "extracting global C symbols from \`$arg'"
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$output.exp"
+ $run $rm $export_symbols
+ $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ else
+ $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
+ $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
+ $run eval 'mv "$nlist"T "$nlist"'
+ fi
+ fi
+
+ for arg in $dlprefiles; do
+ $show "extracting global C symbols from \`$arg'"
+ name=`echo "$arg" | sed -e 's%^.*/%%'`
+ $run eval 'echo ": $name " >> "$nlist"'
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -z "$run"; then
+ # Make sure we have at least an empty file.
+ test -f "$nlist" || : > "$nlist"
+
+ if test -n "$exclude_expsyms"; then
+ egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+ $mv "$nlist"T "$nlist"
+ fi
+
+ # Try sorting and uniquifying the output.
+ if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
+ :
+ else
+ grep -v "^: " < "$nlist" > "$nlist"S
+ fi
+
+ if test -f "$nlist"S; then
+ eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+ else
+ echo '/* NONE */' >> "$output_objdir/$dlsyms"
+ fi
+
+ $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+ sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
+ -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
+ < "$nlist" >> "$output_objdir/$dlsyms"
+
+ $echo >> "$output_objdir/$dlsyms" "\
+ {0, (lt_ptr_t) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ fi
+
+ pic_flag_for_symtable=
+ case "$host" in
+ # compiling the symbol table file with pic_flag works around
+ # a FreeBSD bug that causes programs to crash when -lm is
+ # linked before any other PIC object. But we must not use
+ # pic_flag when linking with -static. The problem exists in
+ # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+ *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
+ esac;;
+ *-*-hpux*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DPIC";;
+ esac
+ esac
+
+ # Now compile the dynamic symbol file.
+ $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+ $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+ # Clean up the generated files.
+ $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+ $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+ # Transform the symbol file into the correct name.
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ ;;
+ *)
+ $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+ exit 1
+ ;;
+ esac
+ else
+ # We keep going just in case the user didn't refer to
+ # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
+ # really was required.
+
+ # Nullify the symbol file.
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+ fi
+
+ if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
+ # Replace the output file specification.
+ compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ link_command="$compile_command$compile_rpath"
+
+ # We have no uninstalled library dependencies, so finalize right now.
+ $show "$link_command"
+ $run eval "$link_command"
+ status=$?
+
+ # Delete the generated files.
+ if test -n "$dlsyms"; then
+ $show "$rm $output_objdir/${outputname}S.${objext}"
+ $run $rm "$output_objdir/${outputname}S.${objext}"
+ fi
+
+ exit $status
+ fi
+
+ if test -n "$shlibpath_var"; then
+ # We should set the shlibpath_var
+ rpath=
+ for dir in $temp_rpath; do
+ case "$dir" in
+ [\\/]* | [A-Za-z]:[\\/]*)
+ # Absolute path.
+ rpath="$rpath$dir:"
+ ;;
+ *)
+ # Relative path: add a thisdir entry.
+ rpath="$rpath\$thisdir/$dir:"
+ ;;
+ esac
+ done
+ temp_rpath="$rpath"
+ fi
+
+ if test -n "$compile_shlibpath$finalize_shlibpath"; then
+ compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+ fi
+ if test -n "$finalize_shlibpath"; then
+ finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+ fi
+
+ compile_var=
+ finalize_var=
+ if test -n "$runpath_var"; then
+ if test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ if test -n "$finalize_perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $finalize_perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ fi
+
+ if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+ $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+ $echo "$modename: \`$output' will be relinked during installation" 1>&2
+ else
+ if test "$fast_install" != no; then
+ link_command="$finalize_var$compile_command$finalize_rpath"
+ if test "$fast_install" = yes; then
+ relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+ else
+ # fast_install is set to needless
+ relink_command=
+ fi
+ else
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+ fi
+ fi
+
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+ # Delete the old output files.
+ $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+
+ # Now create the wrapper script.
+ $show "creating $output"
+
+ # Quote the relink command for shipping.
+ if test -n "$relink_command"; then
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Quote $echo for shipping.
+ if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
+ case "$0" in
+ [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
+ *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
+ esac
+ qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+ else
+ qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Only actually do things if our run command is non-null.
+ if test -z "$run"; then
+ # win32 will think the script is a binary if it has
+ # a .exe suffix, so we strip it off here.
+ case $output in
+ *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
+ esac
+ $rm $output
+ trap "$rm $output; exit 1" 1 2 15
+
+ $echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variable:
+ link_against_libtool_libs='$link_against_libtool_libs'
+else
+ # When we are sourced in execute mode, \$file and \$echo are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ echo=\"$qecho\"
+ file=\"\$0\"
+ # Make sure echo works.
+ if test \"X\$1\" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+ elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+ # Yippee, \$echo works!
+ :
+ else
+ # Restart under the correct shell, and then maybe \$echo will work.
+ exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+ fi
+ fi\
+"
+ $echo >> $output "\
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
+ done
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ echo >> $output "\
+ program=lt-'$outputname'
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" || \\
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $mkdir \"\$progdir\"
+ else
+ $rm \"\$progdir/\$file\"
+ fi"
+
+ echo >> $output "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if (cd \"\$thisdir\" && eval \$relink_command); then :
+ else
+ $rm \"\$progdir/\$file\"
+ exit 1
+ fi
+ fi
+
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $rm \"\$progdir/\$program\";
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $rm \"\$progdir/\$file\"
+ fi"
+ else
+ echo >> $output "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ echo >> $output "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $echo >> $output "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 sed
+ $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ # fixup the dll searchpath if we need to.
+ if test -n "$dllsearchpath"; then
+ $echo >> $output "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ $echo >> $output "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+"
+ case $host in
+ # win32 systems need to use the prog path for dll
+ # lookup to work
+ *-*-cygwin*)
+ $echo >> $output "\
+ exec \$progdir/\$program \${1+\"\$@\"}
+"
+ ;;
+
+ # Backslashes separate directories on plain windows
+ *-*-mingw | *-*-os2*)
+ $echo >> $output "\
+ exec \$progdir\\\\\$program \${1+\"\$@\"}
+"
+ ;;
+
+ *)
+ $echo >> $output "\
+ # Export the path to the program.
+ PATH=\"\$progdir:\$PATH\"
+ export PATH
+
+ exec \$program \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $echo >> $output "\
+ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+ exit 1
+ fi
+ else
+ # The program doesn't exist.
+ \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
+ \$echo \"This script is just a wrapper for \$program.\" 1>&2
+ echo \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit 1
+ fi
+fi\
+"
+ chmod +x $output
+ fi
+ exit 0
+ ;;
+ esac
+
+ # See if we need to build an old-fashioned archive.
+ for oldlib in $oldlibs; do
+
+ if test "$build_libtool_libs" = convenience; then
+ oldobjs="$libobjs_save"
+ addlibs="$convenience"
+ build_libtool_libs=no
+ else
+ if test "$build_libtool_libs" = module; then
+ oldobjs="$libobjs_save"
+ build_libtool_libs=no
+ else
+ oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
+ fi
+ addlibs="$old_convenience"
+ fi
+
+ if test -n "$addlibs"; then
+ gentop="$output_objdir/${outputname}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ # Add in members from convenience archives.
+ for xlib in $addlibs; do
+ # Extract the objects.
+ case "$xlib" in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+
+ # Do each command in the archive commands.
+ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+ eval cmds=\"$old_archive_from_new_cmds\"
+ else
+ # Ensure that we have .o objects in place in case we decided
+ # not to build a shared library, and have fallen back to building
+ # static libs even though --disable-static was passed!
+ for oldobj in $oldobjs; do
+ if test ! -f $oldobj; then
+ xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$oldobj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
+ obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+ $show "(cd $xdir && ${LN_S} $obj $baseobj)"
+ $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
+ fi
+ done
+
+ eval cmds=\"$old_archive_cmds\"
+ fi
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$generated"; then
+ $show "${rm}r$generated"
+ $run ${rm}r$generated
+ fi
+
+ # Now create the libtool archive.
+ case "$output" in
+ *.la)
+ old_library=
+ test "$build_old_libs" = yes && old_library="$libname.$libext"
+ $show "creating $output"
+
+ if test -n "$xrpath"; then
+ temp_xrpath=
+ for libdir in $xrpath; do
+ temp_xrpath="$temp_xrpath -R$libdir"
+ done
+ dependency_libs="$temp_xrpath $dependency_libs"
+ fi
+
+ # Only create the output if not a dry run.
+ if test -z "$run"; then
+ for installed in no yes; do
+ if test "$installed" = yes; then
+ if test -z "$install_libdir"; then
+ break
+ fi
+ output="$output_objdir/$outputname"i
+ fi
+ $rm $output
+ $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$dlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'\
+"
+ done
+ fi
+
+ # Do a symbolic link so that the libtool archive can be found in
+ # LD_LIBRARY_PATH before the program is installed.
+ $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+ $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
+ ;;
+ esac
+ exit 0
+ ;;
+
+ # libtool install mode
+ install)
+ modename="$modename: install"
+
+ # There may be an optional sh(1) argument at the beginning of
+ # install_prog (especially on Windows NT).
+ if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
+ # Aesthetically quote it.
+ arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$arg "
+ arg="$1"
+ shift
+ else
+ install_prog=
+ arg="$nonopt"
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog$arg"
+
+ # We need to accept at least all the BSD install flags.
+ dest=
+ files=
+ opts=
+ prev=
+ install_type=
+ isdir=no
+ stripme=
+ for arg
+ do
+ if test -n "$dest"; then
+ files="$files $dest"
+ dest="$arg"
+ continue
+ fi
+
+ case "$arg" in
+ -d) isdir=yes ;;
+ -f) prev="-f" ;;
+ -g) prev="-g" ;;
+ -m) prev="-m" ;;
+ -o) prev="-o" ;;
+ -s)
+ stripme=" -s"
+ continue
+ ;;
+ -*) ;;
+
+ *)
+ # If the previous option needed an argument, then skip it.
+ if test -n "$prev"; then
+ prev=
+ else
+ dest="$arg"
+ continue
+ fi
+ ;;
+ esac
+
+ # Aesthetically quote the argument.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog $arg"
+ done
+
+ if test -z "$install_prog"; then
+ $echo "$modename: you must specify an install program" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prev' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ $echo "$modename: no file or destination specified" 1>&2
+ else
+ $echo "$modename: you must specify a destination" 1>&2
+ fi
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Strip any trailing slash from the destination.
+ dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$destdir" = "X$dest" && destdir=.
+ destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files
+ if test $# -gt 2; then
+ $echo "$modename: \`$dest' is not a directory" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+ fi
+ case "$destdir" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case "$file" in
+ *.lo) ;;
+ *)
+ $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ staticlibs=
+ future_libdirs=
+ current_libdirs=
+ for file in $files; do
+
+ # Do each installation.
+ case "$file" in
+ *.a | *.lib)
+ # Do the static libraries later.
+ staticlibs="$staticlibs $file"
+ ;;
+
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ library_names=
+ old_library=
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Add the libdir to current_libdirs if it is the destination.
+ if test "X$destdir" = "X$libdir"; then
+ case "$current_libdirs " in
+ *" $libdir "*) ;;
+ *) current_libdirs="$current_libdirs $libdir" ;;
+ esac
+ else
+ # Note the libdir as a future libdir.
+ case "$future_libdirs " in
+ *" $libdir "*) ;;
+ *) future_libdirs="$future_libdirs $libdir" ;;
+ esac
+ fi
+
+ dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
+ test "X$dir" = "X$file/" && dir=
+ dir="$dir$objdir"
+
+ # See the names of the shared library.
+ set dummy $library_names
+ if test -n "$2"; then
+ realname="$2"
+ shift
+ shift
+
+ # Install the shared library and build the symlinks.
+ $show "$install_prog $dir/$realname $destdir/$realname"
+ $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
+
+ if test $# -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ for linkname
+ do
+ if test "$linkname" != "$realname"; then
+ $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ fi
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ eval cmds=\"$postinstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Install the pseudo-library for information purposes.
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ instname="$dir/$name"i
+ $show "$install_prog $instname $destdir/$name"
+ $run eval "$install_prog $instname $destdir/$name" || exit $?
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+ ;;
+
+ *.lo)
+ # Install (i.e. copy) a libtool object.
+
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case "$destfile" in
+ *.lo)
+ staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+ ;;
+ *.o | *.obj)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ if test -n "$destfile"; then
+ $show "$install_prog $file $destfile"
+ $run eval "$install_prog $file $destfile" || exit $?
+ fi
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+ $show "$install_prog $staticobj $staticdest"
+ $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+ fi
+ exit 0
+ ;;
+
+ *)
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Do a test to see if this is really a libtool program.
+ if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ link_against_libtool_libs=
+ relink_command=
+
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Check the variables that should have been set.
+ if test -z "$link_against_libtool_libs"; then
+ $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
+ exit 1
+ fi
+
+ finalize=yes
+ for lib in $link_against_libtool_libs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ # If there is no directory component, then add one.
+ case "$lib" in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+ fi
+ libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+ finalize=no
+ fi
+ done
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ if test "$finalize" = yes && test -z "$run"; then
+ tmpdir="/tmp"
+ test -n "$TMPDIR" && tmpdir="$TMPDIR"
+ tmpdir="$tmpdir/libtool-$$"
+ if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
+ else
+ $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
+ continue
+ fi
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ ${rm}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ $echo "$modename: warning: cannot relink \`$file'" 1>&2
+ fi
+ else
+ # Install the binary that we compiled earlier.
+ file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+ fi
+ fi
+
+ $show "$install_prog$stripme $file $destfile"
+ $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+ test -n "$outputname" && ${rm}r "$tmpdir"
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+
+ $show "$install_prog $file $oldlib"
+ $run eval "$install_prog \$file \$oldlib" || exit $?
+
+ # Do each command in the postinstall commands.
+ eval cmds=\"$old_postinstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$future_libdirs"; then
+ $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+ fi
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ test -n "$run" && current_libdirs=" -n$current_libdirs"
+ exec $SHELL $0 --finish$current_libdirs
+ exit 1
+ fi
+
+ exit 0
+ ;;
+
+ # libtool finish mode
+ finish)
+ modename="$modename: finish"
+ libdirs="$nonopt"
+ admincmds=
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for dir
+ do
+ libdirs="$libdirs $dir"
+ done
+
+ for libdir in $libdirs; do
+ if test -n "$finish_cmds"; then
+ # Do each command in the finish commands.
+ eval cmds=\"$finish_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || admincmds="$admincmds
+ $cmd"
+ done
+ IFS="$save_ifs"
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $run eval "$cmds" || admincmds="$admincmds
+ $cmds"
+ fi
+ done
+ fi
+
+ # Exit here if they wanted silent mode.
+ test "$show" = : && exit 0
+
+ echo "----------------------------------------------------------------------"
+ echo "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ echo " $libdir"
+ done
+ echo
+ echo "If you ever happen to want to link against installed libraries"
+ echo "in a given directory, LIBDIR, you must either use libtool, and"
+ echo "specify the full pathname of the library, or use \`-LLIBDIR'"
+ echo "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ echo " during execution"
+ fi
+ if test -n "$runpath_var"; then
+ echo " - add LIBDIR to the \`$runpath_var' environment variable"
+ echo " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ echo " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ echo " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ echo
+ echo "See any operating system documentation about shared libraries for"
+ echo "more information, such as the ld(1) and ld.so(8) manual pages."
+ echo "----------------------------------------------------------------------"
+ exit 0
+ ;;
+
+ # libtool execute mode
+ execute)
+ modename="$modename: execute"
+
+ # The first argument is the command name.
+ cmd="$nonopt"
+ if test -z "$cmd"; then
+ $echo "$modename: you must specify a COMMAND" 1>&2
+ $echo "$help"
+ exit 1
+ fi
+
+ # Handle -dlopen flags immediately.
+ for file in $execute_dlfiles; do
+ if test ! -f "$file"; then
+ $echo "$modename: \`$file' is not a file" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ dir=
+ case "$file" in
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+
+ if test -f "$dir/$objdir/$dlname"; then
+ dir="$dir/$objdir"
+ else
+ $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+ exit 1
+ fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+ ;;
+
+ *)
+ $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+ continue
+ ;;
+ esac
+
+ # Get the absolute pathname.
+ absdir=`cd "$dir" && pwd`
+ test -n "$absdir" && dir="$absdir"
+
+ # Now add the directory to shlibpath_var.
+ if eval "test -z \"\$$shlibpath_var\""; then
+ eval "$shlibpath_var=\"\$dir\""
+ else
+ eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+ fi
+ done
+
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
+
+ # Check if any of the arguments is a wrapper script.
+ args=
+ for file
+ do
+ case "$file" in
+ -*) ;;
+ *)
+ # Do a test to see if this is really a libtool program.
+ if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+ args="$args \"$file\""
+ done
+
+ if test -z "$run"; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved enviroment variables
+ if test "${save_LC_ALL+set}" = set; then
+ LC_ALL="$save_LC_ALL"; export LC_ALL
+ fi
+ if test "${save_LANG+set}" = set; then
+ LANG="$save_LANG"; export LANG
+ fi
+
+ # Now actually exec the command.
+ eval "exec \$cmd$args"
+
+ $echo "$modename: cannot exec \$cmd$args"
+ exit 1
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+ eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+ $echo "export $shlibpath_var"
+ fi
+ $echo "$cmd$args"
+ exit 0
+ fi
+ ;;
+
+ # libtool uninstall mode
+ uninstall)
+ modename="$modename: uninstall"
+ rm="$nonopt"
+ files=
+
+ for arg
+ do
+ case "$arg" in
+ -*) rm="$rm $arg" ;;
+ *) files="$files $arg" ;;
+ esac
+ done
+
+ if test -z "$rm"; then
+ $echo "$modename: you must specify an RM program" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ for file in $files; do
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+ rmfiles="$file"
+
+ case "$name" in
+ *.la)
+ # Possibly a libtool archive, so verify it.
+ if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ . $dir/$name
+
+ # Delete the libtool libraries and symlinks.
+ for n in $library_names; do
+ rmfiles="$rmfiles $dir/$n"
+ done
+ test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
+
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles
+
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ eval cmds=\"$postuninstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+ done
+ IFS="$save_ifs"
+ fi
+
+ if test -n "$old_library"; then
+ # Do each command in the old_postuninstall commands.
+ eval cmds=\"$old_postuninstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+ done
+ IFS="$save_ifs"
+ fi
+
+ # FIXME: should reinstall the best remaining shared library.
+ fi
+ ;;
+
+ *.lo)
+ if test "$build_old_libs" = yes; then
+ oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
+ rmfiles="$rmfiles $dir/$oldobj"
+ fi
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles
+ ;;
+
+ *)
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles
+ ;;
+ esac
+ done
+ exit 0
+ ;;
+
+ "")
+ $echo "$modename: you must specify a MODE" 1>&2
+ $echo "$generic_help" 1>&2
+ exit 1
+ ;;
+ esac
+
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$generic_help" 1>&2
+ exit 1
+fi # test -z "$show_help"
+
+# We need to display help for each of the modes.
+case "$mode" in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+ --config show all configuration variables
+ --debug enable verbose shell tracing
+-n, --dry-run display commands without modifying any files
+ --features display basic configuration information and exit
+ --finish same as \`--mode=finish'
+ --help display this help message and exit
+ --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
+ --quiet same as \`--silent'
+ --silent don't print informational messages
+ --version print version information
+
+MODE must be one of the following:
+
+ compile compile a source file into a libtool object
+ execute automatically set library path, then run a program
+ finish complete the installation of libtool libraries
+ install install libraries or executables
+ link create a library or an executable
+ uninstall remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE."
+ exit 0
+ ;;
+
+compile)
+ $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
+ -static always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+ ;;
+
+execute)
+ $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+ -dlopen FILE add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+ ;;
+
+finish)
+ $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges. Use
+the \`--dry-run' option if you just want to see what would be executed."
+ ;;
+
+install)
+ $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command. The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+link)
+ $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+ -all-static do not do any dynamic linking at all
+ -avoid-version do not add a version suffix if possible
+ -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
+ -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
+ -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+ -export-symbols SYMFILE
+ try to export only the symbols listed in SYMFILE
+ -export-symbols-regex REGEX
+ try to export only the symbols matching REGEX
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -module build a library that can dlopened
+ -no-undefined declare that a library does not refer to external symbols
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -release RELEASE specify package release information
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -static do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename. Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+ ;;
+
+uninstall)
+ $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+*)
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+esac
+
+echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit 0
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/contrib/idn/idnkit-1.0-src/make.wnt b/contrib/idn/idnkit-1.0-src/make.wnt
new file mode 100644
index 0000000..73316ca
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/make.wnt
@@ -0,0 +1,76 @@
+# $Id: make.wnt,v 1.1.1.1 2003/06/04 00:25:03 marka Exp $
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+all : force
+ copy include\config.h.win include\config.h
+ cd lib
+ $(MAKE) -f make.wnt
+ cd ..
+ cd tools
+ $(MAKE) -f make.wnt
+ cd ..
+ cd wsock
+ $(MAKE) -f make.wnt
+ cd ..
+
+install : all
+ cd lib
+ $(MAKE) -f make.wnt install
+ cd ..
+ cd tools
+ $(MAKE) -f make.wnt install
+ cd ..
+ cd wsock
+ $(MAKE) -f make.wnt install
+ cd ..
+
+clean : force
+ cd lib
+ $(MAKE) -f make.wnt clean
+ cd ..
+ cd tools
+ $(MAKE) -f make.wnt clean
+ cd ..
+ cd wsock
+ $(MAKE) -f make.wnt clean
+ cd ..
+
+force:
diff --git a/contrib/idn/idnkit-1.0-src/man/Makefile.in b/contrib/idn/idnkit-1.0-src/man/Makefile.in
new file mode 100644
index 0000000..a85a793
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/man/Makefile.in
@@ -0,0 +1,116 @@
+# $Id: Makefile.in,v 1.1.1.1 2003/06/04 00:27:14 marka Exp $
+#
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+top_builddir = ..
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+sysconfdir = @sysconfdir@
+mandir = @mandir@
+man3dir = $(mandir)/man3
+man5dir = $(mandir)/man5
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
+SHELL = @SHELL@
+
+@LITEONLY_TRUE@all: libidnkitlite.3 idn.conf.5 idnrc.5 idnalias.conf.5
+@LITEONLY_FALSE@all: libidnkitlite.3 idn.conf.5 idnrc.5 idnalias.conf.5 libidnkit.3
+
+libidnkit.3: libidnkit.3.in
+ sed 's%[@]sysconfdir[@]%$(sysconfdir)%' < $(srcdir)/libidnkit.3.in > $@
+libidnkitlite.3: libidnkit.3.in
+ sed 's%[@]sysconfdir[@]%$(sysconfdir)%' < $(srcdir)/libidnkit.3.in > $@
+idn.conf.5: idn.conf.5.in
+ sed 's%[@]sysconfdir[@]%$(sysconfdir)%' < $(srcdir)/idn.conf.5.in > $@
+idnrc.5: idn.conf.5.in
+ sed 's%[@]sysconfdir[@]%$(sysconfdir)%' < $(srcdir)/idn.conf.5.in > $@
+idnalias.conf.5: idn.conf.5.in
+ sed 's%[@]sysconfdir[@]%$(sysconfdir)%' < $(srcdir)/idn.conf.5.in > $@
+
+@LITEONLY_TRUE@@COMPAT_TRUE@install: all install-common install-compat-common
+@LITEONLY_FALSE@@COMPAT_TRUE@install: all install-common install-nolite install-compat-common install-compat-nolite
+@LITEONLY_TRUE@@COMPAT_FALSE@install: all install-common
+@LITEONLY_FALSE@@COMPAT_FALSE@install: all install-common install-nolite
+
+install-common:
+ $(MKINSTALLDIRS) $(DESTDIR)$(man3dir)
+ $(INSTALL_DATA) libidnkitlite.3 $(DESTDIR)$(man3dir)/libidnkitlite.3
+ $(MKINSTALLDIRS) $(DESTDIR)$(man5dir)
+ $(INSTALL_DATA) idn.conf.5 $(DESTDIR)$(man5dir)/idn.conf.5
+ $(INSTALL_DATA) idnrc.5 $(DESTDIR)$(man5dir)/idnrc.5
+ $(INSTALL_DATA) idnalias.conf.5 $(DESTDIR)$(man5dir)/idnalias.conf.5
+
+install-nolite:
+ $(MKINSTALLDIRS) $(DESTDIR)$(man3dir)
+ $(INSTALL_DATA) libidnkit.3 $(DESTDIR)$(man3dir)/libidnkit.3
+
+install-compat-common:
+ src=$(DESTDIR)$(man3dir)/libidnkitlite.3; \
+ dst=$(DESTDIR)$(man3dir)/libmdnlite.3; \
+ rm -f $$dst; \
+ ln $$src $$dst || cp $$src $$dst
+ src=$(DESTDIR)$(man5dir)/idn.conf.5; \
+ dst=$(DESTDIR)$(man5dir)/mdn.conf.5; \
+ rm -f $$dst; \
+ ln $$src $$dst || cp $$src $$dst
+
+install-compat-nolite:
+ src=$(DESTDIR)$(man3dir)/libidnkit.3; \
+ dst=$(DESTDIR)$(man3dir)/libmdn.3; \
+ rm -f $$dst; \
+ ln $$src $$dst || cp $$src $$dst
+
+clean:
+ rm -f idn.conf.5 idnrc.5 idnalias.conf.5 libidnkit.3 libidnkitlite.3
+ rm -f *~
+
+distclean: clean
+ rm -f Makefile
+
+test check:
diff --git a/contrib/idn/idnkit-1.0-src/man/idn.conf.5.in b/contrib/idn/idnkit-1.0-src/man/idn.conf.5.in
new file mode 100644
index 0000000..cbc2248
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/man/idn.conf.5.in
@@ -0,0 +1,312 @@
+.\" $Id: idn.conf.5.in,v 1.1.1.1 2003/06/04 00:27:16 marka Exp $"
+.\"
+.\" Copyright (c) 2000,2001 Japan Network Information Center.
+.\" All rights reserved.
+.\"
+.\" By using this file, you agree to the terms and conditions set forth bellow.
+.\"
+.\" LICENSE TERMS AND CONDITIONS
+.\"
+.\" The following License Terms and Conditions apply, unless a different
+.\" license is obtained from Japan Network Information Center ("JPNIC"),
+.\" a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+.\" Chiyoda-ku, Tokyo 101-0047, Japan.
+.\"
+.\" 1. Use, Modification and Redistribution (including distribution of any
+.\" modified or derived work) in source and/or binary forms is permitted
+.\" under this License Terms and Conditions.
+.\"
+.\" 2. Redistribution of source code must retain the copyright notices as they
+.\" appear in each source code file, this License Terms and Conditions.
+.\"
+.\" 3. Redistribution in binary form must reproduce the Copyright Notice,
+.\" this License Terms and Conditions, in the documentation and/or other
+.\" materials provided with the distribution. For the purposes of binary
+.\" distribution the "Copyright Notice" refers to the following language:
+.\" "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+.\"
+.\" 4. The name of JPNIC may not be used to endorse or promote products
+.\" derived from this Software without specific prior written approval of
+.\" JPNIC.
+.\"
+.\" 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+.\" PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+.\"
+.TH idn.conf 5 "Mar 8, 2002"
+.\"
+.SH NAME
+idn.conf, .idnrc, idnalias.conf \- configuration files for idnkit library
+.\"
+.SH SYNOPSIS
+@sysconfdir@/idn.conf
+.br
+~/.idnrc
+.br
+@sysconfdir@/idnalias.conf
+.\"
+.SH DESCRIPTION
+\fBidn.conf\fR and \fB.idnrc\fR are configuration files for idnkit
+library which is a toolkit for handling internationalized domain names.
+.PP
+idnkit library tries to load the user's configuration file ~/.idnrc
+first, and then tries the system configutation file
+@sysconfdir@/idn.conf.
+Note that idnkit library loads either, not both.
+.PP
+To use internationalized domain names in DNS or other protocols, they
+must be converted to an appropriate format before further processing.
+In idnkit, this conversion process is comprised of the following tasks.
+.IP 1. 3
+Convert the given domain name in application's local codeset to Unicode,
+and vice versa.
+.IP 2. 3
+Map certain characters in the name to period character so that they are
+treated as the domain name
+delimiter (\fIdelimiter mapping\fR).
+.IP 3. 3
+Map certain characters in the name to other characters or chracter sequences,
+according to a mapping rule determined by its top level domain (TLD).
+.IP 4. 3
+Perform NAMEPREP, which is a starndard name preparation process for
+internationalized domain names. This process is composed of
+the tree steps called mapping, normalization, prohibited character
+checking and bidirectional string checking.
+.IP 5. 3
+Convert the nameprepped name to IDN encoding, which is the standard encoding
+for internationalized domain names (also known as ASCII-compatible encoding,
+ACE), and vice versa.
+.PP
+The configuration file specifies the parameters for these tasks, such as:
+.RS 2
+.IP \- 2
+the encoding of internationalized domain names (IDN encoding).
+.IP \- 2
+NAMEPREP schemes.
+.RE
+.\"
+.SH SYNTAX
+The configuration file is a simple text files, and each line in the file
+(other than comment lines, which begin with ``#'', and empty lines)
+forms an entry of the following format:
+.PP
+.RS 4
+.nf
+\fIkeyword\fP\ \fIvalue..\fP
+.fi
+.RE
+\."
+.SH "IDN-ENCODING ENTRY"
+IDN encoding entry specifies the encoding name (codeset name) which
+is used as the encoding of internationalized domain names.
+.PP
+The syntax of this entry is:
+.PP
+.RS 4
+.nf
+\f(CWidn-encoding \fP\fIencoding\fP
+.fi
+.RE
+.PP
+\fIencoding\fP is the encoding name to be used, and any of the following
+names can be specified.
+.RS 2
+.IP "\(bu" 2
+``Punycode''
+.IP "\(bu" 2
+``UTF-8''
+.IP "\(bu" 2
+Codeset names which iconv_open() library function accepts. Please
+consult iconv() documentation for the available codesets.
+.IP "\(bu" 2
+Any alias names for the above, defined by the alias file.
+(See section ``ENCODING-ALIAS-FILE'')
+.RE
+.PP
+The standard encoding was determined as Punycode.
+.\"
+.SH "NAMEPREP ENTRY"
+Nameprep entry specifies the version of NAMEPREP, which is a specification
+of ``canonicalization'' process of internationalized domain name before
+it is converted to the IDN encoding.
+.PP
+The syntax of this entry is:
+.PP
+.RS 4
+.nf
+\f(CWnameprep \fP\fIversion\fP
+.fi
+.RE
+.PP
+\fIversion\fR is the version name of NAMEPREP specification, and currently
+the following versions can be specified.
+.RS 2
+.IP "\(bu" 2
+``RFC3491''
+.br
+This version refers to RFC3491 ``rfc-3491.txt''.
+.RE
+.PP
+The NAMEPREP process consists of the following 4 subprocesses.
+.IP 1. 3
+mapping, which maps certain characters in a name to other characters,
+possibly none.
+.IP 2. 3
+normalization, which replaces character variants in a name to
+a unique one.
+.IP 3. 3
+prohibited character checking, which detects invalid characters in a name.
+.IP 4. 3
+unassigned codepoint checking, which also invalid codepoints in a name.
+.IP 5. 3
+bidirectional string checking, which detecs invalid string.
+.\"
+.SH "LOCAL-MAP ENTRY"
+This entry specifies localized mapping phase before NAMEPREP takes place.
+Different mapping rules can be specified for each TLD (top-level domain).
+For example, you can have one mapping for ``.tw'' domain, and another for
+``.jp'' domain.
+.PP
+The syntax of this entry is:
+.PP
+.RS 4
+.nf
+\f(CWlocal-map \fItld\f(CW \fIscheme\fR [\fIscheme\fR..]
+.fi
+.RE
+.PP
+\fItld\fR specifies the TLD to which the mapping rule is to be applied,
+and \fIscheme\fR specifies the mapping scheme, and currently available
+schemes are:
+.RS 2
+.TP 4
+\f(CWRFC3491\fP
+Specify mapping defined by RFC3491.
+.TP 4
+\f(CWfilemap:\fP\fIpathname\fP
+Specify mapping defined by the file \fIpathname\fP.
+See ``MAPFILE FORMAT'' for the format of this file.
+.RE
+.PP
+There are two special \fItld\fRs for specifying the mapping rule for
+local domain names (domain names without any dots in them), and the
+default mapping rule.
+If
+\fItld\fR is ``-'', it matches domain names which do not contain any
+dots.
+If \fItld\fR is ``.'', it matches any domain names which don't match
+to any other mapping rules specified by ``local-map'' entries.
+.\"
+.SH "MAPFILE FORMAT"
+A mapfile defines a set of character mapping rules. It can define
+unconditional one-character to N-character-sequence (N can be 0, 1 or more)
+mappings.
+.PP
+A mapfile is a simple text file, and each line specifies a single mapping.
+Each line is of the form:
+.PP
+.RS 4
+.nf
+\fIsrc-codepoint\fR\f(CW; \fImapped-codepoint-seq\fR\f(CW;\fR
+.fi
+.RE
+.PP
+\fIsrc-codepoint\fR indicates source character of the mapping, and must
+be a Unicode codepoint value in hexadecimal string.
+\fImapped-codepoint-seq\fR is a sequence of characters which is the
+outcome of the mapping, and must be a (possibly empty) list of Unicode
+codepoint values in hexadecimal string, separated by spaces.
+.PP
+Lines which begin with ``#'' are treated as comments and ignored.
+.PP
+A sample mapfile is shown below.
+.PP
+.RS 4
+.nf
+.ft CW
+# map "A" to "a"
+0041; 0061;
+# map "#" to nothing
+0023; ;
+# map "@" to "at"
+0040; 0061 0074;
+.ft R
+.fi
+.RE
+.\"
+.SH "LOCAL CODESET"
+\fBidn.conf\fR or \fB~/.idnrc\fR doesn't have an entry to specify the
+local codeset, since it is determined from the application's current
+locale information.
+So each application can use different local codeset.
+.PP
+Although idnkit tries hard to find out the local codeset, sometimes it
+fails. For example, there are applications which use non-ASCII codeset
+but work in C locale. In this case, you can specify the application's
+local codeset by an environment variable ``\fBIDN_LOCAL_CODESET\fR''.
+Just set the codeset name (or its alias name) to the variable, and
+idnkit will use the codeset as the local one, regardless of the locale
+setting.
+.\"
+.SH "ENCODING-ALIAS-FILE"
+Encoding alias file specifies codeset name aliases. It is located on
+@sysconfdir@/idnalias.conf and always loaded automatically as idn.conf
+and .idnrc. The aliases in this file can be used just as the real names.
+.PP
+The alias file is a simple text file, consisting of lines of the form:
+.PP
+.RS 4
+.nf
+\fIalias-name\fP\ \fIname\fP
+.fi
+.RE
+.PP
+\fIalias-name\fR is the alias name to be defined, and \fIname\fR is
+the real name or another alias name.
+.\"
+.SH "SAMPLE CONFIGURATION"
+The following shows a sample configuration file.
+.PP
+.RS 4
+.ft CW
+.nf
+#
+# a sample configuration.
+#
+
+# Use Punycode as the IDN encoding.
+idn-encoding Punycode
+
+# Use RFC3491 as NAMEPREP.
+nameprep RFC3491
+
+# Perform Japanese-specific mapping for .jp domain.
+# assuming /usr/local/lib/idnkit/jp-map contains the mapping.
+local-map .jp filemap:/usr/local/lib/idnkit/jp-map
+.fi
+.ft R
+.RE
+.\"
+.SH FILES
+.I @sysconfdir@/idn.conf
+.br
+.I ~/.idnrc
+.br
+.I @sysconfdir@/idnalias.conf
+.br
+.I @sysconfdir@/idn.conf.sample
+\- sample configuration with comments
+.br
+.I @sysconfdir@/idnalias.conf.sample
+\- sample alias file
+.\"
+.SH "SEE ALSO"
+iconv(3)
diff --git a/contrib/idn/idnkit-1.0-src/man/libidnkit.3.in b/contrib/idn/idnkit-1.0-src/man/libidnkit.3.in
new file mode 100644
index 0000000..12bca54
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/man/libidnkit.3.in
@@ -0,0 +1,480 @@
+.\" $Id: libidnkit.3.in,v 1.1.1.1 2003/06/04 00:27:15 marka Exp $
+.\"
+.\" Copyright (c) 2001,2002 Japan Network Information Center.
+.\" All rights reserved.
+.\"
+.\" By using this file, you agree to the terms and conditions set forth bellow.
+.\"
+.\" LICENSE TERMS AND CONDITIONS
+.\"
+.\" The following License Terms and Conditions apply, unless a different
+.\" license is obtained from Japan Network Information Center ("JPNIC"),
+.\" a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+.\" Chiyoda-ku, Tokyo 101-0047, Japan.
+.\"
+.\" 1. Use, Modification and Redistribution (including distribution of any
+.\" modified or derived work) in source and/or binary forms is permitted
+.\" under this License Terms and Conditions.
+.\"
+.\" 2. Redistribution of source code must retain the copyright notices as they
+.\" appear in each source code file, this License Terms and Conditions.
+.\"
+.\" 3. Redistribution in binary form must reproduce the Copyright Notice,
+.\" this License Terms and Conditions, in the documentation and/or other
+.\" materials provided with the distribution. For the purposes of binary
+.\" distribution the "Copyright Notice" refers to the following language:
+.\" "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+.\"
+.\" 4. The name of JPNIC may not be used to endorse or promote products
+.\" derived from this Software without specific prior written approval of
+.\" JPNIC.
+.\"
+.\" 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+.\" PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+.\"
+.TH libidnkit 3 "Mar 11, 2002"
+.\"
+.SH NAME
+libidnkit, libidnkitlite \- Internationalized Domain Name Handling Libraries
+.\"
+.SH SYNOPSIS
+.nf
+#include <idn/api.h>
+
+idn_result_t
+\fBidn_nameinit\fP(int\ load_file)
+
+idn_result_t
+\fBidn_encodename\fP(int\ actions,\ const\ char\ *from,\ char\ *to,\ size_t\ tolen)
+
+idn_result_t
+\fBidn_decodename\fP(int\ actions,\ const\ char\ *from,\ char\ *to,\ size_t\ tolen)
+
+idn_result_t
+\fBidn_decodename2\fP(int\ actions,\ const\ char\ *from,\ char\ *to,\ size_t\ tolen,
+ const\ char\ *auxencoding)
+
+idn_result_t
+\fBidn_enable\fP(int\ on_off)
+
+#include <idn/result.h>
+
+char *
+\fBidn_result_tostring\fP(idn_result_t\ result)
+
+.\"
+.SH OVERVIEW
+The
+\fBlibidnkit\fR and \fBlibidnkitlite\fR libraries support various
+manipulations of internationalized domain names, including:
+.RS 2
+.IP \- 2
+encoding convesion
+.IP \- 2
+name preparation
+.RE
+.PP
+They are designed according to IDNA framework where each application must
+do necessary preparations for the internationalized domain names before
+passing them to the resolver.
+.PP
+To help applications do the preparation, the libraries provide easy-to-use,
+high-level interface for the work.
+.PP
+Both libraries provide almost the same API.
+The difference between them is that \fBlibidnkit\fR internally uses
+\fIiconv\fR function to provide encoding conversion from UTF-8 to the
+local encoding
+(such as iso-8859-1, usually determined by the current locale), and vise
+versa.
+\fBlibidnkitlite\fR is lightweight version of libidnkit.
+It assumes local encoding is UTF-8 so that it never uses \fIiconv\fR.
+.PP
+This manual describes only a small subset of the API that the libraries
+provide, most important functions for application programmers.
+For other API, please refer to the idnkit's specification document
+(which is not yet available) or the header files typically found under
+`/usr/local/include/idn/' on your system.
+.\"
+.SH DESCRIPTION
+.PP
+The \fBidn_nameinit\fR function initializes the library.
+It also sets default configuration if \fIload_file\fR is 0, otherwise
+it tries to read a configuration file.
+If \fBidn_nameinit\fR is called more than once, the library initialization
+will take place only at the first call while the actual configuration
+procedure will occur at every call.
+.PP
+If there are no errors, \fBidn_nameinit\fR returns \fBidn_success\fR.
+Otherwise, the returned value indicates the cause of the error.
+See the section ``RETURN VALUES'' below for the error codes.
+.PP
+Usually you don't have to call this function explicitly because
+it is implicitly called when \fBidn_encodename\fR or \fBidn_decodename\fR
+is first called without prior calling of \fBidn_nameinit\fR.
+In such case, initialization without the configuration file
+takes place.
+.\"
+.PP
+\fBidn_encodename\fR function performs name preparation and encoding
+conversion on the internationalized domain name specified by \fIfrom\fR,
+and stores the result to \fIto\fR, whose length is specified by
+\fItolen\fR.
+\fIactions\fR is a bitwise-OR of the following macros, specifying which
+subprocesses in the encoding process are to be employed.
+.RS 2
+.nf
+.ft CW
+IDN_LOCALCONV Local encoding to UTF-8 conversion
+IDN_DELIMMAP Delimiter mapping
+IDN_LOCALMAP Local mapping
+IDN_NAMEPREP NAMEPREP mapping, normalization,
+ prohibited character check and bidirectional
+ string check
+IDN_UNASCHECK NAMEPREP unassigned codepoint check
+IDN_ASCCHECK ASCII range character check
+IDN_IDNCONV UTF-8 to IDN encoding conversion
+IDN_LENCHECK Label length check
+.ft R
+.fi
+.RE
+.PP
+Details of this encoding process can be found in the section ``NAME ENCODING''.
+.PP
+For convenience, also \fBIDN_ENCODE_QUERY\fR, \fBIDN_ENCODE_APP\fR
+and \fBIDN_ENCODE_STORED\fR macros are provided.
+\fBIDN_ENCODE_QUERY\fR is used to encode a ``query string''
+(see the IDNA specification).
+It is equal to
+.RS 4
+.nf
+.ft CW
+(IDN_LOCALCONV | IDN_DELIMMAP | IDN_LOCALMAP | IDN_NAMEPREP
+ | IDN_IDNCONV | IDN_LENCHECK)
+.ft R
+.fi
+.RE
+.PP
+if you are using \fBlibidnkit\fR, and equal to
+.RS 4
+.nf
+.ft CW
+(IDN_DELIMMAP | IDN_LOCALMAP | IDN_NAMEPREP | IDN_IDNCONV
+ | IDN_LENCHECK)
+.ft R
+.fi
+.RE
+.PP
+if you are using \fBlibidnkitlite\fR.
+.PP
+\fBIDN_ENCODE_APP\fR is used for ordinary application to encode a
+domain name.
+It performs \fBIDN_ASCCHECK\fR in addition with \fBIDN_ENCODE_QUERY\fR.
+\fBIDN_ENCODE_STORED\fR is used to encode a ``stored string''
+(see the IDNA specification).
+It performs \fBIDN_ENCODE_APP\fR plus \fBIDN_UNASCHECK\fR.
+.PP
+\fBidn_decodename\fR function performs the reverse of \fBidn_encodename\fR.
+It converts the internationalized domain name given by \fIfrom\fR,
+which is represented in a special encoding called ACE,
+to the application's local codeset and stores into \fIto\fR,
+whose length is specified by \fItolen\fR.
+As in \fBidn_encodename\fR, \fIactions\fR is a bitwise-OR of the following
+macros.
+.RS 2
+.nf
+.ft CW
+IDN_DELIMMAP Delimiter mapping
+IDN_NAMEPREP NAMEPREP mapping, normalization,
+ prohibited character check and bidirectional
+ string check
+IDN_UNASCHECK NAMEPREP unassigned codepoint check
+IDN_IDNCONV UTF-8 to IDN encoding conversion
+IDN_RTCHECK Round trip check
+IDN_ASCCHECK ASCII range character check
+IDN_LOCALCONV Local encoding to UTF-8 conversion
+.ft R
+.fi
+.RE
+.PP
+Details of this decoding process can be found in the section ``NAME DECODING''.
+.PP
+For convenience, also \fBIDN_DECODE_QUERY\fR, \fBIDN_DECODE_APP\fR
+and \fBIDN_DECODE_STORED\fR macros are provided.
+\fBIDN_DECODE_QUERY\fR is used to decode a ``qeury string''
+(see the IDNA specification).
+It is equal to
+.RS 4
+.nf
+.ft CW
+(IDN_DELIMMAP | IDN_NAMEPREP | IDN_IDNCONV | IDN_RTCHECK
+ | IDN_LOCALCONV)
+.ft R
+.fi
+.RE
+.PP
+if you are using \fBlibidnkit\fR, and equal to
+.RS 4
+.nf
+.ft CW
+(IDN_DELIMMAP | IDN_NAMEPREP | IDN_IDNCONV | IDN_RTCHECK)
+.ft R
+.fi
+.RE
+.PP
+if you are using \fBlibidnkitlite\fR.
+.PP
+\fBIDN_DECODE_APP\fR is used for ordinary application to decode a
+domain name.
+It performs \fBIDN_ASCCHECK\fR in addition with \fBIDN_DECODE_QUERY\fR.
+\fBIDN_DECODE_STORED\fR is used to decode a ``stored string''
+(see the IDNA specification).
+It performs \fBIDN_DECODE_APP\fR plus \fBIDN_UNASCHECK\fR.
+.PP
+\fBidn_decodename2\fR function provides the same functionality as
+\fBidn_decodename\fR except that character encoding of \fIfrom\fR is
+supposed to be \fIauxencoding\fR.
+If IDN encoding is Punycode and \fIauxencoding\fR is ISO 8859-2
+for example, it is assumed that the Punycode string stored in
+\fIfrom\fR is written in ISO 8859-2.
+.PP
+In the IDN decode procedure, \fBIDN_NAMEPREP\fR is done before
+\fBIDN_IDNCONV\fR, and some non-ASCII characters are converted to
+ASCII characters as the result of \fBIDN_NAMEPREP\fR.
+Therefore, ACE string given by \fBfrom\fR may contains those non-ASCII
+characters.
+That is the reason \fBdocode_name2\fR exists.
+.PP
+All of the functions above return error code of type \fBidn_result_t\fR.
+All codes other than \fBidn_success\fR indicates some kind of failure.
+\fBidn_result_tostring\fR function takes an error code \fIresult\fR
+and returns a pointer to the corresponding message string.
+.\"
+.SH "NAME ENCODING"
+Name encoding is a process that transforms the specified
+internationalized domain name to a certain string suitable for name
+resolution.
+For each label in a given domain name, the encoding processor performs:
+.\"
+.IP "(1) Convert to UTF-8 (IDN_LOCALCONV)"
+Convert the encoding of the given domain name from application's local
+encoding (e.g. ISO-8859-1) to UTF-8.
+Note that \fBlibidnkitlite\fR doesn't support this step.
+.\"
+.IP "(2) Delimiter mapping (IDN_DELIMMAP)"
+Map domain name delimiters to `.' (U+002E).
+The recoginzed delimiters are: U+3002 (ideographic full stop),
+U+FF0E (fullwidth full stop), U+FF61 (halfwidth ideographic full stop).
+.\"
+.IP "(3) Local mapping (IDN_LOCALMAP)"
+Apply character mapping whose rule is determined by the TLD of the name.
+.\"
+.IP "(4) NAMEPREP (IDN_NAMEPREP, IDN_UNASCHECK)"
+Perform name preparation (NAMEPREP), which is a standard process for
+name canonicalizaion of internationalized domain names.
+.br
+NAMEPREP consists of 5 steps:
+mapping, normalization, prohibited character check, bidirectional
+text check and unassigned codepoint check.
+The first four steps are done by IDN_NAMEPREP, and the last step is
+done by IDN_UNASCHECK.
+.\"
+.IP "(5) ASCII range character check (IDN_ASCCHECK)"
+Checks if the domain name contains non-LDH ASCII character (not
+alpha-numeric or hyphen), or it begins or end with hyphen.
+.\"
+.IP "(6) Convert to ACE (IDN_IDNCONV)"
+Convert the NAMEPREPed name to a special encoding designed for representing
+internationalized domain names.
+.br
+The encoding is also known as ACE (ASCII Compatible Encoding) since
+a string in the encoding is just like a traditional ASCII domain name
+consisting of only letters, numbers and hyphens.
+.\"
+.IP "(7) Label length check (IDN_LENCHECK)"
+For each label, check the number of characters in it.
+It must be in the range 1 to 63.
+.PP
+There are many configuration parameters for this process, such as the
+ACE or the local mapping rules. These parameters are read from the
+default idnkit's configuration file, \fBidn.conf\fR.
+See idn.conf(5) for details.
+.\"
+.SH "NAME DECODING"
+Name decoding is a reverse process of the name encoding.
+It transforms the specified
+internationalized domain name in a special encoding suitable for name
+resolution to the normal name string in the application's current codeset.
+However, name encoding and name decoding are not symmetric.
+.PP
+For each label in a given domain name, the decoding processor performs:
+.\"
+.IP "(1) Delimiter mapping (IDN_DELIMMAP)"
+Map domain name delimiters to `.' (U+002E).
+The recoginzed delimiters are: U+3002 (ideographic full stop),
+U+FF0E (fullwidth full stop), U+FF61 (halfwidth ideographic full stop).
+.\"
+.IP "(2) NAMEPREP (IDN_NAMEPREP, IDN_UNASCHECK)"
+Perform name preparation (NAMEPREP), which is a standard process for
+name canonicalizaion of internationalized domain names.
+.\"
+.IP "(3) Convert to UTF-8 (IDN_IDNCONV)"
+Convert the encoding of the given domain name from ACE to UTF-8.
+.\"
+.IP "(4) Round trip check (IDN_RTCHECK)"
+Encode the result of (3) using the ``NAME ENCODING'' scheme, and then
+compare it with the result of the step (2).
+If they are different, the check is failed.
+If IDN_UNASCHECK, IDN_ASCCHECK or both are specified, also they are
+done in the encoding processes.
+.\"
+.IP "(5) Convert to local encoding"
+Convert the result of (3) from UTF-8 to the application's local
+encoding (e.g. ISO-8859-1).
+Note that \fBlibidnkitlite\fR doesn't support this step.
+.PP
+If prohibited character check, unassigned codepoint check or
+bidirectional text check at step (2) is failed, or round trip check
+at step (4) is failed, the original input label is returned.
+.PP
+The configuration parameters for this process,
+are also read from the configuration file \fBidn.conf\fR.
+.\"
+.SH "IDN_DISABLE"
+If the \fBIDN_DISABLE\fR environ variable is defined at run-time,
+the libraries disable internationalized domain name support, by default.
+In this case, \fBidn_encodename\fR and \fBidn_decodename\fR don't
+encode/decode an input name, but instead they simply ouput a copy
+of the input name as the result of encoding/decoding.
+.PP
+If your application should always enable mulitilingual domain name
+support regardless of definition of \fBIDN_DISABLE\fR, call
+.RS 4
+.nf
+.ft CW
+idn_enable(1)
+.ft R
+.fi
+.RE
+.PP
+before performing encoding/decoding.
+.\"
+.SH "RETURN VALUES"
+Most of the API functions return values of type \fBidn_result_t\fR in
+order to indicate the status of the call.
+
+The following is a complete list of the status codes. Note that some
+of them are never returned by the functions described in this manual.
+.TP 15
+.SB idn_success
+Not an error. The call succeeded.
+.TP
+.SB idn_notfound
+Specified information does not exist.
+.TP
+.SB idn_invalid_encoding
+The encoding of the specified string is invalid.
+.TP
+.SB idn_invalid_syntax
+There is a syntax error in the configuration file.
+.TP
+.SB idn_invalid_name
+The specified name is not valid.
+.TP
+.SB idn_invalid_message
+The specified DNS message is not valid.
+.TP
+.SB idn_invalid_action
+The specified action contains invalid flags.
+.TP
+.SB idn_invalid_codepoint
+The specified Unicode code point value is not valid.
+.TP
+.SB idn_invalid_length
+The number of characters in an ACE label is not in the range 1 to 63.
+.TP
+.SB idn_buffer_overflow
+The specified buffer is too small to hold the result.
+.TP
+.SB idn_noentry
+The specified key does not exist in the hash table.
+.TP
+.SB idn_nomemory
+Memory allocation using malloc failed.
+.TP
+.SB idn_nofile
+The specified file could not be opened.
+.TP
+.SB idn_nomapping
+Some characters do not have the mapping to the target character set.
+.TP
+.SB idn_context_required
+Context information is required.
+.TP
+.SB idn_prohibited
+The specified string contains some prohibited characters.
+.TP
+.SB idn_failure
+Generic error which is not covered by the above codes.
+.\"
+.SH EXAMPLES
+To get the address of a internationalized domain name in the application's
+local codeset, use \fBidn_encodename\fR to convert the name to the format
+suitable for passing to resolver functions.
+.RS 4
+.nf
+.ft CW
+idn_result_t r;
+char ace_name[256];
+struct hostent *hp;
+
+\&...
+r = idn_encodename(IDN_ENCODE_APP, name, ace_name,
+ sizeof(ace_name));
+if (r != idn_success) {
+ fprintf(stderr, "idn_encodename failed: %s\en",
+ idn_result_tostring(r));
+ exit(1);
+}
+
+hp = gethostbyname(ace_name);
+\&...
+.ft R
+.fi
+.RE
+.PP
+To decode the internationalized domain name returned from a resolver function,
+use \fBidn_decodename\fR.
+.RS 4
+.nf
+.ft CW
+idn_result_t r;
+char local_name[256];
+struct hostent *hp;
+
+\&...
+hp = gethostbyname(name);
+r = idn_decodename(IDN_DECODE_APP, hp->h_name, local_name,
+ sizeof(local_name));
+if (r != idn_success) {
+ fprintf(stderr, "idn_decodename failed: %s\en",
+ idn_result_tostring(r));
+ exit(1);
+}
+printf("name: %s\en", local_name);
+\&...
+.ft R
+.fi
+.RE
+.\"
+.SH "SEE ALSO"
+idn.conf(5)
diff --git a/contrib/idn/idnkit-1.0-src/map/Makefile.in b/contrib/idn/idnkit-1.0-src/map/Makefile.in
new file mode 100644
index 0000000..5e52385
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/map/Makefile.in
@@ -0,0 +1,75 @@
+# $Id: Makefile.in,v 1.1.1.1 2003/06/04 00:27:55 marka Exp $
+#
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+top_builddir = ..
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+datadir = @datadir@
+mapdir = $(datadir)/idnkit
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
+SHELL = @SHELL@
+
+MAPS = jp.map
+
+all:
+
+install:
+ $(MKINSTALLDIRS) $(DESTDIR)$(mapdir)
+ for map in $(MAPS); do \
+ $(INSTALL_DATA) $(srcdir)/$$map $(DESTDIR)$(mapdir)/$$map; \
+ done
+
+clean:
+ rm -f *~
+
+distclean: clean
+ rm -f Makefile
+
+test check:
diff --git a/contrib/idn/idnkit-1.0-src/map/jp.map b/contrib/idn/idnkit-1.0-src/map/jp.map
new file mode 100644
index 0000000..5deff1a
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/map/jp.map
@@ -0,0 +1,50 @@
+# $Id: jp.map,v 1.1.1.1 2003/06/04 00:27:55 marka Exp $
+# Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+#
+# Local map table for JP domain.
+#
+
+# version=1.0
+
+2212; FF0D
+309B; 3099
+309C; 309A
diff --git a/contrib/idn/idnkit-1.0-src/mkinstalldirs b/contrib/idn/idnkit-1.0-src/mkinstalldirs
new file mode 100755
index 0000000..946773d
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/mkinstalldirs
@@ -0,0 +1,40 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+# $Id: mkinstalldirs,v 1.1.1.1 2003/06/04 00:25:33 marka Exp $
+
+errstatus=0
+
+for file
+do
+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ shift
+
+ pathcomp=
+ for d
+ do
+ pathcomp="$pathcomp$d"
+ case "$pathcomp" in
+ -* ) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp"
+
+ mkdir "$pathcomp" || lasterr=$?
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ fi
+ fi
+
+ pathcomp="$pathcomp/"
+ done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
diff --git a/contrib/idn/idnkit-1.0-src/patch/bind9/bind-9.2.1-patch b/contrib/idn/idnkit-1.0-src/patch/bind9/bind-9.2.1-patch
new file mode 100644
index 0000000..7a8e3de
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/patch/bind9/bind-9.2.1-patch
@@ -0,0 +1,5900 @@
+IDN patch for bind-9.2.1
+========================
+
+
+This is a patch file for ISC BIND 9.2.1 to make it work with
+internationalized domain names. With this patch you'll get IDN-aware
+dig/host/nslookup.
+
+To apply this patch, you should go to the top directory of the BIND
+distribution (where you see `README' file), then invoke `patch'
+command like this:
+
+ % patch -p0 < this-file
+
+Then follow the instructions described in `README.idnkit' to compile
+and install.
+
+
+Index: README.idnkit
+diff -c /dev/null mdn/othersrc/bind9/README.idnkit:1.2
+*** README.idnkit Mon May 27 16:53:24 2002
+--- README.idnkit Tue Mar 26 16:35:05 2002
+***************
+*** 0 ****
+--- 1,113 ----
++
++ BIND-9 IDN patch
++
++ Japan Network Information Center (JPNIC)
++
++
++ * What is this patch for?
++
++ This patch adds internationalized domain name (IDN) support to BIND-9.
++ You'll get internationalized version of dig/host/nslookup commands.
++
++ + internationalized dig/host/nslookup
++ dig/host/nslookup accepts non-ASCII domain names in the local
++ codeset (such as Shift JIS, Big5 or ISO8859-1) determined by
++ the locale information. The domain names are normalized and
++ converted to the encoding on the DNS protocol, and sent to DNS
++ servers. The replies are converted back to the local codeset
++ and displayed.
++
++
++ * Compilation & installation
++
++ 0. Prerequisite
++
++ You have to build and install idnkit before building this patched version
++ of bind-9.
++
++ 1. Running configure script
++
++ Run `configure' in the top directory. See `README' for the
++ configuration options.
++
++ This patch adds the following 4 options to `configure'. You should
++ at least specify `--with-idn' option to enable IDN support.
++
++ --with-idn[=IDN_PREFIX]
++ To enable IDN support, you have to specify `--with-idn' option.
++ The argument IDN_PREFIX is the install prefix of idnkit. If
++ IDN_PREFIX is omitted, PREFIX (derived from `--prefix=PREFIX')
++ is assumed.
++
++ --with-libiconv[=LIBICONV_PREFIX]
++ Specify this option if idnkit you have installed links GNU
++ libiconv. The argument LIBICONV_PREFIX is install prefix of
++ GNU libiconv. If the argument is omitted, PREFIX (derived
++ from `--prefix=PREFIX') is assumed.
++
++ `--with-libiconv' is shorthand option for GNU libiconv.
++
++ --with-libiconv=/usr/local
++
++ This is equivalent to:
++
++ --with-iconv='-L/usr/local/lib -R/usr/local/lib -liconv'
++
++ `--with-libiconv' assumes that your C compiler has `-R'
++ option, and that the option adds the specified run-time path
++ to an exacutable binary. If `-R' option of your compiler has
++ different meaning, or your compiler lacks the option, you
++ should use `--with-iconv' option instead. Binary command
++ without run-time path information might be unexecutable.
++ In that case, you would see an error message like:
++
++ error in loading shared libraries: libiconv.so.2: cannot
++ open shared object file
++
++ If both `--with-libiconv' and `--with-iconv' options are
++ specified, `--with-iconv' is prior to `--with-libiconv'.
++
++ --with-iconv=ICONV_LIBSPEC
++ If your libc doens't provide iconv(), you need to specify the
++ library containing iconv() with this option. `ICONV_LIBSPEC'
++ is the argument(s) to `cc' or `ld' to link the library, for
++ example, `--with-iconv="-L/usr/local/lib -liconv"'.
++ You don't need to specify the header file directory for "iconv.h"
++ to the compiler, as it isn't included directly by bind-9 with
++ this patch.
++
++ --with-idnlib=IDN_LIBSPEC
++ With this option, you can explicitly specify the argument(s)
++ to `cc' or `ld' to link the idnkit's library, `libidnkit'. If
++ this option is not specified, `-L${PREFIX}/lib -lidnkit' is
++ assumed, where ${PREFIX} is the installation prefix specified
++ with `--with-idn' option above. You may need to use this
++ option to specify extra argments, for example,
++ `--with-idnlib="-L/usr/local/lib -R/usr/local/lib -lidnkit"'.
++
++ Please consult `README' for other configuration options.
++
++ Note that if you want to specify some extra header file directories,
++ you should use the environment variable STD_CINCLUDES instead of
++ CFLAGS, as described in README.
++
++ 2. Compilation and installation
++
++ After running "configure", just do
++
++ make
++ make install
++
++ for compiling and installing.
++
++
++ * Contact information
++
++ Please see http//www.nic.ad.jp/jp/research/mdn/ for the latest news
++ about idnkit and this patch.
++
++ Bug reports and comments on this kit should be sent to
++ mdnkit-bugs@nic.ad.jp and mdn-cmt@nic.ad.jp, respectively.
++
++
++ ; $Id: bind-9.2.1-patch,v 1.1.1.1 2003/06/04 00:27:30 marka Exp $
+Index: config.h.in
+diff -c mdn/othersrc/bind9/config.h.in:1.1.1.6 mdn/othersrc/bind9/config.h.in:1.12
+*** config.h.in Tue Nov 27 16:55:45 2001
+--- config.h.in Tue Mar 19 16:45:35 2002
+***************
+*** 141,146 ****
+--- 141,149 ----
+ /* define if you have strerror in the C library. */
+ #undef HAVE_STRERROR
+
++ /* Define if you have the setlocale function. */
++ #undef HAVE_SETLOCALE
++
+ /* Define if you have the <dlfcn.h> header file. */
+ #undef HAVE_DLFCN_H
+
+***************
+*** 150,155 ****
+--- 153,161 ----
+ /* Define if you have the <linux/capability.h> header file. */
+ #undef HAVE_LINUX_CAPABILITY_H
+
++ /* Define if you have the <locale.h> header file. */
++ #undef HAVE_LOCALE_H
++
+ /* Define if you have the <sys/prctl.h> header file. */
+ #undef HAVE_SYS_PRCTL_H
+
+***************
+*** 176,178 ****
+--- 182,188 ----
+
+ /* Define if you have the socket library (-lsocket). */
+ #undef HAVE_LIBSOCKET
++
++ /* define if idnkit support is to be included. */
++ #undef WITH_IDN
++
+Index: configure
+diff -c mdn/othersrc/bind9/configure:1.1.1.9 mdn/othersrc/bind9/configure:1.15
+*** configure Wed May 22 17:14:53 2002
+--- configure Mon May 27 12:10:14 2002
+***************
+*** 369,374 ****
+--- 369,382 ----
+ --with-kame[=PATH] use Kame IPv6 [default path /usr/local/v6]"
+ ac_help="$ac_help
+ --disable-linux-caps disable linux capabilities"
++ ac_help="$ac_help
++ --with-idn[=MPREFIX] enable IDN support using idnkit [default PREFIX]"
++ ac_help="$ac_help
++ --with-libiconv[=IPREFIX] GNU libiconv are in IPREFIX [default PREFIX]"
++ ac_help="$ac_help
++ --with-iconv[=LIBSPEC] specify iconv library [default -liconv]"
++ ac_help="$ac_help
++ --with-idnlib=ARG specify libidnkit"
+
+ # Initialize some variables set by options.
+ # The variables have the same names as the options, with
+***************
+*** 911,917 ****
+ fi
+
+ echo $ac_n "checking host system type""... $ac_c" 1>&6
+! echo "configure:915: checking host system type" >&5
+
+ host_alias=$host
+ case "$host_alias" in
+--- 919,925 ----
+ fi
+
+ echo $ac_n "checking host system type""... $ac_c" 1>&6
+! echo "configure:923: checking host system type" >&5
+
+ host_alias=$host
+ case "$host_alias" in
+***************
+*** 933,939 ****
+
+
+ echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+! echo "configure:937: checking whether ${MAKE-make} sets \${MAKE}" >&5
+ set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+--- 941,947 ----
+
+
+ echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+! echo "configure:945: checking whether ${MAKE-make} sets \${MAKE}" >&5
+ set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+***************
+*** 962,968 ****
+ # Extract the first word of "ranlib", so it can be a program name with args.
+ set dummy ranlib; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:966: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 970,976 ----
+ # Extract the first word of "ranlib", so it can be a program name with args.
+ set dummy ranlib; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:974: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 1001,1007 ****
+ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+ # ./install, which can be erroneously created by make from ./install.sh.
+ echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+! echo "configure:1005: checking for a BSD compatible install" >&5
+ if test -z "$INSTALL"; then
+ if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+--- 1009,1015 ----
+ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+ # ./install, which can be erroneously created by make from ./install.sh.
+ echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+! echo "configure:1013: checking for a BSD compatible install" >&5
+ if test -z "$INSTALL"; then
+ if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+***************
+*** 1062,1068 ****
+ # Extract the first word of "ar", so it can be a program name with args.
+ set dummy ar; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:1066: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 1070,1076 ----
+ # Extract the first word of "ar", so it can be a program name with args.
+ set dummy ar; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:1074: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 1121,1127 ****
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:1125: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_ETAGS'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 1129,1135 ----
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:1133: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_ETAGS'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 1163,1169 ****
+ #
+ if test "X$ETAGS" != "X"; then
+ echo $ac_n "checking for Exuberant Ctags etags""... $ac_c" 1>&6
+! echo "configure:1167: checking for Exuberant Ctags etags" >&5
+ if $ETAGS --version 2>&1 | grep 'Exuberant Ctags' >/dev/null 2>&1; then
+ echo "$ac_t""yes" 1>&6
+ ETAGS="$ETAGS -L"
+--- 1171,1177 ----
+ #
+ if test "X$ETAGS" != "X"; then
+ echo $ac_n "checking for Exuberant Ctags etags""... $ac_c" 1>&6
+! echo "configure:1175: checking for Exuberant Ctags etags" >&5
+ if $ETAGS --version 2>&1 | grep 'Exuberant Ctags' >/dev/null 2>&1; then
+ echo "$ac_t""yes" 1>&6
+ ETAGS="$ETAGS -L"
+***************
+*** 1181,1187 ****
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:1185: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 1189,1195 ----
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:1193: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 1328,1334 ****
+ # Extract the first word of "gcc", so it can be a program name with args.
+ set dummy gcc; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:1332: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 1336,1342 ----
+ # Extract the first word of "gcc", so it can be a program name with args.
+ set dummy gcc; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:1340: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 1358,1364 ****
+ # Extract the first word of "cc", so it can be a program name with args.
+ set dummy cc; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:1362: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 1366,1372 ----
+ # Extract the first word of "cc", so it can be a program name with args.
+ set dummy cc; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:1370: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 1409,1415 ****
+ # Extract the first word of "cl", so it can be a program name with args.
+ set dummy cl; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:1413: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 1417,1423 ----
+ # Extract the first word of "cl", so it can be a program name with args.
+ set dummy cl; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:1421: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 1441,1447 ****
+ fi
+
+ echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+! echo "configure:1445: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ ac_ext=c
+ # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+--- 1449,1455 ----
+ fi
+
+ echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+! echo "configure:1453: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ ac_ext=c
+ # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+***************
+*** 1452,1463 ****
+
+ cat > conftest.$ac_ext << EOF
+
+! #line 1456 "configure"
+ #include "confdefs.h"
+
+ main(){return(0);}
+ EOF
+! if { (eval echo configure:1461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+--- 1460,1471 ----
+
+ cat > conftest.$ac_ext << EOF
+
+! #line 1464 "configure"
+ #include "confdefs.h"
+
+ main(){return(0);}
+ EOF
+! if { (eval echo configure:1469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+***************
+*** 1483,1494 ****
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+ fi
+ echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+! echo "configure:1487: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+ echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+ cross_compiling=$ac_cv_prog_cc_cross
+
+ echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+! echo "configure:1492: checking whether we are using GNU C" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 1491,1502 ----
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+ fi
+ echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+! echo "configure:1495: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+ echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+ cross_compiling=$ac_cv_prog_cc_cross
+
+ echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+! echo "configure:1500: checking whether we are using GNU C" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 1497,1503 ****
+ yes;
+ #endif
+ EOF
+! if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1501: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+ else
+ ac_cv_prog_gcc=no
+--- 1505,1511 ----
+ yes;
+ #endif
+ EOF
+! if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1509: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+ else
+ ac_cv_prog_gcc=no
+***************
+*** 1516,1522 ****
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=
+ echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+! echo "configure:1520: checking whether ${CC-cc} accepts -g" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 1524,1530 ----
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=
+ echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+! echo "configure:1528: checking whether ${CC-cc} accepts -g" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 1549,1555 ****
+
+
+ echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+! echo "configure:1553: checking how to run the C preprocessor" >&5
+ # On Suns, sometimes $CPP names a directory.
+ if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+--- 1557,1563 ----
+
+
+ echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+! echo "configure:1561: checking how to run the C preprocessor" >&5
+ # On Suns, sometimes $CPP names a directory.
+ if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+***************
+*** 1564,1576 ****
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+! #line 1568 "configure"
+ #include "confdefs.h"
+ #include <assert.h>
+ Syntax Error
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+! { (eval echo configure:1574: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+ :
+--- 1572,1584 ----
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+! #line 1576 "configure"
+ #include "confdefs.h"
+ #include <assert.h>
+ Syntax Error
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+! { (eval echo configure:1582: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+ :
+***************
+*** 1581,1593 ****
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+! #line 1585 "configure"
+ #include "confdefs.h"
+ #include <assert.h>
+ Syntax Error
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+! { (eval echo configure:1591: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+ :
+--- 1589,1601 ----
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+! #line 1593 "configure"
+ #include "confdefs.h"
+ #include <assert.h>
+ Syntax Error
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+! { (eval echo configure:1599: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+ :
+***************
+*** 1598,1610 ****
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+! #line 1602 "configure"
+ #include "confdefs.h"
+ #include <assert.h>
+ Syntax Error
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+! { (eval echo configure:1608: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+ :
+--- 1606,1618 ----
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+! #line 1610 "configure"
+ #include "confdefs.h"
+ #include <assert.h>
+ Syntax Error
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+! { (eval echo configure:1616: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+ :
+***************
+*** 1629,1640 ****
+ echo "$ac_t""$CPP" 1>&6
+
+ echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+! echo "configure:1633: checking for ANSI C header files" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 1638 "configure"
+ #include "confdefs.h"
+ #include <stdlib.h>
+ #include <stdarg.h>
+--- 1637,1648 ----
+ echo "$ac_t""$CPP" 1>&6
+
+ echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+! echo "configure:1641: checking for ANSI C header files" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 1646 "configure"
+ #include "confdefs.h"
+ #include <stdlib.h>
+ #include <stdarg.h>
+***************
+*** 1642,1648 ****
+ #include <float.h>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+! { (eval echo configure:1646: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+ rm -rf conftest*
+--- 1650,1656 ----
+ #include <float.h>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+! { (eval echo configure:1654: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+ rm -rf conftest*
+***************
+*** 1659,1665 ****
+ if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat > conftest.$ac_ext <<EOF
+! #line 1663 "configure"
+ #include "confdefs.h"
+ #include <string.h>
+ EOF
+--- 1667,1673 ----
+ if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat > conftest.$ac_ext <<EOF
+! #line 1671 "configure"
+ #include "confdefs.h"
+ #include <string.h>
+ EOF
+***************
+*** 1677,1683 ****
+ if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat > conftest.$ac_ext <<EOF
+! #line 1681 "configure"
+ #include "confdefs.h"
+ #include <stdlib.h>
+ EOF
+--- 1685,1691 ----
+ if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat > conftest.$ac_ext <<EOF
+! #line 1689 "configure"
+ #include "confdefs.h"
+ #include <stdlib.h>
+ EOF
+***************
+*** 1698,1704 ****
+ :
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 1702 "configure"
+ #include "confdefs.h"
+ #include <ctype.h>
+ #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+--- 1706,1712 ----
+ :
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 1710 "configure"
+ #include "confdefs.h"
+ #include <ctype.h>
+ #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+***************
+*** 1709,1715 ****
+ exit (0); }
+
+ EOF
+! if { (eval echo configure:1713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ :
+ else
+--- 1717,1723 ----
+ exit (0); }
+
+ EOF
+! if { (eval echo configure:1721: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ :
+ else
+***************
+*** 1737,1753 ****
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+! echo "configure:1741: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 1746 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+! { (eval echo configure:1751: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+ rm -rf conftest*
+--- 1745,1761 ----
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+! echo "configure:1749: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 1754 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+! { (eval echo configure:1759: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+ rm -rf conftest*
+***************
+*** 1775,1786 ****
+
+
+ echo $ac_n "checking for working const""... $ac_c" 1>&6
+! echo "configure:1779: checking for working const" >&5
+ if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 1784 "configure"
+ #include "confdefs.h"
+
+ int main() {
+--- 1783,1794 ----
+
+
+ echo $ac_n "checking for working const""... $ac_c" 1>&6
+! echo "configure:1787: checking for working const" >&5
+ if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 1792 "configure"
+ #include "confdefs.h"
+
+ int main() {
+***************
+*** 1829,1835 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:1833: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_const=yes
+ else
+--- 1837,1843 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:1841: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_const=yes
+ else
+***************
+*** 1850,1870 ****
+ fi
+
+ echo $ac_n "checking for inline""... $ac_c" 1>&6
+! echo "configure:1854: checking for inline" >&5
+ if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ ac_cv_c_inline=no
+ for ac_kw in inline __inline__ __inline; do
+ cat > conftest.$ac_ext <<EOF
+! #line 1861 "configure"
+ #include "confdefs.h"
+
+ int main() {
+ } $ac_kw foo() {
+ ; return 0; }
+ EOF
+! if { (eval echo configure:1868: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_inline=$ac_kw; break
+ else
+--- 1858,1878 ----
+ fi
+
+ echo $ac_n "checking for inline""... $ac_c" 1>&6
+! echo "configure:1862: checking for inline" >&5
+ if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ ac_cv_c_inline=no
+ for ac_kw in inline __inline__ __inline; do
+ cat > conftest.$ac_ext <<EOF
+! #line 1869 "configure"
+ #include "confdefs.h"
+
+ int main() {
+ } $ac_kw foo() {
+ ; return 0; }
+ EOF
+! if { (eval echo configure:1876: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_inline=$ac_kw; break
+ else
+***************
+*** 1890,1901 ****
+ esac
+
+ echo $ac_n "checking for sysctlbyname""... $ac_c" 1>&6
+! echo "configure:1894: checking for sysctlbyname" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_sysctlbyname'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 1899 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char sysctlbyname(); below. */
+--- 1898,1909 ----
+ esac
+
+ echo $ac_n "checking for sysctlbyname""... $ac_c" 1>&6
+! echo "configure:1902: checking for sysctlbyname" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_sysctlbyname'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 1907 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char sysctlbyname(); below. */
+***************
+*** 1918,1924 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:1922: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_sysctlbyname=yes"
+ else
+--- 1926,1932 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:1930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_sysctlbyname=yes"
+ else
+***************
+*** 1946,1954 ****
+ # is reported to not support "static inline" (RT #1212).
+ #
+ echo $ac_n "checking for static inline breakage""... $ac_c" 1>&6
+! echo "configure:1950: checking for static inline breakage" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 1952 "configure"
+ #include "confdefs.h"
+
+ int main() {
+--- 1954,1962 ----
+ # is reported to not support "static inline" (RT #1212).
+ #
+ echo $ac_n "checking for static inline breakage""... $ac_c" 1>&6
+! echo "configure:1958: checking for static inline breakage" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 1960 "configure"
+ #include "confdefs.h"
+
+ int main() {
+***************
+*** 1965,1971 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:1969: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""no" 1>&6
+ else
+--- 1973,1979 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:1977: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""no" 1>&6
+ else
+***************
+*** 1981,1992 ****
+ rm -f conftest*
+
+ echo $ac_n "checking for size_t""... $ac_c" 1>&6
+! echo "configure:1985: checking for size_t" >&5
+ if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 1990 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #if STDC_HEADERS
+--- 1989,2000 ----
+ rm -f conftest*
+
+ echo $ac_n "checking for size_t""... $ac_c" 1>&6
+! echo "configure:1993: checking for size_t" >&5
+ if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 1998 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #if STDC_HEADERS
+***************
+*** 2014,2025 ****
+ fi
+
+ echo $ac_n "checking for ssize_t""... $ac_c" 1>&6
+! echo "configure:2018: checking for ssize_t" >&5
+ if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 2023 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #if STDC_HEADERS
+--- 2022,2033 ----
+ fi
+
+ echo $ac_n "checking for ssize_t""... $ac_c" 1>&6
+! echo "configure:2026: checking for ssize_t" >&5
+ if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 2031 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #if STDC_HEADERS
+***************
+*** 2047,2058 ****
+ fi
+
+ echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+! echo "configure:2051: checking whether time.h and sys/time.h may both be included" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 2056 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #include <sys/time.h>
+--- 2055,2066 ----
+ fi
+
+ echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+! echo "configure:2059: checking whether time.h and sys/time.h may both be included" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 2064 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #include <sys/time.h>
+***************
+*** 2061,2067 ****
+ struct tm *tp;
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2065: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_header_time=yes
+ else
+--- 2069,2075 ----
+ struct tm *tp;
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2073: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_header_time=yes
+ else
+***************
+*** 2082,2097 ****
+ fi
+
+ echo $ac_n "checking for long long""... $ac_c" 1>&6
+! echo "configure:2086: checking for long long" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 2088 "configure"
+ #include "confdefs.h"
+
+ int main() {
+ long long i = 0; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2095: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_HAVELONGLONG="#define ISC_PLATFORM_HAVELONGLONG 1"
+--- 2090,2105 ----
+ fi
+
+ echo $ac_n "checking for long long""... $ac_c" 1>&6
+! echo "configure:2094: checking for long long" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 2096 "configure"
+ #include "confdefs.h"
+
+ int main() {
+ long long i = 0; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2103: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_HAVELONGLONG="#define ISC_PLATFORM_HAVELONGLONG 1"
+***************
+*** 2111,2119 ****
+ case $ac_cv_header_unistd_h in
+ yes)
+ echo $ac_n "checking if unistd.h defines fd_set""... $ac_c" 1>&6
+! echo "configure:2115: checking if unistd.h defines fd_set" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 2117 "configure"
+ #include "confdefs.h"
+
+ #include <unistd.h>
+--- 2119,2127 ----
+ case $ac_cv_header_unistd_h in
+ yes)
+ echo $ac_n "checking if unistd.h defines fd_set""... $ac_c" 1>&6
+! echo "configure:2123: checking if unistd.h defines fd_set" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 2125 "configure"
+ #include "confdefs.h"
+
+ #include <unistd.h>
+***************
+*** 2121,2127 ****
+ fd_set read_set; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2125: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH"
+--- 2129,2135 ----
+ fd_set read_set; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2133: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH"
+***************
+*** 2163,2176 ****
+ # Find the machine's endian flavor.
+ #
+ echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
+! echo "configure:2167: checking whether byte ordering is bigendian" >&5
+ if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ ac_cv_c_bigendian=unknown
+ # See if sys/param.h defines the BYTE_ORDER macro.
+ cat > conftest.$ac_ext <<EOF
+! #line 2174 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #include <sys/param.h>
+--- 2171,2184 ----
+ # Find the machine's endian flavor.
+ #
+ echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
+! echo "configure:2175: checking whether byte ordering is bigendian" >&5
+ if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ ac_cv_c_bigendian=unknown
+ # See if sys/param.h defines the BYTE_ORDER macro.
+ cat > conftest.$ac_ext <<EOF
+! #line 2182 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #include <sys/param.h>
+***************
+*** 2181,2191 ****
+ #endif
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2185: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ # It does; now see whether it defined to BIG_ENDIAN or not.
+ cat > conftest.$ac_ext <<EOF
+! #line 2189 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #include <sys/param.h>
+--- 2189,2199 ----
+ #endif
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2193: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ # It does; now see whether it defined to BIG_ENDIAN or not.
+ cat > conftest.$ac_ext <<EOF
+! #line 2197 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #include <sys/param.h>
+***************
+*** 2196,2202 ****
+ #endif
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2200: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_bigendian=yes
+ else
+--- 2204,2210 ----
+ #endif
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2208: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_bigendian=yes
+ else
+***************
+*** 2216,2222 ****
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 2220 "configure"
+ #include "confdefs.h"
+ main () {
+ /* Are we little or big endian? From Harbison&Steele. */
+--- 2224,2230 ----
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 2228 "configure"
+ #include "confdefs.h"
+ main () {
+ /* Are we little or big endian? From Harbison&Steele. */
+***************
+*** 2229,2235 ****
+ exit (u.c[sizeof (long) - 1] == 1);
+ }
+ EOF
+! if { (eval echo configure:2233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ ac_cv_c_bigendian=no
+ else
+--- 2237,2243 ----
+ exit (u.c[sizeof (long) - 1] == 1);
+ }
+ EOF
+! if { (eval echo configure:2241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ ac_cv_c_bigendian=no
+ else
+***************
+*** 2257,2263 ****
+ # was --with-openssl specified?
+ #
+ echo $ac_n "checking for OpenSSL library""... $ac_c" 1>&6
+! echo "configure:2261: checking for OpenSSL library" >&5
+ # Check whether --with-openssl or --without-openssl was given.
+ if test "${with_openssl+set}" = set; then
+ withval="$with_openssl"
+--- 2265,2271 ----
+ # was --with-openssl specified?
+ #
+ echo $ac_n "checking for OpenSSL library""... $ac_c" 1>&6
+! echo "configure:2269: checking for OpenSSL library" >&5
+ # Check whether --with-openssl or --without-openssl was given.
+ if test "${with_openssl+set}" = set; then
+ withval="$with_openssl"
+***************
+*** 2298,2304 ****
+ echo "$ac_t""using openssl from $use_openssl/lib and $use_openssl/include" 1>&6
+
+ echo $ac_n "checking OpenSSL library version""... $ac_c" 1>&6
+! echo "configure:2302: checking OpenSSL library version" >&5
+ saved_cflags="$CFLAGS"
+ saved_libs="$LIBS"
+ CFLAGS="$CFLAGS $DST_OPENSSL_INC"
+--- 2306,2312 ----
+ echo "$ac_t""using openssl from $use_openssl/lib and $use_openssl/include" 1>&6
+
+ echo $ac_n "checking OpenSSL library version""... $ac_c" 1>&6
+! echo "configure:2310: checking OpenSSL library version" >&5
+ saved_cflags="$CFLAGS"
+ saved_libs="$LIBS"
+ CFLAGS="$CFLAGS $DST_OPENSSL_INC"
+***************
+*** 2307,2313 ****
+ echo "$ac_t""assuming target platform has compatible version" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 2311 "configure"
+ #include "confdefs.h"
+
+ #include <stdio.h>
+--- 2315,2321 ----
+ echo "$ac_t""assuming target platform has compatible version" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 2319 "configure"
+ #include "confdefs.h"
+
+ #include <stdio.h>
+***************
+*** 2322,2328 ****
+ }
+
+ EOF
+! if { (eval echo configure:2326: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ echo "$ac_t""ok" 1>&6
+ else
+--- 2330,2336 ----
+ }
+
+ EOF
+! if { (eval echo configure:2334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ echo "$ac_t""ok" 1>&6
+ else
+***************
+*** 2387,2393 ****
+ # was --with-randomdev specified?
+ #
+ echo $ac_n "checking for random device""... $ac_c" 1>&6
+! echo "configure:2391: checking for random device" >&5
+ # Check whether --with-randomdev or --without-randomdev was given.
+ if test "${with_randomdev+set}" = set; then
+ withval="$with_randomdev"
+--- 2395,2401 ----
+ # was --with-randomdev specified?
+ #
+ echo $ac_n "checking for random device""... $ac_c" 1>&6
+! echo "configure:2399: checking for random device" >&5
+ # Check whether --with-randomdev or --without-randomdev was given.
+ if test "${with_randomdev+set}" = set; then
+ withval="$with_randomdev"
+***************
+*** 2411,2417 ****
+
+ ac_safe=`echo "$devrandom" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $devrandom""... $ac_c" 1>&6
+! echo "configure:2415: checking for $devrandom" >&5
+ if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 2419,2425 ----
+
+ ac_safe=`echo "$devrandom" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $devrandom""... $ac_c" 1>&6
+! echo "configure:2423: checking for $devrandom" >&5
+ if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 2463,2469 ****
+ #
+
+ echo $ac_n "checking whether to build with thread support""... $ac_c" 1>&6
+! echo "configure:2467: checking whether to build with thread support" >&5
+
+ case $host in
+ *-dec-osf*)
+--- 2471,2477 ----
+ #
+
+ echo $ac_n "checking whether to build with thread support""... $ac_c" 1>&6
+! echo "configure:2475: checking whether to build with thread support" >&5
+
+ case $host in
+ *-dec-osf*)
+***************
+*** 2551,2557 ****
+ # experiment with it.
+ CC="gcc"
+ echo $ac_n "checking which NetBSD thread library to use""... $ac_c" 1>&6
+! echo "configure:2555: checking which NetBSD thread library to use" >&5
+
+ # Check whether --with-ptl2 or --without-ptl2 was given.
+ if test "${with_ptl2+set}" = set; then
+--- 2559,2565 ----
+ # experiment with it.
+ CC="gcc"
+ echo $ac_n "checking which NetBSD thread library to use""... $ac_c" 1>&6
+! echo "configure:2563: checking which NetBSD thread library to use" >&5
+
+ # Check whether --with-ptl2 or --without-ptl2 was given.
+ if test "${with_ptl2+set}" = set; then
+***************
+*** 2590,2596 ****
+ ;;
+ *)
+ echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
+! echo "configure:2594: checking for pthread_create in -lpthread" >&5
+ ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+--- 2598,2604 ----
+ ;;
+ *)
+ echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
+! echo "configure:2602: checking for pthread_create in -lpthread" >&5
+ ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+***************
+*** 2598,2604 ****
+ ac_save_LIBS="$LIBS"
+ LIBS="-lpthread $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 2602 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+--- 2606,2612 ----
+ ac_save_LIBS="$LIBS"
+ LIBS="-lpthread $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 2610 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+***************
+*** 2609,2615 ****
+ pthread_create()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2613: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+--- 2617,2623 ----
+ pthread_create()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2621: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+***************
+*** 2635,2641 ****
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for __pthread_create in -lpthread""... $ac_c" 1>&6
+! echo "configure:2639: checking for __pthread_create in -lpthread" >&5
+ ac_lib_var=`echo pthread'_'__pthread_create | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+--- 2643,2649 ----
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for __pthread_create in -lpthread""... $ac_c" 1>&6
+! echo "configure:2647: checking for __pthread_create in -lpthread" >&5
+ ac_lib_var=`echo pthread'_'__pthread_create | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+***************
+*** 2643,2649 ****
+ ac_save_LIBS="$LIBS"
+ LIBS="-lpthread $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 2647 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+--- 2651,2657 ----
+ ac_save_LIBS="$LIBS"
+ LIBS="-lpthread $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 2655 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+***************
+*** 2654,2660 ****
+ __pthread_create()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+--- 2662,2668 ----
+ __pthread_create()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2666: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+***************
+*** 2680,2686 ****
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for __pthread_create_system in -lpthread""... $ac_c" 1>&6
+! echo "configure:2684: checking for __pthread_create_system in -lpthread" >&5
+ ac_lib_var=`echo pthread'_'__pthread_create_system | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+--- 2688,2694 ----
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for __pthread_create_system in -lpthread""... $ac_c" 1>&6
+! echo "configure:2692: checking for __pthread_create_system in -lpthread" >&5
+ ac_lib_var=`echo pthread'_'__pthread_create_system | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+***************
+*** 2688,2694 ****
+ ac_save_LIBS="$LIBS"
+ LIBS="-lpthread $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 2692 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+--- 2696,2702 ----
+ ac_save_LIBS="$LIBS"
+ LIBS="-lpthread $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 2700 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+***************
+*** 2699,2705 ****
+ __pthread_create_system()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+--- 2707,2713 ----
+ __pthread_create_system()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+***************
+*** 2725,2731 ****
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
+! echo "configure:2729: checking for pthread_create in -lc_r" >&5
+ ac_lib_var=`echo c_r'_'pthread_create | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+--- 2733,2739 ----
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
+! echo "configure:2737: checking for pthread_create in -lc_r" >&5
+ ac_lib_var=`echo c_r'_'pthread_create | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+***************
+*** 2733,2739 ****
+ ac_save_LIBS="$LIBS"
+ LIBS="-lc_r $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 2737 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+--- 2741,2747 ----
+ ac_save_LIBS="$LIBS"
+ LIBS="-lc_r $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 2745 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+***************
+*** 2744,2750 ****
+ pthread_create()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+--- 2752,2758 ----
+ pthread_create()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+***************
+*** 2770,2776 ****
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
+! echo "configure:2774: checking for pthread_create in -lc" >&5
+ ac_lib_var=`echo c'_'pthread_create | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+--- 2778,2784 ----
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
+! echo "configure:2782: checking for pthread_create in -lc" >&5
+ ac_lib_var=`echo c'_'pthread_create | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+***************
+*** 2778,2784 ****
+ ac_save_LIBS="$LIBS"
+ LIBS="-lc $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 2782 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+--- 2786,2792 ----
+ ac_save_LIBS="$LIBS"
+ LIBS="-lc $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 2790 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+***************
+*** 2789,2795 ****
+ pthread_create()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+--- 2797,2803 ----
+ pthread_create()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+***************
+*** 2835,2841 ****
+ # We'd like to use sigwait() too
+ #
+ echo $ac_n "checking for sigwait in -lc""... $ac_c" 1>&6
+! echo "configure:2839: checking for sigwait in -lc" >&5
+ ac_lib_var=`echo c'_'sigwait | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+--- 2843,2849 ----
+ # We'd like to use sigwait() too
+ #
+ echo $ac_n "checking for sigwait in -lc""... $ac_c" 1>&6
+! echo "configure:2847: checking for sigwait in -lc" >&5
+ ac_lib_var=`echo c'_'sigwait | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+***************
+*** 2843,2849 ****
+ ac_save_LIBS="$LIBS"
+ LIBS="-lc $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 2847 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+--- 2851,2857 ----
+ ac_save_LIBS="$LIBS"
+ LIBS="-lc $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 2855 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+***************
+*** 2854,2860 ****
+ sigwait()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2858: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+--- 2862,2868 ----
+ sigwait()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+***************
+*** 2876,2882 ****
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for sigwait in -lpthread""... $ac_c" 1>&6
+! echo "configure:2880: checking for sigwait in -lpthread" >&5
+ ac_lib_var=`echo pthread'_'sigwait | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+--- 2884,2890 ----
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for sigwait in -lpthread""... $ac_c" 1>&6
+! echo "configure:2888: checking for sigwait in -lpthread" >&5
+ ac_lib_var=`echo pthread'_'sigwait | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+***************
+*** 2884,2890 ****
+ ac_save_LIBS="$LIBS"
+ LIBS="-lpthread $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 2888 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+--- 2892,2898 ----
+ ac_save_LIBS="$LIBS"
+ LIBS="-lpthread $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 2896 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+***************
+*** 2895,2901 ****
+ sigwait()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+--- 2903,2909 ----
+ sigwait()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2907: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+***************
+*** 2917,2923 ****
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for _Psigwait in -lpthread""... $ac_c" 1>&6
+! echo "configure:2921: checking for _Psigwait in -lpthread" >&5
+ ac_lib_var=`echo pthread'_'_Psigwait | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+--- 2925,2931 ----
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for _Psigwait in -lpthread""... $ac_c" 1>&6
+! echo "configure:2929: checking for _Psigwait in -lpthread" >&5
+ ac_lib_var=`echo pthread'_'_Psigwait | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+***************
+*** 2925,2931 ****
+ ac_save_LIBS="$LIBS"
+ LIBS="-lpthread $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 2929 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+--- 2933,2939 ----
+ ac_save_LIBS="$LIBS"
+ LIBS="-lpthread $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 2937 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+***************
+*** 2936,2942 ****
+ _Psigwait()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+--- 2944,2950 ----
+ _Psigwait()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+***************
+*** 2966,2977 ****
+
+
+ echo $ac_n "checking for pthread_attr_getstacksize""... $ac_c" 1>&6
+! echo "configure:2970: checking for pthread_attr_getstacksize" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_pthread_attr_getstacksize'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 2975 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char pthread_attr_getstacksize(); below. */
+--- 2974,2985 ----
+
+
+ echo $ac_n "checking for pthread_attr_getstacksize""... $ac_c" 1>&6
+! echo "configure:2978: checking for pthread_attr_getstacksize" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_pthread_attr_getstacksize'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 2983 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char pthread_attr_getstacksize(); below. */
+***************
+*** 2994,3000 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:2998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_pthread_attr_getstacksize=yes"
+ else
+--- 3002,3008 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_pthread_attr_getstacksize=yes"
+ else
+***************
+*** 3026,3032 ****
+ #
+ *-freebsd*)
+ echo $ac_n "checking for sigwait in -lc_r""... $ac_c" 1>&6
+! echo "configure:3030: checking for sigwait in -lc_r" >&5
+ ac_lib_var=`echo c_r'_'sigwait | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+--- 3034,3040 ----
+ #
+ *-freebsd*)
+ echo $ac_n "checking for sigwait in -lc_r""... $ac_c" 1>&6
+! echo "configure:3038: checking for sigwait in -lc_r" >&5
+ ac_lib_var=`echo c_r'_'sigwait | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+***************
+*** 3034,3040 ****
+ ac_save_LIBS="$LIBS"
+ LIBS="-lc_r $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 3038 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+--- 3042,3048 ----
+ ac_save_LIBS="$LIBS"
+ LIBS="-lc_r $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 3046 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+***************
+*** 3045,3051 ****
+ sigwait()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3049: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+--- 3053,3059 ----
+ sigwait()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+***************
+*** 3100,3111 ****
+ EOF
+
+ echo $ac_n "checking for pthread_setconcurrency""... $ac_c" 1>&6
+! echo "configure:3104: checking for pthread_setconcurrency" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_pthread_setconcurrency'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 3109 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char pthread_setconcurrency(); below. */
+--- 3108,3119 ----
+ EOF
+
+ echo $ac_n "checking for pthread_setconcurrency""... $ac_c" 1>&6
+! echo "configure:3112: checking for pthread_setconcurrency" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_pthread_setconcurrency'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 3117 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char pthread_setconcurrency(); below. */
+***************
+*** 3128,3134 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3132: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_pthread_setconcurrency=yes"
+ else
+--- 3136,3142 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_pthread_setconcurrency=yes"
+ else
+***************
+*** 3166,3177 ****
+ # Look for sysconf to allow detection of the number of processors.
+ #
+ echo $ac_n "checking for sysconf""... $ac_c" 1>&6
+! echo "configure:3170: checking for sysconf" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_sysconf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 3175 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char sysconf(); below. */
+--- 3174,3185 ----
+ # Look for sysconf to allow detection of the number of processors.
+ #
+ echo $ac_n "checking for sysconf""... $ac_c" 1>&6
+! echo "configure:3178: checking for sysconf" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_sysconf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 3183 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char sysconf(); below. */
+***************
+*** 3194,3200 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3198: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_sysconf=yes"
+ else
+--- 3202,3208 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_sysconf=yes"
+ else
+***************
+*** 3275,3286 ****
+ # be defined.
+ #
+ echo $ac_n "checking for flockfile""... $ac_c" 1>&6
+! echo "configure:3279: checking for flockfile" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_flockfile'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 3284 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char flockfile(); below. */
+--- 3283,3294 ----
+ # be defined.
+ #
+ echo $ac_n "checking for flockfile""... $ac_c" 1>&6
+! echo "configure:3287: checking for flockfile" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_flockfile'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 3292 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char flockfile(); below. */
+***************
+*** 3303,3309 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3307: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_flockfile=yes"
+ else
+--- 3311,3317 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_flockfile=yes"
+ else
+***************
+*** 3326,3337 ****
+ fi
+
+ echo $ac_n "checking for getc_unlocked""... $ac_c" 1>&6
+! echo "configure:3330: checking for getc_unlocked" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_getc_unlocked'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 3335 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char getc_unlocked(); below. */
+--- 3334,3345 ----
+ fi
+
+ echo $ac_n "checking for getc_unlocked""... $ac_c" 1>&6
+! echo "configure:3338: checking for getc_unlocked" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_getc_unlocked'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 3343 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char getc_unlocked(); below. */
+***************
+*** 3354,3360 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_getc_unlocked=yes"
+ else
+--- 3362,3368 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_getc_unlocked=yes"
+ else
+***************
+*** 3381,3387 ****
+ # Indicate what the final decision was regarding threads.
+ #
+ echo $ac_n "checking whether to build with threads""... $ac_c" 1>&6
+! echo "configure:3385: checking whether to build with threads" >&5
+ if $use_threads; then
+ echo "$ac_t""yes" 1>&6
+ else
+--- 3389,3395 ----
+ # Indicate what the final decision was regarding threads.
+ #
+ echo $ac_n "checking whether to build with threads""... $ac_c" 1>&6
+! echo "configure:3393: checking whether to build with threads" >&5
+ if $use_threads; then
+ echo "$ac_t""yes" 1>&6
+ else
+***************
+*** 3457,3468 ****
+ # NLS
+ #
+ echo $ac_n "checking for catgets""... $ac_c" 1>&6
+! echo "configure:3461: checking for catgets" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_catgets'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 3466 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char catgets(); below. */
+--- 3465,3476 ----
+ # NLS
+ #
+ echo $ac_n "checking for catgets""... $ac_c" 1>&6
+! echo "configure:3469: checking for catgets" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_catgets'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 3474 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char catgets(); below. */
+***************
+*** 3485,3491 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3489: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_catgets=yes"
+ else
+--- 3493,3499 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3497: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_catgets=yes"
+ else
+***************
+*** 3523,3529 ****
+ ;;
+ *)
+ echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
+! echo "configure:3527: checking for socket in -lsocket" >&5
+ ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+--- 3531,3537 ----
+ ;;
+ *)
+ echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
+! echo "configure:3535: checking for socket in -lsocket" >&5
+ ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+***************
+*** 3531,3537 ****
+ ac_save_LIBS="$LIBS"
+ LIBS="-lsocket $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 3535 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+--- 3539,3545 ----
+ ac_save_LIBS="$LIBS"
+ LIBS="-lsocket $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 3543 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+***************
+*** 3542,3548 ****
+ socket()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3546: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+--- 3550,3556 ----
+ socket()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+***************
+*** 3570,3576 ****
+ fi
+
+ echo $ac_n "checking for inet_ntoa in -lnsl""... $ac_c" 1>&6
+! echo "configure:3574: checking for inet_ntoa in -lnsl" >&5
+ ac_lib_var=`echo nsl'_'inet_ntoa | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+--- 3578,3584 ----
+ fi
+
+ echo $ac_n "checking for inet_ntoa in -lnsl""... $ac_c" 1>&6
+! echo "configure:3582: checking for inet_ntoa in -lnsl" >&5
+ ac_lib_var=`echo nsl'_'inet_ntoa | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+***************
+*** 3578,3584 ****
+ ac_save_LIBS="$LIBS"
+ LIBS="-lnsl $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 3582 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+--- 3586,3592 ----
+ ac_save_LIBS="$LIBS"
+ LIBS="-lnsl $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 3590 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+***************
+*** 3589,3595 ****
+ inet_ntoa()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+--- 3597,3603 ----
+ inet_ntoa()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3601: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+***************
+*** 3623,3629 ****
+ # Purify support
+ #
+ echo $ac_n "checking whether to use purify""... $ac_c" 1>&6
+! echo "configure:3627: checking whether to use purify" >&5
+ # Check whether --with-purify or --without-purify was given.
+ if test "${with_purify+set}" = set; then
+ withval="$with_purify"
+--- 3631,3637 ----
+ # Purify support
+ #
+ echo $ac_n "checking whether to use purify""... $ac_c" 1>&6
+! echo "configure:3635: checking whether to use purify" >&5
+ # Check whether --with-purify or --without-purify was given.
+ if test "${with_purify+set}" = set; then
+ withval="$with_purify"
+***************
+*** 3640,3646 ****
+ # Extract the first word of "purify", so it can be a program name with args.
+ set dummy purify; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:3644: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_purify_path'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 3648,3654 ----
+ # Extract the first word of "purify", so it can be a program name with args.
+ set dummy purify; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:3652: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_purify_path'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 3717,3728 ****
+ case $use_libtool in
+ yes)
+ echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+! echo "configure:3721: checking for Cygwin environment" >&5
+ if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 3726 "configure"
+ #include "confdefs.h"
+
+ int main() {
+--- 3725,3736 ----
+ case $use_libtool in
+ yes)
+ echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+! echo "configure:3729: checking for Cygwin environment" >&5
+ if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 3734 "configure"
+ #include "confdefs.h"
+
+ int main() {
+***************
+*** 3733,3739 ****
+ return __CYGWIN__;
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3737: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_cygwin=yes
+ else
+--- 3741,3747 ----
+ return __CYGWIN__;
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3745: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_cygwin=yes
+ else
+***************
+*** 3750,3768 ****
+ CYGWIN=
+ test "$ac_cv_cygwin" = yes && CYGWIN=yes
+ echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+! echo "configure:3754: checking for mingw32 environment" >&5
+ if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 3759 "configure"
+ #include "confdefs.h"
+
+ int main() {
+ return __MINGW32__;
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3766: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_mingw32=yes
+ else
+--- 3758,3776 ----
+ CYGWIN=
+ test "$ac_cv_cygwin" = yes && CYGWIN=yes
+ echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+! echo "configure:3762: checking for mingw32 environment" >&5
+ if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 3767 "configure"
+ #include "confdefs.h"
+
+ int main() {
+ return __MINGW32__;
+ ; return 0; }
+ EOF
+! if { (eval echo configure:3774: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_mingw32=yes
+ else
+***************
+*** 3848,3854 ****
+ fi
+
+ echo $ac_n "checking build system type""... $ac_c" 1>&6
+! echo "configure:3852: checking build system type" >&5
+
+ build_alias=$build
+ case "$build_alias" in
+--- 3856,3862 ----
+ fi
+
+ echo $ac_n "checking build system type""... $ac_c" 1>&6
+! echo "configure:3860: checking build system type" >&5
+
+ build_alias=$build
+ case "$build_alias" in
+***************
+*** 3877,3883 ****
+ if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
+! echo "configure:3881: checking for ld used by GCC" >&5
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+--- 3885,3891 ----
+ if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
+! echo "configure:3889: checking for ld used by GCC" >&5
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+***************
+*** 3907,3916 ****
+ esac
+ elif test "$with_gnu_ld" = yes; then
+ echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
+! echo "configure:3911: checking for GNU ld" >&5
+ else
+ echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+! echo "configure:3914: checking for non-GNU ld" >&5
+ fi
+ if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+--- 3915,3924 ----
+ esac
+ elif test "$with_gnu_ld" = yes; then
+ echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
+! echo "configure:3919: checking for GNU ld" >&5
+ else
+ echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+! echo "configure:3922: checking for non-GNU ld" >&5
+ fi
+ if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+***************
+*** 3945,3951 ****
+ fi
+ test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
+ echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
+! echo "configure:3949: checking if the linker ($LD) is GNU ld" >&5
+ if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 3953,3959 ----
+ fi
+ test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
+ echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
+! echo "configure:3957: checking if the linker ($LD) is GNU ld" >&5
+ if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 3962,3968 ****
+
+
+ echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
+! echo "configure:3966: checking for $LD option to reload object files" >&5
+ if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 3970,3976 ----
+
+
+ echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
+! echo "configure:3974: checking for $LD option to reload object files" >&5
+ if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 3974,3980 ****
+ test -n "$reload_flag" && reload_flag=" $reload_flag"
+
+ echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
+! echo "configure:3978: checking for BSD-compatible nm" >&5
+ if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 3982,3988 ----
+ test -n "$reload_flag" && reload_flag=" $reload_flag"
+
+ echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
+! echo "configure:3986: checking for BSD-compatible nm" >&5
+ if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 4012,4018 ****
+ echo "$ac_t""$NM" 1>&6
+
+ echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+! echo "configure:4016: checking whether ln -s works" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 4020,4026 ----
+ echo "$ac_t""$NM" 1>&6
+
+ echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+! echo "configure:4024: checking whether ln -s works" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 4033,4039 ****
+ fi
+
+ echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
+! echo "configure:4037: checking how to recognise dependant libraries" >&5
+ if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 4041,4047 ----
+ fi
+
+ echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
+! echo "configure:4045: checking how to recognise dependant libraries" >&5
+ if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 4206,4218 ****
+ deplibs_check_method=$lt_cv_deplibs_check_method
+
+ echo $ac_n "checking for object suffix""... $ac_c" 1>&6
+! echo "configure:4210: checking for object suffix" >&5
+ if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ rm -f conftest*
+ echo 'int i = 1;' > conftest.$ac_ext
+! if { (eval echo configure:4216: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ for ac_file in conftest.*; do
+ case $ac_file in
+ *.c) ;;
+--- 4214,4226 ----
+ deplibs_check_method=$lt_cv_deplibs_check_method
+
+ echo $ac_n "checking for object suffix""... $ac_c" 1>&6
+! echo "configure:4218: checking for object suffix" >&5
+ if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ rm -f conftest*
+ echo 'int i = 1;' > conftest.$ac_ext
+! if { (eval echo configure:4224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ for ac_file in conftest.*; do
+ case $ac_file in
+ *.c) ;;
+***************
+*** 4232,4238 ****
+
+
+ echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+! echo "configure:4236: checking for executable suffix" >&5
+ if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 4240,4246 ----
+
+
+ echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+! echo "configure:4244: checking for executable suffix" >&5
+ if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 4242,4251 ****
+ rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.$ac_ext
+ ac_cv_exeext=
+! if { (eval echo configure:4246: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ for file in conftest.*; do
+ case $file in
+! *.c | *.o | *.obj) ;;
+ *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+--- 4250,4259 ----
+ rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.$ac_ext
+ ac_cv_exeext=
+! if { (eval echo configure:4254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ for file in conftest.*; do
+ case $file in
+! *.c | *.C | *.o | *.obj) ;;
+ *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+***************
+*** 4273,4279 ****
+
+ # Check for command to grab the raw symbol name followed by C symbol from nm.
+ echo $ac_n "checking command to parse $NM output""... $ac_c" 1>&6
+! echo "configure:4277: checking command to parse $NM output" >&5
+ if eval "test \"`echo '$''{'lt_cv_sys_global_symbol_pipe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 4281,4287 ----
+
+ # Check for command to grab the raw symbol name followed by C symbol from nm.
+ echo $ac_n "checking command to parse $NM output""... $ac_c" 1>&6
+! echo "configure:4285: checking command to parse $NM output" >&5
+ if eval "test \"`echo '$''{'lt_cv_sys_global_symbol_pipe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 4349,4358 ****
+ int main(){nm_test_var='a';nm_test_func();return(0);}
+ EOF
+
+! if { (eval echo configure:4353: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+! if { (eval echo configure:4356: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5; } && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+--- 4357,4366 ----
+ int main(){nm_test_var='a';nm_test_func();return(0);}
+ EOF
+
+! if { (eval echo configure:4361: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+! if { (eval echo configure:4364: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5; } && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+***************
+*** 4403,4409 ****
+ save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$no_builtin_flag"
+! if { (eval echo configure:4407: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ pipe_works=yes
+ fi
+ LIBS="$save_LIBS"
+--- 4411,4417 ----
+ save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$no_builtin_flag"
+! if { (eval echo configure:4415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ pipe_works=yes
+ fi
+ LIBS="$save_LIBS"
+***************
+*** 4449,4465 ****
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+! echo "configure:4453: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 4458 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+! { (eval echo configure:4463: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+ rm -rf conftest*
+--- 4457,4473 ----
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+! echo "configure:4461: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 4466 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+! { (eval echo configure:4471: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+ rm -rf conftest*
+***************
+*** 4494,4500 ****
+ file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
+! echo "configure:4498: checking for ${ac_tool_prefix}file" >&5
+ if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 4502,4508 ----
+ file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
+! echo "configure:4506: checking for ${ac_tool_prefix}file" >&5
+ if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 4556,4562 ****
+ if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ echo $ac_n "checking for file""... $ac_c" 1>&6
+! echo "configure:4560: checking for file" >&5
+ if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 4564,4570 ----
+ if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ echo $ac_n "checking for file""... $ac_c" 1>&6
+! echo "configure:4568: checking for file" >&5
+ if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 4627,4633 ****
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:4631: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 4635,4641 ----
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:4639: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 4659,4665 ****
+ # Extract the first word of "ranlib", so it can be a program name with args.
+ set dummy ranlib; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:4663: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 4667,4673 ----
+ # Extract the first word of "ranlib", so it can be a program name with args.
+ set dummy ranlib; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:4671: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 4694,4700 ****
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}strip; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:4698: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 4702,4708 ----
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}strip; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:4706: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 4726,4732 ****
+ # Extract the first word of "strip", so it can be a program name with args.
+ set dummy strip; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:4730: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 4734,4740 ----
+ # Extract the first word of "strip", so it can be a program name with args.
+ set dummy strip; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:4738: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 4775,4782 ****
+ case $host in
+ *-*-irix6*)
+ # Find out which ABI we are using.
+! echo '#line 4779 "configure"' > conftest.$ac_ext
+! if { (eval echo configure:4780: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+--- 4783,4790 ----
+ case $host in
+ *-*-irix6*)
+ # Find out which ABI we are using.
+! echo '#line 4787 "configure"' > conftest.$ac_ext
+! if { (eval echo configure:4788: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+***************
+*** 4797,4803 ****
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
+! echo "configure:4801: checking whether the C compiler needs -belf" >&5
+ if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 4805,4811 ----
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
+! echo "configure:4809: checking whether the C compiler needs -belf" >&5
+ if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 4810,4823 ****
+ cross_compiling=$ac_cv_prog_cc_cross
+
+ cat > conftest.$ac_ext <<EOF
+! #line 4814 "configure"
+ #include "confdefs.h"
+
+ int main() {
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:4821: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ lt_cv_cc_needs_belf=yes
+ else
+--- 4818,4831 ----
+ cross_compiling=$ac_cv_prog_cc_cross
+
+ cat > conftest.$ac_ext <<EOF
+! #line 4822 "configure"
+ #include "confdefs.h"
+
+ int main() {
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:4829: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ lt_cv_cc_needs_belf=yes
+ else
+***************
+*** 4932,4938 ****
+ ## FIXME: this should be a separate macro
+ ##
+ echo $ac_n "checking for objdir""... $ac_c" 1>&6
+! echo "configure:4936: checking for objdir" >&5
+ rm -f .libs 2>/dev/null
+ mkdir .libs 2>/dev/null
+ if test -d .libs; then
+--- 4940,4946 ----
+ ## FIXME: this should be a separate macro
+ ##
+ echo $ac_n "checking for objdir""... $ac_c" 1>&6
+! echo "configure:4944: checking for objdir" >&5
+ rm -f .libs 2>/dev/null
+ mkdir .libs 2>/dev/null
+ if test -d .libs; then
+***************
+*** 4963,4969 ****
+ # in isolation, and that seeing it set (from the cache) indicates that
+ # the associated values are set (in the cache) correctly too.
+ echo $ac_n "checking for $compiler option to produce PIC""... $ac_c" 1>&6
+! echo "configure:4967: checking for $compiler option to produce PIC" >&5
+ if eval "test \"`echo '$''{'lt_cv_prog_cc_pic'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 4971,4977 ----
+ # in isolation, and that seeing it set (from the cache) indicates that
+ # the associated values are set (in the cache) correctly too.
+ echo $ac_n "checking for $compiler option to produce PIC""... $ac_c" 1>&6
+! echo "configure:4975: checking for $compiler option to produce PIC" >&5
+ if eval "test \"`echo '$''{'lt_cv_prog_cc_pic'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 5115,5135 ****
+
+ # Check to make sure the pic_flag actually works.
+ echo $ac_n "checking if $compiler PIC flag $lt_cv_prog_cc_pic works""... $ac_c" 1>&6
+! echo "configure:5119: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5
+ if eval "test \"`echo '$''{'lt_cv_prog_cc_pic_works'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC"
+ cat > conftest.$ac_ext <<EOF
+! #line 5126 "configure"
+ #include "confdefs.h"
+
+ int main() {
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:5133: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ case $host_os in
+ hpux9* | hpux10* | hpux11*)
+--- 5123,5143 ----
+
+ # Check to make sure the pic_flag actually works.
+ echo $ac_n "checking if $compiler PIC flag $lt_cv_prog_cc_pic works""... $ac_c" 1>&6
+! echo "configure:5127: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5
+ if eval "test \"`echo '$''{'lt_cv_prog_cc_pic_works'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC"
+ cat > conftest.$ac_ext <<EOF
+! #line 5134 "configure"
+ #include "confdefs.h"
+
+ int main() {
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:5141: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ case $host_os in
+ hpux9* | hpux10* | hpux11*)
+***************
+*** 5185,5191 ****
+ ## FIXME: this should be a separate macro
+ ##
+ echo $ac_n "checking if $compiler static flag $lt_cv_prog_cc_static works""... $ac_c" 1>&6
+! echo "configure:5189: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5
+ if eval "test \"`echo '$''{'lt_cv_prog_cc_static_works'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 5193,5199 ----
+ ## FIXME: this should be a separate macro
+ ##
+ echo $ac_n "checking if $compiler static flag $lt_cv_prog_cc_static works""... $ac_c" 1>&6
+! echo "configure:5197: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5
+ if eval "test \"`echo '$''{'lt_cv_prog_cc_static_works'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 5193,5206 ****
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static"
+ cat > conftest.$ac_ext <<EOF
+! #line 5197 "configure"
+ #include "confdefs.h"
+
+ int main() {
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:5204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ lt_cv_prog_cc_static_works=yes
+ else
+--- 5201,5214 ----
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static"
+ cat > conftest.$ac_ext <<EOF
+! #line 5205 "configure"
+ #include "confdefs.h"
+
+ int main() {
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:5212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ lt_cv_prog_cc_static_works=yes
+ else
+***************
+*** 5231,5237 ****
+ ##
+ # Check to see if options -o and -c are simultaneously supported by compiler
+ echo $ac_n "checking if $compiler supports -c -o file.$ac_objext""... $ac_c" 1>&6
+! echo "configure:5235: checking if $compiler supports -c -o file.$ac_objext" >&5
+ if eval "test \"`echo '$''{'lt_cv_compiler_c_o'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 5239,5245 ----
+ ##
+ # Check to see if options -o and -c are simultaneously supported by compiler
+ echo $ac_n "checking if $compiler supports -c -o file.$ac_objext""... $ac_c" 1>&6
+! echo "configure:5243: checking if $compiler supports -c -o file.$ac_objext" >&5
+ if eval "test \"`echo '$''{'lt_cv_compiler_c_o'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 5250,5256 ****
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
+ compiler_c_o=no
+! if { (eval echo configure:5254: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s out/conftest.err; then
+--- 5258,5264 ----
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
+ compiler_c_o=no
+! if { (eval echo configure:5262: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s out/conftest.err; then
+***************
+*** 5279,5285 ****
+ if test x"$compiler_c_o" = x"yes"; then
+ # Check to see if we can write to a .lo
+ echo $ac_n "checking if $compiler supports -c -o file.lo""... $ac_c" 1>&6
+! echo "configure:5283: checking if $compiler supports -c -o file.lo" >&5
+ if eval "test \"`echo '$''{'lt_cv_compiler_o_lo'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 5287,5293 ----
+ if test x"$compiler_c_o" = x"yes"; then
+ # Check to see if we can write to a .lo
+ echo $ac_n "checking if $compiler supports -c -o file.lo""... $ac_c" 1>&6
+! echo "configure:5291: checking if $compiler supports -c -o file.lo" >&5
+ if eval "test \"`echo '$''{'lt_cv_compiler_o_lo'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 5288,5301 ****
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -c -o conftest.lo"
+ cat > conftest.$ac_ext <<EOF
+! #line 5292 "configure"
+ #include "confdefs.h"
+
+ int main() {
+ int some_variable = 0;
+ ; return 0; }
+ EOF
+! if { (eval echo configure:5299: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+--- 5296,5309 ----
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -c -o conftest.lo"
+ cat > conftest.$ac_ext <<EOF
+! #line 5300 "configure"
+ #include "confdefs.h"
+
+ int main() {
+ int some_variable = 0;
+ ; return 0; }
+ EOF
+! if { (eval echo configure:5307: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+***************
+*** 5329,5335 ****
+ if test "$compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ echo $ac_n "checking if we can lock with hard links""... $ac_c" 1>&6
+! echo "configure:5333: checking if we can lock with hard links" >&5
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+--- 5337,5343 ----
+ if test "$compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ echo $ac_n "checking if we can lock with hard links""... $ac_c" 1>&6
+! echo "configure:5341: checking if we can lock with hard links" >&5
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+***************
+*** 5352,5371 ****
+ if test "$GCC" = yes; then
+ # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
+ echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions""... $ac_c" 1>&6
+! echo "configure:5356: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
+ compiler_rtti_exceptions=no
+ cat > conftest.$ac_ext <<EOF
+! #line 5362 "configure"
+ #include "confdefs.h"
+
+ int main() {
+ int some_variable = 0;
+ ; return 0; }
+ EOF
+! if { (eval echo configure:5369: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+--- 5360,5379 ----
+ if test "$GCC" = yes; then
+ # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
+ echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions""... $ac_c" 1>&6
+! echo "configure:5364: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
+ compiler_rtti_exceptions=no
+ cat > conftest.$ac_ext <<EOF
+! #line 5370 "configure"
+ #include "confdefs.h"
+
+ int main() {
+ int some_variable = 0;
+ ; return 0; }
+ EOF
+! if { (eval echo configure:5377: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+***************
+*** 5396,5402 ****
+ ##
+ # See if the linker supports building shared libraries.
+ echo $ac_n "checking whether the linker ($LD) supports shared libraries""... $ac_c" 1>&6
+! echo "configure:5400: checking whether the linker ($LD) supports shared libraries" >&5
+
+ allow_undefined_flag=
+ no_undefined_flag=
+--- 5404,5410 ----
+ ##
+ # See if the linker supports building shared libraries.
+ echo $ac_n "checking whether the linker ($LD) supports shared libraries""... $ac_c" 1>&6
+! echo "configure:5408: checking whether the linker ($LD) supports shared libraries" >&5
+
+ allow_undefined_flag=
+ no_undefined_flag=
+***************
+*** 6016,6022 ****
+ ##
+ # Check hardcoding attributes.
+ echo $ac_n "checking how to hardcode library paths into programs""... $ac_c" 1>&6
+! echo "configure:6020: checking how to hardcode library paths into programs" >&5
+ hardcode_action=
+ if test -n "$hardcode_libdir_flag_spec" || \
+ test -n "$runpath_var"; then
+--- 6024,6030 ----
+ ##
+ # Check hardcoding attributes.
+ echo $ac_n "checking how to hardcode library paths into programs""... $ac_c" 1>&6
+! echo "configure:6028: checking how to hardcode library paths into programs" >&5
+ hardcode_action=
+ if test -n "$hardcode_libdir_flag_spec" || \
+ test -n "$runpath_var"; then
+***************
+*** 6048,6054 ****
+ striplib=
+ old_striplib=
+ echo $ac_n "checking whether stripping libraries is possible""... $ac_c" 1>&6
+! echo "configure:6052: checking whether stripping libraries is possible" >&5
+ if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+--- 6056,6062 ----
+ striplib=
+ old_striplib=
+ echo $ac_n "checking whether stripping libraries is possible""... $ac_c" 1>&6
+! echo "configure:6060: checking whether stripping libraries is possible" >&5
+ if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+***************
+*** 6066,6072 ****
+ ##
+ # PORTME Fill in your ld.so characteristics
+ echo $ac_n "checking dynamic linker characteristics""... $ac_c" 1>&6
+! echo "configure:6070: checking dynamic linker characteristics" >&5
+ library_names_spec=
+ libname_spec='lib$name'
+ soname_spec=
+--- 6074,6080 ----
+ ##
+ # PORTME Fill in your ld.so characteristics
+ echo $ac_n "checking dynamic linker characteristics""... $ac_c" 1>&6
+! echo "configure:6078: checking dynamic linker characteristics" >&5
+ library_names_spec=
+ libname_spec='lib$name'
+ soname_spec=
+***************
+*** 6456,6462 ****
+ ##
+ # Report the final consequences.
+ echo $ac_n "checking if libtool supports shared libraries""... $ac_c" 1>&6
+! echo "configure:6460: checking if libtool supports shared libraries" >&5
+ echo "$ac_t""$can_build_shared" 1>&6
+ ##
+ ## END FIXME
+--- 6464,6470 ----
+ ##
+ # Report the final consequences.
+ echo $ac_n "checking if libtool supports shared libraries""... $ac_c" 1>&6
+! echo "configure:6468: checking if libtool supports shared libraries" >&5
+ echo "$ac_t""$can_build_shared" 1>&6
+ ##
+ ## END FIXME
+***************
+*** 6497,6503 ****
+
+ *)
+ echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+! echo "configure:6501: checking for dlopen in -ldl" >&5
+ ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+--- 6505,6511 ----
+
+ *)
+ echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+! echo "configure:6509: checking for dlopen in -ldl" >&5
+ ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+***************
+*** 6505,6511 ****
+ ac_save_LIBS="$LIBS"
+ LIBS="-ldl $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 6509 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+--- 6513,6519 ----
+ ac_save_LIBS="$LIBS"
+ LIBS="-ldl $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 6517 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+***************
+*** 6516,6522 ****
+ dlopen()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:6520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+--- 6524,6530 ----
+ dlopen()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:6528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+***************
+*** 6535,6546 ****
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for dlopen""... $ac_c" 1>&6
+! echo "configure:6539: checking for dlopen" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 6544 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char dlopen(); below. */
+--- 6543,6554 ----
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for dlopen""... $ac_c" 1>&6
+! echo "configure:6547: checking for dlopen" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 6552 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char dlopen(); below. */
+***************
+*** 6563,6569 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:6567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_dlopen=yes"
+ else
+--- 6571,6577 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:6575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_dlopen=yes"
+ else
+***************
+*** 6581,6592 ****
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for shl_load""... $ac_c" 1>&6
+! echo "configure:6585: checking for shl_load" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 6590 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char shl_load(); below. */
+--- 6589,6600 ----
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for shl_load""... $ac_c" 1>&6
+! echo "configure:6593: checking for shl_load" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 6598 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char shl_load(); below. */
+***************
+*** 6609,6615 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:6613: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_shl_load=yes"
+ else
+--- 6617,6623 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:6621: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_shl_load=yes"
+ else
+***************
+*** 6627,6633 ****
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for dlopen in -lsvld""... $ac_c" 1>&6
+! echo "configure:6631: checking for dlopen in -lsvld" >&5
+ ac_lib_var=`echo svld'_'dlopen | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+--- 6635,6641 ----
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for dlopen in -lsvld""... $ac_c" 1>&6
+! echo "configure:6639: checking for dlopen in -lsvld" >&5
+ ac_lib_var=`echo svld'_'dlopen | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+***************
+*** 6635,6641 ****
+ ac_save_LIBS="$LIBS"
+ LIBS="-lsvld $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 6639 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+--- 6643,6649 ----
+ ac_save_LIBS="$LIBS"
+ LIBS="-lsvld $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 6647 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+***************
+*** 6646,6652 ****
+ dlopen()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:6650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+--- 6654,6660 ----
+ dlopen()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:6658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+***************
+*** 6665,6671 ****
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
+! echo "configure:6669: checking for shl_load in -ldld" >&5
+ ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+--- 6673,6679 ----
+ else
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
+! echo "configure:6677: checking for shl_load in -ldld" >&5
+ ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+***************
+*** 6673,6679 ****
+ ac_save_LIBS="$LIBS"
+ LIBS="-ldld $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 6677 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+--- 6681,6687 ----
+ ac_save_LIBS="$LIBS"
+ LIBS="-ldld $LIBS"
+ cat > conftest.$ac_ext <<EOF
+! #line 6685 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+ /* We use char because int might match the return type of a gcc2
+***************
+*** 6684,6690 ****
+ shl_load()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:6688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+--- 6692,6698 ----
+ shl_load()
+ ; return 0; }
+ EOF
+! if { (eval echo configure:6696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+***************
+*** 6737,6743 ****
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
+! echo "configure:6741: checking whether a program can dlopen itself" >&5
+ if eval "test \"`echo '$''{'lt_cv_dlopen_self'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 6745,6751 ----
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
+! echo "configure:6749: checking whether a program can dlopen itself" >&5
+ if eval "test \"`echo '$''{'lt_cv_dlopen_self'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 6747,6753 ****
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+! #line 6751 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+--- 6755,6761 ----
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+! #line 6759 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+***************
+*** 6808,6814 ****
+ exit (status);
+ }
+ EOF
+! if { (eval echo configure:6812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+--- 6816,6822 ----
+ exit (status);
+ }
+ EOF
+! if { (eval echo configure:6820: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+***************
+*** 6831,6837 ****
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ LDFLAGS="$LDFLAGS $link_static_flag"
+ echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
+! echo "configure:6835: checking whether a statically linked program can dlopen itself" >&5
+ if eval "test \"`echo '$''{'lt_cv_dlopen_self_static'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 6839,6845 ----
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ LDFLAGS="$LDFLAGS $link_static_flag"
+ echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
+! echo "configure:6843: checking whether a statically linked program can dlopen itself" >&5
+ if eval "test \"`echo '$''{'lt_cv_dlopen_self_static'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 6841,6847 ****
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+! #line 6845 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+--- 6849,6855 ----
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+! #line 6853 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+***************
+*** 6902,6908 ****
+ exit (status);
+ }
+ EOF
+! if { (eval echo configure:6906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+--- 6910,6916 ----
+ exit (status);
+ }
+ EOF
+! if { (eval echo configure:6914: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+***************
+*** 6953,6966 ****
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ echo $ac_n "checking whether -lc should be explicitly linked in""... $ac_c" 1>&6
+! echo "configure:6957: checking whether -lc should be explicitly linked in" >&5
+ if eval "test \"`echo '$''{'lt_cv_archive_cmds_need_lc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ $rm conftest*
+ echo 'static int dummy;' > conftest.$ac_ext
+
+! if { (eval echo configure:6964: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+--- 6961,6974 ----
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ echo $ac_n "checking whether -lc should be explicitly linked in""... $ac_c" 1>&6
+! echo "configure:6965: checking whether -lc should be explicitly linked in" >&5
+ if eval "test \"`echo '$''{'lt_cv_archive_cmds_need_lc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ $rm conftest*
+ echo 'static int dummy;' > conftest.$ac_ext
+
+! if { (eval echo configure:6972: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+***************
+*** 6973,6979 ****
+ libname=conftest
+ save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+! if { (eval echo configure:6977: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\") 1>&5; (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5; }
+ then
+ lt_cv_archive_cmds_need_lc=no
+ else
+--- 6981,6987 ----
+ libname=conftest
+ save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+! if { (eval echo configure:6985: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\") 1>&5; (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5; }
+ then
+ lt_cv_archive_cmds_need_lc=no
+ else
+***************
+*** 7630,7638 ****
+ # the right suffix on the files.
+ #
+ echo $ac_n "checking for IPv6 structures""... $ac_c" 1>&6
+! echo "configure:7634: checking for IPv6 structures" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 7636 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+--- 7638,7646 ----
+ # the right suffix on the files.
+ #
+ echo $ac_n "checking for IPv6 structures""... $ac_c" 1>&6
+! echo "configure:7642: checking for IPv6 structures" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 7644 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+***************
+*** 7642,7648 ****
+ struct sockaddr_in6 sin6; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:7646: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ found_ipv6=yes
+--- 7650,7656 ----
+ struct sockaddr_in6 sin6; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:7654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ found_ipv6=yes
+***************
+*** 7660,7666 ****
+ # This is done before other IPv6 linking tests to LIBS is properly set.
+ #
+ echo $ac_n "checking for Kame IPv6 support""... $ac_c" 1>&6
+! echo "configure:7664: checking for Kame IPv6 support" >&5
+ # Check whether --with-kame or --without-kame was given.
+ if test "${with_kame+set}" = set; then
+ withval="$with_kame"
+--- 7668,7674 ----
+ # This is done before other IPv6 linking tests to LIBS is properly set.
+ #
+ echo $ac_n "checking for Kame IPv6 support""... $ac_c" 1>&6
+! echo "configure:7672: checking for Kame IPv6 support" >&5
+ # Check whether --with-kame or --without-kame was given.
+ if test "${with_kame+set}" = set; then
+ withval="$with_kame"
+***************
+*** 7751,7759 ****
+ LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
+
+ echo $ac_n "checking for in6_addr""... $ac_c" 1>&6
+! echo "configure:7755: checking for in6_addr" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 7757 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+--- 7759,7767 ----
+ LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
+
+ echo $ac_n "checking for in6_addr""... $ac_c" 1>&6
+! echo "configure:7763: checking for in6_addr" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 7765 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+***************
+*** 7766,7772 ****
+ struct in6_addr in6; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:7770: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6"
+--- 7774,7780 ----
+ struct in6_addr in6; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:7778: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6"
+***************
+*** 7784,7792 ****
+ rm -f conftest*
+
+ echo $ac_n "checking for in6addr_any""... $ac_c" 1>&6
+! echo "configure:7788: checking for in6addr_any" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 7790 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+--- 7792,7800 ----
+ rm -f conftest*
+
+ echo $ac_n "checking for in6addr_any""... $ac_c" 1>&6
+! echo "configure:7796: checking for in6addr_any" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 7798 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+***************
+*** 7800,7806 ****
+ struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:7804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
+--- 7808,7814 ----
+ struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:7812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
+***************
+*** 7816,7824 ****
+ rm -f conftest*
+
+ echo $ac_n "checking for in6addr_loopback""... $ac_c" 1>&6
+! echo "configure:7820: checking for in6addr_loopback" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 7822 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+--- 7824,7832 ----
+ rm -f conftest*
+
+ echo $ac_n "checking for in6addr_loopback""... $ac_c" 1>&6
+! echo "configure:7828: checking for in6addr_loopback" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 7830 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+***************
+*** 7832,7838 ****
+ struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:7836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK"
+--- 7840,7846 ----
+ struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:7844: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK"
+***************
+*** 7848,7856 ****
+ rm -f conftest*
+
+ echo $ac_n "checking for sin6_scope_id in struct sockaddr_in6""... $ac_c" 1>&6
+! echo "configure:7852: checking for sin6_scope_id in struct sockaddr_in6" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 7854 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+--- 7856,7864 ----
+ rm -f conftest*
+
+ echo $ac_n "checking for sin6_scope_id in struct sockaddr_in6""... $ac_c" 1>&6
+! echo "configure:7860: checking for sin6_scope_id in struct sockaddr_in6" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 7862 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+***************
+*** 7863,7869 ****
+ struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:7867: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ result="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
+--- 7871,7877 ----
+ struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:7875: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ result="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
+***************
+*** 7878,7886 ****
+ LWRES_HAVE_SIN6_SCOPE_ID="$result"
+
+ echo $ac_n "checking for in6_pktinfo""... $ac_c" 1>&6
+! echo "configure:7882: checking for in6_pktinfo" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 7884 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+--- 7886,7894 ----
+ LWRES_HAVE_SIN6_SCOPE_ID="$result"
+
+ echo $ac_n "checking for in6_pktinfo""... $ac_c" 1>&6
+! echo "configure:7890: checking for in6_pktinfo" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 7892 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+***************
+*** 7893,7899 ****
+ struct in6_pktinfo xyzzy; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:7897: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"
+--- 7901,7907 ----
+ struct in6_pktinfo xyzzy; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:7905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"
+***************
+*** 7948,7956 ****
+ #
+
+ echo $ac_n "checking for inet_ntop""... $ac_c" 1>&6
+! echo "configure:7952: checking for inet_ntop" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 7954 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+--- 7956,7964 ----
+ #
+
+ echo $ac_n "checking for inet_ntop""... $ac_c" 1>&6
+! echo "configure:7960: checking for inet_ntop" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 7962 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+***************
+*** 7960,7966 ****
+ inet_ntop(0, 0, 0, 0); return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:7964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"
+--- 7968,7974 ----
+ inet_ntop(0, 0, 0, 0); return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:7972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"
+***************
+*** 7981,7993 ****
+ # zeros should also be rejected.
+
+ echo $ac_n "checking for inet_pton""... $ac_c" 1>&6
+! echo "configure:7985: checking for inet_pton" >&5
+ if test "$cross_compiling" = yes; then
+ echo "$ac_t""assuming target platform has working inet_pton" 1>&6
+ ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 7991 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+--- 7989,8001 ----
+ # zeros should also be rejected.
+
+ echo $ac_n "checking for inet_pton""... $ac_c" 1>&6
+! echo "configure:7993: checking for inet_pton" >&5
+ if test "$cross_compiling" = yes; then
+ echo "$ac_t""assuming target platform has working inet_pton" 1>&6
+ ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 7999 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+***************
+*** 7997,8003 ****
+ main() { char a[4]; return (inet_pton(AF_INET, "1.2.3", a) == 1 ? 1 :
+ inet_pton(AF_INET, "1.2.3.04", a) == 1 ? 1 : 0); }
+ EOF
+! if { (eval echo configure:8001: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"
+--- 8005,8011 ----
+ main() { char a[4]; return (inet_pton(AF_INET, "1.2.3", a) == 1 ? 1 :
+ inet_pton(AF_INET, "1.2.3.04", a) == 1 ? 1 : 0); }
+ EOF
+! if { (eval echo configure:8009: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"
+***************
+*** 8015,8023 ****
+
+
+ echo $ac_n "checking for inet_aton""... $ac_c" 1>&6
+! echo "configure:8019: checking for inet_aton" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8021 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+--- 8023,8031 ----
+
+
+ echo $ac_n "checking for inet_aton""... $ac_c" 1>&6
+! echo "configure:8027: checking for inet_aton" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8029 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+***************
+*** 8027,8033 ****
+ struct in_addr in; inet_aton(0, &in); return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8031: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_NEEDATON="#undef ISC_PLATFORM_NEEDATON"
+--- 8035,8041 ----
+ struct in_addr in; inet_aton(0, &in); return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_NEEDATON="#undef ISC_PLATFORM_NEEDATON"
+***************
+*** 8060,8068 ****
+ esac
+
+ echo $ac_n "checking for sa_len in struct sockaddr""... $ac_c" 1>&6
+! echo "configure:8064: checking for sa_len in struct sockaddr" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8066 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+--- 8068,8076 ----
+ esac
+
+ echo $ac_n "checking for sa_len in struct sockaddr""... $ac_c" 1>&6
+! echo "configure:8072: checking for sa_len in struct sockaddr" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8074 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+***************
+*** 8071,8077 ****
+ struct sockaddr sa; sa.sa_len = 0; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8075: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1"
+--- 8079,8085 ----
+ struct sockaddr sa; sa.sa_len = 0; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8083: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1"
+***************
+*** 8092,8100 ****
+ # Look for a 4.4BSD or 4.3BSD struct msghdr
+ #
+ echo $ac_n "checking for struct msghdr flavor""... $ac_c" 1>&6
+! echo "configure:8096: checking for struct msghdr flavor" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8098 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+--- 8100,8108 ----
+ # Look for a 4.4BSD or 4.3BSD struct msghdr
+ #
+ echo $ac_n "checking for struct msghdr flavor""... $ac_c" 1>&6
+! echo "configure:8104: checking for struct msghdr flavor" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8106 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+***************
+*** 8103,8109 ****
+ struct msghdr msg; msg.msg_flags = 0; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8107: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""4.4BSD" 1>&6
+ ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"
+--- 8111,8117 ----
+ struct msghdr msg; msg.msg_flags = 0; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""4.4BSD" 1>&6
+ ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"
+***************
+*** 8121,8129 ****
+ # Look for in_port_t.
+ #
+ echo $ac_n "checking for type in_port_t""... $ac_c" 1>&6
+! echo "configure:8125: checking for type in_port_t" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8127 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+--- 8129,8137 ----
+ # Look for in_port_t.
+ #
+ echo $ac_n "checking for type in_port_t""... $ac_c" 1>&6
+! echo "configure:8133: checking for type in_port_t" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8135 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+***************
+*** 8132,8138 ****
+ in_port_t port = 25; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8136: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT"
+--- 8140,8146 ----
+ in_port_t port = 25; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8144: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT"
+***************
+*** 8150,8158 ****
+ # Check for addrinfo
+ #
+ echo $ac_n "checking for struct addrinfo""... $ac_c" 1>&6
+! echo "configure:8154: checking for struct addrinfo" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8156 "configure"
+ #include "confdefs.h"
+
+ #include <netdb.h>
+--- 8158,8166 ----
+ # Check for addrinfo
+ #
+ echo $ac_n "checking for struct addrinfo""... $ac_c" 1>&6
+! echo "configure:8162: checking for struct addrinfo" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8164 "configure"
+ #include "confdefs.h"
+
+ #include <netdb.h>
+***************
+*** 8160,8166 ****
+ struct addrinfo a; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8164: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_LWRES_NEEDADDRINFO="#undef ISC_LWRES_NEEDADDRINFO"
+--- 8168,8174 ----
+ struct addrinfo a; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8172: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_LWRES_NEEDADDRINFO="#undef ISC_LWRES_NEEDADDRINFO"
+***************
+*** 8182,8190 ****
+ # Check for rrsetinfo
+ #
+ echo $ac_n "checking for struct rrsetinfo""... $ac_c" 1>&6
+! echo "configure:8186: checking for struct rrsetinfo" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8188 "configure"
+ #include "confdefs.h"
+
+ #include <netdb.h>
+--- 8190,8198 ----
+ # Check for rrsetinfo
+ #
+ echo $ac_n "checking for struct rrsetinfo""... $ac_c" 1>&6
+! echo "configure:8194: checking for struct rrsetinfo" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8196 "configure"
+ #include "confdefs.h"
+
+ #include <netdb.h>
+***************
+*** 8192,8198 ****
+ struct rrsetinfo r; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8196: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_LWRES_NEEDRRSETINFO="#undef ISC_LWRES_NEEDRRSETINFO"
+--- 8200,8206 ----
+ struct rrsetinfo r; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8204: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_LWRES_NEEDRRSETINFO="#undef ISC_LWRES_NEEDRRSETINFO"
+***************
+*** 8207,8215 ****
+
+
+ echo $ac_n "checking for int sethostent""... $ac_c" 1>&6
+! echo "configure:8211: checking for int sethostent" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8213 "configure"
+ #include "confdefs.h"
+
+ #include <netdb.h>
+--- 8215,8223 ----
+
+
+ echo $ac_n "checking for int sethostent""... $ac_c" 1>&6
+! echo "configure:8219: checking for int sethostent" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8221 "configure"
+ #include "confdefs.h"
+
+ #include <netdb.h>
+***************
+*** 8217,8223 ****
+ int i = sethostent(0); return(0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8221: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_LWRES_SETHOSTENTINT="#define ISC_LWRES_SETHOSTENTINT 1"
+--- 8225,8231 ----
+ int i = sethostent(0); return(0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8229: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_LWRES_SETHOSTENTINT="#define ISC_LWRES_SETHOSTENTINT 1"
+***************
+*** 8232,8240 ****
+
+
+ echo $ac_n "checking for int endhostent""... $ac_c" 1>&6
+! echo "configure:8236: checking for int endhostent" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8238 "configure"
+ #include "confdefs.h"
+
+ #include <netdb.h>
+--- 8240,8248 ----
+
+
+ echo $ac_n "checking for int endhostent""... $ac_c" 1>&6
+! echo "configure:8244: checking for int endhostent" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8246 "configure"
+ #include "confdefs.h"
+
+ #include <netdb.h>
+***************
+*** 8242,8248 ****
+ int i = endhostent(); return(0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8246: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_LWRES_ENDHOSTENTINT="#define ISC_LWRES_ENDHOSTENTINT 1"
+--- 8250,8256 ----
+ int i = endhostent(); return(0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8254: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_LWRES_ENDHOSTENTINT="#define ISC_LWRES_ENDHOSTENTINT 1"
+***************
+*** 8257,8265 ****
+
+
+ echo $ac_n "checking for getnetbyaddr(in_addr_t, ...)""... $ac_c" 1>&6
+! echo "configure:8261: checking for getnetbyaddr(in_addr_t, ...)" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8263 "configure"
+ #include "confdefs.h"
+
+ #include <netdb.h>
+--- 8265,8273 ----
+
+
+ echo $ac_n "checking for getnetbyaddr(in_addr_t, ...)""... $ac_c" 1>&6
+! echo "configure:8269: checking for getnetbyaddr(in_addr_t, ...)" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8271 "configure"
+ #include "confdefs.h"
+
+ #include <netdb.h>
+***************
+*** 8268,8274 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8272: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_LWRES_GETNETBYADDRINADDR="#define ISC_LWRES_GETNETBYADDRINADDR 1"
+--- 8276,8282 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8280: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_LWRES_GETNETBYADDRINADDR="#define ISC_LWRES_GETNETBYADDRINADDR 1"
+***************
+*** 8283,8291 ****
+
+
+ echo $ac_n "checking for int setnetent""... $ac_c" 1>&6
+! echo "configure:8287: checking for int setnetent" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8289 "configure"
+ #include "confdefs.h"
+
+ #include <netdb.h>
+--- 8291,8299 ----
+
+
+ echo $ac_n "checking for int setnetent""... $ac_c" 1>&6
+! echo "configure:8295: checking for int setnetent" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8297 "configure"
+ #include "confdefs.h"
+
+ #include <netdb.h>
+***************
+*** 8293,8299 ****
+ int i = setnetent(0); return(0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8297: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_LWRES_SETNETENTINT="#define ISC_LWRES_SETNETENTINT 1"
+--- 8301,8307 ----
+ int i = setnetent(0); return(0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8305: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_LWRES_SETNETENTINT="#define ISC_LWRES_SETNETENTINT 1"
+***************
+*** 8308,8316 ****
+
+
+ echo $ac_n "checking for int endnetent""... $ac_c" 1>&6
+! echo "configure:8312: checking for int endnetent" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8314 "configure"
+ #include "confdefs.h"
+
+ #include <netdb.h>
+--- 8316,8324 ----
+
+
+ echo $ac_n "checking for int endnetent""... $ac_c" 1>&6
+! echo "configure:8320: checking for int endnetent" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8322 "configure"
+ #include "confdefs.h"
+
+ #include <netdb.h>
+***************
+*** 8318,8324 ****
+ int i = endnetent(); return(0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8322: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_LWRES_ENDNETENTINT="#define ISC_LWRES_ENDNETENTINT 1"
+--- 8326,8332 ----
+ int i = endnetent(); return(0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8330: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_LWRES_ENDNETENTINT="#define ISC_LWRES_ENDNETENTINT 1"
+***************
+*** 8333,8341 ****
+
+
+ echo $ac_n "checking for gethostbyaddr(const void *, size_t, ...)""... $ac_c" 1>&6
+! echo "configure:8337: checking for gethostbyaddr(const void *, size_t, ...)" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8339 "configure"
+ #include "confdefs.h"
+
+ #include <netdb.h>
+--- 8341,8349 ----
+
+
+ echo $ac_n "checking for gethostbyaddr(const void *, size_t, ...)""... $ac_c" 1>&6
+! echo "configure:8345: checking for gethostbyaddr(const void *, size_t, ...)" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8347 "configure"
+ #include "confdefs.h"
+
+ #include <netdb.h>
+***************
+*** 8344,8350 ****
+ return(0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8348: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_LWRES_GETHOSTBYADDRVOID="#define ISC_LWRES_GETHOSTBYADDRVOID 1"
+--- 8352,8358 ----
+ return(0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8356: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_LWRES_GETHOSTBYADDRVOID="#define ISC_LWRES_GETHOSTBYADDRVOID 1"
+***************
+*** 8359,8367 ****
+
+
+ echo $ac_n "checking for h_errno in netdb.h""... $ac_c" 1>&6
+! echo "configure:8363: checking for h_errno in netdb.h" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8365 "configure"
+ #include "confdefs.h"
+
+ #include <netdb.h>
+--- 8367,8375 ----
+
+
+ echo $ac_n "checking for h_errno in netdb.h""... $ac_c" 1>&6
+! echo "configure:8371: checking for h_errno in netdb.h" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8373 "configure"
+ #include "confdefs.h"
+
+ #include <netdb.h>
+***************
+*** 8369,8375 ****
+ h_errno = 1; return(0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8373: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_LWRES_NEEDHERRNO="#undef ISC_LWRES_NEEDHERRNO"
+--- 8377,8383 ----
+ h_errno = 1; return(0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8381: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_LWRES_NEEDHERRNO="#undef ISC_LWRES_NEEDHERRNO"
+***************
+*** 8384,8395 ****
+
+
+ echo $ac_n "checking for getipnodebyname""... $ac_c" 1>&6
+! echo "configure:8388: checking for getipnodebyname" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_getipnodebyname'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8393 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char getipnodebyname(); below. */
+--- 8392,8403 ----
+
+
+ echo $ac_n "checking for getipnodebyname""... $ac_c" 1>&6
+! echo "configure:8396: checking for getipnodebyname" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_getipnodebyname'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8401 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char getipnodebyname(); below. */
+***************
+*** 8412,8418 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8416: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_getipnodebyname=yes"
+ else
+--- 8420,8426 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_getipnodebyname=yes"
+ else
+***************
+*** 8433,8444 ****
+ fi
+
+ echo $ac_n "checking for getnameinfo""... $ac_c" 1>&6
+! echo "configure:8437: checking for getnameinfo" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_getnameinfo'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8442 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char getnameinfo(); below. */
+--- 8441,8452 ----
+ fi
+
+ echo $ac_n "checking for getnameinfo""... $ac_c" 1>&6
+! echo "configure:8445: checking for getnameinfo" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_getnameinfo'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8450 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char getnameinfo(); below. */
+***************
+*** 8461,8467 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_getnameinfo=yes"
+ else
+--- 8469,8475 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_getnameinfo=yes"
+ else
+***************
+*** 8482,8493 ****
+ fi
+
+ echo $ac_n "checking for getaddrinfo""... $ac_c" 1>&6
+! echo "configure:8486: checking for getaddrinfo" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_getaddrinfo'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8491 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char getaddrinfo(); below. */
+--- 8490,8501 ----
+ fi
+
+ echo $ac_n "checking for getaddrinfo""... $ac_c" 1>&6
+! echo "configure:8494: checking for getaddrinfo" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_getaddrinfo'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8499 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char getaddrinfo(); below. */
+***************
+*** 8510,8516 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8514: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_getaddrinfo=yes"
+ else
+--- 8518,8524 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8522: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_getaddrinfo=yes"
+ else
+***************
+*** 8535,8546 ****
+ fi
+
+ echo $ac_n "checking for gai_strerror""... $ac_c" 1>&6
+! echo "configure:8539: checking for gai_strerror" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_gai_strerror'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8544 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char gai_strerror(); below. */
+--- 8543,8554 ----
+ fi
+
+ echo $ac_n "checking for gai_strerror""... $ac_c" 1>&6
+! echo "configure:8547: checking for gai_strerror" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_gai_strerror'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8552 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char gai_strerror(); below. */
+***************
+*** 8563,8569 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_gai_strerror=yes"
+ else
+--- 8571,8577 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_gai_strerror=yes"
+ else
+***************
+*** 8593,8601 ****
+ # Look for a sysctl call to get the list of network interfaces.
+ #
+ echo $ac_n "checking for interface list sysctl""... $ac_c" 1>&6
+! echo "configure:8597: checking for interface list sysctl" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8599 "configure"
+ #include "confdefs.h"
+
+ #include <sys/param.h>
+--- 8601,8609 ----
+ # Look for a sysctl call to get the list of network interfaces.
+ #
+ echo $ac_n "checking for interface list sysctl""... $ac_c" 1>&6
+! echo "configure:8605: checking for interface list sysctl" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8607 "configure"
+ #include "confdefs.h"
+
+ #include <sys/param.h>
+***************
+*** 8632,8647 ****
+ # AC_CHECK_FUNC() incorrectly succeeds because it declares
+ # the function itself.
+ echo $ac_n "checking for correctly declared strsep()""... $ac_c" 1>&6
+! echo "configure:8636: checking for correctly declared strsep()" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8638 "configure"
+ #include "confdefs.h"
+ #include <string.h>
+ int main() {
+ char *sp; char *foo = strsep(&sp, ".");
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6; ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"
+ else
+--- 8640,8655 ----
+ # AC_CHECK_FUNC() incorrectly succeeds because it declares
+ # the function itself.
+ echo $ac_n "checking for correctly declared strsep()""... $ac_c" 1>&6
+! echo "configure:8644: checking for correctly declared strsep()" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8646 "configure"
+ #include "confdefs.h"
+ #include <string.h>
+ int main() {
+ char *sp; char *foo = strsep(&sp, ".");
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6; ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"
+ else
+***************
+*** 8653,8664 ****
+ rm -f conftest*
+
+ echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6
+! echo "configure:8657: checking for vsnprintf" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_vsnprintf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8662 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char vsnprintf(); below. */
+--- 8661,8672 ----
+ rm -f conftest*
+
+ echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6
+! echo "configure:8665: checking for vsnprintf" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_vsnprintf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8670 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char vsnprintf(); below. */
+***************
+*** 8681,8687 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_vsnprintf=yes"
+ else
+--- 8689,8695 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_vsnprintf=yes"
+ else
+***************
+*** 8706,8717 ****
+
+
+ echo $ac_n "checking for strerror""... $ac_c" 1>&6
+! echo "configure:8710: checking for strerror" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8715 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char strerror(); below. */
+--- 8714,8725 ----
+
+
+ echo $ac_n "checking for strerror""... $ac_c" 1>&6
+! echo "configure:8718: checking for strerror" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8723 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char strerror(); below. */
+***************
+*** 8734,8740 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_strerror=yes"
+ else
+--- 8742,8748 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_strerror=yes"
+ else
+***************
+*** 8768,8784 ****
+ # but that's defined elsewhere since we don't use configure on Win32.
+ #
+ echo $ac_n "checking printf format modifier for 64-bit integers""... $ac_c" 1>&6
+! echo "configure:8772: checking printf format modifier for 64-bit integers" >&5
+ if test "$cross_compiling" = yes; then
+ echo "$ac_t""assuming target platform uses ll" 1>&6
+ ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8778 "configure"
+ #include "confdefs.h"
+ main() { exit(!(sizeof(long long int) == sizeof(long int))); }
+ EOF
+! if { (eval echo configure:8782: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ echo "$ac_t""l" 1>&6
+ ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "l"'
+--- 8776,8792 ----
+ # but that's defined elsewhere since we don't use configure on Win32.
+ #
+ echo $ac_n "checking printf format modifier for 64-bit integers""... $ac_c" 1>&6
+! echo "configure:8780: checking printf format modifier for 64-bit integers" >&5
+ if test "$cross_compiling" = yes; then
+ echo "$ac_t""assuming target platform uses ll" 1>&6
+ ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8786 "configure"
+ #include "confdefs.h"
+ main() { exit(!(sizeof(long long int) == sizeof(long int))); }
+ EOF
+! if { (eval echo configure:8790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ echo "$ac_t""l" 1>&6
+ ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "l"'
+***************
+*** 8798,8809 ****
+ # Security Stuff
+ #
+ echo $ac_n "checking for chroot""... $ac_c" 1>&6
+! echo "configure:8802: checking for chroot" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_chroot'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8807 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char chroot(); below. */
+--- 8806,8817 ----
+ # Security Stuff
+ #
+ echo $ac_n "checking for chroot""... $ac_c" 1>&6
+! echo "configure:8810: checking for chroot" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_chroot'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8815 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char chroot(); below. */
+***************
+*** 8826,8832 ****
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8830: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_chroot=yes"
+ else
+--- 8834,8840 ----
+
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_chroot=yes"
+ else
+***************
+*** 8860,8876 ****
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+! echo "configure:8864: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8869 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+! { (eval echo configure:8874: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+ rm -rf conftest*
+--- 8868,8884 ----
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+! echo "configure:8872: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8877 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+! { (eval echo configure:8882: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+ rm -rf conftest*
+***************
+*** 8904,8920 ****
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+! echo "configure:8908: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8913 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+! { (eval echo configure:8918: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+ rm -rf conftest*
+--- 8912,8928 ----
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+! echo "configure:8916: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8921 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+! { (eval echo configure:8926: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+ rm -rf conftest*
+***************
+*** 8945,8953 ****
+ # BSD/OS, and perhaps some others, don't define rlim_t.
+ #
+ echo $ac_n "checking for type rlim_t""... $ac_c" 1>&6
+! echo "configure:8949: checking for type rlim_t" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8951 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+--- 8953,8961 ----
+ # BSD/OS, and perhaps some others, don't define rlim_t.
+ #
+ echo $ac_n "checking for type rlim_t""... $ac_c" 1>&6
+! echo "configure:8957: checking for type rlim_t" >&5
+ cat > conftest.$ac_ext <<EOF
+! #line 8959 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+***************
+*** 8957,8963 ****
+ rlim_t rl = 19671212; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8961: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE rlim_t"
+--- 8965,8971 ----
+ rlim_t rl = 19671212; return (0);
+ ; return 0; }
+ EOF
+! if { (eval echo configure:8969: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE rlim_t"
+***************
+*** 8968,8979 ****
+ echo "$ac_t""no" 1>&6
+
+ echo $ac_n "checking type of rlim_cur""... $ac_c" 1>&6
+! echo "configure:8972: checking type of rlim_cur" >&5
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: cannot determine type of rlim_cur when cross compiling - define rlim_t" 1>&2; exit 1; }
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8977 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+--- 8976,8987 ----
+ echo "$ac_t""no" 1>&6
+
+ echo $ac_n "checking type of rlim_cur""... $ac_c" 1>&6
+! echo "configure:8980: checking type of rlim_cur" >&5
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: cannot determine type of rlim_cur when cross compiling - define rlim_t" 1>&2; exit 1; }
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8985 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+***************
+*** 8981,8987 ****
+ #include <sys/resource.h>
+ main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(int)));}
+ EOF
+! if { (eval echo configure:8985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ echo "$ac_t""int" 1>&6
+ ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE int"
+--- 8989,8995 ----
+ #include <sys/resource.h>
+ main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(int)));}
+ EOF
+! if { (eval echo configure:8993: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ echo "$ac_t""int" 1>&6
+ ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE int"
+***************
+*** 8994,9000 ****
+ { echo "configure: error: this cannot happen" 1>&2; exit 1; }
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 8998 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+--- 9002,9008 ----
+ { echo "configure: error: this cannot happen" 1>&2; exit 1; }
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 9006 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+***************
+*** 9002,9008 ****
+ #include <sys/resource.h>
+ main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(long int)));}
+ EOF
+! if { (eval echo configure:9006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ echo "$ac_t""long int" 1>&6
+ ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long int"
+--- 9010,9016 ----
+ #include <sys/resource.h>
+ main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(long int)));}
+ EOF
+! if { (eval echo configure:9014: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ echo "$ac_t""long int" 1>&6
+ ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long int"
+***************
+*** 9015,9021 ****
+ { echo "configure: error: this cannot happen" 1>&2; exit 1; }
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 9019 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+--- 9023,9029 ----
+ { echo "configure: error: this cannot happen" 1>&2; exit 1; }
+ else
+ cat > conftest.$ac_ext <<EOF
+! #line 9027 "configure"
+ #include "confdefs.h"
+
+ #include <sys/types.h>
+***************
+*** 9023,9029 ****
+ #include <sys/resource.h>
+ main() { struct rlimit r; exit((!sizeof(r.rlim_cur) == sizeof(long long int)));}
+ EOF
+! if { (eval echo configure:9027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ echo "$ac_t""long long int" 1>&6
+ ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long long int"
+--- 9031,9037 ----
+ #include <sys/resource.h>
+ main() { struct rlimit r; exit((!sizeof(r.rlim_cur) == sizeof(long long int)));}
+ EOF
+! if { (eval echo configure:9035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ echo "$ac_t""long long int" 1>&6
+ ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long long int"
+***************
+*** 9147,9153 ****
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:9151: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_OPENJADE'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 9155,9161 ----
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:9159: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_OPENJADE'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 9194,9200 ****
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:9198: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_JADETEX'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 9202,9208 ----
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:9206: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_JADETEX'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 9237,9243 ****
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:9241: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_PDFJADETEX'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+--- 9245,9251 ----
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+! echo "configure:9249: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_PDFJADETEX'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+***************
+*** 9293,9299 ****
+
+ SGMLCATALOG=""
+ echo $ac_n "checking for catalog""... $ac_c" 1>&6
+! echo "configure:9297: checking for catalog" >&5
+ for d in $sgmltrees
+ do
+ f=$d/catalog
+--- 9301,9307 ----
+
+ SGMLCATALOG=""
+ echo $ac_n "checking for catalog""... $ac_c" 1>&6
+! echo "configure:9305: checking for catalog" >&5
+ for d in $sgmltrees
+ do
+ f=$d/catalog
+***************
+*** 9335,9341 ****
+
+ HTMLSTYLE=""
+ echo $ac_n "checking for html/docbook.dsl""... $ac_c" 1>&6
+! echo "configure:9339: checking for html/docbook.dsl" >&5
+ for d in $stylepath
+ do
+ f=$d/html/docbook.dsl
+--- 9343,9349 ----
+
+ HTMLSTYLE=""
+ echo $ac_n "checking for html/docbook.dsl""... $ac_c" 1>&6
+! echo "configure:9347: checking for html/docbook.dsl" >&5
+ for d in $stylepath
+ do
+ f=$d/html/docbook.dsl
+***************
+*** 9356,9362 ****
+
+ PRINTSTYLE=""
+ echo $ac_n "checking for print/docbook.dsl""... $ac_c" 1>&6
+! echo "configure:9360: checking for print/docbook.dsl" >&5
+ for d in $stylepath
+ do
+ f=$d/print/docbook.dsl
+--- 9364,9370 ----
+
+ PRINTSTYLE=""
+ echo $ac_n "checking for print/docbook.dsl""... $ac_c" 1>&6
+! echo "configure:9368: checking for print/docbook.dsl" >&5
+ for d in $stylepath
+ do
+ f=$d/print/docbook.dsl
+***************
+*** 9382,9388 ****
+
+ XMLDCL=""
+ echo $ac_n "checking for docbook/dsssl/modular/dtds/decls/xml.dcl""... $ac_c" 1>&6
+! echo "configure:9386: checking for docbook/dsssl/modular/dtds/decls/xml.dcl" >&5
+ for d in $sgmltrees
+ do
+ f=$d/docbook/dsssl/modular/dtds/decls/xml.dcl
+--- 9390,9396 ----
+
+ XMLDCL=""
+ echo $ac_n "checking for docbook/dsssl/modular/dtds/decls/xml.dcl""... $ac_c" 1>&6
+! echo "configure:9394: checking for docbook/dsssl/modular/dtds/decls/xml.dcl" >&5
+ for d in $sgmltrees
+ do
+ f=$d/docbook/dsssl/modular/dtds/decls/xml.dcl
+***************
+*** 9408,9414 ****
+
+ DOCBOOK2MANSPEC=""
+ echo $ac_n "checking for docbook2X/docbook2man-spec.pl""... $ac_c" 1>&6
+! echo "configure:9412: checking for docbook2X/docbook2man-spec.pl" >&5
+ for d in $sgmltrees
+ do
+ f=$d/docbook2X/docbook2man-spec.pl
+--- 9416,9422 ----
+
+ DOCBOOK2MANSPEC=""
+ echo $ac_n "checking for docbook2X/docbook2man-spec.pl""... $ac_c" 1>&6
+! echo "configure:9420: checking for docbook2X/docbook2man-spec.pl" >&5
+ for d in $sgmltrees
+ do
+ f=$d/docbook2X/docbook2man-spec.pl
+***************
+*** 9428,9433 ****
+--- 9436,9631 ----
+
+
+ #
++ # IDN support
++ #
++ # Check whether --with-idn or --without-idn was given.
++ if test "${with_idn+set}" = set; then
++ withval="$with_idn"
++ use_idn="$withval"
++ else
++ use_idn="no"
++ fi
++
++ case "$use_idn" in
++ yes)
++ if test X$prefix = XNONE ; then
++ idn_path=/usr/local
++ else
++ idn_path=$prefix
++ fi
++ ;;
++ no)
++ ;;
++ *)
++ idn_path="$use_idn"
++ ;;
++ esac
++
++ iconvinc=
++ iconvlib=
++ # Check whether --with-libiconv or --without-libiconv was given.
++ if test "${with_libiconv+set}" = set; then
++ withval="$with_libiconv"
++ use_libiconv="$withval"
++ else
++ use_libiconv="no"
++ fi
++
++ case "$use_libiconv" in
++ yes)
++ if test X$prefix = XNONE ; then
++ iconvlib="-L/usr/local/lib -R/usr/local/lib -liconv"
++ else
++ iconvlib="-L$prefix/lib -R$prefix/lib -liconv"
++ fi
++ ;;
++ no)
++ iconvlib=
++ ;;
++ *)
++ iconvlib="-L$use_libiconv/lib -R$use_libiconv/lib -liconv"
++ ;;
++ esac
++
++ # Check whether --with-iconv or --without-iconv was given.
++ if test "${with_iconv+set}" = set; then
++ withval="$with_iconv"
++ iconvlib="$withval"
++ fi
++
++ case "$iconvlib" in
++ no)
++ iconvlib=
++ ;;
++ yes)
++ iconvlib=-liconv
++ ;;
++ esac
++
++ # Check whether --with-idnlib or --without-idnlib was given.
++ if test "${with_idnlib+set}" = set; then
++ withval="$with_idnlib"
++ idnlib="$withval"
++ else
++ idnlib="no"
++ fi
++
++ if test "$idnlib" = yes; then
++ { echo "configure: error: You must specify ARG for --with-idnlib." 1>&2; exit 1; }
++ fi
++
++ IDNLIBS=
++ if test "$use_idn" != no; then
++ cat >> confdefs.h <<\EOF
++ #define WITH_IDN 1
++ EOF
++
++ STD_CINCLUDES="$STD_CINCLUDES -I$idn_path/include"
++ if test "$idnlib" != no; then
++ IDNLIBS="$idnlib $iconvlib"
++ else
++ IDNLIBS="-L$idn_path/lib -lidnkit $iconvlib"
++ fi
++ fi
++
++
++ for ac_hdr in locale.h
++ do
++ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
++ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
++ echo "configure:9537: checking for $ac_hdr" >&5
++ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
++ echo $ac_n "(cached) $ac_c" 1>&6
++ else
++ cat > conftest.$ac_ext <<EOF
++ #line 9542 "configure"
++ #include "confdefs.h"
++ #include <$ac_hdr>
++ EOF
++ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
++ { (eval echo configure:9547: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
++ if test -z "$ac_err"; then
++ rm -rf conftest*
++ eval "ac_cv_header_$ac_safe=yes"
++ else
++ echo "$ac_err" >&5
++ echo "configure: failed program was:" >&5
++ cat conftest.$ac_ext >&5
++ rm -rf conftest*
++ eval "ac_cv_header_$ac_safe=no"
++ fi
++ rm -f conftest*
++ fi
++ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
++ echo "$ac_t""yes" 1>&6
++ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
++ cat >> confdefs.h <<EOF
++ #define $ac_tr_hdr 1
++ EOF
++
++ else
++ echo "$ac_t""no" 1>&6
++ fi
++ done
++
++ for ac_func in setlocale
++ do
++ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
++ echo "configure:9576: checking for $ac_func" >&5
++ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
++ echo $ac_n "(cached) $ac_c" 1>&6
++ else
++ cat > conftest.$ac_ext <<EOF
++ #line 9581 "configure"
++ #include "confdefs.h"
++ /* System header to define __stub macros and hopefully few prototypes,
++ which can conflict with char $ac_func(); below. */
++ #include <assert.h>
++ /* Override any gcc2 internal prototype to avoid an error. */
++ /* We use char because int might match the return type of a gcc2
++ builtin and then its argument prototype would still apply. */
++ char $ac_func();
++
++ int main() {
++
++ /* The GNU C library defines this for functions which it implements
++ to always fail with ENOSYS. Some functions are actually named
++ something starting with __ and the normal name is an alias. */
++ #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
++ choke me
++ #else
++ $ac_func();
++ #endif
++
++ ; return 0; }
++ EOF
++ if { (eval echo configure:9604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++ rm -rf conftest*
++ eval "ac_cv_func_$ac_func=yes"
++ else
++ echo "configure: failed program was:" >&5
++ cat conftest.$ac_ext >&5
++ rm -rf conftest*
++ eval "ac_cv_func_$ac_func=no"
++ fi
++ rm -f conftest*
++ fi
++
++ if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
++ echo "$ac_t""yes" 1>&6
++ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
++ cat >> confdefs.h <<EOF
++ #define $ac_tr_func 1
++ EOF
++
++ else
++ echo "$ac_t""no" 1>&6
++ fi
++ done
++
++
++ #
+ # Substitutions
+ #
+
+***************
+*** 9799,9804 ****
+--- 9997,10003 ----
+ s%@PRINTSTYLE@%$PRINTSTYLE%g
+ s%@XMLDCL@%$XMLDCL%g
+ s%@DOCBOOK2MANSPEC@%$DOCBOOK2MANSPEC%g
++ s%@IDNLIBS@%$IDNLIBS%g
+ s%@BIND9_TOP_BUILDDIR@%$BIND9_TOP_BUILDDIR%g
+ s%@BIND9_ISC_BUILDINCLUDE@%$BIND9_ISC_BUILDINCLUDE%g
+ s%@BIND9_ISCCC_BUILDINCLUDE@%$BIND9_ISCCC_BUILDINCLUDE%g
+***************
+*** 9828,9834 ****
+
+ # Split the substitutions into bite-sized pieces for seds with
+ # small command number limits, like on Digital OSF/1 and HP-UX.
+! ac_max_sed_cmds=50 # Maximum number of lines to put in a sed script.
+ ac_file=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_cmds # Line after last line for current file.
+--- 10027,10033 ----
+
+ # Split the substitutions into bite-sized pieces for seds with
+ # small command number limits, like on Digital OSF/1 and HP-UX.
+! ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ ac_file=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_cmds # Line after last line for current file.
+Index: configure.in
+diff -c mdn/othersrc/bind9/configure.in:1.1.1.9 mdn/othersrc/bind9/configure.in:1.15
+*** configure.in Wed May 22 17:14:53 2002
+--- configure.in Mon May 27 12:10:14 2002
+***************
+*** 1614,1619 ****
+--- 1614,1695 ----
+ NOM_PATH_FILE(DOCBOOK2MANSPEC, docbook2X/docbook2man-spec.pl, $sgmltrees)
+
+ #
++ # IDN support
++ #
++ AC_ARG_WITH(idn,
++ [ --with-idn[=MPREFIX] enable IDN support using idnkit [default PREFIX]],
++ use_idn="$withval", use_idn="no")
++ case "$use_idn" in
++ yes)
++ if test X$prefix = XNONE ; then
++ idn_path=/usr/local
++ else
++ idn_path=$prefix
++ fi
++ ;;
++ no)
++ ;;
++ *)
++ idn_path="$use_idn"
++ ;;
++ esac
++
++ iconvinc=
++ iconvlib=
++ AC_ARG_WITH(libiconv,
++ [ --with-libiconv[=IPREFIX] GNU libiconv are in IPREFIX [default PREFIX]],
++ use_libiconv="$withval", use_libiconv="no")
++ case "$use_libiconv" in
++ yes)
++ if test X$prefix = XNONE ; then
++ iconvlib="-L/usr/local/lib -R/usr/local/lib -liconv"
++ else
++ iconvlib="-L$prefix/lib -R$prefix/lib -liconv"
++ fi
++ ;;
++ no)
++ iconvlib=
++ ;;
++ *)
++ iconvlib="-L$use_libiconv/lib -R$use_libiconv/lib -liconv"
++ ;;
++ esac
++
++ AC_ARG_WITH(iconv,
++ [ --with-iconv[=LIBSPEC] specify iconv library [default -liconv]],
++ iconvlib="$withval")
++ case "$iconvlib" in
++ no)
++ iconvlib=
++ ;;
++ yes)
++ iconvlib=-liconv
++ ;;
++ esac
++
++ AC_ARG_WITH(idnlib,
++ [ --with-idnlib=ARG specify libidnkit],
++ idnlib="$withval", idnlib="no")
++ if test "$idnlib" = yes; then
++ AC_MSG_ERROR([You must specify ARG for --with-idnlib.])
++ fi
++
++ IDNLIBS=
++ if test "$use_idn" != no; then
++ AC_DEFINE(WITH_IDN, 1, [define if idnkit support is to be included.])
++ STD_CINCLUDES="$STD_CINCLUDES -I$idn_path/include"
++ if test "$idnlib" != no; then
++ IDNLIBS="$idnlib $iconvlib"
++ else
++ IDNLIBS="-L$idn_path/lib -lidnkit $iconvlib"
++ fi
++ fi
++ AC_SUBST(IDNLIBS)
++
++ AC_CHECK_HEADERS(locale.h)
++ AC_CHECK_FUNCS(setlocale)
++
++ #
+ # Substitutions
+ #
+ AC_SUBST(BIND9_TOP_BUILDDIR)
+Index: bin/dig/Makefile.in
+diff -c mdn/othersrc/bind9/bin/dig/Makefile.in:1.1.1.6 mdn/othersrc/bind9/bin/dig/Makefile.in:1.3
+*** bin/dig/Makefile.in Tue Nov 27 16:55:50 2001
+--- bin/dig/Makefile.in Tue Mar 19 16:45:35 2002
+***************
+*** 36,42 ****
+
+ DEPLIBS = ${DNSDEPLIBS} ${ISCDEPLIBS}
+
+! LIBS = ${DNSLIBS} ${ISCLIBS} @LIBS@
+
+ SUBDIRS =
+
+--- 36,42 ----
+
+ DEPLIBS = ${DNSDEPLIBS} ${ISCDEPLIBS}
+
+! LIBS = ${DNSLIBS} ${ISCLIBS} @IDNLIBS@ @LIBS@
+
+ SUBDIRS =
+
+Index: bin/dig/dig.1
+diff -c mdn/othersrc/bind9/bin/dig/dig.1:1.1.1.2 mdn/othersrc/bind9/bin/dig/dig.1:1.4
+*** bin/dig/dig.1 Wed May 22 17:14:53 2002
+--- bin/dig/dig.1 Mon May 27 12:10:14 2002
+***************
+*** 349,354 ****
+--- 349,365 ----
+ \fI+noqr\fR which means that \fBdig\fR
+ will not print the initial query when it looks up the NS records for
+ isc.org.
++ .SH "IDN SUPPORT"
++ .PP
++ If \fBdig\fR has been built with IDN (internationalized
++ domain name) support, it can accept and display non-ASCII domain names.
++ \fBdig\fR appropriately converts character encoding of
++ domain name before sending a request to DNS server or displaying a
++ reply from the server.
++ If you'd like to turn off the IDN support for some reason, defines
++ the \fBIDN_DISABLE\fR environment variable.
++ The IDN support is disabled if the the variable is set when
++ \fBdig\fR runs.
+ .SH "FILES"
+ .PP
+ \fI/etc/resolv.conf\fR
+Index: bin/dig/dig.docbook
+diff -c mdn/othersrc/bind9/bin/dig/dig.docbook:1.1.1.2 mdn/othersrc/bind9/bin/dig/dig.docbook:1.4
+*** bin/dig/dig.docbook Wed May 22 17:14:53 2002
+--- bin/dig/dig.docbook Mon May 27 12:10:15 2002
+***************
+*** 523,528 ****
+--- 523,543 ----
+ </refsect1>
+
+ <refsect1>
++ <title>IDN SUPPORT</title>
++ <para>
++ If <command>dig</command> has been built with IDN (internationalized
++ domain name) support, it can accept and display non-ASCII domain names.
++ <command>dig</command> appropriately converts character encoding of
++ domain name before sending a request to DNS server or displaying a
++ reply from the server.
++ If you'd like to turn off the IDN support for some reason, defines
++ the <envar>IDN_DISABLE</envar> environment variable.
++ The IDN support is disabled if the the variable is set when
++ <command>dig</command> runs.
++ </para>
++ </refsect1>
++
++ <refsect1>
+ <title>FILES</title>
+ <para>
+ <filename>/etc/resolv.conf</filename>
+Index: bin/dig/dighost.c
+diff -c mdn/othersrc/bind9/bin/dig/dighost.c:1.1.1.12 mdn/othersrc/bind9/bin/dig/dighost.c:1.32
+*** bin/dig/dighost.c Wed May 22 17:14:53 2002
+--- bin/dig/dighost.c Mon May 27 12:10:15 2002
+***************
+*** 32,37 ****
+--- 32,48 ----
+ #include <string.h>
+ #include <limits.h>
+
++ #ifdef HAVE_LOCALE_H
++ #include <locale.h>
++ #endif
++
++ #ifdef WITH_IDN
++ #include <idn/result.h>
++ #include <idn/log.h>
++ #include <idn/resconf.h>
++ #include <idn/api.h>
++ #endif
++
+ #include <dns/byaddr.h>
+ #include <dns/fixedname.h>
+ #include <dns/message.h>
+***************
+*** 130,135 ****
+--- 141,158 ----
+ isc_mutex_t lookup_lock;
+ dig_lookup_t *current_lookup = NULL;
+
++ #ifdef WITH_IDN
++ static void initialize_idn(void);
++ static isc_result_t output_filter(isc_buffer_t *buffer,
++ unsigned int used_org,
++ isc_boolean_t absolute);
++ static idn_result_t append_textname(char *name, const char *origin,
++ size_t namesize);
++ static void idn_check_result(idn_result_t r, const char *msg);
++
++ #define MAXDLEN 256
++ #endif
++
+ /*
+ * Apply and clear locks at the event level in global task.
+ * Can I get rid of these using shutdown events? XXX
+***************
+*** 648,653 ****
+--- 671,680 ----
+ ISC_LIST_APPEND(server_list, srv, link);
+ }
+
++ #ifdef WITH_IDN
++ initialize_idn();
++ #endif
++
+ if (keyfile[0] != 0)
+ setup_file_key();
+ else if (keysecret[0] != 0)
+***************
+*** 1168,1173 ****
+--- 1195,1208 ----
+ isc_buffer_t b;
+ dns_compress_t cctx;
+ char store[MXNAME];
++ #ifdef WITH_IDN
++ idn_result_t mr;
++ char utf8_textname[MXNAME], utf8_origin[MXNAME], idn_textname[MXNAME];
++ #endif
++
++ #ifdef WITH_IDN
++ dns_name_settotextfilter(output_filter);
++ #endif
+
+ REQUIRE(lookup != NULL);
+ INSIST(!free_now);
+***************
+*** 1196,1201 ****
+--- 1231,1247 ----
+ isc_buffer_init(&lookup->onamebuf, lookup->onamespace,
+ sizeof(lookup->onamespace));
+
++ #ifdef WITH_IDN
++ /*
++ * We cannot convert `textname' and `origin' separately.
++ * `textname' doesn't contain TLD, but local mapping needs
++ * TLD.
++ */
++ mr = idn_encodename(IDN_LOCALCONV | IDN_DELIMMAP, lookup->textname,
++ utf8_textname, sizeof(utf8_textname));
++ idn_check_result(mr, "convert textname to UTF-8");
++ #endif
++
+ /*
+ * If the name has too many dots, force the origin to be NULL
+ * (which produces an absolute lookup). Otherwise, take the origin
+***************
+*** 1204,1215 ****
+--- 1250,1290 ----
+ * is TRUE or we got a domain line in the resolv.conf file.
+ */
+ /* XXX New search here? */
++ #ifdef WITH_IDN
++ if ((count_dots(utf8_textname) >= ndots) || !usesearch)
++ lookup->origin = NULL; /* Force abs lookup */
++ else if (lookup->origin == NULL && lookup->new_search && usesearch) {
++ lookup->origin = ISC_LIST_HEAD(search_list);
++ }
++ #else
+ if ((count_dots(lookup->textname) >= ndots) || !usesearch)
+ lookup->origin = NULL; /* Force abs lookup */
+ else if (lookup->origin == NULL && lookup->new_search && usesearch) {
+ lookup->origin = ISC_LIST_HEAD(search_list);
+ }
++ #endif
++
++ #ifdef WITH_IDN
+ if (lookup->origin != NULL) {
++ mr = idn_encodename(IDN_LOCALCONV | IDN_DELIMMAP,
++ lookup->origin->origin, utf8_origin,
++ sizeof(utf8_origin));
++ idn_check_result(mr, "convert origin to UTF-8");
++ mr = append_textname(utf8_textname, utf8_origin,
++ sizeof(utf8_textname));
++ idn_check_result(mr, "append origin to textname");
++ }
++ mr = idn_encodename(IDN_LOCALMAP | IDN_NAMEPREP | IDN_ASCCHECK |
++ IDN_IDNCONV | IDN_LENCHECK, utf8_textname,
++ idn_textname, sizeof(idn_textname));
++ idn_check_result(mr, "convert UTF-8 textname to IDN encoding");
++ #endif
++
++ #ifdef WITH_IDN
++ if (0) {
++ #else
++ if (lookup->origin != NULL) {
++ #endif
+ debug("trying origin %s", lookup->origin->origin);
+ result = dns_message_gettempname(lookup->sendmsg,
+ &lookup->oname);
+***************
+*** 1254,1259 ****
+--- 1329,1343 ----
+ if (lookup->trace && lookup->trace_root)
+ dns_name_clone(dns_rootname, lookup->name);
+ else {
++ #ifdef WITH_IDN
++ len = strlen(idn_textname);
++ isc_buffer_init(&b, idn_textname, len);
++ isc_buffer_add(&b, len);
++ result = dns_name_fromtext(lookup->name, &b,
++ dns_rootname,
++ ISC_FALSE,
++ &lookup->namebuf);
++ #else
+ len = strlen(lookup->textname);
+ isc_buffer_init(&b, lookup->textname, len);
+ isc_buffer_add(&b, len);
+***************
+*** 1261,1266 ****
+--- 1345,1351 ----
+ dns_rootname,
+ ISC_FALSE,
+ &lookup->namebuf);
++ #endif
+ }
+ if (result != ISC_R_SUCCESS) {
+ dns_message_puttempname(lookup->sendmsg,
+***************
+*** 2591,2593 ****
+--- 2676,2776 ----
+ if (mctx != NULL)
+ isc_mem_destroy(&mctx);
+ }
++
++ #ifdef WITH_IDN
++ static void
++ initialize_idn(void) {
++ idn_result_t r;
++
++ #ifdef HAVE_SETLOCALE
++ /* Set locale */
++ (void)setlocale(LC_ALL, "");
++ #endif
++ /* Create configuration context. */
++ r = idn_nameinit(1);
++ if (r != idn_success)
++ fatal("idn api initialization failed: %s",
++ idn_result_tostring(r));
++
++ /* Set domain name -> text post-conversion filter. */
++ dns_name_settotextfilter(output_filter);
++ }
++
++ static isc_result_t
++ output_filter(isc_buffer_t *buffer, unsigned int used_org,
++ isc_boolean_t absolute)
++ {
++ char tmp1[MAXDLEN], tmp2[MAXDLEN];
++ size_t fromlen, tolen;
++ isc_boolean_t end_with_dot;
++
++ /*
++ * Copy contents of 'buffer' to 'tmp1', supply trailing dot
++ * if 'absolute' is true, and terminate with NUL.
++ */
++ fromlen = isc_buffer_usedlength(buffer) - used_org;
++ if (fromlen >= MAXDLEN)
++ return (ISC_R_SUCCESS);
++ memcpy(tmp1, (char *)isc_buffer_base(buffer) + used_org, fromlen);
++ end_with_dot = (tmp1[fromlen - 1] == '.') ? ISC_TRUE : ISC_FALSE;
++ if (absolute && !end_with_dot) {
++ fromlen++;
++ if (fromlen >= MAXDLEN)
++ return (ISC_R_SUCCESS);
++ tmp1[fromlen - 1] = '.';
++ }
++ tmp1[fromlen] = '\0';
++
++ /*
++ * Convert contents of 'tmp1' to local encoding.
++ */
++ if (idn_decodename(IDN_DECODE_APP, tmp1, tmp2, MAXDLEN) != idn_success)
++ return (ISC_R_SUCCESS);
++ strcpy(tmp1, tmp2);
++
++ /*
++ * Copy the converted contents in 'tmp1' back to 'buffer'.
++ * If we have appended trailing dot, remove it.
++ */
++ tolen = strlen(tmp1);
++ if (absolute && !end_with_dot && tmp1[tolen - 1] == '.')
++ tolen--;
++
++ if (isc_buffer_length(buffer) < used_org + tolen)
++ return (ISC_R_NOSPACE);
++
++ isc_buffer_subtract(buffer, isc_buffer_usedlength(buffer) - used_org);
++ memcpy(isc_buffer_used(buffer), tmp1, tolen);
++ isc_buffer_add(buffer, tolen);
++
++ return (ISC_R_SUCCESS);
++ }
++
++ static idn_result_t
++ append_textname(char *name, const char *origin, size_t namesize) {
++ size_t namelen = strlen(name);
++ size_t originlen = strlen(origin);
++
++ /* Already absolute? */
++ if (namelen > 0 && name[namelen - 1] == '.')
++ return idn_success;
++
++ /* Append dot and origin */
++
++ if (namelen + 1 + originlen >= namesize)
++ return idn_buffer_overflow;
++
++ name[namelen++] = '.';
++ (void)strcpy(name + namelen, origin);
++ return idn_success;
++ }
++
++ static void
++ idn_check_result(idn_result_t r, const char *msg) {
++ if (r != idn_success) {
++ exitcode = 1;
++ fatal("%s: %s", msg, idn_result_tostring(r));
++ }
++ }
++
++ #endif /* WITH_IDN */
+Index: bin/dig/host.1
+diff -c mdn/othersrc/bind9/bin/dig/host.1:1.1.1.1 mdn/othersrc/bind9/bin/dig/host.1:1.3
+*** bin/dig/host.1 Tue Nov 27 16:55:51 2001
+--- bin/dig/host.1 Tue Mar 19 16:45:36 2002
+***************
+*** 120,125 ****
+--- 120,136 ----
+ effectively wait forever for a reply. The time to wait for a response
+ will be set to the number of seconds given by the hardware's maximum
+ value for an integer quantity.
++ .SH "IDN SUPPORT"
++ .PP
++ If \fBhost\fR has been built with IDN (internationalized
++ domain name) support, it can accept and display non-ASCII domain names.
++ \fBhost\fR appropriately converts character encoding of
++ domain name before sending a request to DNS server or displaying a
++ reply from the server.
++ If you'd like to turn off the IDN support for some reason, defines
++ the \fBIDN_DISABLE\fR environment variable.
++ The IDN support is disabled if the the variable is set when
++ \fBhost\fR runs.
+ .SH "FILES"
+ .PP
+ \fI/etc/resolv.conf\fR
+Index: bin/dig/host.docbook
+diff -c mdn/othersrc/bind9/bin/dig/host.docbook:1.1.1.1 mdn/othersrc/bind9/bin/dig/host.docbook:1.3
+*** bin/dig/host.docbook Tue Nov 27 16:55:51 2001
+--- bin/dig/host.docbook Tue Mar 19 16:45:36 2002
+***************
+*** 181,186 ****
+--- 181,201 ----
+ </refsect1>
+
+ <refsect1>
++ <title>IDN SUPPORT</title>
++ <para>
++ If <command>host</command> has been built with IDN (internationalized
++ domain name) support, it can accept and display non-ASCII domain names.
++ <command>host</command> appropriately converts character encoding of
++ domain name before sending a request to DNS server or displaying a
++ reply from the server.
++ If you'd like to turn off the IDN support for some reason, defines
++ the <envar>IDN_DISABLE</envar> environment variable.
++ The IDN support is disabled if the the variable is set when
++ <command>host</command> runs.
++ </para>
++ </refsect1>
++
++ <refsect1>
+ <title>FILES</title>
+ <para>
+ <filename>/etc/resolv.conf</filename>
+Index: lib/dns/name.c
+diff -c mdn/othersrc/bind9/lib/dns/name.c:1.1.1.10 mdn/othersrc/bind9/lib/dns/name.c:1.14
+*** lib/dns/name.c Wed May 22 17:15:27 2002
+--- lib/dns/name.c Mon May 27 12:10:15 2002
+***************
+*** 194,199 ****
+--- 194,206 ----
+ /* XXXDCL make const? */
+ dns_name_t *dns_wildcardname = &wild;
+
++ #ifdef WITH_IDN
++ /*
++ * dns_name_t to text post-conversion procedure.
++ */
++ static dns_name_totextfilter_t totext_filter_proc = NULL;
++ #endif
++
+ static void
+ set_offsets(const dns_name_t *name, unsigned char *offsets,
+ dns_name_t *set_name);
+***************
+*** 1682,1687 ****
+--- 1689,1697 ----
+ unsigned int labels;
+ isc_boolean_t saw_root = ISC_FALSE;
+ char num[4];
++ #ifdef WITH_IDN
++ unsigned int oused = target->used;
++ #endif
+
+ /*
+ * This function assumes the name is in proper uncompressed
+***************
+*** 1859,1864 ****
+--- 1869,1878 ----
+
+ isc_buffer_add(target, tlen - trem);
+
++ #ifdef WITH_IDN
++ if (totext_filter_proc != NULL)
++ return ((*totext_filter_proc)(target, oused, saw_root));
++ #endif
+ return (ISC_R_SUCCESS);
+ }
+
+***************
+*** 3315,3317 ****
+--- 3329,3337 ----
+ return (ISC_R_SUCCESS);
+ }
+
++ #ifdef WITH_IDN
++ void
++ dns_name_settotextfilter(dns_name_totextfilter_t proc) {
++ totext_filter_proc = proc;
++ }
++ #endif
+Index: lib/dns/include/dns/name.h
+diff -c mdn/othersrc/bind9/lib/dns/include/dns/name.h:1.1.1.7 mdn/othersrc/bind9/lib/dns/include/dns/name.h:1.10
+*** lib/dns/include/dns/name.h Wed May 22 17:15:29 2002
+--- lib/dns/include/dns/name.h Mon May 27 12:10:15 2002
+***************
+*** 219,224 ****
+--- 219,235 ----
+ */
+ #define DNS_NAME_MAXWIRE 255
+
++ #ifdef WITH_IDN
++ /*
++ * Text output filter procedure.
++ * 'target' is the buffer to be converted. The region to be converted
++ * is from 'buffer'->base + 'used_org' to the end of the used region.
++ */
++ typedef isc_result_t (*dns_name_totextfilter_t)(isc_buffer_t *target,
++ unsigned int used_org,
++ isc_boolean_t absolute);
++ #endif
++
+ /***
+ *** Initialization
+ ***/
+***************
+*** 1244,1249 ****
+--- 1255,1268 ----
+ * 'size' > 0.
+ *
+ */
++
++ #ifdef WITH_IDN
++ void
++ dns_name_settotextfilter(dns_name_totextfilter_t proc);
++ /*
++ * Call 'proc' at the end of dns_name_totext.
++ */
++ #endif /* WITH_IDN */
+
+ #define DNS_NAME_FORMATSIZE (DNS_NAME_MAXTEXT + 1)
+ /*
diff --git a/contrib/idn/idnkit-1.0-src/patch/bind9/bind-9.2.2-patch b/contrib/idn/idnkit-1.0-src/patch/bind9/bind-9.2.2-patch
new file mode 100644
index 0000000..ccf4355
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/patch/bind9/bind-9.2.2-patch
@@ -0,0 +1,1169 @@
+IDN patch for bind-9.2.2
+========================
+
+
+This is a patch file for ISC BIND 9.2.2 to make it work with
+internationalized domain names. With this patch you'll get IDN-aware
+dig/host/nslookup.
+
+To apply this patch, you should go to the top directory of the BIND
+distribution (where you see `README' file), then invoke `patch'
+command like this:
+
+ % patch -p0 < this-file
+
+Then follow the instructions described in `README.idnkit' to compile
+and install.
+
+
+Index: README.idnkit
+diff -c /dev/null mdn/othersrc/bind9/README.idnkit:1.3
+*** README.idnkit Tue Mar 11 08:55:20 2003
+--- README.idnkit Mon Mar 10 09:47:41 2003
+***************
+*** 0 ****
+--- 1,113 ----
++
++ BIND-9 IDN patch
++
++ Japan Network Information Center (JPNIC)
++
++
++ * What is this patch for?
++
++ This patch adds internationalized domain name (IDN) support to BIND-9.
++ You'll get internationalized version of dig/host/nslookup commands.
++
++ + internationalized dig/host/nslookup
++ dig/host/nslookup accepts non-ASCII domain names in the local
++ codeset (such as Shift JIS, Big5 or ISO8859-1) determined by
++ the locale information. The domain names are normalized and
++ converted to the encoding on the DNS protocol, and sent to DNS
++ servers. The replies are converted back to the local codeset
++ and displayed.
++
++
++ * Compilation & installation
++
++ 0. Prerequisite
++
++ You have to build and install idnkit before building this patched version
++ of bind-9.
++
++ 1. Running configure script
++
++ Run `configure' in the top directory. See `README' for the
++ configuration options.
++
++ This patch adds the following 4 options to `configure'. You should
++ at least specify `--with-idn' option to enable IDN support.
++
++ --with-idn[=IDN_PREFIX]
++ To enable IDN support, you have to specify `--with-idn' option.
++ The argument IDN_PREFIX is the install prefix of idnkit. If
++ IDN_PREFIX is omitted, PREFIX (derived from `--prefix=PREFIX')
++ is assumed.
++
++ --with-libiconv[=LIBICONV_PREFIX]
++ Specify this option if idnkit you have installed links GNU
++ libiconv. The argument LIBICONV_PREFIX is install prefix of
++ GNU libiconv. If the argument is omitted, PREFIX (derived
++ from `--prefix=PREFIX') is assumed.
++
++ `--with-libiconv' is shorthand option for GNU libiconv.
++
++ --with-libiconv=/usr/local
++
++ This is equivalent to:
++
++ --with-iconv='-L/usr/local/lib -R/usr/local/lib -liconv'
++
++ `--with-libiconv' assumes that your C compiler has `-R'
++ option, and that the option adds the specified run-time path
++ to an exacutable binary. If `-R' option of your compiler has
++ different meaning, or your compiler lacks the option, you
++ should use `--with-iconv' option instead. Binary command
++ without run-time path information might be unexecutable.
++ In that case, you would see an error message like:
++
++ error in loading shared libraries: libiconv.so.2: cannot
++ open shared object file
++
++ If both `--with-libiconv' and `--with-iconv' options are
++ specified, `--with-iconv' is prior to `--with-libiconv'.
++
++ --with-iconv=ICONV_LIBSPEC
++ If your libc doens't provide iconv(), you need to specify the
++ library containing iconv() with this option. `ICONV_LIBSPEC'
++ is the argument(s) to `cc' or `ld' to link the library, for
++ example, `--with-iconv="-L/usr/local/lib -liconv"'.
++ You don't need to specify the header file directory for "iconv.h"
++ to the compiler, as it isn't included directly by bind-9 with
++ this patch.
++
++ --with-idnlib=IDN_LIBSPEC
++ With this option, you can explicitly specify the argument(s)
++ to `cc' or `ld' to link the idnkit's library, `libidnkit'. If
++ this option is not specified, `-L${PREFIX}/lib -lidnkit' is
++ assumed, where ${PREFIX} is the installation prefix specified
++ with `--with-idn' option above. You may need to use this
++ option to specify extra argments, for example,
++ `--with-idnlib="-L/usr/local/lib -R/usr/local/lib -lidnkit"'.
++
++ Please consult `README' for other configuration options.
++
++ Note that if you want to specify some extra header file directories,
++ you should use the environment variable STD_CINCLUDES instead of
++ CFLAGS, as described in README.
++
++ 2. Compilation and installation
++
++ After running "configure", just do
++
++ make
++ make install
++
++ for compiling and installing.
++
++
++ * Contact information
++
++ Please see http//www.nic.ad.jp/en/idn/ for the latest news
++ about idnkit and this patch.
++
++ Bug reports and comments on this kit should be sent to
++ mdnkit-bugs@nic.ad.jp and idn-cmt@nic.ad.jp, respectively.
++
++
++ ; $Id: bind-9.2.2-patch,v 1.1.1.1 2003/06/04 00:27:32 marka Exp $
+Index: config.h.in
+diff -c mdn/othersrc/bind9/config.h.in:1.1.1.6 mdn/othersrc/bind9/config.h.in:1.12
+*** config.h.in Tue Nov 27 16:55:45 2001
+--- config.h.in Tue Mar 19 16:45:35 2002
+***************
+*** 141,146 ****
+--- 141,149 ----
+ /* define if you have strerror in the C library. */
+ #undef HAVE_STRERROR
+
++ /* Define if you have the setlocale function. */
++ #undef HAVE_SETLOCALE
++
+ /* Define if you have the <dlfcn.h> header file. */
+ #undef HAVE_DLFCN_H
+
+***************
+*** 150,155 ****
+--- 153,161 ----
+ /* Define if you have the <linux/capability.h> header file. */
+ #undef HAVE_LINUX_CAPABILITY_H
+
++ /* Define if you have the <locale.h> header file. */
++ #undef HAVE_LOCALE_H
++
+ /* Define if you have the <sys/prctl.h> header file. */
+ #undef HAVE_SYS_PRCTL_H
+
+***************
+*** 176,178 ****
+--- 182,188 ----
+
+ /* Define if you have the socket library (-lsocket). */
+ #undef HAVE_LIBSOCKET
++
++ /* define if idnkit support is to be included. */
++ #undef WITH_IDN
++
+Index: configure
+diff -c mdn/othersrc/bind9/configure:1.1.1.10 mdn/othersrc/bind9/configure:1.16
+*** configure Wed Mar 5 17:14:55 2003
+--- configure Thu Mar 6 20:10:05 2003
+***************
+*** 1007,1012 ****
+--- 1007,1016 ----
+ --with-gnu-ld assume the C compiler uses GNU ld default=no
+ --with-pic try to use only PIC/non-PIC objects default=use both
+ --with-kame=PATH use Kame IPv6 default path /usr/local/v6
++ --with-idn=MPREFIX enable IDN support using idnkit default PREFIX
++ --with-libiconv=IPREFIX GNU libiconv are in IPREFIX default PREFIX
++ --with-iconv=LIBSPEC specify iconv library default -liconv
++ --with-idnlib=ARG specify libidnkit
+
+ Some influential environment variables:
+ CC C compiler command
+***************
+*** 7371,7377 ****
+ case $host in
+ *-*-irix6*)
+ # Find out which ABI we are using.
+! echo '#line 7374 "configure"' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+--- 7375,7381 ----
+ case $host in
+ *-*-irix6*)
+ # Find out which ABI we are using.
+! echo '#line 7378 "configure"' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+***************
+*** 7914,7920 ****
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
+ compiler_c_o=no
+! if { (eval echo configure:7917: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s out/conftest.err; then
+--- 7918,7924 ----
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
+ compiler_c_o=no
+! if { (eval echo configure:7921: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s out/conftest.err; then
+***************
+*** 9599,9605 ****
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+! #line 9602 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+--- 9603,9609 ----
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+! #line 9606 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+***************
+*** 9697,9703 ****
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+! #line 9700 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+--- 9701,9707 ----
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+! #line 9704 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+***************
+*** 13265,13270 ****
+--- 13269,13580 ----
+
+
+ #
++ # IDN support
++ #
++
++ # Check whether --with-idn or --without-idn was given.
++ if test "${with_idn+set}" = set; then
++ withval="$with_idn"
++ use_idn="$withval"
++ else
++ use_idn="no"
++ fi;
++ case "$use_idn" in
++ yes)
++ if test X$prefix = XNONE ; then
++ idn_path=/usr/local
++ else
++ idn_path=$prefix
++ fi
++ ;;
++ no)
++ ;;
++ *)
++ idn_path="$use_idn"
++ ;;
++ esac
++
++ iconvinc=
++ iconvlib=
++
++ # Check whether --with-libiconv or --without-libiconv was given.
++ if test "${with_libiconv+set}" = set; then
++ withval="$with_libiconv"
++ use_libiconv="$withval"
++ else
++ use_libiconv="no"
++ fi;
++ case "$use_libiconv" in
++ yes)
++ if test X$prefix = XNONE ; then
++ iconvlib="-L/usr/local/lib -R/usr/local/lib -liconv"
++ else
++ iconvlib="-L$prefix/lib -R$prefix/lib -liconv"
++ fi
++ ;;
++ no)
++ iconvlib=
++ ;;
++ *)
++ iconvlib="-L$use_libiconv/lib -R$use_libiconv/lib -liconv"
++ ;;
++ esac
++
++
++ # Check whether --with-iconv or --without-iconv was given.
++ if test "${with_iconv+set}" = set; then
++ withval="$with_iconv"
++ iconvlib="$withval"
++ fi;
++ case "$iconvlib" in
++ no)
++ iconvlib=
++ ;;
++ yes)
++ iconvlib=-liconv
++ ;;
++ esac
++
++
++ # Check whether --with-idnlib or --without-idnlib was given.
++ if test "${with_idnlib+set}" = set; then
++ withval="$with_idnlib"
++ idnlib="$withval"
++ else
++ idnlib="no"
++ fi;
++ if test "$idnlib" = yes; then
++ { { echo "$as_me:$LINENO: error: You must specify ARG for --with-idnlib." >&5
++ echo "$as_me: error: You must specify ARG for --with-idnlib." >&2;}
++ { (exit 1); exit 1; }; }
++ fi
++
++ IDNLIBS=
++ if test "$use_idn" != no; then
++
++ cat >>confdefs.h <<\_ACEOF
++ #define WITH_IDN 1
++ _ACEOF
++
++ STD_CINCLUDES="$STD_CINCLUDES -I$idn_path/include"
++ if test "$idnlib" != no; then
++ IDNLIBS="$idnlib $iconvlib"
++ else
++ IDNLIBS="-L$idn_path/lib -lidnkit $iconvlib"
++ fi
++ fi
++
++
++
++ for ac_header in locale.h
++ do
++ as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
++ if eval "test \"\${$as_ac_Header+set}\" = set"; then
++ echo "$as_me:$LINENO: checking for $ac_header" >&5
++ echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
++ if eval "test \"\${$as_ac_Header+set}\" = set"; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++ fi
++ echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
++ echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
++ else
++ # Is the header compilable?
++ echo "$as_me:$LINENO: checking $ac_header usability" >&5
++ echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
++ cat >conftest.$ac_ext <<_ACEOF
++ #line $LINENO "configure"
++ #include "confdefs.h"
++ $ac_includes_default
++ #include <$ac_header>
++ _ACEOF
++ rm -f conftest.$ac_objext
++ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++ (eval $ac_compile) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); } &&
++ { ac_try='test -s conftest.$ac_objext'
++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++ (eval $ac_try) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; }; then
++ ac_header_compiler=yes
++ else
++ echo "$as_me: failed program was:" >&5
++ cat conftest.$ac_ext >&5
++ ac_header_compiler=no
++ fi
++ rm -f conftest.$ac_objext conftest.$ac_ext
++ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
++ echo "${ECHO_T}$ac_header_compiler" >&6
++
++ # Is the header present?
++ echo "$as_me:$LINENO: checking $ac_header presence" >&5
++ echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
++ cat >conftest.$ac_ext <<_ACEOF
++ #line $LINENO "configure"
++ #include "confdefs.h"
++ #include <$ac_header>
++ _ACEOF
++ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
++ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
++ ac_status=$?
++ egrep -v '^ *\+' conftest.er1 >conftest.err
++ rm -f conftest.er1
++ cat conftest.err >&5
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); } >/dev/null; then
++ if test -s conftest.err; then
++ ac_cpp_err=$ac_c_preproc_warn_flag
++ else
++ ac_cpp_err=
++ fi
++ else
++ ac_cpp_err=yes
++ fi
++ if test -z "$ac_cpp_err"; then
++ ac_header_preproc=yes
++ else
++ echo "$as_me: failed program was:" >&5
++ cat conftest.$ac_ext >&5
++ ac_header_preproc=no
++ fi
++ rm -f conftest.err conftest.$ac_ext
++ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
++ echo "${ECHO_T}$ac_header_preproc" >&6
++
++ # So? What about this header?
++ case $ac_header_compiler:$ac_header_preproc in
++ yes:no )
++ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
++ echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
++ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
++ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
++ no:yes )
++ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
++ echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
++ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
++ echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
++ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
++ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
++ esac
++ echo "$as_me:$LINENO: checking for $ac_header" >&5
++ echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
++ if eval "test \"\${$as_ac_Header+set}\" = set"; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++ else
++ eval "$as_ac_Header=$ac_header_preproc"
++ fi
++ echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
++ echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
++
++ fi
++ if test `eval echo '${'$as_ac_Header'}'` = yes; then
++ cat >>confdefs.h <<_ACEOF
++ #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
++ _ACEOF
++
++ fi
++
++ done
++
++
++ for ac_func in setlocale
++ do
++ as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
++ echo "$as_me:$LINENO: checking for $ac_func" >&5
++ echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
++ if eval "test \"\${$as_ac_var+set}\" = set"; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++ else
++ cat >conftest.$ac_ext <<_ACEOF
++ #line $LINENO "configure"
++ #include "confdefs.h"
++ /* From autoconf 2.57 */
++ /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
++ For example, HP-UX 11i <limits.h> declares gettimeofday. */
++ #define $ac_func innocuous_$ac_func
++
++ /* System header to define __stub macros and hopefully few prototypes,
++ which can conflict with char $ac_func (); below.
++ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
++ <limits.h> exists even on freestanding compilers. */
++
++ #ifdef __STDC__
++ # include <limits.h>
++ #else
++ # include <assert.h>
++ #endif
++
++ #undef $ac_func
++
++ /* Override any gcc2 internal prototype to avoid an error. */
++ #ifdef __cplusplus
++ extern "C"
++ {
++ #endif
++ /* We use char because int might match the return type of a gcc2
++ builtin and then its argument prototype would still apply. */
++ char $ac_func ();
++ /* The GNU C library defines this for functions which it implements
++ to always fail with ENOSYS. Some functions are actually named
++ something starting with __ and the normal name is an alias. */
++ #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
++ choke me
++ #else
++ char (*f) () = $ac_func;
++ #endif
++ #ifdef __cplusplus
++ }
++ #endif
++
++ #ifdef F77_DUMMY_MAIN
++ # ifdef __cplusplus
++ extern "C"
++ # endif
++ int F77_DUMMY_MAIN() { return 1; }
++ #endif
++ int
++ main ()
++ {
++ return f != $ac_func;
++ ;
++ return 0;
++ }
++ _ACEOF
++ rm -f conftest.$ac_objext conftest$ac_exeext
++ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
++ (eval $ac_link) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); } &&
++ { ac_try='test -s conftest$ac_exeext'
++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++ (eval $ac_try) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; }; then
++ eval "$as_ac_var=yes"
++ else
++ echo "$as_me: failed program was:" >&5
++ cat conftest.$ac_ext >&5
++ eval "$as_ac_var=no"
++ fi
++ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
++ fi
++ echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
++ echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
++ if test `eval echo '${'$as_ac_var'}'` = yes; then
++ cat >>confdefs.h <<_ACEOF
++ #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
++ _ACEOF
++
++ fi
++ done
++
++
++ #
+ # Substitutions
+ #
+
+***************
+*** 14061,14066 ****
+--- 14371,14377 ----
+ s,@PRINTSTYLE@,$PRINTSTYLE,;t t
+ s,@XMLDCL@,$XMLDCL,;t t
+ s,@DOCBOOK2MANSPEC@,$DOCBOOK2MANSPEC,;t t
++ s,@IDNLIBS@,$IDNLIBS,;t t
+ s,@BIND9_TOP_BUILDDIR@,$BIND9_TOP_BUILDDIR,;t t
+ s,@BIND9_ISC_BUILDINCLUDE@,$BIND9_ISC_BUILDINCLUDE,;t t
+ s,@BIND9_ISCCC_BUILDINCLUDE@,$BIND9_ISCCC_BUILDINCLUDE,;t t
+Index: configure.in
+diff -c mdn/othersrc/bind9/configure.in:1.1.1.10 mdn/othersrc/bind9/configure.in:1.16
+*** configure.in Wed Mar 5 17:14:56 2003
+--- configure.in Wed Mar 5 17:37:08 2003
+***************
+*** 1681,1686 ****
+--- 1681,1762 ----
+ NOM_PATH_FILE(DOCBOOK2MANSPEC, docbook2X/docbook2man-spec.pl, $sgmltrees)
+
+ #
++ # IDN support
++ #
++ AC_ARG_WITH(idn,
++ [ --with-idn[=MPREFIX] enable IDN support using idnkit [default PREFIX]],
++ use_idn="$withval", use_idn="no")
++ case "$use_idn" in
++ yes)
++ if test X$prefix = XNONE ; then
++ idn_path=/usr/local
++ else
++ idn_path=$prefix
++ fi
++ ;;
++ no)
++ ;;
++ *)
++ idn_path="$use_idn"
++ ;;
++ esac
++
++ iconvinc=
++ iconvlib=
++ AC_ARG_WITH(libiconv,
++ [ --with-libiconv[=IPREFIX] GNU libiconv are in IPREFIX [default PREFIX]],
++ use_libiconv="$withval", use_libiconv="no")
++ case "$use_libiconv" in
++ yes)
++ if test X$prefix = XNONE ; then
++ iconvlib="-L/usr/local/lib -R/usr/local/lib -liconv"
++ else
++ iconvlib="-L$prefix/lib -R$prefix/lib -liconv"
++ fi
++ ;;
++ no)
++ iconvlib=
++ ;;
++ *)
++ iconvlib="-L$use_libiconv/lib -R$use_libiconv/lib -liconv"
++ ;;
++ esac
++
++ AC_ARG_WITH(iconv,
++ [ --with-iconv[=LIBSPEC] specify iconv library [default -liconv]],
++ iconvlib="$withval")
++ case "$iconvlib" in
++ no)
++ iconvlib=
++ ;;
++ yes)
++ iconvlib=-liconv
++ ;;
++ esac
++
++ AC_ARG_WITH(idnlib,
++ [ --with-idnlib=ARG specify libidnkit],
++ idnlib="$withval", idnlib="no")
++ if test "$idnlib" = yes; then
++ AC_MSG_ERROR([You must specify ARG for --with-idnlib.])
++ fi
++
++ IDNLIBS=
++ if test "$use_idn" != no; then
++ AC_DEFINE(WITH_IDN, 1, [define if idnkit support is to be included.])
++ STD_CINCLUDES="$STD_CINCLUDES -I$idn_path/include"
++ if test "$idnlib" != no; then
++ IDNLIBS="$idnlib $iconvlib"
++ else
++ IDNLIBS="-L$idn_path/lib -lidnkit $iconvlib"
++ fi
++ fi
++ AC_SUBST(IDNLIBS)
++
++ AC_CHECK_HEADERS(locale.h)
++ AC_CHECK_FUNCS(setlocale)
++
++ #
+ # Substitutions
+ #
+ AC_SUBST(BIND9_TOP_BUILDDIR)
+Index: bin/dig/Makefile.in
+diff -c mdn/othersrc/bind9/bin/dig/Makefile.in:1.1.1.6 mdn/othersrc/bind9/bin/dig/Makefile.in:1.3
+*** bin/dig/Makefile.in Tue Nov 27 16:55:50 2001
+--- bin/dig/Makefile.in Tue Mar 19 16:45:35 2002
+***************
+*** 36,42 ****
+
+ DEPLIBS = ${DNSDEPLIBS} ${ISCDEPLIBS}
+
+! LIBS = ${DNSLIBS} ${ISCLIBS} @LIBS@
+
+ SUBDIRS =
+
+--- 36,42 ----
+
+ DEPLIBS = ${DNSDEPLIBS} ${ISCDEPLIBS}
+
+! LIBS = ${DNSLIBS} ${ISCLIBS} @IDNLIBS@ @LIBS@
+
+ SUBDIRS =
+
+Index: bin/dig/dig.1
+diff -c mdn/othersrc/bind9/bin/dig/dig.1:1.1.1.3 mdn/othersrc/bind9/bin/dig/dig.1:1.5
+*** bin/dig/dig.1 Wed Mar 5 17:14:57 2003
+--- bin/dig/dig.1 Wed Mar 5 17:42:53 2003
+***************
+*** 349,354 ****
+--- 349,365 ----
+ \fI+noqr\fR which means that \fBdig\fR
+ will not print the initial query when it looks up the NS records for
+ isc.org.
++ .SH "IDN SUPPORT"
++ .PP
++ If \fBdig\fR has been built with IDN (internationalized
++ domain name) support, it can accept and display non-ASCII domain names.
++ \fBdig\fR appropriately converts character encoding of
++ domain name before sending a request to DNS server or displaying a
++ reply from the server.
++ If you'd like to turn off the IDN support for some reason, defines
++ the \fBIDN_DISABLE\fR environment variable.
++ The IDN support is disabled if the the variable is set when
++ \fBdig\fR runs.
+ .SH "FILES"
+ .PP
+ \fI/etc/resolv.conf\fR
+Index: bin/dig/dig.docbook
+diff -c mdn/othersrc/bind9/bin/dig/dig.docbook:1.1.1.3 mdn/othersrc/bind9/bin/dig/dig.docbook:1.5
+*** bin/dig/dig.docbook Wed Mar 5 17:14:57 2003
+--- bin/dig/dig.docbook Wed Mar 5 17:42:53 2003
+***************
+*** 523,528 ****
+--- 523,543 ----
+ </refsect1>
+
+ <refsect1>
++ <title>IDN SUPPORT</title>
++ <para>
++ If <command>dig</command> has been built with IDN (internationalized
++ domain name) support, it can accept and display non-ASCII domain names.
++ <command>dig</command> appropriately converts character encoding of
++ domain name before sending a request to DNS server or displaying a
++ reply from the server.
++ If you'd like to turn off the IDN support for some reason, defines
++ the <envar>IDN_DISABLE</envar> environment variable.
++ The IDN support is disabled if the the variable is set when
++ <command>dig</command> runs.
++ </para>
++ </refsect1>
++
++ <refsect1>
+ <title>FILES</title>
+ <para>
+ <filename>/etc/resolv.conf</filename>
+Index: bin/dig/dighost.c
+diff -c mdn/othersrc/bind9/bin/dig/dighost.c:1.1.1.13 mdn/othersrc/bind9/bin/dig/dighost.c:1.33
+*** bin/dig/dighost.c Wed Mar 5 17:14:57 2003
+--- bin/dig/dighost.c Wed Mar 5 17:42:53 2003
+***************
+*** 32,37 ****
+--- 32,48 ----
+ #include <string.h>
+ #include <limits.h>
+
++ #ifdef HAVE_LOCALE_H
++ #include <locale.h>
++ #endif
++
++ #ifdef WITH_IDN
++ #include <idn/result.h>
++ #include <idn/log.h>
++ #include <idn/resconf.h>
++ #include <idn/api.h>
++ #endif
++
+ #include <dns/byaddr.h>
+ #include <dns/fixedname.h>
+ #include <dns/message.h>
+***************
+*** 130,135 ****
+--- 141,158 ----
+ isc_mutex_t lookup_lock;
+ dig_lookup_t *current_lookup = NULL;
+
++ #ifdef WITH_IDN
++ static void initialize_idn(void);
++ static isc_result_t output_filter(isc_buffer_t *buffer,
++ unsigned int used_org,
++ isc_boolean_t absolute);
++ static idn_result_t append_textname(char *name, const char *origin,
++ size_t namesize);
++ static void idn_check_result(idn_result_t r, const char *msg);
++
++ #define MAXDLEN 256
++ #endif
++
+ /*
+ * Apply and clear locks at the event level in global task.
+ * Can I get rid of these using shutdown events? XXX
+***************
+*** 648,653 ****
+--- 671,680 ----
+ ISC_LIST_APPEND(server_list, srv, link);
+ }
+
++ #ifdef WITH_IDN
++ initialize_idn();
++ #endif
++
+ if (keyfile[0] != 0)
+ setup_file_key();
+ else if (keysecret[0] != 0)
+***************
+*** 1168,1173 ****
+--- 1195,1208 ----
+ isc_buffer_t b;
+ dns_compress_t cctx;
+ char store[MXNAME];
++ #ifdef WITH_IDN
++ idn_result_t mr;
++ char utf8_textname[MXNAME], utf8_origin[MXNAME], idn_textname[MXNAME];
++ #endif
++
++ #ifdef WITH_IDN
++ dns_name_settotextfilter(output_filter);
++ #endif
+
+ REQUIRE(lookup != NULL);
+ INSIST(!free_now);
+***************
+*** 1196,1201 ****
+--- 1231,1247 ----
+ isc_buffer_init(&lookup->onamebuf, lookup->onamespace,
+ sizeof(lookup->onamespace));
+
++ #ifdef WITH_IDN
++ /*
++ * We cannot convert `textname' and `origin' separately.
++ * `textname' doesn't contain TLD, but local mapping needs
++ * TLD.
++ */
++ mr = idn_encodename(IDN_LOCALCONV | IDN_DELIMMAP, lookup->textname,
++ utf8_textname, sizeof(utf8_textname));
++ idn_check_result(mr, "convert textname to UTF-8");
++ #endif
++
+ /*
+ * If the name has too many dots, force the origin to be NULL
+ * (which produces an absolute lookup). Otherwise, take the origin
+***************
+*** 1204,1215 ****
+--- 1250,1290 ----
+ * is TRUE or we got a domain line in the resolv.conf file.
+ */
+ /* XXX New search here? */
++ #ifdef WITH_IDN
++ if ((count_dots(utf8_textname) >= ndots) || !usesearch)
++ lookup->origin = NULL; /* Force abs lookup */
++ else if (lookup->origin == NULL && lookup->new_search && usesearch) {
++ lookup->origin = ISC_LIST_HEAD(search_list);
++ }
++ #else
+ if ((count_dots(lookup->textname) >= ndots) || !usesearch)
+ lookup->origin = NULL; /* Force abs lookup */
+ else if (lookup->origin == NULL && lookup->new_search && usesearch) {
+ lookup->origin = ISC_LIST_HEAD(search_list);
+ }
++ #endif
++
++ #ifdef WITH_IDN
+ if (lookup->origin != NULL) {
++ mr = idn_encodename(IDN_LOCALCONV | IDN_DELIMMAP,
++ lookup->origin->origin, utf8_origin,
++ sizeof(utf8_origin));
++ idn_check_result(mr, "convert origin to UTF-8");
++ mr = append_textname(utf8_textname, utf8_origin,
++ sizeof(utf8_textname));
++ idn_check_result(mr, "append origin to textname");
++ }
++ mr = idn_encodename(IDN_LOCALMAP | IDN_NAMEPREP | IDN_ASCCHECK |
++ IDN_IDNCONV | IDN_LENCHECK, utf8_textname,
++ idn_textname, sizeof(idn_textname));
++ idn_check_result(mr, "convert UTF-8 textname to IDN encoding");
++ #endif
++
++ #ifdef WITH_IDN
++ if (0) {
++ #else
++ if (lookup->origin != NULL) {
++ #endif
+ debug("trying origin %s", lookup->origin->origin);
+ result = dns_message_gettempname(lookup->sendmsg,
+ &lookup->oname);
+***************
+*** 1254,1259 ****
+--- 1329,1343 ----
+ if (lookup->trace && lookup->trace_root)
+ dns_name_clone(dns_rootname, lookup->name);
+ else {
++ #ifdef WITH_IDN
++ len = strlen(idn_textname);
++ isc_buffer_init(&b, idn_textname, len);
++ isc_buffer_add(&b, len);
++ result = dns_name_fromtext(lookup->name, &b,
++ dns_rootname,
++ ISC_FALSE,
++ &lookup->namebuf);
++ #else
+ len = strlen(lookup->textname);
+ isc_buffer_init(&b, lookup->textname, len);
+ isc_buffer_add(&b, len);
+***************
+*** 1261,1266 ****
+--- 1345,1351 ----
+ dns_rootname,
+ ISC_FALSE,
+ &lookup->namebuf);
++ #endif
+ }
+ if (result != ISC_R_SUCCESS) {
+ dns_message_puttempname(lookup->sendmsg,
+***************
+*** 2663,2665 ****
+--- 2748,2848 ----
+ if (mctx != NULL)
+ isc_mem_destroy(&mctx);
+ }
++
++ #ifdef WITH_IDN
++ static void
++ initialize_idn(void) {
++ idn_result_t r;
++
++ #ifdef HAVE_SETLOCALE
++ /* Set locale */
++ (void)setlocale(LC_ALL, "");
++ #endif
++ /* Create configuration context. */
++ r = idn_nameinit(1);
++ if (r != idn_success)
++ fatal("idn api initialization failed: %s",
++ idn_result_tostring(r));
++
++ /* Set domain name -> text post-conversion filter. */
++ dns_name_settotextfilter(output_filter);
++ }
++
++ static isc_result_t
++ output_filter(isc_buffer_t *buffer, unsigned int used_org,
++ isc_boolean_t absolute)
++ {
++ char tmp1[MAXDLEN], tmp2[MAXDLEN];
++ size_t fromlen, tolen;
++ isc_boolean_t end_with_dot;
++
++ /*
++ * Copy contents of 'buffer' to 'tmp1', supply trailing dot
++ * if 'absolute' is true, and terminate with NUL.
++ */
++ fromlen = isc_buffer_usedlength(buffer) - used_org;
++ if (fromlen >= MAXDLEN)
++ return (ISC_R_SUCCESS);
++ memcpy(tmp1, (char *)isc_buffer_base(buffer) + used_org, fromlen);
++ end_with_dot = (tmp1[fromlen - 1] == '.') ? ISC_TRUE : ISC_FALSE;
++ if (absolute && !end_with_dot) {
++ fromlen++;
++ if (fromlen >= MAXDLEN)
++ return (ISC_R_SUCCESS);
++ tmp1[fromlen - 1] = '.';
++ }
++ tmp1[fromlen] = '\0';
++
++ /*
++ * Convert contents of 'tmp1' to local encoding.
++ */
++ if (idn_decodename(IDN_DECODE_APP, tmp1, tmp2, MAXDLEN) != idn_success)
++ return (ISC_R_SUCCESS);
++ strcpy(tmp1, tmp2);
++
++ /*
++ * Copy the converted contents in 'tmp1' back to 'buffer'.
++ * If we have appended trailing dot, remove it.
++ */
++ tolen = strlen(tmp1);
++ if (absolute && !end_with_dot && tmp1[tolen - 1] == '.')
++ tolen--;
++
++ if (isc_buffer_length(buffer) < used_org + tolen)
++ return (ISC_R_NOSPACE);
++
++ isc_buffer_subtract(buffer, isc_buffer_usedlength(buffer) - used_org);
++ memcpy(isc_buffer_used(buffer), tmp1, tolen);
++ isc_buffer_add(buffer, tolen);
++
++ return (ISC_R_SUCCESS);
++ }
++
++ static idn_result_t
++ append_textname(char *name, const char *origin, size_t namesize) {
++ size_t namelen = strlen(name);
++ size_t originlen = strlen(origin);
++
++ /* Already absolute? */
++ if (namelen > 0 && name[namelen - 1] == '.')
++ return idn_success;
++
++ /* Append dot and origin */
++
++ if (namelen + 1 + originlen >= namesize)
++ return idn_buffer_overflow;
++
++ name[namelen++] = '.';
++ (void)strcpy(name + namelen, origin);
++ return idn_success;
++ }
++
++ static void
++ idn_check_result(idn_result_t r, const char *msg) {
++ if (r != idn_success) {
++ exitcode = 1;
++ fatal("%s: %s", msg, idn_result_tostring(r));
++ }
++ }
++
++ #endif /* WITH_IDN */
+Index: bin/dig/host.1
+diff -c mdn/othersrc/bind9/bin/dig/host.1:1.1.1.2 mdn/othersrc/bind9/bin/dig/host.1:1.4
+*** bin/dig/host.1 Wed Mar 5 17:14:57 2003
+--- bin/dig/host.1 Wed Mar 5 17:42:53 2003
+***************
+*** 120,125 ****
+--- 120,136 ----
+ effectively wait forever for a reply. The time to wait for a response
+ will be set to the number of seconds given by the hardware's maximum
+ value for an integer quantity.
++ .SH "IDN SUPPORT"
++ .PP
++ If \fBhost\fR has been built with IDN (internationalized
++ domain name) support, it can accept and display non-ASCII domain names.
++ \fBhost\fR appropriately converts character encoding of
++ domain name before sending a request to DNS server or displaying a
++ reply from the server.
++ If you'd like to turn off the IDN support for some reason, defines
++ the \fBIDN_DISABLE\fR environment variable.
++ The IDN support is disabled if the the variable is set when
++ \fBhost\fR runs.
+ .SH "FILES"
+ .PP
+ \fI/etc/resolv.conf\fR
+Index: bin/dig/host.docbook
+diff -c mdn/othersrc/bind9/bin/dig/host.docbook:1.1.1.2 mdn/othersrc/bind9/bin/dig/host.docbook:1.4
+*** bin/dig/host.docbook Wed Mar 5 17:14:57 2003
+--- bin/dig/host.docbook Wed Mar 5 17:42:53 2003
+***************
+*** 181,186 ****
+--- 181,201 ----
+ </refsect1>
+
+ <refsect1>
++ <title>IDN SUPPORT</title>
++ <para>
++ If <command>host</command> has been built with IDN (internationalized
++ domain name) support, it can accept and display non-ASCII domain names.
++ <command>host</command> appropriately converts character encoding of
++ domain name before sending a request to DNS server or displaying a
++ reply from the server.
++ If you'd like to turn off the IDN support for some reason, defines
++ the <envar>IDN_DISABLE</envar> environment variable.
++ The IDN support is disabled if the the variable is set when
++ <command>host</command> runs.
++ </para>
++ </refsect1>
++
++ <refsect1>
+ <title>FILES</title>
+ <para>
+ <filename>/etc/resolv.conf</filename>
+Index: lib/dns/name.c
+diff -c mdn/othersrc/bind9/lib/dns/name.c:1.1.1.11 mdn/othersrc/bind9/lib/dns/name.c:1.15
+*** lib/dns/name.c Wed Mar 5 17:16:22 2003
+--- lib/dns/name.c Wed Mar 5 17:49:58 2003
+***************
+*** 194,199 ****
+--- 194,206 ----
+ /* XXXDCL make const? */
+ dns_name_t *dns_wildcardname = &wild;
+
++ #ifdef WITH_IDN
++ /*
++ * dns_name_t to text post-conversion procedure.
++ */
++ static dns_name_totextfilter_t totext_filter_proc = NULL;
++ #endif
++
+ static void
+ set_offsets(const dns_name_t *name, unsigned char *offsets,
+ dns_name_t *set_name);
+***************
+*** 1684,1689 ****
+--- 1691,1699 ----
+ unsigned int labels;
+ isc_boolean_t saw_root = ISC_FALSE;
+ char num[4];
++ #ifdef WITH_IDN
++ unsigned int oused = target->used;
++ #endif
+
+ /*
+ * This function assumes the name is in proper uncompressed
+***************
+*** 1861,1866 ****
+--- 1871,1880 ----
+
+ isc_buffer_add(target, tlen - trem);
+
++ #ifdef WITH_IDN
++ if (totext_filter_proc != NULL)
++ return ((*totext_filter_proc)(target, oused, saw_root));
++ #endif
+ return (ISC_R_SUCCESS);
+ }
+
+***************
+*** 3325,3327 ****
+--- 3339,3347 ----
+ return (ISC_R_SUCCESS);
+ }
+
++ #ifdef WITH_IDN
++ void
++ dns_name_settotextfilter(dns_name_totextfilter_t proc) {
++ totext_filter_proc = proc;
++ }
++ #endif
+Index: lib/dns/include/dns/name.h
+diff -c mdn/othersrc/bind9/lib/dns/include/dns/name.h:1.1.1.7 mdn/othersrc/bind9/lib/dns/include/dns/name.h:1.10
+*** lib/dns/include/dns/name.h Wed May 22 17:15:29 2002
+--- lib/dns/include/dns/name.h Mon May 27 12:10:15 2002
+***************
+*** 219,224 ****
+--- 219,235 ----
+ */
+ #define DNS_NAME_MAXWIRE 255
+
++ #ifdef WITH_IDN
++ /*
++ * Text output filter procedure.
++ * 'target' is the buffer to be converted. The region to be converted
++ * is from 'buffer'->base + 'used_org' to the end of the used region.
++ */
++ typedef isc_result_t (*dns_name_totextfilter_t)(isc_buffer_t *target,
++ unsigned int used_org,
++ isc_boolean_t absolute);
++ #endif
++
+ /***
+ *** Initialization
+ ***/
+***************
+*** 1244,1249 ****
+--- 1255,1268 ----
+ * 'size' > 0.
+ *
+ */
++
++ #ifdef WITH_IDN
++ void
++ dns_name_settotextfilter(dns_name_totextfilter_t proc);
++ /*
++ * Call 'proc' at the end of dns_name_totext.
++ */
++ #endif /* WITH_IDN */
+
+ #define DNS_NAME_FORMATSIZE (DNS_NAME_MAXTEXT + 1)
+ /*
diff --git a/contrib/idn/idnkit-1.0-src/tools/Makefile.in b/contrib/idn/idnkit-1.0-src/tools/Makefile.in
new file mode 100644
index 0000000..108bf24
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/Makefile.in
@@ -0,0 +1,65 @@
+# $Id: Makefile.in,v 1.1.1.1 2003/06/04 00:27:05 marka Exp $
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+SUBDIRS = idnconv runidn
+
+SHELL = @SHELL@
+
+all: all-subdirs
+install: install-subdirs
+clean: clean-subdirs
+distclean: distclean-localdir distclean-subdirs
+test check: test-subdirs
+
+all-subdirs install-subdirs clean-subdirs distclean-subdirs test-subdirs:
+ @target=`echo $@ | sed 's/-subdirs$$//'`; \
+ for d in $(SUBDIRS); do \
+ (cd $$d; $(MAKE) DESTDIR=$(DESTDIR) $$target); \
+ done
+
+distclean-localdir:
+ rm -f Makefile
diff --git a/contrib/idn/idnkit-1.0-src/tools/idnconv/Makefile.in b/contrib/idn/idnkit-1.0-src/tools/idnconv/Makefile.in
new file mode 100644
index 0000000..671c2c0
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/idnconv/Makefile.in
@@ -0,0 +1,116 @@
+# $Id: Makefile.in,v 1.1.1.1 2003/06/04 00:27:05 marka Exp $
+# Copyright (c) 2000, 2002 Japan Network Information Center.
+# All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+top_builddir = ../..
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+mandir = @mandir@
+man1dir = $(mandir)/man1
+
+CC = @CC@
+RANLIB = @RANLIB@
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
+SHELL = @SHELL@
+LIBTOOL = @LIBTOOL@
+
+ICONVINC = @ICONVINC@
+ICONVLIB = @ICONVLIB@
+IDNLIB = ../../lib/libidnkit.la
+
+INCS = -I$(srcdir) -I$(srcdir)/../../include -I../../include $(ICONVINC)
+DEFS =
+
+CFLAGS = $(INCS) $(DEFS) @CPPFLAGS@ @CFLAGS@
+LDFLAGS = @LDFLAGS@
+
+SRCS = idnconv.c util.c selectiveencode.c
+OBJS = idnconv.o util.o selectiveencode.o
+
+@LITEONLY_TRUE@all:
+@LITEONLY_FALSE@all: idnconv idnslookup idnconv.1
+
+idnconv: $(OBJS) $(IDNLIB)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ $(OBJS) $(IDNLIB) $(ICONVLIB)
+
+idnslookup: $(srcdir)/idnslookup.in
+ sed -e 's%[@]bindir[@]%$(bindir)%' $(srcdir)/idnslookup.in > idnslookup
+ chmod 0755 idnslookup
+
+@LITEONLY_TRUE@install:
+@LITEONLY_FALSE@@COMPAT_TRUE@install: all install-nolite install-compat
+@LITEONLY_FALSE@@COMPAT_FALSE@install: all install-nolite
+
+install-nolite:
+ $(MKINSTALLDIRS) $(DESTDIR)$(bindir)
+ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) idnconv \
+ $(DESTDIR)$(bindir)/idnconv
+ $(MKINSTALLDIRS) $(DESTDIR)$(man1dir)
+ $(INSTALL_DATA) $(srcdir)/idnconv.1 $(DESTDIR)$(man1dir)/idnconv.1
+
+install-compat:
+ src=$(DESTDIR)$(bindir)/idnconv; \
+ dst=$(DESTDIR)$(bindir)/mdnconv; \
+ rm -f $$dst; \
+ ln $$src $$dst || cp $$src $$dst
+ src=$(DESTDIR)$(man1dir)/idnconv.1; \
+ dst=$(DESTDIR)$(man1dir)/mdnconv.1; \
+ rm -f $$dst; \
+ ln $$src $$dst || cp $$src $$dst
+
+clean:
+ rm -f *.o idnconv idnslookup *.core core *~
+ rm -fr .libs/
+
+distclean: clean
+ rm -f Makefile
+
+test check:
diff --git a/contrib/idn/idnkit-1.0-src/tools/idnconv/idnconv.1 b/contrib/idn/idnkit-1.0-src/tools/idnconv/idnconv.1
new file mode 100644
index 0000000..5e7551e
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/idnconv/idnconv.1
@@ -0,0 +1,373 @@
+.\" $Id: idnconv.1,v 1.1.1.1 2003/06/04 00:27:10 marka Exp $
+.\"
+.\" Copyright (c) 2000,2001,2002 Japan Network Information Center.
+.\" All rights reserved.
+.\"
+.\" By using this file, you agree to the terms and conditions set forth bellow.
+.\"
+.\" LICENSE TERMS AND CONDITIONS
+.\"
+.\" The following License Terms and Conditions apply, unless a different
+.\" license is obtained from Japan Network Information Center ("JPNIC"),
+.\" a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+.\" Chiyoda-ku, Tokyo 101-0047, Japan.
+.\"
+.\" 1. Use, Modification and Redistribution (including distribution of any
+.\" modified or derived work) in source and/or binary forms is permitted
+.\" under this License Terms and Conditions.
+.\"
+.\" 2. Redistribution of source code must retain the copyright notices as they
+.\" appear in each source code file, this License Terms and Conditions.
+.\"
+.\" 3. Redistribution in binary form must reproduce the Copyright Notice,
+.\" this License Terms and Conditions, in the documentation and/or other
+.\" materials provided with the distribution. For the purposes of binary
+.\" distribution the "Copyright Notice" refers to the following language:
+.\" "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+.\"
+.\" 4. The name of JPNIC may not be used to endorse or promote products
+.\" derived from this Software without specific prior written approval of
+.\" JPNIC.
+.\"
+.\" 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+.\" PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+.\"
+.TH IDNCONV 1 "Mar 3, 2001"
+.\"
+.SH NAME
+idnconv \- codeset converter for named.conf and zone master files
+.\"
+.SH SYNOPSIS
+\fBidnconv\fP [\fIoptions..\fP] [\fIfile\fP...]
+.\"
+.SH DESCRIPTION
+\fBidnconv\fR is a codeset converter for named configuration files
+and zone master files.
+\fBidnconv\fR performs codeset conversion specified either
+by the command-line arguments or by the configuration file,
+and writes the converted text to stdout.
+.PP
+If file name is specified, \fBidnconv\fR converts the contents of
+the file.
+Otherwise, \fBidnconv\fR converts \fIstdin\fR.
+.PP
+Since \fBidnconv\fR is specifically designed for converting
+internatinalized domain names, it may not be suitable as a general
+codeset converter.
+.\"
+.SH "OPERATION MODES"
+\fBidnconv\fR has two operation modes.
+.PP
+One is a mode to convert local-encoded domain names to IDN-encoded
+one. Usually this mode is used for preparing domain names to be
+listed in named configuration files or zone master files.
+In this mode, the following processes are performed in addition to
+the codeset (encoding) conversion.
+.RS 2
+.IP \- 2
+local mapping
+.IP \- 2
+standard domain name preperation (NAMEPREP)
+.RE
+.PP
+The other mode is a reverse conversion, from IDN-encoded domain name to
+local-encoded domain names.
+In this mode, local mapping and NAMEPREP are not performed since
+IDN-encoded names should already be normalized.
+Instead, a check is done in order to make sure the IDN-encoded domain name
+is properly NAMEPREP'ed. If it is not, the name will be output in
+IDN encoding, not in the local encoding.
+.\"
+.SH OPTIONS
+Normally \fBidnconv\fR reads system's default configuration file
+(idn.conf) and performs conversion or name preparation according to
+the parameters specified in the file.
+You can override the setting in the configuration file by various
+command line options below.
+.TP 4
+\fB\-in\fP \fIin-code\fP, \fB\-i\fP \fIin-code\fP
+Specify the codeset name of the input text.
+Any of the following codeset names can be specified.
+.RS 4
+.IP "\(bu" 2
+Any codeset names which \fIiconv_open()\fP library function accepts
+.IP "\(bu" 2
+\f(CWPunycode\fR
+.IP "\(bu" 2
+\f(CWUTF-8\fR
+.IP "\(bu" 2
+Any alias names for the above, defined by the codeset alias file.
+.RE
+.IP "" 4
+If this option is not specified, the default codeset is determined
+from the locale in normal conversion mode.
+In reverse conversion mode, the default codeset is the IDN encoding
+specified by the configuration file (``idn-encoding'' entry).
+.TP 4
+\fB\-out\fP \fIout-code\fP, \fB\-o\fP \fIout-code\fP
+Specify the codeset name of the output text. \fIout-code\fP can be any
+codeset name that can be specified for \fB\-in\fR option.
+.IP "" 4
+If this option is not specified, the default is the IDN encoding
+specified by the configuration file (``idn-encoding'' entry) in
+normal conversion mode.
+In reverse conversion mode, the default codeset is determined from
+the locale.
+.TP 4
+\fB\-conf\fP \fIpath\fP, \fB\-c\fP \fIpath\fP
+Specify the pathname of idnkit configuration file (``idn.conf'').
+If not specified, system's default file is used, unless \-noconf
+option is specified.
+.TP 4
+\fB\-noconf\fP, \fB\-C\fP
+Specify that no configuration file is to be used.
+.TP 4
+\fB\-reverse\fP, \fB\-r\fP
+Specify reverse conversion mode.
+.br
+If this option is not specified, the normal conversion mode is used.
+.TP 4
+\fB\-nameprep\fR \fIversion\fR, \fB\-n\fR \fIversion\fR
+Specify the version of NAMEPREP.
+The following is a list of currently available versions.
+.RS 4
+.IP \f(CWRFC3491\fR 4
+Perform NAMEPREP according to the RFC3491
+``rfc-3491.txt''.
+.RE
+.TP 4
+\fB\-nonameprep\fR, \fB\-N\fR
+Specify to skip NAMEPREP process (or NAMEPREP verification process
+in the reverse conversion mode).
+This option implies -nounassigncheck and -nobidicheck.
+.TP 4
+\fB\-localmap\fR \fImap\fR
+Specify the name of local mapping rule.
+Currently, following maps are available.
+.RS 4
+.IP \f(CWRFC3491\fR 4
+Use the list of mappings specified by RFC3491.
+.IP \f(CWfilemap:\fR\fIpath\fR 4
+Use list of mappings specified by mapfile \fIpath\fR.
+See idn.conf(5) for the format of a mapfile.
+.RE
+.IP "" 4
+This option can be specified more than once.
+In that case, each mapping will be performed in the order of the
+specification.
+.TP 4
+\fB\-nounassigncheck\fR, \fB\-U\fR
+Skip unassigned codepoint check.
+.TP 4
+\fB\-nobidicheck\fR, \fB\-B\fR
+Skip bidi character check.
+.TP 4
+\fB\-nolengthcheck\fR
+Do not check label length of normal conversion result.
+This option is only meaningful in the normal conversion mode.
+.TP 4
+\fB\-noasciicheck\fR, \fB\-A\fR
+Do not check ASCII range characters.
+This option is only meaningful in the normal conversion mode.
+.TP 4
+\fB\-noroundtripcheck\fR
+Do not perform round trip check.
+This option is only meaningful in the reverse conversion mode.
+.TP 4
+\fB\-delimiter\fR \fIcodepoint\fP
+Specify the character to be mapped to domain name delimiter (period).
+This option can be specified more than once in order to specify multiple
+characters.
+.br
+This option is only meaningful in the normal conversion mode.
+.TP 4
+\fB\-whole\fP, \fB\-w\fP
+Perform local mapping, nameprep and conversion to output codeset for the entire
+input text. If this option is not specified, only non-ASCII characters
+and their surrounding texts will be processed.
+See ``NORAML CONVERSION MECHANISM'' and ``REVERSE CONVERSION MECHANISM''
+for details.
+.TP 4
+\fB\-alias\fP \fIpath\fP, \fB\-a\fP \fIpath\fP
+Specify a codeset alias file. It is a simple text file, where
+each line has a pair of alias name and real name separated by one
+or more white spaces like below:
+.nf
+.ft CW
+
+ \fIalias-codeset-name\fP \fIreal-codeset-name\fP
+
+.ft R
+.fi
+Lines starting with ``#'' are treated as comments.
+.TP 4
+\fB\-flush\fP
+Force line-buffering mode.
+.TP 4
+\fB\-version\fP, \fB\-v\fP
+Print version information and quit.
+.\"
+.SH LOCAL CODESET
+idnconv guesses local codeset from locale and environment variables.
+See the ``LOCAL CODESET'' section in idn.conf(5) for more details.
+.\"
+.SH NORMAL CONVERSION MECHANISM
+\fBidnconv\fR performs conversion line by line.
+Here describes how \fBidnconv\fR does its job for each line.
+.\"
+.IP "1. read a line from input text" 4
+.IP "2. convert the line to UTF-8" 4
+\fBidnconv\fR converts the line from local encoding to UTF-8.
+.IP "3. find internationalized domain names" 4
+If the \-whole\ (or \-w) option is specified, the entire line is
+assumed as an internationalized domain name.
+Otherwise, \fBidnconv\fR recognizes any character sequences having
+the following properties in the line as internationalized domain names.
+.RS 4
+.IP "\(bu" 2
+containing at least one non-ASCII character, and
+.IP "\(bu" 2
+consisting of legal domain name characters (alphabets, digits, hypens),
+non-ASCII characters and period.
+.RE
+.IP "4. convert internationalized domain names to ACE" 4
+For each internationalized domain name found in the line,
+\fBidnconv\fR converts the name to ACE.
+The details about the conversion procedure is:
+.RS 4
+.IP "4.1. delimiter mapping" 4
+Substibute certain characters specified as domain name delimiter
+with period.
+.IP "4.2. local mapping" 4
+Perform local mapping.
+If the local mapping is specified by command line option \-localmap,
+the specified mapping rule is applied. Otherwise, find the mapping rule
+from the configuration file which matches to the TLD of the name,
+and perform mapping according to the matched rule.
+.br
+This step is skipped if the \-nolocalmap (or \-L) option is specified.
+.IP "4.3. NAMEPREP" 4
+Perform name preparation (NAMEPREP).
+Mapping, normalization, prohibited character checking, unassigned
+codepoint checking, bidirectional character checking are done in
+that order.
+If the prohibited character check, unassigned codepoint check, or
+bidi character check fails, the normal conversion procedure aborts.
+.br
+This step is skipped if the \-nonameprep (or \-N) option is specified.
+.IP "4.4. ASCII character checking" 4
+Checks ASCII range character in the domain name.
+the normal conversion procedure aborts, if the domain name has a label
+beginning or end with hyphen (U+002D) or it contains ASCII range character
+except for alphanumeric and hyphen,
+.br
+This step is skipped if the \-noasciicheck (or \-A) option is specified.
+.IP "4.5. ACE conversion" 4
+Convert the string to ACE.
+.IP "4.6. label length checking" 4
+The normal conversion procedure aborts, if the domain name has an empty
+label or too long label (64 characters or more).
+.br
+This step is skipped if the \-nolengthcheck option is specified.
+.RE
+.IP "5. output the result" 4
+.PP
+.\"
+.SH REVERSE CONVERSION MECHANISM
+This is like the normal conversion mechanism, but they are not symmetric.
+\fBidnconv\fR does its job for each line.
+.\"
+.IP "1. read a line from input text" 4
+.IP "2. convert the line to UTF-8" 4
+\fBidnconv\fR converts the line from local encoding to UTF-8.
+.IP "3. find internationalized domain names" 4
+If the \-whole\ (or \-w) option is specified, the entire line is
+assumed as an internationalized domain name.
+Otherwise, \fBidnconv\fR decodes any valid ASCII domain names
+including ACE names in the line.
+.IP "4. convert domain names to local encoding"
+Then, \fBidnconv\fR decodes the domain names.
+The decode procedure consists of the following steps.
+.RS 4
+.IP "4.1. Delimiter mapping" 4
+Substibute certain characters specified as domain name delimiter
+with period.
+.br
+.IP "4.2. NAMEPREP" 4
+Perform name preparation (NAMEPREP) for each label in the domain name.
+Mapping, normalization, prohibited character checking, unassigned
+codepoint checking, bidirectional character checking are done in
+that order.
+If the prohibited character check, unassigned codepoint check, or
+bidi character check fails, disqualified labels are restored to
+original input strings and further conversion on those labels are
+not performed.
+.br
+This step is skipped if the \-nonameprep (or \-N) option is specified.
+.IP "4.3. ACE conversion" 4
+Convert the string from ACE to UTF-8.
+.IP "4.4. Round trip checkning" 4
+For each label, perform the normal conversion and compare it with
+the result of the step 4.2.
+This check succeeds, if they are equivalent strings.
+In case of failure, disqualified labels are restored to original
+input strings and further conversion on those labels are not
+performed.
+.br
+This step is skipped if the \-noroundtripcheck option is specified.
+.IP "4.5. local encoding conversion" 4
+Convert the result of the step 4.3. from UTF-8 to local encoding.
+If a label in the domain name contains a character which cannot be
+represented in the local encoding, the label is restored to the
+original input string.
+.RE
+.IP "5. output the result" 4
+.PP
+.\"
+.SH FILE MANAGEMENT
+Maybe the best way to manage named.conf or zone master files that contains
+internationalized domain name is to keep them in your local codeset so that
+they can be edited with your favorite editor, and generate a version in
+the IDN encoding using \fBidnconv\fP.
+.PP
+`make' is a convenient tool for this purpose.
+Suppose the local codeset version has suffix `.lc', and its ACE version
+has suffix `.ace'. The following Makefile enables you to generate
+ACE version from local codeset version by just typing `make'.
+.RS 4
+.nf
+.ft CW
+
+\&.SUFFIXES: .lc .ace
+\&.lc.ace:
+ idnconv -in $(LOCALCODE) -out $(IDNCODE) \\
+ $(IDNCONVOPT) $< > $@
+
+LOCALCODE = EUC-JP
+IDNCODE = Punycode
+IDNCONVOPT =
+
+DESTFILES = db.zone1.ace db.zone2.ace
+
+all: $(DESTFILES)
+.ft
+.fi
+.RE
+.\"
+.SH SEE ALSO
+idn.conf(5),
+iconv(3)
+.\"
+.SH BUGS
+The automatic input-code selection depends on your system, and sometimes
+it cannot guess or guess wrong. It is better to explicitly specify it
+using \-in option.
diff --git a/contrib/idn/idnkit-1.0-src/tools/idnconv/idnconv.c b/contrib/idn/idnkit-1.0-src/tools/idnconv/idnconv.c
new file mode 100644
index 0000000..a10a738
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/idnconv/idnconv.c
@@ -0,0 +1,803 @@
+#ifndef lint
+static char *rcsid = "$Id: idnconv.c,v 1.1.1.1 2003/06/04 00:27:07 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000,2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+/*
+ * idnconv -- Codeset converter for named.conf and zone files
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+#include <idn/result.h>
+#include <idn/converter.h>
+#include <idn/normalizer.h>
+#include <idn/utf8.h>
+#include <idn/resconf.h>
+#include <idn/res.h>
+#include <idn/util.h>
+#include <idn/version.h>
+
+#include "util.h"
+
+#define MAX_DELIMITER 10
+#define MAX_LOCALMAPPER 10
+#define MAX_MAPPER 10
+#define MAX_NORMALIZER 10
+#define MAX_CHEKER 10
+
+#define FLAG_REVERSE 0x0001
+#define FLAG_DELIMMAP 0x0002
+#define FLAG_LOCALMAP 0x0004
+#define FLAG_MAP 0x0008
+#define FLAG_NORMALIZE 0x0010
+#define FLAG_PROHIBITCHECK 0x0020
+#define FLAG_UNASSIGNCHECK 0x0040
+#define FLAG_BIDICHECK 0x0080
+#define FLAG_ASCIICHECK 0x0100
+#define FLAG_LENGTHCHECK 0x0200
+#define FLAG_ROUNDTRIPCHECK 0x0400
+#define FLAG_SELECTIVE 0x0800
+
+#define FLAG_NAMEPREP \
+ (FLAG_MAP|FLAG_NORMALIZE|FLAG_PROHIBITCHECK|FLAG_UNASSIGNCHECK|\
+ FLAG_BIDICHECK)
+
+#define DEFAULT_FLAGS \
+ (FLAG_LOCALMAP|FLAG_NAMEPREP|FLAG_ASCIICHECK|FLAG_LENGTHCHECK|\
+ FLAG_ROUNDTRIPCHECK|FLAG_SELECTIVE|FLAG_DELIMMAP)
+
+int line_number; /* current input file line number */
+static int flush_every_line = 0; /* pretty obvious */
+
+static int encode_file(idn_resconf_t conf1, idn_resconf_t conf2,
+ FILE *fp, int flags);
+static int decode_file(idn_resconf_t conf1, idn_resconf_t conf2,
+ FILE *fp, int flags);
+static int trim_newline(idnconv_strbuf_t *buf);
+static idn_result_t convert_line(idnconv_strbuf_t *from,
+ idnconv_strbuf_t *to,
+ idn_resconf_t conf,
+ idn_action_t actions, int flags);
+static void print_usage(char *cmd);
+static void print_version(void);
+static unsigned long get_ucs(const char *p);
+
+int
+main(int ac, char **av) {
+ char *cmd = *av;
+ char *cname;
+ unsigned long delimiters[MAX_DELIMITER];
+ char *localmappers[MAX_LOCALMAPPER];
+ char *nameprep_version = NULL;
+ int ndelimiters = 0;
+ int nlocalmappers = 0;
+ char *in_code = NULL;
+ char *out_code = NULL;
+ char *resconf_file = NULL;
+ int no_resconf = 0;
+ char *encoding_alias = NULL;
+ int flags = DEFAULT_FLAGS;
+ FILE *fp;
+ idn_result_t r;
+ idn_resconf_t resconf1, resconf2;
+ idn_converter_t conv;
+ int exit_value;
+
+#ifdef HAVE_SETLOCALE
+ (void)setlocale(LC_ALL, "");
+#endif
+
+ /*
+ * If the command name begins with 'r', reverse mode is assumed.
+ */
+ if ((cname = strrchr(cmd, '/')) != NULL)
+ cname++;
+ else
+ cname = cmd;
+ if (cname[0] == 'r')
+ flags |= FLAG_REVERSE;
+
+ ac--;
+ av++;
+ while (ac > 0 && **av == '-') {
+
+#define OPT_MATCH(opt) (strcmp(*av, opt) == 0)
+#define MUST_HAVE_ARG if (ac < 2) print_usage(cmd)
+#define APPEND_LIST(array, size, item, what) \
+ if (size >= (sizeof(array) / sizeof(array[0]))) { \
+ errormsg("too many " what "\n"); \
+ exit(1); \
+ } \
+ array[size++] = item; \
+ ac--; av++
+
+ if (OPT_MATCH("-in") || OPT_MATCH("-i")) {
+ MUST_HAVE_ARG;
+ in_code = av[1];
+ ac--;
+ av++;
+ } else if (OPT_MATCH("-out") || OPT_MATCH("-o")) {
+ MUST_HAVE_ARG;
+ out_code = av[1];
+ ac--;
+ av++;
+ } else if (OPT_MATCH("-conf") || OPT_MATCH("-c")) {
+ MUST_HAVE_ARG;
+ resconf_file = av[1];
+ ac--;
+ av++;
+ } else if (OPT_MATCH("-nameprep") || OPT_MATCH("-n")) {
+ MUST_HAVE_ARG;
+ nameprep_version = av[1];
+ ac--;
+ av++;
+ } else if (OPT_MATCH("-noconf") || OPT_MATCH("-C")) {
+ no_resconf = 1;
+ } else if (OPT_MATCH("-reverse") || OPT_MATCH("-r")) {
+ flags |= FLAG_REVERSE;
+ } else if (OPT_MATCH("-nolocalmap") || OPT_MATCH("-L")) {
+ flags &= ~FLAG_LOCALMAP;
+ } else if (OPT_MATCH("-nonameprep") || OPT_MATCH("-N")) {
+ flags &= ~FLAG_NAMEPREP;
+ } else if (OPT_MATCH("-unassigncheck") || OPT_MATCH("-u")) {
+ flags |= FLAG_UNASSIGNCHECK;
+ } else if (OPT_MATCH("-nounassigncheck") || OPT_MATCH("-U")) {
+ flags &= ~FLAG_UNASSIGNCHECK;
+ } else if (OPT_MATCH("-nobidicheck") || OPT_MATCH("-B")) {
+ flags &= ~FLAG_BIDICHECK;
+ } else if (OPT_MATCH("-noasciicheck") || OPT_MATCH("-A")) {
+ flags &= ~FLAG_ASCIICHECK;
+ } else if (OPT_MATCH("-nolengthcheck")) {
+ flags &= ~FLAG_LENGTHCHECK;
+ } else if (OPT_MATCH("-noroundtripcheck")) {
+ flags &= ~FLAG_ROUNDTRIPCHECK;
+ } else if (OPT_MATCH("-whole") || OPT_MATCH("-w")) {
+ flags &= ~FLAG_SELECTIVE;
+ } else if (OPT_MATCH("-localmap")) {
+ MUST_HAVE_ARG;
+ APPEND_LIST(localmappers, nlocalmappers, av[1],
+ "local maps");
+ } else if (OPT_MATCH("-delimiter")) {
+ unsigned long v;
+ MUST_HAVE_ARG;
+ v = get_ucs(av[1]);
+ APPEND_LIST(delimiters, ndelimiters, v,
+ "delimiter maps");
+ } else if (OPT_MATCH("-alias") || OPT_MATCH("-a")) {
+ MUST_HAVE_ARG;
+ encoding_alias = av[1];
+ ac--;
+ av++;
+ } else if (OPT_MATCH("-flush")) {
+ flush_every_line = 1;
+ } else if (OPT_MATCH("-version") || OPT_MATCH("-v")) {
+ print_version();
+ } else {
+ print_usage(cmd);
+ }
+#undef OPT_MATCH
+#undef MUST_HAVE_ARG
+#undef APPEND_LIST
+
+ ac--;
+ av++;
+ }
+
+ if (ac > 1)
+ print_usage(cmd);
+
+ /* Initialize. */
+ if ((r = idn_resconf_initialize()) != idn_success) {
+ errormsg("error initializing library\n");
+ return (1);
+ }
+
+ /*
+ * Create resource contexts.
+ * `resconf1' and `resconf2' are almost the same but local and
+ * IDN encodings are reversed.
+ */
+ resconf1 = NULL;
+ resconf2 = NULL;
+ if (idn_resconf_create(&resconf1) != idn_success ||
+ idn_resconf_create(&resconf2) != idn_success) {
+ errormsg("error initializing configuration contexts\n");
+ return (1);
+ }
+
+ /* Load configuration file. */
+ if (no_resconf) {
+ set_defaults(resconf1);
+ set_defaults(resconf2);
+ } else {
+ load_conf_file(resconf1, resconf_file);
+ load_conf_file(resconf2, resconf_file);
+ }
+
+ /* Set encoding alias file. */
+ if (encoding_alias != NULL)
+ set_encoding_alias(encoding_alias);
+
+ /* Set input codeset. */
+ if (flags & FLAG_REVERSE) {
+ if (in_code == NULL) {
+ conv = idn_resconf_getidnconverter(resconf1);
+ if (conv == NULL) {
+ errormsg("cannot get the IDN encoding.\n"
+ "please specify an appropriate one "
+ "with `-in' option.\n");
+ exit(1);
+ }
+ idn_resconf_setlocalconverter(resconf2, conv);
+ idn_converter_destroy(conv);
+ } else {
+ set_idncode(resconf1, in_code);
+ set_localcode(resconf2, in_code);
+ }
+ } else {
+ if (in_code == NULL) {
+ conv = idn_resconf_getlocalconverter(resconf1);
+ if (conv == NULL) {
+ errormsg("cannot get the local encoding.\n"
+ "please specify an appropriate one "
+ "with `-in' option.\n");
+ exit(1);
+ }
+ idn_resconf_setidnconverter(resconf2, conv);
+ idn_converter_destroy(conv);
+ } else {
+ set_localcode(resconf1, in_code);
+ set_idncode(resconf2, in_code);
+ }
+ }
+
+ /* Set output codeset. */
+ if (flags & FLAG_REVERSE) {
+ if (out_code == NULL) {
+ conv = idn_resconf_getlocalconverter(resconf1);
+ if (conv == NULL) {
+ errormsg("cannot get the local encoding.\n"
+ "please specify an appropriate one "
+ "with `-out' option.\n");
+ exit(1);
+ }
+ idn_resconf_setidnconverter(resconf2, conv);
+ idn_converter_destroy(conv);
+ } else {
+ set_localcode(resconf1, out_code);
+ set_idncode(resconf2, out_code);
+ }
+ } else {
+ if (out_code == NULL) {
+ conv = idn_resconf_getidnconverter(resconf1);
+ if (conv == NULL) {
+ errormsg("cannot get the IDN encoding.\n"
+ "please specify an appropriate one "
+ "with `-out' option.\n");
+ exit(1);
+ }
+ idn_resconf_setlocalconverter(resconf2, conv);
+ idn_converter_destroy(conv);
+ } else {
+ set_idncode(resconf1, out_code);
+ set_localcode(resconf2, out_code);
+ }
+ }
+
+ /* Set delimiter map(s). */
+ if (ndelimiters > 0) {
+ set_delimitermapper(resconf1, delimiters, ndelimiters);
+ set_delimitermapper(resconf2, delimiters, ndelimiters);
+ }
+
+ /* Set local map(s). */
+ if (nlocalmappers > 0) {
+ set_localmapper(resconf1, localmappers, nlocalmappers);
+ set_localmapper(resconf2, localmappers, nlocalmappers);
+ }
+
+ /* Set NAMEPREP version. */
+ if (nameprep_version != NULL) {
+ set_nameprep(resconf1, nameprep_version);
+ set_nameprep(resconf2, nameprep_version);
+ }
+
+ idn_res_enable(1);
+
+ /* Open input file. */
+ if (ac > 0) {
+ if ((fp = fopen(av[0], "r")) == NULL) {
+ errormsg("cannot open file %s: %s\n",
+ av[0], strerror(errno));
+ return (1);
+ }
+ } else {
+ fp = stdin;
+ }
+
+ /* Do the conversion. */
+ if (flags & FLAG_REVERSE)
+ exit_value = decode_file(resconf1, resconf2, fp, flags);
+ else
+ exit_value = encode_file(resconf1, resconf2, fp, flags);
+
+ idn_resconf_destroy(resconf1);
+ idn_resconf_destroy(resconf2);
+
+ return exit_value;
+}
+
+static int
+encode_file(idn_resconf_t conf1, idn_resconf_t conf2, FILE *fp, int flags) {
+ idn_result_t r;
+ idnconv_strbuf_t buf1, buf2;
+ idn_action_t actions1, actions2;
+ int nl_trimmed;
+ int local_ace_hack;
+ idn_converter_t conv;
+
+ /*
+ * See if the input codeset is an ACE.
+ */
+ conv = idn_resconf_getlocalconverter(conf1);
+ if (conv != NULL && idn_converter_isasciicompatible(conv) &&
+ (flags & FLAG_SELECTIVE))
+ local_ace_hack = 1;
+ else
+ local_ace_hack = 0;
+ if (conv != NULL)
+ idn_converter_destroy(conv);
+
+ if (local_ace_hack) {
+ actions1 = IDN_IDNCONV;
+ if (flags & FLAG_ROUNDTRIPCHECK)
+ actions1 |= IDN_RTCHECK;
+ } else {
+ actions1 = IDN_LOCALCONV;
+ }
+
+ actions2 = IDN_IDNCONV;
+ if (flags & FLAG_DELIMMAP)
+ actions2 |= IDN_DELIMMAP;
+ if (flags & FLAG_LOCALMAP)
+ actions2 |= IDN_LOCALMAP;
+ if (flags & FLAG_MAP)
+ actions2 |= IDN_MAP;
+ if (flags & FLAG_NORMALIZE)
+ actions2 |= IDN_NORMALIZE;
+ if (flags & FLAG_PROHIBITCHECK)
+ actions2 |= IDN_PROHCHECK;
+ if (flags & FLAG_UNASSIGNCHECK)
+ actions2 |= IDN_UNASCHECK;
+ if (flags & FLAG_BIDICHECK)
+ actions2 |= IDN_BIDICHECK;
+ if (flags & FLAG_ASCIICHECK)
+ actions2 |= IDN_ASCCHECK;
+ if (flags & FLAG_LENGTHCHECK)
+ actions2 |= IDN_LENCHECK;
+
+ strbuf_init(&buf1);
+ strbuf_init(&buf2);
+ line_number = 1;
+ while (strbuf_getline(&buf1, fp) != NULL) {
+ /*
+ * Trim newline at the end. This is needed for
+ * those ascii-comatible encodings such as UTF-5 or RACE
+ * not to try converting newlines, which will result
+ * in `invalid encoding' error.
+ */
+ nl_trimmed = trim_newline(&buf1);
+
+ /*
+ * Convert input line to UTF-8.
+ */
+ if (local_ace_hack)
+ r = convert_line(&buf1, &buf2, conf2, actions1,
+ FLAG_REVERSE|FLAG_SELECTIVE);
+ else
+ r = convert_line(&buf1, &buf2, conf1, actions1,
+ 0);
+
+ if (r != idn_success) {
+ errormsg("conversion failed at line %d: %s\n",
+ line_number,
+ idn_result_tostring(r));
+ goto error;
+ }
+ if (!idn_utf8_isvalidstring(strbuf_get(&buf2))) {
+ errormsg("conversion to utf-8 failed at line %d\n",
+ line_number);
+ goto error;
+ }
+
+ /*
+ * Perform local mapping and NAMEPREP, and convert to
+ * the output codeset.
+ */
+ r = convert_line(&buf2, &buf1, conf1, actions2,
+ flags & FLAG_SELECTIVE);
+
+ if (r != idn_success) {
+ errormsg("error in nameprep or output conversion "
+ "at line %d: %s\n",
+ line_number, idn_result_tostring(r));
+ goto error;
+ }
+
+ fputs(strbuf_get(&buf1), stdout);
+ if (nl_trimmed)
+ putc('\n', stdout);
+
+ if (flush_every_line)
+ fflush(stdout);
+
+ line_number++;
+ }
+
+ strbuf_reset(&buf1);
+ strbuf_reset(&buf2);
+ return (0);
+
+ error:
+ strbuf_reset(&buf1);
+ strbuf_reset(&buf2);
+ return (1);
+}
+
+static int
+decode_file(idn_resconf_t conf1, idn_resconf_t conf2, FILE *fp, int flags) {
+ idn_result_t r;
+ idnconv_strbuf_t buf1, buf2;
+ idn_action_t actions1, actions2;
+ int nl_trimmed;
+ int local_ace_hack, idn_ace_hack;
+ idn_converter_t conv;
+
+ /*
+ * See if the input codeset is an ACE.
+ */
+ conv = idn_resconf_getidnconverter(conf1);
+ if (conv != NULL && idn_converter_isasciicompatible(conv) &&
+ (flags & FLAG_SELECTIVE))
+ idn_ace_hack = 1;
+ else
+ idn_ace_hack = 0;
+ if (conv != NULL)
+ idn_converter_destroy(conv);
+
+ conv = idn_resconf_getlocalconverter(conf1);
+ if (conv != NULL && idn_converter_isasciicompatible(conv) &&
+ (flags & FLAG_SELECTIVE))
+ local_ace_hack = 1;
+ else
+ local_ace_hack = 0;
+ if (conv != NULL)
+ idn_converter_destroy(conv);
+
+ actions1 = IDN_IDNCONV;
+
+ if (local_ace_hack) {
+ actions2 = IDN_IDNCONV;
+ if (flags & FLAG_MAP)
+ actions2 |= IDN_MAP;
+ if (flags & FLAG_NORMALIZE)
+ actions2 |= IDN_NORMALIZE;
+ if (flags & FLAG_PROHIBITCHECK)
+ actions2 |= IDN_PROHCHECK;
+ if (flags & FLAG_UNASSIGNCHECK)
+ actions2 |= IDN_UNASCHECK;
+ if (flags & FLAG_BIDICHECK)
+ actions2 |= IDN_BIDICHECK;
+ if (flags & FLAG_ASCIICHECK)
+ actions2 |= IDN_ASCCHECK;
+ if (flags & FLAG_LENGTHCHECK)
+ actions2 |= IDN_LENCHECK;
+ } else {
+ actions2 = IDN_LOCALCONV;
+ }
+
+ if (flags & FLAG_DELIMMAP)
+ actions1 |= IDN_DELIMMAP;
+ if (flags & FLAG_MAP)
+ actions1 |= IDN_MAP;
+ if (flags & FLAG_NORMALIZE)
+ actions1 |= IDN_NORMALIZE;
+ if (flags & FLAG_NORMALIZE)
+ actions1 |= IDN_NORMALIZE;
+ if (flags & FLAG_PROHIBITCHECK)
+ actions1 |= IDN_PROHCHECK;
+ if (flags & FLAG_UNASSIGNCHECK)
+ actions1 |= IDN_UNASCHECK;
+ if (flags & FLAG_BIDICHECK)
+ actions1 |= IDN_BIDICHECK;
+ if (flags & FLAG_ASCIICHECK)
+ actions1 |= IDN_ASCCHECK;
+ if (flags & FLAG_ROUNDTRIPCHECK)
+ actions1 |= IDN_RTCHECK;
+
+ strbuf_init(&buf1);
+ strbuf_init(&buf2);
+ line_number = 1;
+ while (strbuf_getline(&buf1, fp) != NULL) {
+ /*
+ * Trim newline at the end. This is needed for
+ * those ascii-comatible encodings such as UTF-5 or RACE
+ * not to try converting newlines, which will result
+ * in `invalid encoding' error.
+ */
+ nl_trimmed = trim_newline(&buf1);
+
+ /*
+ * Treat input line as the string encoded in local
+ * encoding and convert it to UTF-8 encoded string.
+ */
+ if (local_ace_hack) {
+ if (strbuf_copy(&buf2, strbuf_get(&buf1)) == NULL)
+ r = idn_nomemory;
+ else
+ r = idn_success;
+ } else {
+ r = convert_line(&buf1, &buf2, conf1, IDN_LOCALCONV,
+ 0);
+ }
+ if (r != idn_success) {
+ errormsg("conversion failed at line %d: %s\n",
+ line_number, idn_result_tostring(r));
+ goto error;
+ }
+
+ /*
+ * Convert internationalized domain names in the line.
+ */
+ if (idn_ace_hack) {
+ r = convert_line(&buf2, &buf1, conf1, actions1,
+ FLAG_REVERSE|FLAG_SELECTIVE);
+ } else {
+ r = convert_line(&buf2, &buf1, conf1, actions1,
+ FLAG_REVERSE);
+ }
+ if (r != idn_success) {
+ errormsg("conversion failed at line %d: %s\n",
+ line_number,
+ idn_result_tostring(r));
+ goto error;
+ }
+ if (!idn_utf8_isvalidstring(strbuf_get(&buf1))) {
+ errormsg("conversion to utf-8 failed at line %d\n",
+ line_number);
+ goto error;
+ }
+
+ /*
+ * Perform round trip check and convert to the output
+ * codeset.
+ */
+ if (local_ace_hack) {
+ r = convert_line(&buf1, &buf2, conf2, actions2,
+ FLAG_SELECTIVE);
+ } else {
+ r = convert_line(&buf1, &buf2, conf1, actions2,
+ FLAG_REVERSE);
+ }
+
+ if (r != idn_success) {
+ errormsg("error in nameprep or output conversion "
+ "at line %d: %s\n",
+ line_number, idn_result_tostring(r));
+ goto error;
+ }
+
+ fputs(strbuf_get(&buf2), stdout);
+ if (nl_trimmed)
+ putc('\n', stdout);
+
+ if (flush_every_line)
+ fflush(stdout);
+
+ line_number++;
+ }
+ strbuf_reset(&buf1);
+ strbuf_reset(&buf2);
+ return (0);
+
+ error:
+ strbuf_reset(&buf1);
+ strbuf_reset(&buf2);
+ return (1);
+}
+
+static int
+trim_newline(idnconv_strbuf_t *buf) {
+ /*
+ * If the string in BUF ends with a newline, trim it and
+ * return 1. Otherwise, just return 0 without modifying BUF.
+ */
+ char *s = strbuf_get(buf);
+ size_t len = strlen(s);
+
+ if (s[len - 1] == '\n') {
+ s[len - 1] = '\0';
+ return (1);
+ }
+
+ return (0);
+}
+
+static idn_result_t
+convert_line(idnconv_strbuf_t *from, idnconv_strbuf_t *to,
+ idn_resconf_t conf, idn_action_t actions, int flags)
+{
+ idn_result_t r = idn_success;
+ char *from_str = strbuf_get(from);
+
+ for (;;) {
+ char *to_str = strbuf_get(to);
+ size_t to_size = strbuf_size(to);
+
+ switch (flags & (FLAG_REVERSE|FLAG_SELECTIVE)) {
+ case 0:
+ r = idn_res_encodename(conf, actions, from_str,
+ to_str, to_size);
+ break;
+ case FLAG_REVERSE:
+ r = idn_res_decodename(conf, actions, from_str,
+ to_str, to_size);
+ break;
+ case FLAG_SELECTIVE:
+ r = selective_encode(conf, actions, from_str,
+ to_str, to_size);
+ break;
+ case FLAG_REVERSE|FLAG_SELECTIVE:
+ r = selective_decode(conf, actions, from_str,
+ to_str, to_size);
+ break;
+ }
+ if (r == idn_buffer_overflow) {
+ /*
+ * Conversion is not successful because
+ * the size of the target buffer is not enough.
+ * Double the size and retry.
+ */
+ if (strbuf_double(to) == NULL) {
+ /* oops. allocation failed. */
+ return (idn_nomemory);
+ }
+ } else {
+ break;
+ }
+ }
+ return (r);
+}
+
+static char *options[] = {
+ "-in INPUT-CODESET : specifies input codeset name.",
+ "-i INPUT-CODESET : synonym for -in",
+ "-out OUTPUT-CODESET : specifies output codeset name.",
+ "-o OUTPUT-CODESET : synonym for -out",
+ "-conf CONF-FILE : specifies idnkit configuration file.",
+ "-c CONF-FILE : synonym for -conf",
+ "-noconf : do not load idnkit configuration file.",
+ "-C : synonym for -noconf",
+ "-reverse : specifies reverse conversion.",
+ " (i.e. IDN encoding to local encoding)",
+ "-r : synonym for -reverse",
+ "-nameprep VERSION : specifies version name of NAMEPREP.",
+ "-n VERSION : synonym for -nameprep",
+ "-nonameprep : do not perform NAMEPREP.",
+ "-N : synonym for -nonameprep",
+ "-localmap MAPPING : specifies local mapping.",
+ "-nolocalmap : do not perform local mapping.",
+ "-L : synonym for -nolocalmap",
+ "-nounassigncheck : do not perform unassigned codepoint check.",
+ "-U : synonym for -nounassigncheck",
+ "-nobidicheck : do not perform bidirectional text check.",
+ "-B : synonym for -nobidicheck",
+ "-nolengthcheck : do not check label length.",
+ "-noasciicheck : do not check ASCII range characters.",
+ "-A : synonym for -noasciicheck",
+ "-noroundtripcheck : do not perform round trip check.",
+ "-delimiter U+XXXX : specifies local delimiter code point.",
+ "-alias alias-file : specifies codeset alias file.",
+ "-a : synonym for -alias",
+ "-flush : line-buffering mode.",
+ "-whole : convert the whole region instead of",
+ " regions containing non-ascii characters.",
+ "-w : synonym for -whole",
+ "-version : print version number, then exit.",
+ "-v : synonym for -version",
+ "",
+ " The following options can be specified multiple times",
+ " -localmap, -delimiter",
+ NULL,
+};
+
+static void
+print_version() {
+ fprintf(stderr, "idnconv (idnkit) version: %s\n"
+ "library version: %s\n",
+ IDNKIT_VERSION,
+ idn_version_getstring());
+ exit(0);
+}
+
+static void
+print_usage(char *cmd) {
+ int i;
+
+ fprintf(stderr, "Usage: %s [options..] [file]\n", cmd);
+
+ for (i = 0; options[i] != NULL; i++)
+ fprintf(stderr, "\t%s\n", options[i]);
+
+ exit(1);
+}
+
+static unsigned long
+get_ucs(const char *p) {
+ unsigned long v;
+ char *end;
+
+ /* Skip optional 'U+' */
+ if (strncmp(p, "U+", 2) == 0)
+ p += 2;
+
+ v = strtoul(p, &end, 16);
+ if (*end != '\0') {
+ fprintf(stderr, "invalid UCS code point \"%s\"\n", p);
+ exit(1);
+ }
+
+ return v;
+}
diff --git a/contrib/idn/idnkit-1.0-src/tools/idnconv/idnslookup.in b/contrib/idn/idnkit-1.0-src/tools/idnconv/idnslookup.in
new file mode 100644
index 0000000..d380f1e
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/idnconv/idnslookup.in
@@ -0,0 +1,116 @@
+#! /bin/sh
+# $Id: idnslookup.in,v 1.1.1.1 2003/06/04 00:27:10 marka Exp $
+#
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+USAGE="Usage: $0 domain-name DNS-server"
+
+#
+# Parse command line arguments.
+#
+if [ $# -lt 2 ] ; then
+ echo "$0: too few argument" 1>&2
+ echo $USAGE 1>&2
+ exit 1
+fi
+
+if [ $# -gt 2 ] ; then
+ echo "$0: too many argument" 1>&2
+ echo $USAGE 1>&2
+ exit 1
+fi
+
+case "$1" in
+-*) echo "$0: unknown option $1" 1>&2
+ echo $USAGE 1>&2
+ exit 1
+ ;;
+esac
+
+LOCAL_DOMAIN_NAME="$1"
+NAME_SERVER="$2"
+
+#
+# Append some directories to PATH.
+#
+[ -d /usr/sbin ] && PATH=$PATH:/usr/sbin
+[ -d /sbin ] && PATH=$PATH:/sbin
+
+#
+# Find `nslookup' command.
+#
+if [ x"$NSLOOKUP" = x ] ; then
+ for I in `echo $PATH | sed -e 's/:/ /g'` ; do
+ if [ -x $I/nslookup ] ; then
+ NSLOOKUP="$I/nslookup"
+ break
+ fi
+ done
+ if [ "$NSLOOKUP" = "" ] ; then
+ echo "$0: nslookup not found" 1>&2
+ exit 1
+ fi
+fi
+if [ ! -x "$NSLOOKUP" ] ; then
+ echo "$0: nslookup not found" 1>&2
+ exit 1
+fi
+
+#
+# Check if `idnconv' command exists.
+#
+IDNCONV=${IDNCONV-"@bindir@/idnconv"}
+if [ ! -x "$IDNCONV" ] ; then
+ echo "$0: idnconv not found" 1>&2
+ exit 1
+fi
+
+#
+# Convert domain name to IDN encoding.
+#
+IDN_DOMAIN_NAME="`echo $LOCAL_DOMAIN_NAME | $IDNCONV -w`" || exit 1
+
+#
+# Invoke nslookup.
+#
+$NSLOOKUP $IDN_DOMAIN_NAME $NAME_SERVER < /dev/null || exit 1
+
+exit 0
diff --git a/contrib/idn/idnkit-1.0-src/tools/idnconv/make.wnt b/contrib/idn/idnkit-1.0-src/tools/idnconv/make.wnt
new file mode 100644
index 0000000..97ce188
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/idnconv/make.wnt
@@ -0,0 +1,72 @@
+# $Id: make.wnt,v 1.1.1.1 2003/06/04 00:27:06 marka Exp $
+# Makefile for idnconv, manually configured for WIN-NT (VC5.0)
+#
+# Copyright (c) 2000,2002 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+!include <ntwin32.mak>
+
+INCDIR = ..\..\include
+ICONVDIR = ..\..\win
+IDNLIBDIR = ..\..\lib
+LIBS = $(IDNLIBDIR)\idnkit.lib $(ICONVDIR)\iconv.lib
+SYSLIBS = $(conlibsdll)
+
+SRCS = idnconv.c util.c selectiveencode.c
+OBJS = idnconv.obj util.obj selectiveencode.obj
+
+TARGET = idnconv.exe
+
+all: $(TARGET)
+
+idnconv.exe: $(OBJS) $(LIBS)
+ $(link) $(conflags) /out:idnconv.exe $(OBJS) $(LIBS) $(SYSLIBS)
+
+install:
+
+clean:
+ -del *.exe *.obj *.lib core *.core *~
+
+idnconv.obj: idnconv.c
+ $(cc) $(cflags) $(cvarsdll) -I$(INCDIR) $*.c
+util.obj: util.c
+ $(cc) $(cflags) $(cvarsdll) -I$(INCDIR) $*.c
+selectiveencode.obj: selectiveencode.c
+ $(cc) $(cflags) $(cvarsdll) -I$(INCDIR) $*.c
diff --git a/contrib/idn/idnkit-1.0-src/tools/idnconv/selectiveencode.c b/contrib/idn/idnkit-1.0-src/tools/idnconv/selectiveencode.c
new file mode 100644
index 0000000..ae509df
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/idnconv/selectiveencode.c
@@ -0,0 +1,127 @@
+#ifndef lint
+static char *rcsid = "$Id: selectiveencode.c,v 1.1.1.1 2003/06/04 00:27:07 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+
+#include <idn/assert.h>
+#include <idn/logmacro.h>
+#include <idn/result.h>
+#include <idn/utf8.h>
+#include <idn/debug.h>
+
+#include "selectiveencode.h"
+
+static int is_domain_delimiter(char c);
+static char *find_nonascii(const char *s);
+
+idn_result_t
+idn_selectiveencode_findregion(const char *s,
+ char **startp, char **endp)
+{
+ char *non_ascii;
+ char *start, *end;
+
+ assert(s != NULL && startp != NULL && endp != NULL);
+
+ TRACE(("idn_selectiveencode_findregion(s=\"%s\")\n",
+ idn__debug_xstring(s, 20)));
+
+ /*
+ * Scan the specified string looking for non-ascii character.
+ */
+ if ((non_ascii = find_nonascii(s)) == NULL)
+ return (idn_notfound);
+
+ /*
+ * Non-ascii character found.
+ * Determine the region to encode.
+ */
+
+ /*
+ * First, we scan backwards to find the beginning of the region
+ * that should be converted.
+ */
+ start = non_ascii;
+ while (start > s) {
+ char *prev = idn_utf8_findfirstbyte(start - 1, s);
+ if (is_domain_delimiter(*prev))
+ break; /* Found */
+ start = prev;
+ }
+ *startp = start;
+
+ /*
+ * Next we scan forwards looking for the end of the region.
+ */
+ end = non_ascii + idn_utf8_mblen(non_ascii);
+ while (!is_domain_delimiter(*end))
+ end += idn_utf8_mblen(end);
+ *endp = end;
+
+ return (idn_success);
+}
+
+static int
+is_domain_delimiter(char c) {
+ return ((unsigned char)c < 0x80 &&
+ !('A' <= c && c <= 'Z') &&
+ !('a' <= c && c <= 'z') &&
+ !('0' <= c && c <= '9') &&
+ c != '-' && c != '.');
+}
+
+static char *
+find_nonascii(const char *s) {
+ while (*s != '\0' && (unsigned char)*s < 0x80)
+ s++;
+ if (*s == '\0')
+ return (NULL);
+ else
+ return ((char *)s);
+}
diff --git a/contrib/idn/idnkit-1.0-src/tools/idnconv/selectiveencode.h b/contrib/idn/idnkit-1.0-src/tools/idnconv/selectiveencode.h
new file mode 100644
index 0000000..ec4d8f6
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/idnconv/selectiveencode.h
@@ -0,0 +1,70 @@
+/* $Id: selectiveencode.h,v 1.1.1.1 2003/06/04 00:27:08 marka Exp $ */
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_SELECTIVENCODE_H
+#define IDN_SELECTIVENCODE_H 1
+
+/*
+ * Find where to convert.
+ *
+ * Find a substring for which IDN domain name codeset conversion is necessary.
+ */
+
+#include <idn/result.h>
+
+/*
+ * Scan the given string 's' (in UTF-8 encoding) looking for a substring
+ * made of
+ * + at least one non-ascii character and
+ * + zero or more legitimate domain-name characters (i.e. ascii alphabets,
+ * digits and hyphens) and periods.
+ *
+ * Returns:
+ * idn_success -- ok, found.
+ * idn_notfound -- not found.
+ */
+extern idn_result_t
+idn_selectiveencode_findregion(const char *s, char **startp, char **endp);
+
+#endif /* IDN_SELECTIVENCODE_H */
diff --git a/contrib/idn/idnkit-1.0-src/tools/idnconv/util.c b/contrib/idn/idnkit-1.0-src/tools/idnconv/util.c
new file mode 100644
index 0000000..35677e9
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/idnconv/util.c
@@ -0,0 +1,554 @@
+#ifndef lint
+static char *rcsid = "$Id: util.c,v 1.1.1.1 2003/06/04 00:27:08 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+#include <idn/resconf.h>
+#include <idn/converter.h>
+#include <idn/res.h>
+#include <idn/utf8.h>
+
+#include "util.h"
+#include "selectiveencode.h"
+
+extern int line_number;
+
+idn_result_t
+selective_encode(idn_resconf_t conf, idn_action_t actions,
+ char *from, char *to, int tolen)
+{
+ for (;;) {
+ int len;
+ char *region_start, *region_end;
+ idn_result_t r;
+ char save;
+
+ /*
+ * Find the region that needs conversion.
+ */
+ r = idn_selectiveencode_findregion(from, &region_start,
+ &region_end);
+ if (r == idn_notfound) {
+ /*
+ * Not found. Just copy the whole thing.
+ */
+ if (tolen <= strlen(from))
+ return (idn_buffer_overflow);
+ (void)strcpy(to, from);
+ return (idn_success);
+ } else if (r != idn_success) {
+ /* This should not happen.. */
+ errormsg("internal error at line %d: %s\n",
+ line_number, idn_result_tostring(r));
+ return (r);
+ }
+
+ /*
+ * We have found a region to convert.
+ * First, copy the prefix part verbatim.
+ */
+ len = region_start - from;
+ if (tolen < len) {
+ errormsg("internal buffer overflow at line %d\n",
+ line_number);
+ return (idn_buffer_overflow);
+ }
+ (void)memcpy(to, from, len);
+ to += len;
+ tolen -= len;
+
+ /*
+ * Terminate the region with NUL.
+ */
+ save = *region_end;
+ *region_end = '\0';
+
+ /*
+ * Encode the region.
+ */
+ r = idn_res_encodename(conf, actions, region_start, to, tolen);
+
+ /*
+ * Restore character.
+ */
+ *region_end = save;
+
+ if (r != idn_success)
+ return (r);
+
+ len = strlen(to);
+ to += len;
+ tolen -= len;
+
+ from = region_end;
+ }
+}
+
+idn_result_t
+selective_decode(idn_resconf_t conf, idn_action_t actions,
+ char *from, char *to, int tolen)
+{
+ char *domain_name;
+ char *ignored_chunk;
+ char save;
+ int len;
+ idn_result_t r;
+
+ /*
+ * While `*from' points to a character in a string which may be
+ * a domain name, `domain_name' refers to the beginning of the
+ * domain name.
+ */
+ domain_name = NULL;
+
+ /*
+ * We ignore chunks matching to the regular expression:
+ * [\-\.][0-9A-Za-z\-\.]*
+ *
+ * While `*from' points to a character in such a chunk,
+ * `ignored_chunk' refers to the beginning of the chunk.
+ */
+ ignored_chunk = NULL;
+
+ for (;;) {
+ if (*from == '-') {
+ /*
+ * We don't recognize `.-' as a part of domain name.
+ */
+ if (domain_name != NULL) {
+ if (*(from - 1) == '.') {
+ ignored_chunk = domain_name;
+ domain_name = NULL;
+ }
+ } else if (ignored_chunk == NULL) {
+ ignored_chunk = from;
+ }
+
+ } else if (*from == '.') {
+ /*
+ * We don't recognize `-.' nor `..' as a part of
+ * domain name.
+ */
+ if (domain_name != NULL) {
+ if (*(from - 1) == '-' || *(from - 1) == '.') {
+ ignored_chunk = domain_name;
+ domain_name = NULL;
+ }
+ } else if (ignored_chunk == NULL) {
+ ignored_chunk = from;
+ }
+
+ } else if (('a' <= *from && *from <= 'z') ||
+ ('A' <= *from && *from <= 'Z') ||
+ ('0' <= *from && *from <= '9')) {
+ if (ignored_chunk == NULL && domain_name == NULL)
+ domain_name = from;
+
+ } else {
+ if (ignored_chunk != NULL) {
+ /*
+ * `from' reaches the end of the ignored chunk.
+ * Copy the chunk to `to'.
+ */
+ len = from - ignored_chunk;
+ if (tolen < len)
+ return (idn_buffer_overflow);
+ (void)memcpy(to, ignored_chunk, len);
+ to += len;
+ tolen -= len;
+
+ } else if (domain_name != NULL) {
+ /*
+ * `from' reaches the end of the domain name.
+ * Decode the domain name, and copy the result
+ * to `to'.
+ */
+ save = *from;
+ *from = '\0';
+ r = idn_res_decodename(conf, actions,
+ domain_name, to, tolen);
+ *from = save;
+
+ if (r == idn_success) {
+ len = strlen(to);
+ } else if (r == idn_invalid_encoding) {
+ len = from - domain_name;
+ if (tolen < len)
+ return (idn_buffer_overflow);
+ (void)memcpy(to, domain_name, len);
+ } else {
+ return (r);
+ }
+ to += len;
+ tolen -= len;
+ }
+
+ /*
+ * Copy a character `*from' to `to'.
+ */
+ if (tolen < 1)
+ return (idn_buffer_overflow);
+ *to = *from;
+ to++;
+ tolen--;
+
+ domain_name = NULL;
+ ignored_chunk = NULL;
+
+ if (*from == '\0')
+ break;
+ }
+
+ from++;
+ }
+
+ return (idn_success);
+}
+
+void
+set_defaults(idn_resconf_t conf) {
+ idn_result_t r;
+
+ if ((r = idn_resconf_setdefaults(conf)) != idn_success) {
+ errormsg("error setting default configuration: %s\n",
+ idn_result_tostring(r));
+ exit(1);
+ }
+}
+
+void
+load_conf_file(idn_resconf_t conf, const char *file) {
+ idn_result_t r;
+
+ if ((r = idn_resconf_loadfile(conf, file)) != idn_success) {
+ errormsg("error reading configuration file: %s\n",
+ idn_result_tostring(r));
+ exit(1);
+ }
+}
+
+void
+set_encoding_alias(const char *encoding_alias) {
+ idn_result_t r;
+
+ if ((r = idn_converter_resetalias()) != idn_success) {
+ errormsg("cannot reset alias information: %s\n",
+ idn_result_tostring(r));
+ exit(1);
+ }
+
+ if ((r = idn_converter_aliasfile(encoding_alias)) != idn_success) {
+ errormsg("cannot read alias file %s: %s\n",
+ encoding_alias, idn_result_tostring(r));
+ exit(1);
+ }
+}
+
+void
+set_localcode(idn_resconf_t conf, const char *code) {
+ idn_result_t r;
+
+ r = idn_resconf_setlocalconvertername(conf, code,
+ IDN_CONVERTER_RTCHECK);
+ if (r != idn_success) {
+ errormsg("cannot create converter for codeset %s: %s\n",
+ code, idn_result_tostring(r));
+ exit(1);
+ }
+}
+
+void
+set_idncode(idn_resconf_t conf, const char *code) {
+ idn_result_t r;
+
+ r = idn_resconf_setidnconvertername(conf, code,
+ IDN_CONVERTER_RTCHECK);
+ if (r != idn_success) {
+ errormsg("cannot create converter for codeset %s: %s\n",
+ code, idn_result_tostring(r));
+ exit(1);
+ }
+}
+
+void
+set_delimitermapper(idn_resconf_t conf, unsigned long *delimiters,
+ int ndelimiters) {
+ idn_result_t r;
+
+ r = idn_resconf_addalldelimitermapucs(conf, delimiters, ndelimiters);
+ if (r != idn_success) {
+ errormsg("cannot add delimiter: %s\n",
+ idn_result_tostring(r));
+ exit(1);
+ }
+}
+
+void
+set_localmapper(idn_resconf_t conf, char **mappers, int nmappers) {
+ idn_result_t r;
+
+ /* Add mapping. */
+ r = idn_resconf_addalllocalmapselectornames(conf,
+ IDN_MAPSELECTOR_DEFAULTTLD,
+ (const char **)mappers,
+ nmappers);
+ if (r != idn_success) {
+ errormsg("cannot add local map: %s\n",
+ idn_result_tostring(r));
+ exit(1);
+ }
+}
+
+void
+set_nameprep(idn_resconf_t conf, char *version) {
+ idn_result_t r;
+
+ r = idn_resconf_setnameprepversion(conf, version);
+ if (r != idn_success) {
+ errormsg("error setting nameprep %s: %s\n",
+ version, idn_result_tostring(r));
+ exit(1);
+ }
+}
+
+void
+set_mapper(idn_resconf_t conf, char **mappers, int nmappers) {
+ idn_result_t r;
+
+ /* Configure mapper. */
+ r = idn_resconf_addallmappernames(conf, (const char **)mappers,
+ nmappers);
+ if (r != idn_success) {
+ errormsg("cannot add nameprep map: %s\n",
+ idn_result_tostring(r));
+ exit(1);
+ }
+}
+
+void
+set_normalizer(idn_resconf_t conf, char **normalizers, int nnormalizer) {
+ idn_result_t r;
+
+ r = idn_resconf_addallnormalizernames(conf,
+ (const char **)normalizers,
+ nnormalizer);
+ if (r != idn_success) {
+ errormsg("cannot add normalizer: %s\n",
+ idn_result_tostring(r));
+ exit(1);
+ }
+}
+
+void
+set_prohibit_checkers(idn_resconf_t conf, char **prohibits, int nprohibits) {
+ idn_result_t r;
+
+ r = idn_resconf_addallprohibitcheckernames(conf,
+ (const char **)prohibits,
+ nprohibits);
+ if (r != idn_success) {
+ errormsg("cannot add prohibit checker: %s\n",
+ idn_result_tostring(r));
+ exit(1);
+ }
+}
+
+void
+set_unassigned_checkers(idn_resconf_t conf, char **unassigns, int nunassigns) {
+ idn_result_t r;
+
+ r = idn_resconf_addallunassignedcheckernames(conf,
+ (const char **)unassigns,
+ nunassigns);
+ if (r != idn_success) {
+ errormsg("cannot add unassigned checker: %s\n",
+ idn_result_tostring(r));
+ exit(1);
+ }
+}
+
+void
+errormsg(const char *fmt, ...) {
+ va_list args;
+
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+}
+
+
+/*
+ * Dynamic Stirng Buffer Utility
+ */
+
+void
+strbuf_init(idnconv_strbuf_t *buf) {
+ /*
+ * Initialize the given string buffer.
+ * Caller must allocate the structure (idnconv_strbuf_t)
+ * as an automatic variable or by malloc().
+ */
+ buf->str = buf->local_buf;
+ buf->str[0] = '\0';
+ buf->size = sizeof(buf->local_buf);
+}
+
+void
+strbuf_reset(idnconv_strbuf_t *buf) {
+ /*
+ * Reset the given string buffer.
+ * Free memory allocated by this utility, and
+ * re-initialize.
+ */
+ if (buf->str != NULL && buf->str != buf->local_buf) {
+ free(buf->str);
+ }
+ strbuf_init(buf);
+}
+
+char *
+strbuf_get(idnconv_strbuf_t *buf) {
+ /*
+ * Get the pointer of the buffer.
+ */
+ return (buf->str);
+}
+
+size_t
+strbuf_size(idnconv_strbuf_t *buf) {
+ /*
+ * Get the allocated size of the buffer.
+ */
+ return (buf->size);
+}
+
+char *
+strbuf_copy(idnconv_strbuf_t *buf, const char *str) {
+ /*
+ * Copy STR to BUF.
+ */
+ size_t len = strlen(str);
+
+ if (strbuf_alloc(buf, len + 1) == NULL)
+ return (NULL);
+ strcpy(buf->str, str);
+ return (buf->str);
+}
+
+char *
+strbuf_append(idnconv_strbuf_t *buf, const char *str) {
+ /*
+ * Append STR to the end of BUF.
+ */
+ size_t len1 = strlen(buf->str);
+ size_t len2 = strlen(str);
+ char *p;
+#define MARGIN 50
+
+ p = strbuf_alloc(buf, len1 + len2 + 1 + MARGIN);
+ if (p != NULL)
+ strcpy(buf->str + len1, str);
+ return (p);
+}
+
+char *
+strbuf_alloc(idnconv_strbuf_t *buf, size_t size) {
+ /*
+ * Reallocate the buffer of BUF if needed
+ * so that BUF can hold SIZE bytes of data at least.
+ */
+ char *p;
+
+ if (buf->size >= size)
+ return (buf->str);
+ if (buf->str == buf->local_buf) {
+ if ((p = malloc(size)) == NULL)
+ return (NULL);
+ memcpy(p, buf->local_buf, sizeof(buf->local_buf));
+ } else {
+ if ((p = realloc(buf->str, size)) == NULL)
+ return (NULL);
+ }
+ buf->str = p;
+ buf->size = size;
+ return (buf->str);
+}
+
+char *
+strbuf_double(idnconv_strbuf_t *buf) {
+ /*
+ * Double the size of the buffer of BUF.
+ */
+ return (strbuf_alloc(buf, buf->size * 2));
+}
+
+char *
+strbuf_getline(idnconv_strbuf_t *buf, FILE *fp) {
+ /*
+ * Read a line from FP.
+ */
+ char s[256];
+
+ buf->str[0] = '\0';
+ while (fgets(s, sizeof(s), fp) != NULL) {
+ if (strbuf_append(buf, s) == NULL)
+ return (NULL);
+ if (strlen(s) < sizeof(s) - 1 || s[sizeof(s) - 2] == '\n')
+ return (buf->str);
+ }
+ if (buf->str[0] != '\0')
+ return (buf->str);
+ return (NULL);
+}
diff --git a/contrib/idn/idnkit-1.0-src/tools/idnconv/util.h b/contrib/idn/idnkit-1.0-src/tools/idnconv/util.h
new file mode 100644
index 0000000..43c5b41
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/idnconv/util.h
@@ -0,0 +1,96 @@
+/* $Id: util.h,v 1.1.1.1 2003/06/04 00:27:09 marka Exp $ */
+/*
+ * Copyright (c) 2000,2001 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IDN_IDNCONV_UTIL_H
+#define IDN_IDNCONV_UTIL_H 1
+
+#include <idn/res.h>
+
+#define IDNCONV_LOCALBUF_SIZE 512
+
+typedef struct {
+ char *str;
+ size_t size;
+ char local_buf[IDNCONV_LOCALBUF_SIZE];
+} idnconv_strbuf_t;
+
+extern idn_result_t selective_encode(idn_resconf_t conf,
+ idn_action_t actions, char *from,
+ char *to, int tolen);
+extern idn_result_t selective_decode(idn_resconf_t conf,
+ idn_action_t actions, char *from,
+ char *to, int tolen);
+extern void set_defaults(idn_resconf_t conf);
+extern void load_conf_file(idn_resconf_t conf, const char *file);
+extern void set_encoding_alias(const char *encoding_alias);
+extern void set_localcode(idn_resconf_t conf, const char *code);
+extern void set_idncode(idn_resconf_t conf, const char *code);
+extern void set_delimitermapper(idn_resconf_t conf,
+ unsigned long *delimiters,
+ int ndelimiters);
+extern void set_localmapper(idn_resconf_t conf,
+ char **mappers, int nmappers);
+extern void set_nameprep(idn_resconf_t conf, char *version);
+extern void set_mapper(idn_resconf_t conf,
+ char **mappers, int nmappers);
+extern void set_normalizer(idn_resconf_t conf,
+ char **normalizer, int nnormalizer);
+extern void set_prohibit_checkers(idn_resconf_t conf,
+ char **prohibits,
+ int nprohibits);
+extern void set_unassigned_checkers(idn_resconf_t conf,
+ char **unassigns,
+ int nunassigns);
+extern void errormsg(const char *fmt, ...);
+extern void strbuf_init(idnconv_strbuf_t *buf);
+extern void strbuf_reset(idnconv_strbuf_t *buf);
+extern char *strbuf_get(idnconv_strbuf_t *buf);
+extern size_t strbuf_size(idnconv_strbuf_t *buf);
+extern char *strbuf_copy(idnconv_strbuf_t *buf, const char *str);
+extern char *strbuf_append(idnconv_strbuf_t *buf, const char *str);
+extern char *strbuf_alloc(idnconv_strbuf_t *buf, size_t size);
+extern char *strbuf_double(idnconv_strbuf_t *buf);
+extern char *strbuf_getline(idnconv_strbuf_t *buf, FILE *fp);
+
+#endif /* IDN_IDNCONV_UTIL_H */
diff --git a/contrib/idn/idnkit-1.0-src/tools/make.wnt b/contrib/idn/idnkit-1.0-src/tools/make.wnt
new file mode 100644
index 0000000..60518f4
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/make.wnt
@@ -0,0 +1,57 @@
+# $Id: make.wnt,v 1.1.1.1 2003/06/04 00:27:05 marka Exp $
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+all : force
+ cd idnconv
+ $(MAKE) -f make.wnt
+ cd ..
+
+install : all
+ cd idnconv
+ $(MAKE) -f make.wnt install
+ cd ..
+
+clean : force
+ cd idnconv
+ $(MAKE) -f make.wnt clean
+ cd ..
+
+force:
diff --git a/contrib/idn/idnkit-1.0-src/tools/rpm/idnkit.spec b/contrib/idn/idnkit-1.0-src/tools/rpm/idnkit.spec
new file mode 100644
index 0000000..c740570
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/rpm/idnkit.spec
@@ -0,0 +1,142 @@
+%define prefix /usr
+%define sysconfdir /etc
+%define version 1.0
+
+# official/beta release:
+#define release 1
+#define distrel %{version}
+
+# release candidate:
+%define release rc1
+%define distrel %{version}-%{release}
+
+%define serial 2002051501
+
+%define name idnkit
+%define distsrc %{name}-%{distrel}-src
+
+Name: %{name}
+Version: %{version}
+Release: %{release}
+Copyright: distributable
+Group: System Environment
+Source: %{distsrc}.tar.gz
+BuildRoot: /var/tmp/%{name}-root
+Serial: %{serial}
+Summary: Internationalized Domain Name kit (idnkit/JPNIC)
+Vendor: JPNIC
+Packager: Japan Network Information Center
+
+%description
+idnkit is a kit for handling Internationalized Domain Name.
+
+%package devel
+Group: Development/Libraries
+Summary: The development files for idnkit
+
+%description devel
+The header files and libraries (libidnkit.a and libidnkitlite.a)
+to develop applications that use the libraries.
+
+%prep
+%setup -n %{distsrc}
+
+%build
+if [ -f /usr/lib/libiconv.a -o -f /usr/lib/libiconv.so ]
+then
+ if [ -f /lib/libc-2.0* ]
+ then
+ ICONV="--with-iconv=yes"
+ fi
+fi
+
+CFLAGS="$RPM_OPT_FLAGS" ./configure \
+ --prefix=%{prefix} --sysconfdir=%{sysconfdir} \
+ --enable-runidn \
+ $ICONV
+make
+
+%install
+rm -fr $RPM_BUILD_ROOT
+make DESTDIR=$RPM_BUILD_ROOT install
+mv $RPM_BUILD_ROOT/etc/idn.conf.sample $RPM_BUILD_ROOT/etc/idn.conf
+mv $RPM_BUILD_ROOT/etc/idnalias.conf.sample $RPM_BUILD_ROOT/etc/idnalias.conf
+
+# devel kit
+#install -c lib/libidnkit.a $RPM_BUILD_ROOT/usr/lib
+#cp -r include/idn $RPM_BUILD_ROOT/usr/include
+
+# docs
+mkdir rpm_docs
+(cp NEWS INSTALL INSTALL.ja DISTFILES README.ja README LICENSE.txt \
+ ChangeLog rpm_docs)
+cp -r patch rpm_docs
+
+%clean
+rm -fr $RPM_BUILD_ROOT
+
+%files
+%defattr(-, root, root)
+%{prefix}/bin/idnconv
+%{prefix}/bin/runidn
+%{prefix}/lib/libidnkit.so.*
+%{prefix}/lib/libidnkitlite.so.*
+%{prefix}/lib/libidnkitres.so.*
+%{prefix}/share/idnkit/*
+%config %{sysconfdir}/idn.conf
+%config %{sysconfdir}/idnalias.conf
+%attr(0644, root, root) %config(noreplace)
+%attr(0644, root, man) %{prefix}/man/man1/*
+%attr(0644, root, man) %{prefix}/man/man3/*
+%attr(0644, root, man) %{prefix}/man/man5/*
+%doc rpm_docs/*
+
+%files devel
+%defattr(-, root, root)
+%{prefix}/lib/libidnkit.a
+%{prefix}/lib/libidnkit.la
+%{prefix}/lib/libidnkit.so
+%{prefix}/lib/libidnkitlite.a
+%{prefix}/lib/libidnkitlite.la
+%{prefix}/lib/libidnkitlite.so
+%{prefix}/lib/libidnkitres.a
+%{prefix}/lib/libidnkitres.la
+%{prefix}/lib/libidnkitres.so
+%{prefix}/include/idn/*
+
+%changelog
+* Web May 15 2002 Motoyuki Kasahara <m-kasahr@sra.co.jp>
+- 1.0beta2, experimental.
+
+* Mon May 28 2001 MANABE Takashi <manabe@dsl.gr.jp>
+- include runmdn, libmdnresolv
+
+* Mon Apr 4 2001 Motoyuki Kasahara <m-kasahr@sra.co.jp>
+- 2.1 release
+
+* Mon Apr 4 2001 Motoyuki Kasahara <m-kasahr@sra.co.jp>
+- 2.0.1 release
+
+* Mon Apr 2 2001 MANABE Takashi <manabe@dsl.gr.jp>
+- 2.0 release
+
+* Fri Mar 3 2001 MANABE Takashi <manabe@dsl.gr.jp>
+- 1.3 release
+
+* Mon Dec 6 2000 MANABE Takashi <manabe@dsl.gr.jp>
+- add brace/lace functions to libmdnresolv(mdnkit-1.2-runmdn.patch)
+- include /var/dnsproxy
+- change files section for compressed man pages
+
+* Mon Nov 27 2000 Makoto Ishisone <ishisone@sra.co.jp>
+- 1.2 release
+
+* Thu Nov 2 2000 MANABE Takashi <manabe@dsl.gr.jp>
+- 1.1 release
+
+* Fri Oct 27 2000 MANABE Takashi <manabe@dsl.gr.jp>
+- dnsproxy.patch1
+- move libmdnresolv.{la,so} from mdnkit-devel to mdnkit package
+
+* Wed Oct 18 2000 MANABE Takashi <manabe@dsl.gr.jp>
+- 1.0 release
diff --git a/contrib/idn/idnkit-1.0-src/tools/runidn/Makefile.in b/contrib/idn/idnkit-1.0-src/tools/runidn/Makefile.in
new file mode 100644
index 0000000..c3098ff
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/runidn/Makefile.in
@@ -0,0 +1,167 @@
+# $Id: Makefile.in,v 1.1.1.1 2003/06/04 00:27:11 marka Exp $
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+LIB_CURRENT = 1
+LIB_REVISION = 1
+LIB_AGE = 0
+
+.SUFFIXES:
+.SUFFIXES: .c .lo
+
+top_builddir = ../..
+subdir = tools/runidn
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+libdir = @libdir@
+mandir = @mandir@
+man1dir = $(mandir)/man1
+
+CC = @CC@
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
+SHELL = @SHELL@
+LIBTOOL = @LIBTOOL@
+
+ICONVINC = @ICONVINC@
+ICONVLIB = @ICONVLIB@
+
+INCS = -I$(srcdir) -I$(srcdir)/../../include -I../../include $(ICONVINC)
+DEFS =
+
+CFLAGS = $(INCS) $(DEFS) @CPPFLAGS@ @CFLAGS@
+LDFLAGS = @LDFLAGS@
+
+LIB = libidnkitres
+OBJS = rtresolver.lo stub.lo $(IDNOBJS)
+SCRIPT = runidn
+LIBDL = @LIBDL@
+
+IDNDIR = ../../lib
+IDNOBJS = \
+ $(IDNDIR)/aliaslist.lo \
+ $(IDNDIR)/api.lo \
+ $(IDNDIR)/checker.lo \
+ $(IDNDIR)/converter.lo \
+ $(IDNDIR)/debug.lo \
+ $(IDNDIR)/delimitermap.lo \
+ $(IDNDIR)/filechecker.lo \
+ $(IDNDIR)/filemapper.lo \
+ $(IDNDIR)/localencoding.lo \
+ $(IDNDIR)/log.lo \
+ $(IDNDIR)/mapper.lo \
+ $(IDNDIR)/mapselector.lo \
+ $(IDNDIR)/nameprep.lo \
+ $(IDNDIR)/normalizer.lo \
+ $(IDNDIR)/punycode.lo \
+ $(IDNDIR)/race.lo \
+ $(IDNDIR)/res.lo \
+ $(IDNDIR)/resconf.lo \
+ $(IDNDIR)/result.lo \
+ $(IDNDIR)/strhash.lo \
+ $(IDNDIR)/ucsmap.lo \
+ $(IDNDIR)/ucsset.lo \
+ $(IDNDIR)/unicode.lo \
+ $(IDNDIR)/unormalize.lo \
+ $(IDNDIR)/ucs4.lo \
+ $(IDNDIR)/utf8.lo \
+ $(IDNDIR)/util.lo \
+ $(IDNDIR)/version.lo
+
+.c.lo:
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $<
+
+@RUNIDN_TRUE@all: $(LIB).la runidn
+@RUNIDN_FALSE@all:
+
+rtresolver.lo: $(srcdir)/resolver.c
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -DFOR_RUNIDN -o $@ \
+ -c $(srcdir)/resolver.c
+
+$(LIB).la: $(OBJS)
+ $(LIBTOOL) --mode=link $(LD) $(LDFLAGS) -o $@ \
+ -version-info $(LIB_CURRENT):$(LIB_REVISION):$(LIB_AGE) \
+ -module -rpath $(libdir) $(OBJS) $(LIBDL)
+
+runidn: $(srcdir)/runidn.in
+ cd $(top_builddir) && \
+ CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= CONFIG_LINKS= \
+ $(SHELL) ./config.status
+
+@RUNIDN_TRUE@@COMPAT_TRUE@install: all install-runidn install-compat
+@RUNIDN_TRUE@@COMPAT_FALSE@install: all install-runidn
+@RUNIDN_FALSE@install:
+
+install-runidn:
+ $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
+ $(LIBTOOL) --mode=install $(INSTALL_DATA) $(LIB).la \
+ $(DESTDIR)$(libdir)/$(LIB).la
+ $(MKINSTALLDIRS) $(DESTDIR)$(bindir)
+ $(INSTALL_SCRIPT) $(SCRIPT) $(DESTDIR)$(bindir)
+ $(MKINSTALLDIRS) $(DESTDIR)$(man1dir)
+ $(INSTALL_DATA) $(srcdir)/runidn.1 $(DESTDIR)$(man1dir)/runidn.1
+
+install-compat:
+ src=$(DESTDIR)$(bindir)/runidn; \
+ dst=$(DESTDIR)$(bindir)/runmdn; \
+ rm -f $$dst; \
+ ln $$src $$dst || cp $$src $$dst
+ src=$(DESTDIR)$(man1dir)/runidn.1; \
+ dst=$(DESTDIR)$(man1dir)/runmdn.1; \
+ rm -f $$dst; \
+ ln $$src $$dst || cp $$src $$dst
+
+clean:
+ rm -f *.lo *.la *.o
+ rm -fr .libs/
+
+distclean: clean
+ rm -f runidn Makefile
+
+test check:
diff --git a/contrib/idn/idnkit-1.0-src/tools/runidn/resolver.c b/contrib/idn/idnkit-1.0-src/tools/runidn/resolver.c
new file mode 100644
index 0000000..129c704
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/runidn/resolver.c
@@ -0,0 +1,1056 @@
+#ifndef lint
+static char *rcsid = "$Id: resolver.c,v 1.1.1.1 2003/06/04 00:27:12 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stddef.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <errno.h>
+
+#include <idn/api.h>
+#include <idn/log.h>
+#include <idn/logmacro.h>
+#include <idn/debug.h>
+
+#ifdef FOR_RUNIDN
+/*
+ * This file is specially compiled for runidn.
+ * runidn replaces existing resolver functions dynamically with ones
+ * with IDN processing (encoding conversion and normalization).
+ * So entry names must be same as the system's one.
+ */
+#include "stub.h"
+
+#define ENTRY(name) name
+#define REAL(name) idn_stub_ ## name
+#else
+/*
+ * For normal use. All the entry names are prefixed with "idn_resolver_".
+ * <idn/resolver.h> has bunch of #defines to substitute the standard
+ * name resolver functions with ones provided here.
+ */
+#include "resolver.h"
+#undef gethostbyname
+#undef gethostbyname2
+#undef gethostbyaddr
+#undef gethostbyname_r
+#undef gethostbyname2_r
+#undef gethostbyaddr_r
+#undef getipnodebyname
+#undef getipnodebyaddr
+#undef getaddrinfo
+#undef getnameinfo
+
+#define ENTRY(name) idn_resolver_ ## name
+#define REAL(name) name
+#endif
+
+#define IDN_NAME_SIZE 512
+
+#define IDN_HOSTBUF_SIZE 2048
+typedef union {
+ char *dummy_for_alignment;
+ char data[IDN_HOSTBUF_SIZE];
+} hostbuf_t;
+
+typedef struct obj_lock {
+ void *key;
+ struct obj_lock *next;
+} obj_lock_t;
+
+#define OBJLOCKHASH_SIZE 127
+static obj_lock_t *obj_lock_hash[OBJLOCKHASH_SIZE];
+
+/*
+ * This variable is to prevent IDN processing occuring more than once for
+ * a single name resolution. This will happen if some resolver function
+ * is implemented using another function (e.g. gethostbyname() implemented
+ * using gethostbyname2()).
+ * No, using the static variable is not a correct thing to do for a multi-
+ * threading environment, but I don't think of a better solution..
+ */
+static int idn_isprocessing = 0;
+
+static int obj_hash(void *key);
+static int obj_islocked(void *key);
+static void obj_lock(void *key);
+static void obj_unlock(void *key);
+static struct hostent *copy_decode_hostent_static(struct hostent *hp,
+ struct hostent *newhp,
+ char *buf, size_t buflen,
+ int *errp);
+static char *decode_name_dynamic(const char *name);
+static struct hostent *copy_decode_hostent_dynamic(struct hostent *hp,
+ int *errp);
+static void free_copied_hostent(struct hostent *hp);
+#ifdef HAVE_GETADDRINFO
+static struct addrinfo *copy_decode_addrinfo_dynamic(struct addrinfo *aip);
+#endif
+#ifdef HAVE_FREEADDRINFO
+static void free_copied_addrinfo(struct addrinfo *aip);
+#endif
+
+/*
+ * Object locking facility.
+ */
+
+static int
+obj_hash(void *key) {
+ /*
+ * Hash function for obj_*.
+ * 'key' is supposed to be an address.
+ */
+ unsigned long v = (unsigned long)key;
+
+ return ((v >> 3) % OBJLOCKHASH_SIZE);
+}
+
+static int
+obj_islocked(void *key)
+{
+ /*
+ * Check if the object specified by 'key' is locked.
+ * Return 1 if so, 0 otherwise.
+ */
+ int h = obj_hash(key);
+ obj_lock_t *olp = obj_lock_hash[h];
+
+ while (olp != NULL) {
+ if (olp->key == key)
+ return (1);
+ olp = olp->next;
+ }
+ return (0);
+}
+
+static void
+obj_lock(void *key)
+{
+ /*
+ * Lock an object specified by 'key'.
+ */
+ int h = obj_hash(key);
+ obj_lock_t *olp;
+
+ olp = malloc(sizeof(obj_lock_t));
+ if (olp != NULL) {
+ olp->key = key;
+ olp->next = obj_lock_hash[h];
+ obj_lock_hash[h] = olp;
+ }
+}
+
+static void
+obj_unlock(void *key)
+{
+ /*
+ * Unlock an object specified by 'key'.
+ */
+ int h = obj_hash(key);
+ obj_lock_t *olp, *olp0;
+
+ olp = obj_lock_hash[h];
+ olp0 = NULL;
+ while (olp != NULL) {
+ if (olp->key == key) {
+ if (olp0 == NULL)
+ obj_lock_hash[h] = olp->next;
+ else
+ olp0->next = olp->next;
+ free(olp);
+ return;
+ }
+ olp0 = olp;
+ olp = olp->next;
+ }
+}
+
+static struct hostent *
+copy_decode_hostent_static(struct hostent *hp, struct hostent *newhp,
+ char *buf, size_t buflen, int *errp)
+{
+ /*
+ * Copy "struct hostent" data referenced by 'hp' to 'newhp'.
+ * It's a deep-copy, meaning all the data referenced by 'hp' are
+ * also copied. They are copied into 'buf', whose length is 'buflen'.
+ * The domain names ('hp->h_name' and 'hp->h_aliases') are
+ * decoded from ACE to the local encoding before they are copied.
+ * If 'buf' is too small to hold all the data, NULL will be
+ * returned and '*errp' is set to NO_RECOVERY.
+ */
+ int naliases = 0;
+ int naddrs = 0;
+
+ if (hp == NULL)
+ return (NULL);
+
+ *newhp = *hp;
+
+ if (hp->h_aliases != NULL) {
+ /*
+ * Allocate aliase table in 'buf'.
+ */
+ size_t sz;
+
+ while (hp->h_aliases[naliases] != NULL)
+ naliases++;
+
+ newhp->h_aliases = (char **)buf;
+ sz = sizeof(char *) * (naliases + 1);
+
+ if (buflen < sz)
+ goto overflow;
+
+ buf += sz;
+ buflen -= sz;
+ }
+
+ if (hp->h_addr_list != NULL) {
+ /*
+ * Allocate address table in 'buf'.
+ */
+ size_t sz;
+ int i;
+
+ while (hp->h_addr_list[naddrs] != NULL)
+ naddrs++;
+
+ newhp->h_addr_list = (char **)buf;
+ sz = sizeof(char *) * (naddrs + 1);
+
+ if (buflen < sz)
+ goto overflow;
+
+ buf += sz;
+ buflen -= sz;
+
+ /*
+ * Copy the addresses.
+ */
+ sz = hp->h_length * naddrs;
+ if (buflen < sz)
+ goto overflow;
+
+ for (i = 0; i < naddrs; i++) {
+ newhp->h_addr_list[i] = buf;
+ memcpy(buf, hp->h_addr_list[i], hp->h_length);
+ buf += hp->h_length;
+ }
+ newhp->h_addr_list[naddrs] = NULL;
+
+ buf += sz;
+ buflen -= sz;
+ }
+
+ if (hp->h_name != NULL) {
+ /*
+ * Decode the name in h_name.
+ */
+ idn_result_t r;
+ size_t slen;
+
+ idn_enable(1);
+ idn_nameinit(1);
+ r = idn_decodename(IDN_DECODE_APP, hp->h_name,
+ buf, buflen);
+ switch (r) {
+ case idn_success:
+ newhp->h_name = buf;
+ break;
+ default:
+ /* Copy hp->h_name verbatim. */
+ if (strlen(hp->h_name) + 1 <= buflen) {
+ newhp->h_name = buf;
+ strcpy(buf, hp->h_name);
+ break;
+ }
+ /* falllthrough */
+ case idn_buffer_overflow:
+ goto overflow;
+ }
+
+ slen = strlen(buf) + 1;
+ buf += slen;
+ buflen -= slen;
+ }
+
+ if (hp->h_aliases != NULL) {
+ /*
+ * Decode the names in h_aliases.
+ */
+ char **aliases = hp->h_aliases;
+ char **newaliases = newhp->h_aliases;
+ int i;
+
+ for (i = 0; i < naliases; i++) {
+ idn_result_t r;
+ size_t slen;
+
+ idn_enable(1);
+ idn_nameinit(1);
+ r = idn_decodename(IDN_DECODE_APP, aliases[i],
+ buf, buflen);
+
+ switch (r) {
+ case idn_success:
+ newaliases[i] = buf;
+ break;
+ default:
+ /* Copy hp->h_name verbatim. */
+ if (strlen(aliases[i]) + 1 <= buflen) {
+ newaliases[i] = buf;
+ strcpy(buf, aliases[i]);
+ break;
+ }
+ /* falllthrough */
+ case idn_buffer_overflow:
+ goto overflow;
+ }
+
+ slen = strlen(buf) + 1;
+ buf += slen;
+ buflen -= slen;
+ }
+ newaliases[naliases] = NULL;
+ }
+
+ return (newhp);
+
+ overflow:
+ *errp = NO_RECOVERY;
+ return (NULL);
+}
+
+static char *
+decode_name_dynamic(const char *name) {
+ idn_result_t r;
+ char buf[IDN_NAME_SIZE];
+ char *s;
+
+ idn_enable(1);
+ idn_nameinit(1);
+ r = idn_decodename(IDN_DECODE_APP, name, buf, sizeof(buf));
+ if (r == idn_success) {
+ name = buf;
+ }
+ s = malloc(strlen(name) + 1);
+ if (s == NULL)
+ return (NULL);
+ else
+ return (strcpy(s, name));
+}
+
+static struct hostent *
+copy_decode_hostent_dynamic(struct hostent *hp, int *errp) {
+ /*
+ * Make a deep-copy of the data referenced by 'hp', and return
+ * a pointer to the copied data.
+ * All the data are dynamically allocated using malloc().
+ * The domain names ('hp->h_name' and 'hp->h_aliases') are
+ * decoded from ACE to the local encoding before they are copied.
+ * If malloc() fails, NULL will be returned and '*errp' is set to
+ * NO_RECOVERY.
+ */
+ struct hostent *newhp;
+ char **pp;
+ size_t alloc_size;
+ int naliases = 0;
+ int naddrs = 0;
+ int i;
+
+ if (hp == NULL)
+ return (NULL);
+
+ if (hp->h_aliases != NULL) {
+ while (hp->h_aliases[naliases] != NULL)
+ naliases++;
+ }
+
+ if (hp->h_addr_list != NULL) {
+ while (hp->h_addr_list[naddrs] != NULL)
+ naddrs++;
+ }
+
+ alloc_size = sizeof(struct hostent) +
+ sizeof(char *) * (naliases + 1) +
+ sizeof(char *) * (naddrs + 1) +
+ hp->h_length * naddrs;
+
+ if ((newhp = malloc(alloc_size)) == NULL) {
+ return (hp);
+ }
+
+ memset(newhp, 0, alloc_size);
+
+ pp = (char **)(newhp + 1);
+
+ if (hp->h_name != NULL) {
+ newhp->h_name = decode_name_dynamic(hp->h_name);
+ if (newhp->h_name == NULL)
+ goto alloc_fail;
+ }
+
+ newhp->h_addrtype = hp->h_addrtype;
+ newhp->h_length = hp->h_length;
+
+ if (hp->h_aliases != NULL) {
+ newhp->h_aliases = pp;
+ for (i = 0; i < naliases; i++) {
+ newhp->h_aliases[i] =
+ decode_name_dynamic(hp->h_aliases[i]);
+ if (newhp->h_aliases[i] == NULL)
+ goto alloc_fail;
+ }
+ newhp->h_aliases[naliases] = NULL;
+ pp += naliases + 1;
+ }
+
+ if (hp->h_addr_list != NULL) {
+ char *p;
+
+ newhp->h_addr_list = pp;
+ pp += naddrs + 1;
+ p = (char *)pp;
+
+ for (i = 0; i < naddrs; i++) {
+ newhp->h_addr_list[i] = p;
+ memcpy(p, hp->h_addr_list[i], hp->h_length);
+ p += hp->h_length;
+ }
+ newhp->h_addr_list[naddrs] = NULL;
+ }
+
+ return (newhp);
+
+ alloc_fail:
+ free_copied_hostent(hp);
+ *errp = NO_RECOVERY;
+ return (NULL);
+}
+
+static void
+free_copied_hostent(struct hostent *hp) {
+ /*
+ * Free all the memory allocated by copy_decode_hostent_dynamic().
+ */
+ if (hp->h_name != NULL)
+ free(hp->h_name);
+ if (hp->h_aliases != NULL) {
+ char **pp = hp->h_aliases;
+ while (*pp != NULL)
+ free(*pp++);
+ }
+ free(hp);
+}
+
+#ifdef HAVE_GETNAMEINFO
+static struct addrinfo *
+copy_decode_addrinfo_dynamic(struct addrinfo *aip) {
+ struct addrinfo *newaip;
+
+ if (aip == NULL)
+ return (NULL);
+
+ newaip = malloc(sizeof(struct addrinfo) + aip->ai_addrlen);
+ if (newaip == NULL)
+ return (NULL);
+
+ *newaip = *aip;
+ newaip->ai_addr = (struct sockaddr *)(newaip + 1);
+ memcpy(newaip->ai_addr, aip->ai_addr, aip->ai_addrlen);
+
+ if (newaip->ai_canonname != NULL)
+ newaip->ai_canonname = decode_name_dynamic(aip->ai_canonname);
+
+ newaip->ai_next = copy_decode_addrinfo_dynamic(aip->ai_next);
+ return (newaip);
+}
+#endif
+
+#ifdef HAVE_FREEADDRINFO
+static void
+free_copied_addrinfo(struct addrinfo *aip) {
+ while (aip != NULL) {
+ struct addrinfo *next = aip->ai_next;
+
+ if (aip->ai_canonname != NULL)
+ free(aip->ai_canonname);
+ free(aip);
+ aip = next;
+ }
+}
+#endif
+
+#ifdef HAVE_GETHOSTBYNAME
+struct hostent *
+ENTRY(gethostbyname)(const char *name) {
+ static hostbuf_t buf;
+ static struct hostent he;
+ idn_result_t r;
+ struct hostent *hp;
+
+ if (idn_isprocessing)
+ return (REAL(gethostbyname)(name));
+
+ TRACE(("gethostbyname(name=%s)\n", idn__debug_xstring(name, 60)));
+
+ idn_isprocessing = 1;
+ idn_enable(1);
+ idn_nameinit(1);
+ r = idn_encodename(IDN_ENCODE_APP, name, buf.data, sizeof(buf));
+ if (r == idn_success)
+ name = buf.data;
+
+ hp = copy_decode_hostent_static(REAL(gethostbyname)(name),
+ &he, buf.data, sizeof(buf),
+ &h_errno);
+ idn_isprocessing = 0;
+ return (hp);
+}
+#endif
+
+#ifdef HAVE_GETHOSTBYNAME2
+struct hostent *
+ENTRY(gethostbyname2)(const char *name, int af) {
+ static hostbuf_t buf;
+ static struct hostent he;
+ idn_result_t r;
+ struct hostent *hp;
+
+ if (idn_isprocessing)
+ return (REAL(gethostbyname2)(name, af));
+
+ TRACE(("gethostbyname2(name=%s)\n", idn__debug_xstring(name, 60), af));
+
+ idn_isprocessing = 1;
+ idn_enable(1);
+ idn_nameinit(1);
+ r = idn_encodename(IDN_ENCODE_APP, name, buf.data, sizeof(buf));
+ if (r == idn_success)
+ name = buf.data;
+
+ hp = copy_decode_hostent_static(REAL(gethostbyname2)(name, af),
+ &he, buf.data, sizeof(buf),
+ &h_errno);
+ idn_isprocessing = 0;
+ return (hp);
+}
+#endif
+
+#ifdef HAVE_GETHOSTBYADDR
+struct hostent *
+ENTRY(gethostbyaddr)(GHBA_ADDR_T addr, GHBA_ADDRLEN_T len, int type) {
+ static hostbuf_t buf;
+ static struct hostent he;
+ struct hostent *hp;
+
+ if (idn_isprocessing)
+ return (REAL(gethostbyaddr)(addr, len, type));
+
+ TRACE(("gethostbyaddr()\n"));
+
+ idn_isprocessing = 1;
+ hp = copy_decode_hostent_static(REAL(gethostbyaddr)(addr, len, type),
+ &he, buf.data, sizeof(buf),
+ &h_errno);
+ idn_isprocessing = 0;
+ return (hp);
+}
+#endif
+
+#ifdef GETHOST_R_GLIBC_FLAVOR
+
+#ifdef HAVE_GETHOSTBYNAME_R
+int
+ENTRY(gethostbyname_r)(const char *name, struct hostent *result,
+ char *buffer, size_t buflen,
+ struct hostent **rp, int *errp)
+{
+ char namebuf[IDN_NAME_SIZE];
+ char *data;
+ size_t datalen;
+ idn_result_t r;
+ struct hostent he;
+ hostbuf_t buf;
+ int n;
+
+ if (idn_isprocessing)
+ return (REAL(gethostbyname_r)(name, result, buffer,
+ buflen, rp, errp));
+
+ TRACE(("gethostbyname_r(name=%s,buflen=%d)\n",
+ idn__debug_xstring(name, 60), buflen));
+
+ if (buflen <= sizeof(buf)) {
+ data = buf.data;
+ datalen = sizeof(buf);
+ } else {
+ data = malloc(buflen);
+ datalen = buflen;
+ if (data == NULL) {
+ *errp = NO_RECOVERY;
+ return (ENOMEM);
+ }
+ }
+
+ idn_isprocessing = 1;
+ idn_enable(1);
+ idn_nameinit(1);
+ r = idn_encodename(IDN_ENCODE_APP, name, namebuf, sizeof(namebuf));
+ if (r == idn_success)
+ name = namebuf;
+
+ *errp = 0;
+ n = REAL(gethostbyname_r)(name, &he, data, datalen, rp, errp);
+
+ if (n == 0 && *rp != NULL)
+ *rp = copy_decode_hostent_static(*rp, result, buffer, buflen,
+ errp);
+ idn_isprocessing = 0;
+
+ if (data != buf.data)
+ free(data);
+
+ if (*errp != 0)
+ n = EINVAL; /* XXX */
+
+ return (n);
+}
+#endif
+
+#ifdef HAVE_GETHOSTBYNAME2_R
+int
+ENTRY(gethostbyname2_r)(const char *name, int af, struct hostent *result,
+ char *buffer, size_t buflen,
+ struct hostent **rp, int *errp)
+{
+ char namebuf[IDN_NAME_SIZE];
+ char *data;
+ size_t datalen;
+ idn_result_t r;
+ struct hostent he;
+ hostbuf_t buf;
+ int n;
+
+ if (idn_isprocessing)
+ return (REAL(gethostbyname2_r)(name, af, result, buffer,
+ buflen, rp, errp));
+
+ TRACE(("gethostbyname2_r(name=%s,buflen=%d)\n",
+ idn__debug_xstring(name, 60), buflen));
+
+ if (buflen <= sizeof(buf)) {
+ data = buf.data;
+ datalen = sizeof(buf);
+ } else {
+ data = malloc(buflen);
+ datalen = buflen;
+ if (data == NULL) {
+ *errp = NO_RECOVERY;
+ return (ENOMEM);
+ }
+ }
+
+ idn_isprocessing = 1;
+ idn_enable(1);
+ idn_nameinit(1);
+ r = idn_encodename(IDN_ENCODE_APP, name, namebuf, sizeof(namebuf));
+ if (r == idn_success)
+ name = namebuf;
+
+ n = REAL(gethostbyname2_r)(name, af, &he, data, datalen, rp, errp);
+
+ if (n == 0 && *rp != NULL)
+ *rp = copy_decode_hostent_static(*rp, result, buffer, buflen,
+ errp);
+ idn_isprocessing = 0;
+
+ if (data != buf.data)
+ free(data);
+
+ if (*errp != 0)
+ n = EINVAL; /* XXX */
+
+ return (n);
+}
+#endif
+
+#ifdef HAVE_GETHOSTBYADDR_R
+int
+ENTRY(gethostbyaddr_r)(GHBA_ADDR_T addr, GHBA_ADDRLEN_T len, int type,
+ struct hostent *result,
+ char *buffer, size_t buflen,
+ struct hostent **rp, int *errp)
+{
+ char *data;
+ size_t datalen;
+ struct hostent he;
+ hostbuf_t buf;
+ int n;
+
+ if (idn_isprocessing) {
+ return (REAL(gethostbyaddr_r)(addr, len, type, result,
+ buffer, buflen, rp, errp));
+ }
+
+ TRACE(("gethostbyaddr_r(buflen=%d)\n", buflen));
+
+ if (buflen <= sizeof(buf)) {
+ data = buf.data;
+ datalen = sizeof(buf);
+ } else {
+ data = malloc(buflen);
+ datalen = buflen;
+ if (data == NULL) {
+ *errp = NO_RECOVERY;
+ return (ENOMEM);
+ }
+ }
+
+ idn_isprocessing = 1;
+ n = REAL(gethostbyaddr_r)(addr, len, type, &he,
+ data, datalen, rp, errp);
+
+ if (n == 0 && *rp != NULL)
+ *rp = copy_decode_hostent_static(*rp, result, buffer, buflen,
+ errp);
+ idn_isprocessing = 0;
+
+ if (data != buf.data)
+ free(data);
+
+ if (*errp != 0)
+ n = EINVAL; /* XXX */
+
+ return (0);
+}
+#endif
+
+#else /* GETHOST_R_GLIBC_FLAVOR */
+
+#ifdef HAVE_GETHOSTBYNAME_R
+struct hostent *
+ENTRY(gethostbyname_r)(const char *name, struct hostent *result,
+ char *buffer, int buflen, int *errp)
+{
+ char namebuf[IDN_NAME_SIZE];
+ char *data;
+ size_t datalen;
+ idn_result_t r;
+ struct hostent *hp, he;
+ hostbuf_t buf;
+
+ if (idn_isprocessing)
+ return (REAL(gethostbyname_r)(name, result, buffer,
+ buflen, errp));
+
+ TRACE(("gethostbyname_r(name=%s,buflen=%d)\n",
+ idn__debug_xstring(name, 60), buflen));
+
+ if (buflen <= sizeof(buf)) {
+ data = buf.data;
+ datalen = sizeof(buf);
+ } else {
+ data = malloc(buflen);
+ datalen = buflen;
+ if (data == NULL) {
+ *errp = NO_RECOVERY;
+ return (NULL);
+ }
+ }
+
+ idn_isprocessing = 1;
+ idn_enable(1);
+ idn_nameinit(1);
+ r = idn_encodename(IDN_ENCODE_APP, name, namebuf, sizeof(namebuf));
+ if (r == idn_success)
+ name = namebuf;
+
+ hp = REAL(gethostbyname_r)(name, &he, data, datalen, errp);
+
+ if (hp != NULL)
+ hp = copy_decode_hostent_static(hp, result, buffer, buflen,
+ errp);
+ idn_isprocessing = 0;
+
+ if (data != buf.data)
+ free(data);
+
+ return (hp);
+}
+#endif
+
+#ifdef HAVE_GETHOSTBYADDR_R
+struct hostent *
+ENTRY(gethostbyaddr_r)(GHBA_ADDR_T addr, GHBA_ADDRLEN_T len, int type,
+ struct hostent *result,
+ char *buffer, int buflen, int *errp)
+{
+ char *data;
+ size_t datalen;
+ struct hostent *hp, he;
+ hostbuf_t buf;
+
+ if (idn_isprocessing) {
+ return (REAL(gethostbyaddr_r)(addr, len, type, result,
+ buffer, buflen, errp));
+ }
+
+ TRACE(("gethostbyaddr_r(buflen=%d)\n", buflen));
+
+ if (buflen <= sizeof(buf)) {
+ data = buf.data;
+ datalen = sizeof(buf);
+ } else {
+ data = malloc(buflen);
+ datalen = buflen;
+ if (data == NULL) {
+ *errp = NO_RECOVERY;
+ return (NULL);
+ }
+ }
+
+ idn_isprocessing = 1;
+ hp = REAL(gethostbyaddr_r)(addr, len, type, &he, data, datalen, errp);
+
+ if (hp != NULL)
+ hp = copy_decode_hostent_static(hp, result, buffer, buflen,
+ errp);
+ idn_isprocessing = 0;
+
+ if (data != buf.data)
+ free(data);
+
+ return (hp);
+}
+#endif
+
+#endif /* GETHOST_R_GLIBC_FLAVOR */
+
+#ifdef HAVE_GETIPNODEBYNAME
+struct hostent *
+ENTRY(getipnodebyname)(const char *name, int af, int flags, int *errp) {
+ char namebuf[IDN_NAME_SIZE];
+ idn_result_t r;
+ struct hostent *hp;
+
+ if (idn_isprocessing)
+ return (REAL(getipnodebyname)(name, af, flags, errp));
+
+ TRACE(("getipnodebyname(name=%s)\n", idn__debug_xstring(name, 60), af));
+
+ idn_isprocessing = 1;
+ idn_enable(1);
+ idn_nameinit(1);
+ r = idn_encodename(IDN_ENCODE_APP, name, namebuf, sizeof(namebuf));
+ if (r == idn_success)
+ name = namebuf;
+
+ hp = REAL(getipnodebyname)(name, af, flags, errp);
+ if (hp != NULL) {
+ struct hostent *newhp = copy_decode_hostent_dynamic(hp, errp);
+ if (newhp != hp) {
+ REAL(freehostent)(hp);
+ obj_lock(newhp);
+ hp = newhp;
+ }
+ }
+ idn_isprocessing = 0;
+ return (hp);
+}
+#endif
+
+#ifdef HAVE_GETIPNODEBYADDR
+struct hostent *
+ENTRY(getipnodebyaddr)(const void *src, size_t len, int af, int *errp) {
+ struct hostent *hp;
+
+ if (idn_isprocessing)
+ return (REAL(getipnodebyaddr)(src, len, af, errp));
+
+ TRACE(("getipnodebyaddr()\n"));
+
+ idn_isprocessing = 1;
+ hp = REAL(getipnodebyaddr)(src, len, af, errp);
+ if (hp != NULL) {
+ struct hostent *newhp = copy_decode_hostent_dynamic(hp, errp);
+ if (newhp != hp) {
+ REAL(freehostent)(hp);
+ obj_lock(newhp);
+ hp = newhp;
+ }
+ }
+ idn_isprocessing = 0;
+ return (hp);
+}
+#endif
+
+#ifdef HAVE_FREEHOSTENT
+void
+ENTRY(freehostent)(struct hostent *hp) {
+ TRACE(("freehostent(hp=%p)\n", (void *)hp));
+
+ if (obj_islocked(hp)) {
+ /*
+ * We allocated the data.
+ */
+ obj_unlock(hp);
+ free_copied_hostent(hp);
+ } else {
+ /*
+ * It was allocated the original getipnodeby*().
+ */
+ REAL(freehostent)(hp);
+ }
+}
+#endif
+
+#ifdef HAVE_GETADDRINFO
+int
+ENTRY(getaddrinfo)(const char *nodename, const char *servname,
+ const struct addrinfo *hints, struct addrinfo **res)
+{
+ char namebuf[IDN_NAME_SIZE];
+ idn_result_t r;
+ struct addrinfo *aip;
+ int err;
+
+ if (nodename == NULL || idn_isprocessing)
+ return (REAL(getaddrinfo)(nodename, servname, hints, res));
+
+ TRACE(("getaddrinfo(nodename=%s)\n", idn__debug_xstring(nodename, 60)));
+
+ idn_isprocessing = 1;
+ idn_enable(1);
+ idn_nameinit(1);
+ r = idn_encodename(IDN_ENCODE_APP, nodename,
+ namebuf, sizeof(namebuf));
+ if (r == idn_success)
+ nodename = namebuf;
+
+ err = REAL(getaddrinfo)(nodename, servname, hints, &aip);
+ if (err == 0 && aip != NULL) {
+ *res = copy_decode_addrinfo_dynamic(aip);
+ if (*res == NULL)
+ err = EAI_FAIL;
+ else
+ obj_lock(*res);
+ if (aip != NULL)
+ REAL(freeaddrinfo)(aip);
+ }
+ idn_isprocessing = 0;
+ return (err);
+}
+#endif
+
+#ifdef HAVE_FREEADDRINFO
+void
+ENTRY(freeaddrinfo)(struct addrinfo *aip) {
+ TRACE(("freeaddrinfo(aip=%p)\n", (void *)aip));
+
+ if (obj_islocked(aip)) {
+ /*
+ * We allocated the data.
+ */
+ obj_unlock(aip);
+ free_copied_addrinfo(aip);
+ } else {
+ /*
+ * It was allocated the original getaddrinfo().
+ */
+ REAL(freeaddrinfo)(aip);
+ }
+}
+#endif
+
+#ifdef HAVE_GETNAMEINFO
+int
+ENTRY(getnameinfo)(const struct sockaddr *sa, GNI_SALEN_T salen,
+ char *host, GNI_HOSTLEN_T hostlen, char *serv,
+ GNI_SERVLEN_T servlen, GNI_FLAGS_T flags)
+{
+ char name[IDN_NAME_SIZE];
+ size_t namelen = sizeof(name);
+ int code;
+ idn_result_t r;
+
+ if (host == NULL || hostlen == 0 || idn_isprocessing) {
+ return (REAL(getnameinfo)(sa, salen, host, hostlen,
+ serv, servlen, flags));
+ }
+
+ TRACE(("getnameinfo(hostlen=%u)\n", hostlen));
+
+ idn_isprocessing = 1;
+ code = REAL(getnameinfo)(sa, salen, name, namelen,
+ serv, servlen, flags);
+ if (code == 0 && name[0] != '\0') {
+ idn_enable(1);
+ idn_nameinit(1);
+ r = idn_decodename(IDN_DECODE_APP, name, host, hostlen);
+ switch (r) {
+ case idn_success:
+ code = 0;
+ break;
+ case idn_buffer_overflow:
+ case idn_nomemory:
+ code = EAI_MEMORY;
+ break;
+ default:
+ code = EAI_FAIL;
+ break;
+ }
+ }
+ idn_isprocessing = 0;
+ return (code);
+}
+#endif
diff --git a/contrib/idn/idnkit-1.0-src/tools/runidn/resolver.h b/contrib/idn/idnkit-1.0-src/tools/runidn/resolver.h
new file mode 100644
index 0000000..e3fc35e
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/runidn/resolver.h
@@ -0,0 +1,70 @@
+/* $Id: resolver.h,v 1.1.1.1 2003/06/04 00:27:13 marka Exp $ */
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef RESOLVER_H
+#define RESOLVER_H 1
+
+#undef gethostbyname
+#define gethostbyname idn_resolver_gethostbyname
+#undef gethostbyname2
+#define gethostbyname2 idn_resolver_gethostbyname2
+#undef gethostbyname_r
+#define gethostbyname_r idn_resolver_gethostbyname_r
+#undef gethostbyaddr
+#define gethostbyaddr idn_resolver_gethostbyaddr
+#undef gethostbyaddr
+#define gethostbyaddr_r idn_resolver_gethostbyaddr_r
+#undef getipnodebyname
+#define getipnodebyname idn_resolver_getipnodebyname
+#undef getipnodebyaddr
+#define getipnodebyaddr idn_resolver_getipnodebyaddr
+#undef freehostent
+#define freehostent idn_resolver_freehostent
+#undef getaddrinfo
+#define getaddrinfo idn_resolver_getaddrinfo
+#undef freeaddrinfo
+#define freeaddrinfo idn_resolver_freeaddrinfo
+#undef getnameinfo
+#define getnameinfo idn_resolver_getnameinfo
+
+#endif /* RESOLVER_H */
diff --git a/contrib/idn/idnkit-1.0-src/tools/runidn/runidn.1 b/contrib/idn/idnkit-1.0-src/tools/runidn/runidn.1
new file mode 100644
index 0000000..a8b1270
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/runidn/runidn.1
@@ -0,0 +1,151 @@
+.\" $Id: runidn.1,v 1.1.1.1 2003/06/04 00:27:14 marka Exp $
+.\"
+.\" Copyright (c) 2000,2001 Japan Network Information Center.
+.\" All rights reserved.
+.\"
+.\" By using this file, you agree to the terms and conditions set forth bellow.
+.\"
+.\" LICENSE TERMS AND CONDITIONS
+.\"
+.\" The following License Terms and Conditions apply, unless a different
+.\" license is obtained from Japan Network Information Center ("JPNIC"),
+.\" a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+.\" Chiyoda-ku, Tokyo 101-0047, Japan.
+.\"
+.\" 1. Use, Modification and Redistribution (including distribution of any
+.\" modified or derived work) in source and/or binary forms is permitted
+.\" under this License Terms and Conditions.
+.\"
+.\" 2. Redistribution of source code must retain the copyright notices as they
+.\" appear in each source code file, this License Terms and Conditions.
+.\"
+.\" 3. Redistribution in binary form must reproduce the Copyright Notice,
+.\" this License Terms and Conditions, in the documentation and/or other
+.\" materials provided with the distribution. For the purposes of binary
+.\" distribution the "Copyright Notice" refers to the following language:
+.\" "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+.\"
+.\" 4. The name of JPNIC may not be used to endorse or promote products
+.\" derived from this Software without specific prior written approval of
+.\" JPNIC.
+.\"
+.\" 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+.\" PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+.\"
+.TH RUNIDN 1 "April 6, 2001"
+.\"
+.SH NAME
+runidn \- A script to allow applications to use internationalized domain names.
+.\"
+.SH SYNOPSIS
+\fBrunidn\fP [\fB-e\fP \fIlocal-codeset\fP] \fIprogram-name\fP [\fIargs..\fP]
+.\"
+.SH DESCRIPTION
+\fBrunidn\fP enables applications to use internationalized domain names
+without recompilation.
+Just add ``runidn'' before the application-name, and the application
+can handle non-ASCII domain names. For example, you can do:
+.PP
+.RS 4
+.nf
+\f(CW% runidn telnet \fInon-ASCII-hostname\fR
+.fi
+.RE
+.PP
+Before using runidn, you should set up properties related to
+internationalized DNS by configuring idnkit's configuration file
+\fBidn.conf\fP.
+See idn.conf(5) which describes the configuration.
+.\"
+.SH OPTION
+The following option is available:
+.TP 4
+\fB\-e\fP \fIlocal-codeset\fP
+Specify the application's local codeset.
+If the option is not specified, \fBrunidn\fR guesses the codeset
+from the current locale.
+See the ``NOTE'' section for more details about local codeset.
+.\"
+.SH IMPLEMENTATION
+\fBrunidn\fR is a small shell script that sets up an environment variable
+called ``LD_PRELOAD'', so that an application dynamically links a shared
+library ``libidnkitres'' before any other shared libraries.
+.PP
+The library ``libidnkitres'' provides a special version of resolver
+functions which implement features for handling internationalized
+domain names.
+\fBrunidn\fR replaces the following functions with the special version:
+.PP
+.RS 4
+.nf
+.ft CW
+gethostbyname
+gethostbyname2
+gethostbyaddr
+gethostbyname_r
+gethostbyname2_r
+gethostbyaddr_r
+getipnodebyname
+getipnodebyaddr
+freehostent
+getaddrinfo
+freeaddrinfo
+getnameinfo
+.ft R
+.fi
+.RE
+.PP
+By overriding them in the standard libraries with the special version
+provided by ``libidnkitres'',
+\fBrunidn\fR enables applications to use internationalized domain names.
+.RS 4
+.IP \(bu 2
+These API functions accept non-ASCII domain names encoded
+in the local codeset that the application is using.
+Also the result from these APIs may contain non-ASCII domain names.
+.IP \(bu 2
+The normalization and codeset conversion between application's local
+codeset and the codeset used in DNS protocol data are handled
+automatically, so users/applications need not worry about them.
+.RE
+.PP
+Properties of internationalized DNS (such as the normalization or
+the codeset used on DNS protocol data) can be configured with the
+idnkit's configuration file (\fBidn.conf\fR).
+See idn.conf(5) for details.
+.\"
+.SH NOTE
+Unless \fB\-e\fP option is specified, \fBrunidn\fR tries to guess
+the application's local codeset from the application's current locale.
+However, sometimes it cannot guess the codeset correctly, for example
+if the application does not set the locale appropriately by calling
+`setlocale()'.
+In that case, you can explicitly specify the local codeset by setting an
+environment variable ``IDN_LOCAL_CODESET''.
+See the section ``LOCAL CODESET'' in idn.conf(5) for details.
+.PP
+The idea of using ``LD_PRELOAD'' to replace some functions in the standard
+library was taken from ``runsocks'' script distributed as part of SOCKS5
+reference implementation.
+.SH BUGS
+There are many cases where \fBrunidn\fR does not work.
+.PP
+Your system must support ``LD_PRELOAD'' mechanism in the first place.
+.PP
+Due to security reasons, ``LD_PRELOAD'' mechanism is disabled for
+setuid programs in any sane systems.
+So \fBrunidn\fR does not work for setuid programs such as ping or rsh.
+.PP
+If your application uses a function other than the ones runidn supports for
+name resolution, you lose.
+.SH "SEE ALSO"
+idn.conf(5), runsocks(1)
diff --git a/contrib/idn/idnkit-1.0-src/tools/runidn/runidn.in b/contrib/idn/idnkit-1.0-src/tools/runidn/runidn.in
new file mode 100644
index 0000000..6437658
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/runidn/runidn.in
@@ -0,0 +1,109 @@
+#! /bin/sh
+# $Id: runidn.in,v 1.1.1.1 2003/06/04 00:27:14 marka Exp $
+#
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+# Parse command line options.
+usage="Usage: `basename $0` [-e local-encoding] command [argument..]"
+while test $# -gt 0; do
+ case "$1" in
+ -e)
+ if test $# -le 1; then
+ echo $usage 1>&2
+ exit 1
+ fi
+ IDN_LOCAL_CODESET="$2"
+ export IDN_LOCAL_CODESET
+ shift
+ ;;
+ -)
+ break
+ ;;
+ -*)
+ echo $usage 1>&2
+ exit 1
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+done
+if test $# -eq 0; then
+ echo $usage 1>&2
+ exit 1
+fi
+
+# Load library info.
+preload=
+iconv_file=@ICONVSOFILE@
+if test "$iconv_file" != none; then
+ preload="$iconv_file@PRELOAD_SEP@"
+fi
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=`echo @libdir@`
+if test ! -f $libdir/libidnkitres.la; then
+ cat <<EOF 1>&2
+Have you installed idnkit? I cannot find libidnkitres.la.
+EOF
+ exit 1
+fi
+eval `grep '^dlname' $libdir/libidnkitres.la`
+if test "$dlname" = ""; then
+ cat <<EOF 1>&2
+Sorry, runidn won't work because libidnkitres is not dynamically loadable.
+EOF
+ exit 1
+fi
+preload=$preload$libdir/$dlname
+
+# Set @PRELOAD_VAR@.
+if [ X$@PRELOAD_VAR@ = X ]; then
+ @PRELOAD_VAR@="$preload@PRELOAD_LAST@"
+else
+ @PRELOAD_VAR@="$preload@PRELOAD_SEP@$@PRELOAD_VAR@@PRELOAD_LAST@"
+fi
+export @PRELOAD_VAR@
+
+# Shoot.
+exec "$@"
diff --git a/contrib/idn/idnkit-1.0-src/tools/runidn/stub.c b/contrib/idn/idnkit-1.0-src/tools/runidn/stub.c
new file mode 100644
index 0000000..0ec1685
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/runidn/stub.c
@@ -0,0 +1,387 @@
+#ifndef lint
+static char *rcsid = "$Id: stub.c,v 1.1.1.1 2003/06/04 00:27:13 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <config.h>
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <errno.h>
+#ifdef HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <idn/logmacro.h>
+#include <idn/debug.h>
+
+#include "stub.h"
+
+#ifndef RTLD_NEXT
+typedef struct {
+ const char *name;
+ void *handle;
+} shared_obj_t;
+
+static shared_obj_t shobj[] = {
+#ifdef SOPATH_LIBC
+ { SOPATH_LIBC },
+#endif
+#ifdef SOPATH_LIBNSL
+ { SOPATH_LIBNSL },
+#endif
+ { NULL },
+};
+#endif
+
+static void *shared_obj_findsym(void *handle, const char *name);
+static void *shared_obj_findsymx(void *handle, const char *name);
+static void *get_func_addr(const char *name);
+
+#ifndef RTLD_NEXT
+static void *
+shared_obj_open(const char *path) {
+#ifdef HAVE_DLOPEN
+ return (dlopen(path, RTLD_LAZY));
+#endif
+ FATAL(("stub: no way to load shared object file\n"));
+ return (NULL);
+}
+#endif
+
+static void *
+shared_obj_findsym(void *handle, const char *name) {
+ char namebuf[100];
+ void *addr;
+ static int need_leading_underscore = -1;
+
+ /* Prepend underscore. */
+ namebuf[0] = '_';
+ (void)strcpy(namebuf + 1, name);
+ name = namebuf;
+
+ if (need_leading_underscore < 0) {
+ /* First try without one. */
+ if ((addr = shared_obj_findsymx(handle, name + 1)) != NULL) {
+ need_leading_underscore = 0;
+ return (addr);
+ }
+ /* Then try with one. */
+ if ((addr = shared_obj_findsymx(handle, name)) != NULL) {
+ need_leading_underscore = 1;
+ return (addr);
+ }
+ } else if (need_leading_underscore) {
+ return (shared_obj_findsymx(handle, name));
+ } else {
+ return (shared_obj_findsymx(handle, name + 1));
+ }
+ return (NULL);
+}
+
+static void *
+shared_obj_findsymx(void *handle, const char *name) {
+#ifdef HAVE_DLSYM
+ return (dlsym(handle, name));
+#endif
+ /* logging */
+ FATAL(("stub: no way to get symbol address\n"));
+ return (NULL);
+}
+
+static void *
+get_func_addr(const char *name) {
+#ifdef RTLD_NEXT
+ void *addr = shared_obj_findsym(RTLD_NEXT, name);
+
+ if (addr != NULL) {
+ TRACE(("stub: %s found in the subsequent objects\n", name));
+ return (addr);
+ }
+#else
+ int i;
+
+ for (i = 0; shobj[i].name != NULL; i++) {
+ if (shobj[i].handle == NULL) {
+ TRACE(("stub: loading %s\n", shobj[i].name));
+ shobj[i].handle = shared_obj_open(shobj[i].name);
+ }
+ if (shobj[i].handle != NULL) {
+ void *addr = shared_obj_findsym(shobj[i].handle, name);
+ if (addr != NULL) {
+ TRACE(("stub: %s found in %s\n",
+ name, shobj[i].name));
+ return (addr);
+ }
+ }
+ }
+#endif
+ TRACE(("stub: %s not found\n", name));
+ return (NULL);
+}
+
+#ifdef HAVE_GETHOSTBYNAME
+struct hostent *
+idn_stub_gethostbyname(const char *name) {
+ static struct hostent *(*fp)(const char *name);
+
+ if (fp == NULL)
+ fp = get_func_addr("gethostbyname");
+ if (fp != NULL)
+ return ((*fp)(name));
+ return (NULL);
+}
+#endif
+
+#ifdef HAVE_GETHOSTBYNAME2
+struct hostent *
+idn_stub_gethostbyname2(const char *name, int af) {
+ static struct hostent *(*fp)(const char *name, int af);
+
+ if (fp == NULL)
+ fp = get_func_addr("gethostbyname2");
+ if (fp != NULL)
+ return ((*fp)(name, af));
+ return (NULL);
+}
+#endif
+
+#ifdef HAVE_GETHOSTBYADDR
+struct hostent *
+idn_stub_gethostbyaddr(GHBA_ADDR_T addr, GHBA_ADDRLEN_T len, int type) {
+ static struct hostent *(*fp)(GHBA_ADDR_T name,
+ GHBA_ADDRLEN_T len, int type);
+
+ if (fp == NULL)
+ fp = get_func_addr("gethostbyaddr");
+ if (fp != NULL)
+ return ((*fp)(addr, len, type));
+ return (NULL);
+}
+#endif
+
+#ifdef GETHOST_R_GLIBC_FLAVOR
+
+#ifdef HAVE_GETHOSTBYNAME_R
+int
+idn_stub_gethostbyname_r(const char *name, struct hostent *result,
+ char *buffer, size_t buflen,
+ struct hostent **rp, int *errp)
+{
+ static int (*fp)(const char *name, struct hostent *result,
+ char *buffer, size_t buflen,
+ struct hostent **rp, int *errp);
+
+ if (fp == NULL)
+ fp = get_func_addr("gethostbyname_r");
+ if (fp != NULL)
+ return ((*fp)(name, result, buffer, buflen, rp, errp));
+ return (ENOENT); /* ??? */
+}
+#endif
+
+#ifdef HAVE_GETHOSTBYNAME2_R
+int
+idn_stub_gethostbyname2_r(const char *name, int af, struct hostent *result,
+ char *buffer, size_t buflen,
+ struct hostent **rp, int *errp)
+{
+ static int (*fp)(const char *name, int af, struct hostent *result,
+ char *buffer, size_t buflen,
+ struct hostent **rp, int *errp);
+
+ if (fp == NULL)
+ fp = get_func_addr("gethostbyname2_r");
+ if (fp != NULL)
+ return ((*fp)(name, af, result, buffer, buflen, rp, errp));
+ return (ENOENT); /* ??? */
+}
+#endif
+
+#ifdef HAVE_GETHOSTBYADDR_R
+int
+idn_stub_gethostbyaddr_r(GHBA_ADDR_T addr, GHBA_ADDRLEN_T len, int type,
+ struct hostent *result, char *buffer,
+ size_t buflen, struct hostent **rp, int *errp)
+{
+ static int (*fp)(GHBA_ADDR_T addr, GHBA_ADDRLEN_T len, int type,
+ struct hostent *result, char *buffer,
+ size_t buflen, struct hostent **rp, int *errp);
+
+ if (fp == NULL)
+ fp = get_func_addr("gethostbyaddr_r");
+ if (fp != NULL)
+ return ((*fp)(addr, len, type, result,
+ buffer, buflen, rp, errp));
+ return (ENOENT); /* ??? */
+}
+#endif
+
+#else /* GETHOST_R_GLIBC_FLAVOR */
+
+#ifdef HAVE_GETHOSTBYNAME_R
+struct hostent *
+idn_stub_gethostbyname_r(const char *name, struct hostent *result,
+ char *buffer, int buflen, int *errp)
+{
+ static struct hostent *(*fp)(const char *name, struct hostent *result,
+ char *buffer, int buflen, int *errp);
+
+ if (fp == NULL)
+ fp = get_func_addr("gethostbyname_r");
+ if (fp != NULL)
+ return ((*fp)(name, result, buffer, buflen, errp));
+ return (NULL);
+}
+#endif
+
+#ifdef HAVE_GETHOSTBYADDR_R
+struct hostent *
+idn_stub_gethostbyaddr_r(GHBA_ADDR_T addr, int len, int type,
+ struct hostent *result, char *buffer,
+ int buflen, int *errp)
+{
+ static struct hostent *(*fp)(GHBA_ADDR_T addr, int len, int type,
+ struct hostent *result, char *buffer,
+ int buflen, int *errp);
+
+ if (fp == NULL)
+ fp = get_func_addr("gethostbyaddr_r");
+ if (fp != NULL)
+ return ((*fp)(addr, len, type, result, buffer, buflen, errp));
+ return (NULL);
+}
+#endif
+
+#endif /* GETHOST_R_GLIBC_FLAVOR */
+
+#ifdef HAVE_GETIPNODEBYNAME
+struct hostent *
+idn_stub_getipnodebyname(const char *name, int af, int flags, int *errp) {
+ static struct hostent *(*fp)(const char *name, int af, int flags,
+ int *errp);
+
+ if (fp == NULL)
+ fp = get_func_addr("getipnodebyname");
+ if (fp != NULL)
+ return ((*fp)(name, af, flags, errp));
+ return (NULL);
+}
+#endif
+
+#ifdef HAVE_GETIPNODEBYADDR
+struct hostent *
+idn_stub_getipnodebyaddr(const void *src, size_t len, int af, int *errp) {
+ static struct hostent *(*fp)(const void *src, size_t len, int af,
+ int *errp);
+
+ if (fp == NULL)
+ fp = get_func_addr("getipnodebyaddr");
+ if (fp != NULL)
+ return ((*fp)(src, len, af, errp));
+ return (NULL);
+}
+#endif
+
+#ifdef HAVE_FREEHOSTENT
+void
+idn_stub_freehostent(struct hostent *hp) {
+ static void (*fp)(struct hostent *hp);
+
+ if (fp == NULL)
+ fp = get_func_addr("freehostent");
+ if (fp != NULL)
+ (*fp)(hp);
+}
+#endif
+
+#ifdef HAVE_GETADDRINFO
+int
+idn_stub_getaddrinfo(const char *nodename, const char *servname,
+ const struct addrinfo *hints, struct addrinfo **res)
+{
+ static int (*fp)(const char *nodename, const char *servname,
+ const struct addrinfo *hints, struct addrinfo **res);
+
+ if (fp == NULL)
+ fp = get_func_addr("getaddrinfo");
+ if (fp != NULL)
+ return ((*fp)(nodename, servname, hints, res));
+ return (EAI_FAIL);
+}
+#endif
+
+#ifdef HAVE_FREEADDRINFO
+void
+idn_stub_freeaddrinfo(struct addrinfo *aip) {
+ static void (*fp)(struct addrinfo *aip);
+
+ if (fp == NULL)
+ fp = get_func_addr("freeaddrinfo");
+ if (fp != NULL)
+ (*fp)(aip);
+}
+#endif
+
+#ifdef HAVE_GETNAMEINFO
+int
+idn_stub_getnameinfo(const struct sockaddr *sa, GNI_SALEN_T salen,
+ char *host, GNI_HOSTLEN_T hostlen,
+ char *serv, GNI_SERVLEN_T servlen, GNI_FLAGS_T flags) {
+ static int (*fp)(const struct sockaddr *sa, GNI_SALEN_T salen,
+ char *host, GNI_HOSTLEN_T hostlen,
+ char *serv, GNI_SERVLEN_T servlen,
+ GNI_FLAGS_T flags);
+
+ if (fp == NULL)
+ fp = get_func_addr("getnameinfo");
+ if (fp != NULL)
+ return ((*fp)(sa, salen, host, hostlen, serv, servlen, flags));
+ return (EAI_FAIL);
+}
+#endif
diff --git a/contrib/idn/idnkit-1.0-src/tools/runidn/stub.h b/contrib/idn/idnkit-1.0-src/tools/runidn/stub.h
new file mode 100644
index 0000000..48167ed
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/tools/runidn/stub.h
@@ -0,0 +1,94 @@
+/* $Id: stub.h,v 1.1.1.1 2003/06/04 00:27:13 marka Exp $ */
+
+#ifndef STUB_H
+#define STUB_H
+
+#ifdef HAVE_GETHOSTBYNAME
+extern struct hostent *
+idn_stub_gethostbyname(const char *name);
+#endif
+
+#ifdef GETHOST_R_GLIBC_FLAVOR
+#ifdef HAVE_GETHOSTBYNAME_R
+extern int
+idn_stub_gethostbyname_r(const char *name, struct hostent *result,
+ char *buffer, size_t buflen,
+ struct hostent **rp, int *errp);
+#endif
+#else /* GETHOST_R_GLIBC_FLAVOR */
+#ifdef HAVE_GETHOSTBYNAME_R
+extern struct hostent *
+idn_stub_gethostbyname_r(const char *name, struct hostent *result,
+ char *buffer, int buflen, int *errp);
+#endif
+#endif /* GETHOST_R_GLIBC_FLAVOR */
+
+#ifdef HAVE_GETHOSTBYNAME2
+extern struct hostent *
+idn_stub_gethostbyname2(const char *name, int af);
+#endif
+
+#ifdef GETHOST_R_GLIBC_FLAVOR
+#ifdef HAVE_GETHOSTBYNAME2_R
+extern int
+idn_stub_gethostbyname2_r(const char *name, int af, struct hostent *result,
+ char *buffer, size_t buflen,
+ struct hostent **rp, int *errp);
+#endif
+#endif /* GETHOST_R_GLIBC_FLAVOR */
+
+#ifdef HAVE_GETHOSTBYADDR
+extern struct hostent *
+idn_stub_gethostbyaddr(GHBA_ADDR_T addr, GHBA_ADDRLEN_T len, int type);
+#endif
+
+#ifdef GETHOST_R_GLIBC_FLAVOR
+#ifdef HAVE_GETHOSTBYADDR_R
+extern int
+idn_stub_gethostbyaddr_r(GHBA_ADDR_T addr, GHBA_ADDRLEN_T len, int type,
+ struct hostent *result, char *buffer,
+ size_t buflen, struct hostent **rp, int *errp);
+#endif
+#else /* GETHOST_R_GLIBC_FLAVOR */
+#ifdef HAVE_GETHOSTBYADDR_R
+extern struct hostent *
+idn_stub_gethostbyaddr_r(GHBA_ADDR_T addr, GHBA_ADDRLEN_T len, int type,
+ struct hostent *result, char *buffer,
+ int buflen, int *errp);
+#endif
+#endif /* GETHOST_R_GLIBC_FLAVOR */
+
+#ifdef HAVE_GETIPNODEBYNAME
+extern struct hostent *
+idn_stub_getipnodebyname(const char *name, int af, int flags, int *errp);
+#endif
+
+#ifdef HAVE_GETIPNODEBYADDR
+extern struct hostent *
+idn_stub_getipnodebyaddr(const void *src, size_t len, int af, int *errp);
+#endif
+
+#ifdef HAVE_FREEHOSTENT
+extern void
+idn_stub_freehostent(struct hostent *hp);
+#endif
+
+#ifdef HAVE_GETADDRINFO
+extern int
+idn_stub_getaddrinfo(const char *nodename, const char *servname,
+ const struct addrinfo *hints, struct addrinfo **res);
+#endif
+
+#ifdef HAVE_FREEADDRINFO
+extern void
+idn_stub_freeaddrinfo(struct addrinfo *aip);
+#endif
+
+#ifdef HAVE_GETNAMEINFO
+extern int
+idn_stub_getnameinfo(const struct sockaddr *sa, GNI_SALEN_T salen,
+ char *host, GNI_HOSTLEN_T hostlen, char *serv,
+ GNI_SERVLEN_T servlen, GNI_FLAGS_T flags);
+#endif
+
+#endif /* STUB_H */
diff --git a/contrib/idn/idnkit-1.0-src/util/Makefile b/contrib/idn/idnkit-1.0-src/util/Makefile
new file mode 100644
index 0000000..2f49ddd
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/util/Makefile
@@ -0,0 +1,43 @@
+# $Id: Makefile,v 1.1.1.1 2003/06/04 00:27:52 marka Exp $
+
+PERL = /usr/local/bin/perl -w
+
+V301_NORM_DIR = data/unicode-3.0.0
+V310_NORM_DIR = data/unicode-3.1.0
+V320_NORM_DIR = data/unicode-3.2.0
+NORM_GENERATOR = ./generate_normalize_data.pl
+
+NAMEPREP_DIR = data/nameprep
+NAMEPREP_FILES = \
+ $(NAMEPREP_DIR)/nameprep.rfc3491.map \
+ $(NAMEPREP_DIR)/nameprep.rfc3491.prohibited \
+ $(NAMEPREP_DIR)/nameprep.rfc3491.unassigned \
+ $(NAMEPREP_DIR)/nameprep.rfc3491.bidi
+NAMEPREP_GENERATOR = ./generate_nameprep_data.pl
+NAMEPREP_VERSIONS = rfc3491
+
+all: normalize nameprep
+
+normalize: ../lib/unicodedata_320.c
+
+nameprep: ../lib/nameprepdata.c
+
+../lib/unicodedata_301.c: $(NORM_GENERATOR)
+ -rm -f $@.tmp
+ $(PERL) $(NORM_GENERATOR) -prefix v301_ -dir $(V301_NORM_DIR) \
+ > $@.tmp && mv $@.tmp $@
+
+../lib/unicodedata_310.c: $(NORM_GENERATOR)
+ -rm -f $@.tmp
+ $(PERL) $(NORM_GENERATOR) -prefix v310_ -dir $(V310_NORM_DIR) \
+ > $@.tmp && mv $@.tmp $@
+
+../lib/unicodedata_320.c: $(NORM_GENERATOR)
+ -rm -f $@.tmp
+ $(PERL) $(NORM_GENERATOR) -prefix v320_ -dir $(V320_NORM_DIR) \
+ > $@.tmp && mv $@.tmp $@
+
+../lib/nameprepdata.c: $(NAMEPREP_GENERATOR) $(NAMEPREP_FILES)
+ -rm -f $@.tmp
+ $(PERL) $(NAMEPREP_GENERATOR) -dir $(NAMEPREP_DIR) \
+ $(NAMEPREP_VERSIONS) > $@.tmp && mv $@.tmp $@
diff --git a/contrib/idn/idnkit-1.0-src/util/SparseMap.pm b/contrib/idn/idnkit-1.0-src/util/SparseMap.pm
new file mode 100644
index 0000000..834c795
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/util/SparseMap.pm
@@ -0,0 +1,575 @@
+# $Id: SparseMap.pm,v 1.1.1.1 2003/06/04 00:27:53 marka Exp $
+#
+# Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+#
+
+package SparseMap;
+
+use strict;
+use Carp;
+
+my $debug = 0;
+
+sub new {
+ # common options are:
+ # BITS => [8, 7, 6], # 3-level map, 2nd level bits=7, 3rd = 6.
+ # MAX => 0x110000 # actually, max + 1.
+ my $class = shift;
+ my $self = {@_};
+
+ croak "BITS unspecified" unless exists $self->{BITS};
+ croak "BITS is not an array reference"
+ unless ref($self->{BITS}) eq 'ARRAY';
+ croak "MAX unspecified" unless exists $self->{MAX};
+
+ $self->{MAXLV} = @{$self->{BITS}} - 1;
+ $self->{FIXED} = 0;
+
+ my $lv0size = (indices($self, $self->{MAX} - 1))[0] + 1;
+
+ my @map = (undef) x $lv0size;
+ $self->{MAP} = \@map;
+
+ bless $self, $class;
+}
+
+sub add1 {
+ my ($self, $n, $val) = @_;
+
+ croak "Already fixed" if $self->{FIXED};
+ carp("data ($n) out of range"), return if $n >= $self->{MAX};
+
+ my @index = $self->indices($n);
+ my $r = $self->{MAP};
+ my $maxlv = $self->{MAXLV};
+ my $idx;
+ my $lv;
+
+ for ($lv = 0; $lv < $maxlv - 1; $lv++) {
+ $idx = $index[$lv];
+ $r->[$idx] = $self->create_imap($lv + 1, undef)
+ unless defined $r->[$idx];
+ $r = $r->[$idx];
+ }
+ $idx = $index[$lv];
+ $r->[$idx] = $self->create_dmap() unless defined $r->[$idx];
+ $self->add_to_dmap($r->[$idx], $index[$maxlv], $val);
+}
+
+sub fix {
+ my $self = shift;
+ my $map = $self->{MAP};
+ my $maxlv = $self->{MAXLV};
+ my @tmp;
+ my @zero;
+
+ carp "Already fixed" if $self->{FIXED};
+ $self->collapse_tree();
+ $self->fill_default();
+ $self->{FIXED} = 1;
+}
+
+sub indices {
+ my $self = shift;
+ my $v = shift;
+ my @bits = @{$self->{BITS}};
+ my @idx;
+
+ print "indices($v,", join(',', @bits), ") = " if $debug;
+ for (my $i = @bits - 1; $i >= 0; $i--) {
+ my $bit = $bits[$i];
+ unshift @idx, $v & ((1 << $bit) - 1);
+ $v = $v >> $bit;
+ }
+ print "(", join(',', @idx), ")\n" if $debug;
+ @idx;
+}
+
+sub get {
+ my $self = shift;
+ my $v = shift;
+ my $map = $self->{MAP};
+ my @index = $self->indices($v);
+
+ croak "Not yet fixed" unless $self->{FIXED};
+
+ my $lastidx = pop @index;
+ foreach my $idx (@index) {
+ return $map->{DEFAULT} unless defined $map->[$idx];
+ $map = $map->[$idx];
+ }
+ $map->[$lastidx];
+}
+
+sub indirectmap {
+ my $self = shift;
+
+ croak "Not yet fixed" unless $self->{FIXED};
+
+ my @maps = $self->collect_maps();
+ my $maxlv = $self->{MAXLV};
+ my @bits = @{$self->{BITS}};
+
+ my @indirect = ();
+ for (my $lv = 0; $lv < $maxlv; $lv++) {
+ my $offset;
+ my $chunksz;
+ my $mapsz = @{$maps[$lv]->[0]};
+ if ($lv < $maxlv - 1) {
+ # indirect map
+ $offset = @indirect + @{$maps[$lv]} * @{$maps[$lv]->[0]};
+ $chunksz = (1 << $bits[$lv + 1]);
+ } else {
+ # direct map
+ $offset = 0;
+ $chunksz = 1;
+ }
+ my $nextmaps = $maps[$lv + 1];
+ foreach my $mapref (@{$maps[$lv]}) {
+ croak "mapsize inconsistent ", scalar(@$mapref),
+ " should be ", $mapsz, " (lv $lv)\n" if @$mapref != $mapsz;
+ foreach my $m (@$mapref) {
+ my $idx;
+ for ($idx = 0; $idx < @$nextmaps; $idx++) {
+ last if $nextmaps->[$idx] == $m;
+ }
+ croak "internal error: map corrupted" if $idx >= @$nextmaps;
+ push @indirect, $offset + $chunksz * $idx;
+ }
+ }
+ }
+ @indirect;
+}
+
+sub cprog_imap {
+ my $self = shift;
+ my %opt = @_;
+ my $name = $opt{NAME} || 'map';
+ my @indirect = $self->indirectmap();
+ my $prog;
+ my $i;
+ my ($idtype, $idcol, $idwid);
+
+ my $max = 0;
+ $max < $_ and $max = $_ foreach @indirect;
+
+ if ($max < 256) {
+ $idtype = 'char';
+ $idcol = 8;
+ $idwid = 3;
+ } elsif ($max < 65536) {
+ $idtype = 'short';
+ $idcol = 8;
+ $idwid = 5;
+ } else {
+ $idtype = 'long';
+ $idcol = 4;
+ $idwid = 10;
+ }
+ $prog = "static const unsigned $idtype ${name}_imap[] = {\n";
+ $i = 0;
+ foreach my $v (@indirect) {
+ if ($i % $idcol == 0) {
+ $prog .= "\n" if $i != 0;
+ $prog .= "\t";
+ }
+ $prog .= sprintf "%${idwid}d, ", $v;
+ $i++;
+ }
+ $prog .= "\n};\n";
+ $prog;
+}
+
+sub cprog {
+ my $self = shift;
+ $self->cprog_imap(@_) . "\n" . $self->cprog_dmap(@_);
+}
+
+sub stat {
+ my $self = shift;
+ my @maps = $self->collect_maps();
+ my $elsize = $self->{ELSIZE};
+ my $i;
+ my $total = 0;
+ my @lines;
+
+ for ($i = 0; $i < $self->{MAXLV}; $i++) {
+ my $nmaps = @{$maps[$i]};
+ my $mapsz = @{$maps[$i]->[0]};
+ push @lines, "level $i: $nmaps maps (size $mapsz) ";
+ push @lines, "[", $nmaps * $mapsz * $elsize, "]" if $elsize;
+ push @lines, "\n";
+ }
+ my $ndmaps = @{$maps[$i]};
+ push @lines, "level $i: $ndmaps dmaps";
+ my $r = $maps[$i]->[0];
+ if (ref($r) eq 'ARRAY') {
+ push @lines, " (size ", scalar(@$r), ")";
+ }
+ push @lines, "\n";
+ join '', @lines;
+}
+
+sub collapse_tree {
+ my $self = shift;
+ my @tmp;
+
+ $self->_collapse_tree_rec($self->{MAP}, 0, \@tmp);
+}
+
+sub _collapse_tree_rec {
+ my ($self, $r, $lv, $refs) = @_;
+ my $ref = $refs->[$lv];
+ my $maxlv = $self->{MAXLV};
+ my $found;
+
+ return $r unless defined $r;
+
+ $ref = $refs->[$lv] = [] unless defined $ref;
+
+ if ($lv == $maxlv) {
+ $found = $self->find_dmap($ref, $r);
+ } else {
+ for (my $i = 0; $i < @$r; $i++) {
+ $r->[$i] = $self->_collapse_tree_rec($r->[$i], $lv + 1, $refs);
+ }
+ $found = $self->find_imap($ref, $r);
+ }
+ unless ($found) {
+ $found = $r;
+ push @$ref, $found;
+ }
+ return $found;
+}
+
+sub fill_default {
+ my $self = shift;
+ my $maxlv = $self->{MAXLV};
+ my $bits = $self->{BITS};
+ my @zeros;
+
+ $zeros[$maxlv] = $self->create_dmap();
+ for (my $lv = $maxlv - 1; $lv >= 0; $lv--) {
+ my $r = $zeros[$lv + 1];
+ $zeros[$lv] = $self->create_imap($lv, $r);
+ }
+ _fill_default_rec($self->{MAP}, 0, $maxlv, \@zeros);
+}
+
+sub _fill_default_rec {
+ my ($r, $lv, $maxlv, $zeros) = @_;
+
+ return if $lv == $maxlv;
+ for (my $i = 0; $i < @$r; $i++) {
+ if (defined($r->[$i])) {
+ _fill_default_rec($r->[$i], $lv + 1, $maxlv, $zeros);
+ } else {
+ $r->[$i] = $zeros->[$lv + 1];
+ }
+ }
+}
+
+sub create_imap {
+ my ($self, $lv, $v) = @_;
+ my @map;
+ @map = ($v) x (1 << $self->{BITS}->[$lv]);
+ \@map;
+}
+
+sub find_imap {
+ my ($self, $maps, $map) = @_;
+ my $i;
+
+ foreach my $el (@$maps) {
+ next unless @$el == @$map;
+ for ($i = 0; $i < @$el; $i++) {
+ last unless ($el->[$i] || 0) == ($map->[$i] || 0);
+ }
+ return $el if $i >= @$el;
+ }
+ undef;
+}
+
+sub collect_maps {
+ my $self = shift;
+ my @maps;
+ _collect_maps_rec($self->{MAP}, 0, $self->{MAXLV}, \@maps);
+ @maps;
+}
+
+sub _collect_maps_rec {
+ my ($r, $lv, $maxlv, $maps) = @_;
+ my $mapref = $maps->[$lv];
+
+ return unless defined $r;
+ foreach my $ref (@{$mapref}) {
+ return if $ref == $r;
+ }
+ push @{$maps->[$lv]}, $r;
+ if ($lv < $maxlv) {
+ _collect_maps_rec($_, $lv + 1, $maxlv, $maps) foreach @{$r};
+ }
+}
+
+sub add {confess "Subclass responsibility";}
+sub create_dmap {confess "Subclass responsibility";}
+sub add_to_dmap {confess "Subclass responsibility";}
+sub find_dmap {confess "Subclass responsibility";}
+sub cprog_dmap {confess "Subclass responsibility";}
+
+1;
+
+package SparseMap::Bit;
+
+use strict;
+use vars qw(@ISA);
+use Carp;
+#use SparseMap;
+
+@ISA = qw(SparseMap);
+
+sub new {
+ my $class = shift;
+ my $self = $class->SUPER::new(@_);
+ $self->{DEFAULT} = 0;
+ bless $self, $class;
+}
+
+sub add {
+ my $self = shift;
+
+ $self->add1($_, undef) foreach @_;
+}
+
+sub create_dmap {
+ my $self = shift;
+ my $bmbits = $self->{BITS}->[-1];
+
+ my $s = "\0" x (1 << ($bmbits - 3));
+ \$s;
+}
+
+sub add_to_dmap {
+ my ($self, $map, $idx, $val) = @_;
+ vec($$map, $idx, 1) = 1;
+}
+
+sub find_dmap {
+ my ($self, $ref, $r) = @_;
+ foreach my $map (@$ref) {
+ return $map if $$map eq $$r;
+ }
+ return undef;
+}
+
+sub cprog_dmap {
+ my $self = shift;
+ my %opt = @_;
+ my $name = $opt{NAME} || 'map';
+ my @maps = $self->collect_maps();
+ my @bitmap = @{$maps[-1]};
+ my $prog;
+ my $bmsize = 1 << ($self->{BITS}->[-1] - 3);
+
+ $prog = <<"END";
+static const struct {
+ unsigned char bm[$bmsize];
+} ${name}_bitmap[] = {
+END
+
+ foreach my $bm (@bitmap) {
+ my $i = 0;
+ $prog .= "\t{{\n";
+ foreach my $v (unpack 'C*', $$bm) {
+ if ($i % 16 == 0) {
+ $prog .= "\n" if $i != 0;
+ $prog .= "\t";
+ }
+ $prog .= sprintf "%3d,", $v;
+ $i++;
+ }
+ $prog .= "\n\t}},\n";
+ }
+ $prog .= "};\n";
+ $prog;
+}
+
+1;
+
+package SparseMap::Int;
+
+use strict;
+use vars qw(@ISA);
+use Carp;
+#use SparseMap;
+
+@ISA = qw(SparseMap);
+
+sub new {
+ my $class = shift;
+ my $self = $class->SUPER::new(@_);
+ $self->{DEFAULT} = 0 unless exists $self->{DEFAULT};
+ bless $self, $class;
+}
+
+sub add {
+ my $self = shift;
+ while (@_ > 0) {
+ my $n = shift;
+ my $val = shift;
+ $self->add1($n, $val);
+ }
+}
+
+sub create_dmap {
+ my $self = shift;
+ my $tblbits = $self->{BITS}->[-1];
+ my $default = $self->{DEFAULT};
+
+ my @tbl = ($default) x (1 << $tblbits);
+ \@tbl;
+}
+
+sub add_to_dmap {
+ my ($self, $map, $idx, $val) = @_;
+ $map->[$idx] = $val;
+}
+
+sub find_dmap {
+ my ($self, $ref, $r) = @_;
+ foreach my $map (@$ref) {
+ if (@$map == @$r) {
+ my $i;
+ for ($i = 0; $i < @$map; $i++) {
+ last if $map->[$i] != $r->[$i];
+ }
+ return $map if $i == @$map;
+ }
+ }
+ return undef;
+}
+
+sub cprog_dmap {
+ my $self = shift;
+ my %opt = @_;
+ my $name = $opt{NAME} || 'map';
+ my @maps = $self->collect_maps();
+ my @table = @{$maps[-1]};
+ my $prog;
+ my $i;
+ my ($idtype, $idcol, $idwid);
+ my $tblsize = 1 << $self->{BITS}->[-1];
+
+ my ($min, $max);
+ foreach my $a (@table) {
+ foreach my $v (@$a) {
+ $min = $v if !defined($min) or $min > $v;
+ $max = $v if !defined($max) or $max < $v;
+ }
+ }
+ if (exists $opt{MAPTYPE}) {
+ $idtype = $opt{MAPTYPE};
+ } else {
+ my $u = $min < 0 ? '' : 'unsigned ';
+ my $absmax = abs($max);
+ $absmax = abs($min) if abs($min) > $absmax;
+
+ if ($absmax < 256) {
+ $idtype = "${u}char";
+ } elsif ($absmax < 65536) {
+ $idtype = "${u}short";
+ } else {
+ $idtype = "${u}long";
+ }
+ }
+
+ $idwid = decimalwidth($max);
+ $idwid = decimalwidth($min) if decimalwidth($min) > $idwid;
+
+ $prog = <<"END";
+static const struct {
+ $idtype tbl[$tblsize];
+} ${name}_table[] = {
+END
+
+ foreach my $a (@table) {
+ my $i = 0;
+ my $col = 0;
+ $prog .= "\t{{\n\t";
+ foreach my $v (@$a) {
+ my $s = sprintf "%${idwid}d, ", $v;
+ $col += length($s);
+ if ($col > 70) {
+ $prog .= "\n\t";
+ $col = length($s);
+ }
+ $prog .= $s;
+ }
+ $prog .= "\n\t}},\n";
+ }
+ $prog .= "};\n";
+ $prog;
+}
+
+sub decimalwidth {
+ my $n = shift;
+ my $neg = 0;
+ my $w;
+
+ if ($n < 0) {
+ $neg = 1;
+ $n = -$n;
+ }
+ if ($n < 100) {
+ $w = 2;
+ } elsif ($n < 10000) {
+ $w = 4;
+ } elsif ($n < 1000000) {
+ $w = 6;
+ } elsif ($n < 100000000) {
+ $w = 8;
+ } else {
+ $w = 10;
+ }
+ $w + $neg;
+}
+
+1;
diff --git a/contrib/idn/idnkit-1.0-src/util/UCD.pm b/contrib/idn/idnkit-1.0-src/util/UCD.pm
new file mode 100644
index 0000000..19629e6
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/util/UCD.pm
@@ -0,0 +1,194 @@
+# $Id: UCD.pm,v 1.1.1.1 2003/06/04 00:27:53 marka Exp $
+#
+# Copyright (c) 2000,2001 Japan Network Information Center.
+# All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+#
+
+package UCD;
+
+#
+# UCD.pm -- parser for Unicode Character Database files.
+#
+# This file is an aggregation of the following modules, each of which
+# provides a parser for a specific data file of UCD.
+# UCD::UnicodeData -- for UnicodeData.txt
+# UCD::CaseFolding -- for CaseFolding.txt
+# UCD::SpecialCasing -- for SpecialCasing.txt
+# UCD::CompositionExclusions -- for CompositionExclusions-1.txt
+#
+# Each module provides two subroutines:
+#
+# $line = getline(\*HANDLE);
+# reads next non-comment line from HANDLE, and returns it.
+# undef will be returned upon EOF.
+#
+# %fields = parse($line);
+# parses a line and extract fields, and returns a list of
+# field name and its value, suitable for assignment to a hash.
+#
+
+package UCD::UnicodeData;
+
+use strict;
+use Carp;
+
+sub getline {
+ my $fh = shift;
+ my $s = <$fh>;
+ $s =~ s/\r?\n$// if $s;
+ $s;
+}
+
+sub parseline {
+ my $s = shift;
+
+ my @f = split /;/, $s, -1;
+ return (CODE => hex($f[0]),
+ NAME => $f[1],
+ CATEGORY => $f[2],
+ CLASS => $f[3]+0,
+ BIDI => $f[4],
+ DECOMP => dcmap($f[5]),
+ DECIMAL => dvalue($f[6]),
+ DIGIT => dvalue($f[7]),
+ NUMERIC => dvalue($f[8]),
+ MIRRORED => $f[9] eq 'Y',
+ NAME10 => $f[10],
+ COMMENT => $f[11],
+ UPPER => ucode($f[12]),
+ LOWER => ucode($f[13]),
+ TITLE => ucode($f[14]));
+}
+
+sub dcmap {
+ my $v = shift;
+ return undef if $v eq '';
+ $v =~ /^(?:(<[^>]+>)\s*)?(\S.*)/
+ or croak "invalid decomposition mapping \"$v\"";
+ my $tag = $1 || '';
+ [$tag, map {hex($_)} split(' ', $2)];
+}
+
+sub ucode {
+ my $v = shift;
+ return undef if $v eq '';
+ hex($v);
+}
+
+sub dvalue {
+ my $v = shift;
+ return undef if $v eq '';
+ $v;
+}
+
+package UCD::CaseFolding;
+
+use strict;
+
+sub getline {
+ my $fh = shift;
+ while (defined(my $s = <$fh>)) {
+ next if $s =~ /^\#/;
+ next if $s =~ /^\s*$/;
+ $s =~ s/\r?\n$//;
+ return $s;
+ }
+ undef;
+}
+
+sub parseline {
+ my $s = shift;
+ my @f = split /;\s*/, $s, -1;
+ return (CODE => hex($f[0]),
+ TYPE => $f[1],
+ MAP => [map(hex, split ' ', $f[2])],
+ );
+}
+
+package UCD::SpecialCasing;
+
+use strict;
+
+sub getline {
+ my $fh = shift;
+ while (defined(my $s = <$fh>)) {
+ next if $s =~ /^\#/;
+ next if $s =~ /^\s*$/;
+ $s =~ s/\r?\n$//;
+ return $s;
+ }
+ undef;
+}
+
+sub parseline {
+ my $s = shift;
+
+ my @f = split /;\s*/, $s, -1;
+ my $cond = (@f > 5) ? $f[4] : undef;
+ return (CODE => hex($f[0]),
+ LOWER => [map(hex, split ' ', $f[1])],
+ TITLE => [map(hex, split ' ', $f[2])],
+ UPPER => [map(hex, split ' ', $f[3])],
+ CONDITION => $cond);
+}
+
+package UCD::CompositionExclusions;
+
+use strict;
+
+sub getline {
+ my $fh = shift;
+ while (defined(my $s = <$fh>)) {
+ next if $s =~ /^\#/;
+ next if $s =~ /^\s*$/;
+ $s =~ s/\r?\n$//;
+ return $s;
+ }
+ undef;
+}
+
+sub parseline {
+ my $s = shift;
+ m/^[0-9A-Fa-f]+/;
+ return (CODE => hex($&));
+}
+
+1;
diff --git a/contrib/idn/idnkit-1.0-src/util/generate_nameprep_data.pl b/contrib/idn/idnkit-1.0-src/util/generate_nameprep_data.pl
new file mode 100755
index 0000000..31dd18b
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/util/generate_nameprep_data.pl
@@ -0,0 +1,405 @@
+#! /usr/local/bin/perl -w
+# $Id: generate_nameprep_data.pl,v 1.1.1.1 2003/06/04 00:27:54 marka Exp $
+#
+# Copyright (c) 2001 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+#
+
+use v5.6.0; # for pack('U')
+use bytes;
+
+use lib qw(.);
+
+use SparseMap;
+use Getopt::Long;
+
+(my $myid = '$Id: generate_nameprep_data.pl,v 1.1.1.1 2003/06/04 00:27:54 marka Exp $') =~ s/\$([^\$]+)\$/\$-$1-\$/;
+
+my @map_bits = (9, 7, 5);
+my @proh_bits = (7, 7, 7);
+my @unas_bits = (7, 7, 7);
+my @bidi_bits = (9, 7, 5);
+
+my @bidi_types = ('OTHERS', 'R_AL', 'L');
+
+my $dir = '.';
+my @versions = ();
+
+GetOptions('dir=s', \$dir) or die usage();
+@versions = @ARGV;
+
+print_header();
+
+bits_definition("MAP", @map_bits);
+bits_definition("PROH", @proh_bits);
+bits_definition("UNAS", @unas_bits);
+bits_definition("BIDI", @bidi_bits);
+
+generate_data($_) foreach @ARGV;
+
+sub usage {
+ die "Usage: $0 [-dir dir] version..\n";
+}
+
+sub generate_data {
+ my $version = shift;
+ generate_mapdata($version, "$dir/nameprep.$version.map");
+ generate_prohibiteddata($version, "$dir/nameprep.$version.prohibited");
+ generate_unassigneddata($version, "$dir/nameprep.$version.unassigned");
+ generate_bididata($version, "$dir/nameprep.$version.bidi");
+}
+
+#
+# Generate mapping data.
+#
+sub generate_mapdata {
+ my $version = shift;
+ my $file = shift;
+
+ my $map = SparseMap::Int->new(BITS => [@map_bits],
+ MAX => 0x110000,
+ MAPALL => 1,
+ DEFAULT => 0);
+ open FILE, $file or die "cannot open $file: $!\n";
+
+ my $mapbuf = "\0"; # dummy
+ my %maphash = ();
+ while (<FILE>) {
+ if ($. == 1 and /^%\s*SAME-AS\s+(\S+)/) {
+ my $same_as = $1;
+ if (grep {$_ eq $same_as} @versions > 0) {
+ generate_map_ref($version, $same_as);
+ close FILE;
+ return;
+ }
+ next;
+ }
+ next if /^\#/;
+ next if /^\s*$/;
+ register_map($map, \$mapbuf, \%maphash, $_);
+ }
+ close FILE;
+ generate_map($version, $map, \$mapbuf);
+}
+
+#
+# Generate prohibited character data.
+#
+sub generate_prohibiteddata {
+ my $version = shift;
+ my $file = shift;
+
+ my $proh = SparseMap::Bit->new(BITS => [@proh_bits],
+ MAX => 0x110000);
+ open FILE, $file or die "cannot open $file: $!\n";
+ while (<FILE>) {
+ if ($. == 1 and /^%\s*SAME-AS\s+(\S+)/) {
+ my $same_as = $1;
+ if (grep {$_ eq $same_as} @versions > 0) {
+ generate_prohibited_ref($version, $same_as);
+ close FILE;
+ return;
+ }
+ next;
+ }
+ next if /^\#/;
+ next if /^\s*$/;
+ register_prohibited($proh, $_);
+ }
+ close FILE;
+ generate_prohibited($version, $proh);
+}
+
+#
+# Generate unassigned codepoint data.
+#
+sub generate_unassigneddata {
+ my $version = shift;
+ my $file = shift;
+
+ my $unas = SparseMap::Bit->new(BITS => [@unas_bits],
+ MAX => 0x110000);
+ open FILE, $file or die "cannot open $file: $!\n";
+ while (<FILE>) {
+ if ($. == 1 and /^%\s*SAME-AS\s+(\S+)/) {
+ my $same_as = $1;
+ if (grep {$_ eq $same_as} @versions > 0) {
+ generate_unassigned_ref($version, $same_as);
+ close FILE;
+ return;
+ }
+ next;
+ }
+ next if /^\#/;
+ next if /^\s*$/;
+ register_unassigned($unas, $_);
+ }
+ close FILE;
+ generate_unassigned($version, $unas);
+}
+
+#
+# Generate data of bidi "R" or "AL" characters.
+#
+sub generate_bididata {
+ my $version = shift;
+ my $file = shift;
+
+ my $bidi = SparseMap::Int->new(BITS => [@bidi_bits],
+ MAX => 0x110000);
+ open FILE, $file or die "cannot open $file: $!\n";
+
+ my $type = 0;
+ while (<FILE>) {
+ if ($. == 1 and /^%\s*SAME-AS\s+(\S+)/) {
+ my $same_as = $1;
+ if (grep {$_ eq $same_as} @versions > 0) {
+ generate_unassigned_ref($version, $same_as);
+ close FILE;
+ return;
+ }
+ next;
+ }
+ if (/^%\s*BIDI_TYPE\s+(\S+)$/) {
+ my $i = 0;
+ for ($i = 0; $i < @bidi_types; $i++) {
+ if ($1 eq $bidi_types[$i]) {
+ $type = $i;
+ last;
+ }
+ }
+ die "unrecognized line: $_" if ($i >= @bidi_types);
+ next;
+ }
+ next if /^\#/;
+ next if /^\s*$/;
+ register_bidi($bidi, $type, $_);
+ }
+ close FILE;
+
+ generate_bidi($version, $bidi);
+}
+
+sub print_header {
+ print <<"END";
+/* \$Id\$ */
+/* $myid */
+/*
+ * Do not edit this file!
+ * This file is generated from NAMEPREP specification.
+ */
+
+END
+}
+
+sub bits_definition {
+ my $name = shift;
+ my @bits = @_;
+ my $i = 0;
+
+ foreach my $n (@bits) {
+ print "#define ${name}_BITS_$i\t$n\n";
+ $i++;
+ }
+ print "\n";
+}
+
+sub register_map {
+ my ($map, $bufref, $hashref, $line) = @_;
+
+ my ($from, $to) = split /;/, $line;
+ my @fcode = map {hex($_)} split ' ', $from;
+ my @tcode = map {hex($_)} split ' ', $to;
+
+ my $ucs4 = pack('V*', @tcode);
+ $ucs4 =~ s/\000+$//;
+
+ my $offset;
+ if (exists $hashref->{$ucs4}) {
+ $offset = $hashref->{$ucs4};
+ } else {
+ $offset = length $$bufref;
+ $$bufref .= pack('C', length($ucs4)) . $ucs4;
+ $hashref->{$ucs4} = $offset;
+ }
+
+ die "unrecognized line: $line" if @fcode != 1;
+ $map->add($fcode[0], $offset);
+}
+
+sub generate_map {
+ my ($version, $map, $bufref) = @_;
+
+ $map->fix();
+
+ print $map->cprog(NAME => "nameprep_${version}_map");
+ print "\nstatic const unsigned char nameprep_${version}_map_data[] = \{\n";
+ print_uchararray($$bufref);
+ print "};\n\n";
+}
+
+sub generate_map_ref {
+ my ($version, $refversion) = @_;
+ print <<"END";
+#define nameprep_${version}_map_imap nameprep_${refversion}_map_imap
+#define nameprep_${version}_map_table nameprep_${refversion}_map_table
+#define nameprep_${version}_map_data nameprep_${refversion}_map_data
+
+END
+}
+
+sub print_uchararray {
+ my @chars = unpack 'C*', $_[0];
+ my $i = 0;
+ foreach my $v (@chars) {
+ if ($i % 12 == 0) {
+ print "\n" if $i != 0;
+ print "\t";
+ }
+ printf "%3d, ", $v;
+ $i++;
+ }
+ print "\n";
+}
+
+sub register_prohibited {
+ my $proh = shift;
+ register_bitmap($proh, @_);
+}
+
+sub register_unassigned {
+ my $unas = shift;
+ register_bitmap($unas, @_);
+}
+
+sub register_bidi {
+ my $bidi = shift;
+ my $type = shift;
+ register_intmap($bidi, $type, @_);
+}
+
+sub generate_prohibited {
+ my ($version, $proh) = @_;
+ generate_bitmap($proh, "nameprep_${version}_prohibited");
+ print "\n";
+}
+
+sub generate_prohibited_ref {
+ my ($version, $refversion) = @_;
+ print <<"END";
+#define nameprep_${version}_prohibited_imap nameprep_${refversion}_prohibited_imap
+#define nameprep_${version}_prohibited_bitmap nameprep_${refversion}_prohibited_bitmap
+
+END
+}
+
+sub generate_unassigned {
+ my ($version, $unas) = @_;
+ generate_bitmap($unas, "nameprep_${version}_unassigned");
+ print "\n";
+}
+
+sub generate_unassigned_ref {
+ my ($version, $refversion) = @_;
+ print <<"END";
+#define nameprep_${version}_unassigned_imap nameprep_${refversion}_unassigned_imap
+#define nameprep_${version}_unassigned_bitmap nameprep_${refversion}_unassigned_bitmap
+
+END
+}
+
+sub generate_bidi {
+ my ($version, $bidi) = @_;
+
+ $bidi->fix();
+
+ print $bidi->cprog(NAME => "nameprep_${version}_bidi");
+ print "\n";
+ print "static const unsigned char nameprep_${version}_bidi_data[] = \{\n";
+
+ foreach my $type (@bidi_types) {
+ printf "\tidn_biditype_%s, \n", lc($type);
+ }
+ print "};\n\n";
+}
+
+sub generate_bidi_ref {
+ my ($version, $refversion) = @_;
+ print <<"END";
+#define nameprep_${version}_bidi_imap nameprep_${refversion}_bidi_imap
+#define nameprep_${version}_bidi_table nameprep_${refversion}_bidi_table
+
+END
+}
+
+sub register_bitmap {
+ my $map = shift;
+ my $line = shift;
+
+ /^([0-9A-Fa-f]+)(?:-([0-9A-Fa-f]+))?/ or die "unrecognized line: $line";
+ my $start = hex($1);
+ my $end = defined($2) ? hex($2) : undef;
+ if (defined $end) {
+ $map->add($start .. $end);
+ } else {
+ $map->add($start);
+ }
+}
+
+sub register_intmap {
+ my $map = shift;
+ my $value = shift;
+ my $line = shift;
+
+ /^([0-9A-Fa-f]+)(?:-([0-9A-Fa-f]+))?/ or die "unrecognized line: $line";
+ my $start = hex($1);
+ my $end = defined($2) ? hex($2) : $start;
+ for (my $i = $start; $i <= $end; $i++) {
+ $map->add($i, $value);
+ }
+}
+
+sub generate_bitmap {
+ my $map = shift;
+ my $name = shift;
+ $map->fix();
+ #$map->stat();
+ print $map->cprog(NAME => $name);
+}
diff --git a/contrib/idn/idnkit-1.0-src/util/generate_normalize_data.pl b/contrib/idn/idnkit-1.0-src/util/generate_normalize_data.pl
new file mode 100755
index 0000000..fe81648
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/util/generate_normalize_data.pl
@@ -0,0 +1,586 @@
+#! /usr/local/bin/perl -w
+# $Id: generate_normalize_data.pl,v 1.1.1.1 2003/06/04 00:27:55 marka Exp $
+#
+# Copyright (c) 2000,2001 Japan Network Information Center.
+# All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+#
+
+#
+# Generate lib/unicodedata.c from UnicodeData.txt,
+# CompositionExclusions-1.txt, SpecialCasing.txt and CaseFolding.txt,
+# all of them available from ftp://ftp.unicode.org/Public/UNIDATA/.
+#
+
+use strict;
+use lib qw(.);
+
+use Getopt::Long;
+use UCD;
+use SparseMap;
+
+use constant UCS_MAX => 0x110000;
+use constant END_BIT => 0x80000000;
+
+my $DECOMP_COMPAT_BIT = 0x8000;
+
+my $CASEMAP_FINAL_BIT = 0x1;
+my $CASEMAP_NONFINAL_BIT = 0x2;
+my $CASEMAP_LAST_BIT = 0x10;
+
+my $LETTER_BIT = 1;
+my $NSPMARK_BIT = 2;
+
+(my $myid = '$Id: generate_normalize_data.pl,v 1.1.1.1 2003/06/04 00:27:55 marka Exp $') =~ s/\$([^\$]+)\$/\$-$1-\$/;
+
+my @default_bits = (9, 7, 5);
+#my @default_bits = (7, 7, 7);
+my @canon_class_bits = @default_bits;
+my @decomp_bits = @default_bits;
+my @comp_bits = @default_bits;
+my @folding_bits = @default_bits;
+my @casemap_bits = @default_bits;
+my @casemap_ctx_bits = @default_bits;
+
+my $prefix = '';
+my $dir = '.';
+my $unicodedatafile = 'UnicodeData.txt';
+my $exclusionfile = 'CompositionExclusions.txt';
+my $specialcasefile = 'SpecialCasing.txt';
+my $casefoldingfile = 'CaseFolding.txt';
+my $verbose;
+
+GetOptions('dir|d=s' => \$dir,
+ 'unicodedata|u=s' => \$unicodedatafile,
+ 'exclude|e=s' => \$exclusionfile,
+ 'specialcase|s=s' => \$specialcasefile,
+ 'casefold|c=s' => \$casefoldingfile,
+ 'prefix|p=s' => \$prefix,
+ 'verbose|v' => \$verbose,
+) or usage();
+
+foreach my $r (\$unicodedatafile, \$exclusionfile,
+ \$specialcasefile, \$casefoldingfile) {
+ $$r = "$dir/$$r" unless $$r =~ m|^/|;
+}
+
+my %exclusions;
+my %lower_special;
+my %upper_special;
+
+my @decomp_data;
+my @comp_data;
+my @toupper_data;
+my @tolower_data;
+my @folding_data;
+
+#
+# Create Mapping/Bitmap objects.
+#
+
+# canonical class
+my $canon_class = SparseMap::Int->new(BITS => [@canon_class_bits],
+ MAX => UCS_MAX,
+ MAPALL => 1,
+ DEFAULT => 0);
+
+# canonical/compatibility decomposition
+my $decomp = SparseMap::Int->new(BITS => [@decomp_bits],
+ MAX => UCS_MAX,
+ MAPALL => 1,
+ DEFAULT => 0);
+
+# canonical composition
+my $comp = SparseMap::Int->new(BITS => [@comp_bits],
+ MAX => UCS_MAX,
+ MAPALL => 1,
+ DEFAULT => 0);
+
+# uppercase/lowercase
+my $upper = SparseMap::Int->new(BITS => [@casemap_bits],
+ MAX => UCS_MAX,
+ MAPALL => 1,
+ DEFAULT => 0);
+my $lower = SparseMap::Int->new(BITS => [@casemap_bits],
+ MAX => UCS_MAX,
+ MAPALL => 1,
+ DEFAULT => 0);
+
+# final/nonfinal context
+my $casemap_ctx = SparseMap::Int->new(BITS => [@casemap_ctx_bits],
+ MAX => UCS_MAX,
+ MAPALL => 1,
+ DEFAULT => 0);
+
+# casefolding
+my $folding = SparseMap::Int->new(BITS => [@folding_bits],
+ MAX => UCS_MAX,
+ MAPALL => 1,
+ DEFAULT => 0);
+
+#
+# Read datafiles.
+#
+
+read_exclusion_file();
+read_specialcasing_file();
+read_unicodedata_file();
+read_casefolding_file();
+
+print_header();
+print_canon_class();
+print_composition();
+print_decomposition();
+print_casemap();
+print_casemap_context();
+print_casefolding();
+
+exit;
+
+sub usage {
+ print STDERR <<"END";
+Usage: $0 [options..]
+ options:
+ -d DIR directory where Unicode Character Data files resides [./]
+ -u FILE name of the UnicodeData file [UnicodeData.txt]
+ -e FILE name of the CompositionExclusion file [CompositionExclusions-1.txt]
+ -s FILE name of the SpecialCasing file [SpecialCasing.txt]
+ -c FILE name of the CaseFolding file [CaseFolding.txt]
+END
+ exit 1;
+}
+
+#
+# read_exclusion_file -- read CompositionExclusions-1.txt.
+#
+sub read_exclusion_file {
+ open EXCLUDE, $exclusionfile or die "cannot open $exclusionfile: $!\n";
+ while ($_ = UCD::CompositionExclusions::getline(\*EXCLUDE)) {
+ my %data = UCD::CompositionExclusions::parseline($_);
+ $exclusions{$data{CODE}} = 1;
+ }
+ close EXCLUDE;
+}
+
+#
+# read_specialcasing_file -- read SpecialCasing.txt
+#
+sub read_specialcasing_file {
+ open SPCASE, $specialcasefile or die "cannot open $specialcasefile: $!\n";
+ while ($_ = UCD::SpecialCasing::getline(\*SPCASE)) {
+ my %data = UCD::SpecialCasing::parseline($_);
+ my $code = $data{CODE};
+ my $lower = $data{LOWER};
+ my $upper = $data{UPPER};
+ my $cond = $data{CONDITION} || '';
+
+ next unless $cond eq '' or $cond =~ /^(NON_)?FINAL/;
+
+ if (defined $cond && (@$lower > 1 || $lower->[0] != $code)
+ or @$lower > 1 or $lower->[0] != $code) {
+ $lower_special{$code} = [$lower, $cond];
+ }
+ if (defined $cond && (@$upper > 1 || $upper->[0] != $code)
+ or @$upper > 1 or $upper->[0] != $code) {
+ $upper_special{$code} = [$upper, $cond];
+ }
+ }
+ close SPCASE;
+}
+
+#
+# read_unicodedata_file -- read UnicodeData.txt
+#
+sub read_unicodedata_file {
+ open UCD, $unicodedatafile or die "cannot open $unicodedatafile: $!\n";
+
+ @decomp_data = (0);
+ @toupper_data = (0);
+ @tolower_data = (0);
+
+ my @comp_cand; # canonical composition candidates
+ my %nonstarter;
+
+ while ($_ = UCD::UnicodeData::getline(\*UCD)) {
+ my %data = UCD::UnicodeData::parseline($_);
+ my $code = $data{CODE};
+
+ # combining class
+ if ($data{CLASS} > 0) {
+ $nonstarter{$code} = 1;
+ $canon_class->add($code, $data{CLASS});
+ }
+
+ # uppercasing
+ if (exists $upper_special{$code} or defined $data{UPPER}) {
+ my $offset = @toupper_data;
+ my @casedata;
+
+ $upper->add($code, $offset);
+ if (exists $upper_special{$code}) {
+ push @casedata, $upper_special{$code};
+ }
+ if (defined $data{UPPER}) {
+ push @casedata, $data{UPPER};
+ }
+ push @toupper_data, casemap_data(@casedata);
+ }
+
+ # lowercasing
+ if (exists $lower_special{$code} or defined $data{LOWER}) {
+ my $offset = @tolower_data;
+ my @casedata;
+
+ $lower->add($code, $offset);
+ if (exists $lower_special{$code}) {
+ push @casedata, $lower_special{$code};
+ }
+ if (defined $data{LOWER}) {
+ push @casedata, $data{LOWER};
+ }
+ push @tolower_data, casemap_data(@casedata);
+ }
+
+ # composition/decomposition
+ if ($data{DECOMP}) {
+ my ($tag, @decomp) = @{$data{DECOMP}};
+ my $offset = @decomp_data;
+
+ # composition
+ if ($tag eq '' and @decomp > 1 and not exists $exclusions{$code}) {
+ # canonical composition candidate
+ push @comp_cand, [$code, @decomp];
+ }
+
+ # decomposition
+ if ($tag ne '') {
+ # compatibility decomposition
+ $offset |= $DECOMP_COMPAT_BIT;
+ }
+ $decomp->add($code, $offset);
+ push @decomp_data, @decomp;
+ $decomp_data[-1] |= END_BIT;
+
+ }
+
+ # final/nonfinal context
+ if ($data{CATEGORY} =~ /L[ult]/) {
+ $casemap_ctx->add($code, $LETTER_BIT);
+ } elsif ($data{CATEGORY} eq 'Mn') {
+ $casemap_ctx->add($code, $NSPMARK_BIT);
+ }
+ }
+ close UCD;
+
+ # Eliminate composition candidates whose decomposition starts with
+ # a non-starter.
+ @comp_cand = grep {not exists $nonstarter{$_->[1]}} @comp_cand;
+
+ @comp_data = ([0, 0, 0]);
+ my $last_code = -1;
+ my $last_offset = @comp_data;
+ for my $r (sort {$a->[1] <=> $b->[1] || $a->[2] <=> $b->[2]} @comp_cand) {
+ if ($r->[1] != $last_code) {
+ $comp->add($last_code,
+ ($last_offset | ((@comp_data - $last_offset)<<16)))
+ unless $last_code == -1;
+ $last_code = $r->[1];
+ $last_offset = @comp_data;
+ }
+ push @comp_data, $r;
+ }
+ $comp->add($last_code,
+ ($last_offset | ((@comp_data - $last_offset)<<16)));
+}
+
+sub casemap_data {
+ my @data = @_;
+ my @result = ();
+ while (@data > 0) {
+ my $r = shift @data;
+ my $flag = 0;
+ if (ref $r) {
+ if ($r->[1] eq 'FINAL') {
+ $flag |= $CASEMAP_FINAL_BIT;
+ } elsif ($r->[1] eq 'NON_FINAL') {
+ $flag |= $CASEMAP_NONFINAL_BIT;
+ } elsif ($r->[1] ne '') {
+ die "unknown condition \"", $r->[1], "\"\n";
+ }
+ }
+ $flag |= $CASEMAP_LAST_BIT if @data == 0;
+ push @result, $flag;
+ push @result, (ref $r) ? @{$r->[0]} : $r;
+ $result[-1] |= END_BIT;
+ }
+ @result;
+}
+
+#
+# read_casefolding_file -- read CaseFolding.txt
+#
+sub read_casefolding_file {
+ open FOLD, $casefoldingfile or die "cannto open $casefoldingfile: $!\n";
+
+ # dummy.
+ @folding_data = (0);
+
+ while ($_ = UCD::CaseFolding::getline(\*FOLD)) {
+ my %data = UCD::CaseFolding::parseline($_);
+
+ $folding->add($data{CODE}, scalar(@folding_data));
+ push @folding_data, @{$data{MAP}};
+ $folding_data[-1] |= END_BIT;
+ }
+ close FOLD;
+}
+
+sub print_header {
+ print <<"END";
+/* \$Id\$ */
+/* $myid */
+/*
+ * Do not edit this file!
+ * This file is generated from UnicodeData.txt, CompositionExclusions-1.txt,
+ * SpecialCasing.txt and CaseFolding.txt.
+ */
+
+END
+}
+
+#
+# print_canon_class -- generate data for canonical class
+#
+sub print_canon_class {
+ $canon_class->fix();
+ print STDERR "** cannon_class\n", $canon_class->stat() if $verbose;
+
+ print <<"END";
+
+/*
+ * Canonical Class
+ */
+
+END
+ print_bits("CANON_CLASS", @canon_class_bits);
+ print "\n";
+ print $canon_class->cprog(NAME => "${prefix}canon_class");
+}
+
+#
+# print_composition -- generate data for canonical composition
+#
+sub print_composition {
+ $comp->fix();
+ print STDERR "** composition\n", $comp->stat() if $verbose;
+
+ print <<"END";
+
+/*
+ * Canonical Composition
+ */
+
+END
+ print_bits("CANON_COMPOSE", @comp_bits);
+ print "\n";
+ print $comp->cprog(NAME => "${prefix}compose");
+ print <<"END";
+
+static const struct composition ${prefix}compose_seq[] = {
+END
+ my $i = 0;
+ foreach my $r (@comp_data) {
+ if ($i % 2 == 0) {
+ print "\n" if $i != 0;
+ print "\t";
+ }
+ printf "{ 0x%08x, 0x%08x }, ", $r->[2], $r->[0];
+ $i++;
+ }
+ print "\n};\n\n";
+}
+
+#
+# print_decomposition -- generate data for canonical/compatibility
+# decomposition
+#
+sub print_decomposition {
+ $decomp->fix();
+ print STDERR "** decomposition\n", $decomp->stat() if $verbose;
+
+ print <<"END";
+
+/*
+ * Canonical/Compatibility Decomposition
+ */
+
+END
+ print_bits("DECOMP", @decomp_bits);
+ print "#define DECOMP_COMPAT\t$DECOMP_COMPAT_BIT\n\n";
+
+ print $decomp->cprog(NAME => "${prefix}decompose");
+
+ print "static const unsigned long ${prefix}decompose_seq[] = {\n";
+ print_ulseq(@decomp_data);
+ print "};\n\n";
+}
+
+#
+# print_casemap -- generate data for case mapping
+#
+sub print_casemap {
+ $upper->fix();
+ $lower->fix();
+ print STDERR "** upper mapping\n", $upper->stat() if $verbose;
+ print STDERR "** lower mapping\n", $lower->stat() if $verbose;
+
+ print <<"END";
+
+/*
+ * Lowercase <-> Uppercase mapping
+ */
+
+/*
+ * Flags for special case mapping.
+ */
+#define CMF_FINAL $CASEMAP_FINAL_BIT
+#define CMF_NONFINAL $CASEMAP_NONFINAL_BIT
+#define CMF_LAST $CASEMAP_LAST_BIT
+#define CMF_CTXDEP (CMF_FINAL|CMF_NONFINAL)
+
+END
+ print_bits("CASEMAP", @casemap_bits);
+ print "\n";
+ print $upper->cprog(NAME => "${prefix}toupper");
+ print $lower->cprog(NAME => "${prefix}tolower");
+
+ print "static const unsigned long ${prefix}toupper_seq[] = {\n";
+ print_ulseq(@toupper_data);
+ print "};\n\n";
+
+ print "static const unsigned long ${prefix}tolower_seq[] = {\n";
+ print_ulseq(@tolower_data);
+ print "};\n\n";
+}
+
+#
+# print_casefolding -- generate data for case folding
+#
+sub print_casefolding {
+ $folding->fix();
+ print STDERR "** case folding\n", $folding->stat() if $verbose;
+
+ print <<"END";
+
+/*
+ * Case Folding
+ */
+
+END
+ print_bits("CASE_FOLDING", @folding_bits);
+ print "\n";
+ print $folding->cprog(NAME => "${prefix}case_folding");
+
+ print "static const unsigned long ${prefix}case_folding_seq[] = {\n";
+ print_ulseq(@folding_data);
+ print "};\n\n";
+}
+
+#
+# print_casemap_context -- gerarate data for determining context
+# (final/non-final)
+#
+sub print_casemap_context {
+ $casemap_ctx->fix();
+ print STDERR "** casemap context\n", $casemap_ctx->stat() if $verbose;
+
+ print <<"END";
+
+/*
+ * Cased characters and non-spacing marks (for casemap context)
+ */
+
+END
+
+ print_bits("CASEMAP_CTX", @casemap_ctx_bits);
+ print <<"END";
+
+#define CTX_CASED $LETTER_BIT
+#define CTX_NSM $NSPMARK_BIT
+
+END
+ print $casemap_ctx->cprog(NAME => "${prefix}casemap_ctx");
+}
+
+sub sprint_composition_hash {
+ my $i = 0;
+ my $s = '';
+ foreach my $r (@_) {
+ if ($i % 2 == 0) {
+ $s .= "\n" if $i != 0;
+ $s .= "\t";
+ }
+ $s .= sprintf "{0x%04x, 0x%04x, 0x%04x}, ", @{$r};
+ $i++;
+ }
+ $s;
+}
+
+sub print_bits {
+ my $prefix = shift;
+ my $i = 0;
+ foreach my $bit (@_) {
+ print "#define ${prefix}_BITS_$i\t$bit\n";
+ $i++;
+ }
+}
+
+sub print_ulseq {
+ my $i = 0;
+ foreach my $v (@_) {
+ if ($i % 4 == 0) {
+ print "\n" if $i != 0;
+ print "\t";
+ }
+ printf "0x%08x, ", $v;
+ $i++;
+ }
+ print "\n";
+}
diff --git a/contrib/idn/idnkit-1.0-src/win/README.WIN b/contrib/idn/idnkit-1.0-src/win/README.WIN
new file mode 100644
index 0000000..8e47f85
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/win/README.WIN
@@ -0,0 +1,17 @@
+To build idnkit for Windows, follow the instruction below.
+
+To build Windows version, you need `iconv' library. A LGPL
+implemenation is available from the following place.
+
+ http://www.gnu.org/software/libiconv/
+
+Follow the instructions described in README.woe32 file which can be
+found in the distribution, and you'll get a DLL vesion of `libiconv'.
+Copy the DLL (iconv.dll), the header (iconv.h) and the import library
+(iconv.lib) here.
+
+Then go to the top directory and run the following command.
+
+ nmake -f make.wnt
+
+; $Id: README.WIN,v 1.1.1.1 2003/06/04 00:27:32 marka Exp $
diff --git a/contrib/idn/idnkit-1.0-src/wsock/README.txt b/contrib/idn/idnkit-1.0-src/wsock/README.txt
new file mode 100644
index 0000000..e7723b4
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/README.txt
@@ -0,0 +1,665 @@
+
+ idn wrapper - Client Side IDN Conversion Software for Windows
+
+ Copyright (c) 2000,2001,2002 Japan Network Information Center.
+ All rights reserved.
+
+ *** NOTICE ******************************************************
+ If you have installed mDN Wrapper (former version of idn wrapper)
+ on your system, you should unwrap all the programs before
+ installing idn wrapper.
+ *****************************************************************
+
+
+1. Introduction
+
+ For supporting internationalized domain names, each client
+ application should convert domain names (their encodings) to that
+ DNS server accepts. This requires applications to handle
+ internationalized domain names in its core, and it is the vendor's
+ responsibility to make their programs IDN-compatible.
+
+ Although there are ongoing efforts in IETF to standardize IDN
+ framework (architecture, encoding etc.) and several RFCs are
+ expected to be published soon as the result, not many applications
+ support IDN to this date.
+
+ So, there are needs for some helper application which makes legacy
+ applications IDN-aware. `runidn' in idnkit is one of such
+ solutions for Unix-like operating systems, and this software, `idn
+ wrapper' is the one for Windows.
+
+ On windows, name resolving request is passed to WINSOCK DLL. idn
+ wrapper replaces WINSOCK DLL with the one that can handle IDN,
+ which makes legacy windows applications compatible with IDN.
+
+2. Architecture
+
+2.1. Wrapper DLL
+
+ Wrapper DLL resides between application and original DLL. It
+ intercept application's calls to original DLL, and preforms some
+ additional processing on those calls.
+
+ +------------+ Call +------------+ Call +------------+
+ | |------->| |------->| |
+ |Application | |Wrapper DLL | |Original DLL|
+ | |<-------| |<-------| |
+ +------------+ Return +------------+ Return +------------+
+ additional
+ processing
+ here
+
+ DLL call from apllication is passed to wrapper DLL. Wrapper DLL
+ then performs some additional processing on that call, and then
+ calls original DLL. Also, result from original DLL will once passed
+ to wrapper DLL and wrapper does additional process on that result,
+ and finally result will passed to the application.
+
+ idn wrapper provides wrapper DLLs for WINSOCK,
+
+ WSOCK32.DLL WINSOCK V1.1
+ WS2_32.DLL WINSOCK V2.0
+
+ to resolve multi-lingual domain names.
+
+2.2. Wrapping APIs
+
+ idn wrapper performs additional processing on name resolving APIs in
+ WINSOCK, listed below.
+
+ both WINSOCK 1.1, WINSOCK 2.0
+
+ gethostbyaddr
+ gethostbyname
+ WSAAsyncGetHostByAddr
+ WSAAsyncGetHostByName
+
+ only in WINSOCK 2.0
+
+ getaddrinfo
+ freeaddrinfo
+ getnameinfo
+ WSALookupServiceBeginA
+ WSALookupServiceNextA
+ WSALookupServiceEnd
+
+ Some applications do not use these APIs to resolve domain names.
+ `nslookup' is one of those programs. `nslookup' builds and parse DNS
+ messages internally and does not use WINSOCK's name resolver APIs.
+ idn wrapper cannot make those programs IDN-aware.
+
+ NOTE:
+ WINSOCK 2.0 also contains WIDE-CHARACTER based name resolution
+ APIs,
+
+ WSALookupServiceBeginW
+ WSALookupServiceNextW
+
+ idn wrapper does not wrap these APIs. These APIs are used in
+ Microsoft's own internationalization framework. It is dangerous
+ to convert to another internationalization framework.
+
+2.3. Other APIs in WINSOCK
+
+ For other APIs in WINSOCK, idn wrapper does nothing, only calls
+ original DLL's entries.
+
+ idn wrapper copies original WINSOCK DLLs with renaming
+ as below, and forward requests to them.
+
+ wsock32.dll -> wsock32o.dll
+ ws2_32.dll -> ws2_32o.dll
+
+ Wrappper DLL will be installed with original DLL names. So after
+ installation of idn wrapper, WINSOCK DLLs should be
+
+ wsock32.dll idn wrapper for WINSOCK V1.1
+ ws2_32.dll idn wrapper for WINSOCK V2.0
+ wsock32o.dll Original WINSOCK V1.1 DLL
+ ws2_32o.dll Original WINSOCK V2.0 DLL
+
+2.4. Asynchronous API
+
+ Domain name conversion take place on
+
+ request to DNS
+
+ convert from local encoding to DNS compatible encoding
+
+ response from DNS
+
+ convert from DNS encoding to local encoding
+
+ For synchronous APIs, local to DNS conversion is done before calling
+ original API, and after return from original API, name should be
+ converted from DNS encoding to local encoding.
+
+ But WINSOCK having some asynchronous APIs, such as
+
+ WSAAsyncGetHostByAddr
+ WSAAsyncGetHostByName
+
+ In these APIs, completion is notified with windows message. To
+ perform DNS to local conversion, wrapper should hook target window
+ procedure to capture those completion messages.
+
+ So, if asynchronous API was called, idn wrapper set hook to target
+ window procedure (passed with API parameter). If hook found
+ notify message (also given with API parameter), then convert
+ resulting name (in DNS encoding) to local encoding.
+
+2.5. Installing Wrapper DLLs
+
+ WINSOCK DLLs are placed at Windows's system directory. To wrap
+ WINSOCK DLLs, one could do following sequence at system directory.
+
+ + Rename Original WINSOCK DLLs
+
+ ren wsock32.dll wsock32o.dll
+ ren ws2_32.dll ws2_32o.dll
+
+ + Install (copy in) Wrapper DLLs
+
+ copy somewhere\wsock32.dll wsock32.dll
+ copy somewhere\ws2_32.dll ws2_32.dll
+ copy another DLLs also
+
+ However, replacing DLLs in Window's system directory is very
+ dangerous:
+
+ a) If you re-install idn wrapper again, original WINSOCK DLLs
+ may be lost.
+
+ b) Some application or service pack will replace WINSOCK DLLs. It
+ may corrupt WINSOCK environment.
+
+ If these happen, at least networking does not work, and worse,
+ Windows never startup again.
+
+ So, idn wrapper usually does not wrap in the system directory, but wrap in
+ each indivisual application's directory.
+
+ In Windows, DLL will be searched in the following places:
+
+ Application's Load Directory
+ %SystemRoot%\System32
+ %SystemRoot%
+ Directories in PATH
+
+ and loaded & linked first found one. So if installed wrapper DLLs is
+ found on application's load directory, the application's call to
+ WINSOCK will wrapped.
+
+ But some applications or DLLs are binded to specific DLL, they do
+ not rely on above DLL's search path. For those applcaitons or DLLs,
+ idn wrapper (in standard installation) cannot wrap them.
+
+ NOTE: Netscape is one of those program. It cannot be wrapped if
+ installed to applications directory. Also WINSOCK DLLs are
+ also binded to related DLLs in system directory. On the
+ other hand, Internet Explore or Window Media Player relys on
+ standard DLL search path, and well wrapped with idn wrapper.
+
+2.6. At which point conversion applied
+
+ If windows supporting WINSOCK 2.0, there are DLLs one for 1.1 and
+ another for 2.0, and call to WINSOCK 1.1 will redirected to 2.0 DLL.
+
+ +------------+ Call +------------+ Call +------------+
+ | |------->| |------->| |
+ |Application | |WINSOCK 1.1 | |WINSOCK 2.0 |
+ | |<-------| |<-------| |
+ +------------+ Return +------------+ Return +------------+
+
+ In this case, calls to 1.1 and 2.0 are both passed to 2.0 DLL. So
+ conversion will done in WINSOCK 2.0 DLL side.
+
+ If windows only supports WINSOCK 1.1, there's 1.1 DLL only.
+
+ +------------+ Call +------------+
+ | |------->| |
+ |Application | |WINSOCK 1.1 |
+ | |<-------| |
+ +------------+ Return +------------+
+
+ In this case, conversion must done in 1.1 DLL.
+
+ If idn wrapper was installed on system directory, DLLs will work as
+ described above. But if wrapper was installed on application's
+ directory, call/return sequence changes. Original WINSOCK 1.1 DLL
+ in windows seems binded to specific WINSOCK 2.0 DLL, placed at
+ window's system diretory. So call from WINSOCK 1.1 to WINSOCK 2.0
+ will passed to original DLL (in system directory) and never passed
+ to wrapper DLL in application's directory. So in this case, both
+ 1.1 and 2.0 DLLs should coonvert domain name encodings.
+
+ These DLL binding is not documented. It may be change on OS
+ versions or DLL versions. So, mDn wrapper determines place of
+ conversion on registry value. With this registry value, idn
+ wrappper absolb OS/DLL variations.
+
+ Registry values for idn wrapper will placed under
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\IDN
+ HKEY_CURRENT_USER\SOFTWARE\JPNIC\IDN
+
+ Place of conversion is determined with registry value "Where",
+
+ Registry Value "Where" REG_DWORD
+
+ 0 both on WINSOCK 1.1 and WINSOCK 2.0
+ 1 if WINSOCK 2.0 exist, only in WINSOCK 2.0
+ otherwise, convert on WINSOCK 1.1
+ 2 only in WINSOCK 1.1
+ 3 only in WINSOCK 2.0
+
+ If you install idn wrapper into application's directory, use "0".
+ If you install idn wrapper into system directory, use "1". If there
+ are no "Where" value, idn wrapper uses "0" as default, it is suited
+ to installation into application's directory (default installation).
+
+2.7. Converting From/To
+
+ Wrapper DLL convert resolving domain name encoded with local code to
+ DNS server's encoding. Also, wrapper DLL convert resulting name (
+ encoded with DNS's encoding) back to local encoding.
+
+ There are several proposals for DNS encodings to handle multi-lingual
+ domain names. Wrapper DLL should be configured to convert to one of
+ those encodings. This DNS side encoding will specified with
+ registry. When installing idn wrapper, this registry will set to
+ some (yet undefined) DNS encoding.
+
+ Registry values for idn wrapper will placed under
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\IDN
+ HKEY_CURRENT_USER\SOFTWARE\JPNIC\IDN
+
+ DNS encoding name will given with registry value (REG_SZ) of "Encoding",
+ this name must be one of encoding names which 'libmdn' recognize.
+
+ Registry Value "Encoding" REG_SZ
+
+ Encoding name of DNS server accepts.
+
+ Local encodings (Windows Apllication Encodings) is generally
+ acquired from process's code page. 'iconv' library, used for idn
+ wrapper, generally accepts MS's codepage names.
+
+ Some windows apllication encode domain name with some specific multi-
+ lingual encoding. For example, if you configured IE to use UTF-8,
+ then domain names are encoded with UTF-8. UTF-8 is one of proposed
+ DNS encoding, but DNS server may expect another encoding.
+
+ For those cases, idn wrapper accept program specific encoding as
+ local encoding. These program specific local encoding should be
+ marked in registry.
+
+ Program specific registry setting will placed under
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\IDN\PerProg
+ HKEY_CURRENT_USER\SOFTWARE\JPNIC\IDN\PerProg
+
+ using program name (executable file name) as key. For example,
+ setting specific to Internet Explore, it executable name is
+ "IEXPLORE", will plcaed at
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\IDN\PerProg\IEXPLORE
+
+ Local encoding name will specified with registry value (REG_SZ) of
+ "Encoding". This name must be one of encoding names which '
+ recognize.libmdn'
+
+ Registry Value "Encoding" REG_SZ
+
+ Encoding name of application program encodes, if it is not
+ system's default encoding.
+
+3. Setup and Configuration
+
+ idn wrapper wraps WINSOCK DLL by placing wrapper (fake) DLLs in
+ the application's directory. For the installation, idn wrapper
+ comes with a setup program and a configuration program.
+
+ NOTE: You can also install idn wrapper DLLs in the Windows
+ system directory. But this installation is very dangerous
+ and may cause severe problems in your system.
+ You should try it at your own risk.
+
+3.1. Setup Program
+
+ To install idn wrapper, run "setup.exe". Setup program will do:
+
+ Installing Files
+
+ Copy idn wrapper files (DLL, Program EXE, etc) into diretory
+
+ "\Program Files\JPNIC\idn wrapper"
+
+ This directory may be changed on setup sequence.
+
+ Setting registry entries
+
+ Setup program will create keys and values under registry:
+
+ "HKEY_LOCAL_MACHINES\Software\JPNIC\IDN"
+
+ InstallDir REG_SZ "<installation directory>"
+ Pathname of the idn wrapper's installation directory.
+ The installer makes copies of the original WINSOCK DLLs
+ in that directory, which is referenced by the idn wrapper's
+ fake DLLs.
+
+ ConfFile REG_SZ "<installation directory>\idn.conf"
+ Name of the idnkit's configuration file, which defines
+ various parameter regarding multilingual domain name
+ handling. See the contents of the file for details.
+ This value can be changed with the Configuration Program
+ or the registry editor.
+
+ LogFile REG_SZ "<installation directory>\idn_wrapper.log"
+ Name of the idn wrapper's log file.
+ This value can be changed with the Configuration Program
+ or the registry editor.
+
+ LogLevel DWORD -1
+ Logging level. Default is -1, which indicates no logging
+ is made. This value can be changed with the Configuration
+ Program or the registry editor.
+
+ PerProg KEY
+
+ Under this key, idn wrapper set program specific values. idn
+ wrapper uses program's executable name as key, and put
+ values under that key.
+
+ PerProg\<progname>\Where REG_DWORD Encoding Position
+ PerProg\>progname>\Encoding REG_SZ Local Encoding Name
+
+ Configuration program set local encpoding name. "Where"
+ value is usually not required in standard installation. If
+ you installed idn wrapper in system directory, chanage
+ "Where" values to fit your environment.
+
+ Creating ICON
+
+ Setup program will create program icon for idn wrapper's
+ configuration program, and put it into "Start Menu". You can
+ start configuration program with it.
+
+3.2. Configuration Program
+
+ Configuration program is a tool for wrap specific program, or unwrap
+ programs. If you start "Configuration Program", you'll get window
+ like this.
+
+ +---+-------------------------------------------------+---+---+---+
+ | | idn wrapper - Configuration | _ | O | X |
+ +---+-------------------------------------------------+---+---+---+
+ | idn wrapper Configuration Program version X.X |
+ +-----------------------------------------------------------------+
+ | Wrapped Program +---------+ |
+ | +---------------------------------------------+---+ | Wrap.. | |
+ | | | A | +---------+ |
+ | | +---+ +---------+ |
+ | | | | | Unwrap..| |
+ | | | | +---------+ |
+ | | | | +---------+ |
+ | | | | |UnwrapAll| |
+ | | | | +---------+ |
+ | | | | +---------+ |
+ | | | | |RewrapAll| |
+ | | | | +---------+ |
+ | | | | +---------+ |
+ | | | | | Log.. | |
+ | | | | +---------+ |
+ | | | | +---------+ |
+ | | +---+ |Advanced.| |
+ | | | V | +---------+ |
+ | +---+-------------------------------------+---+---+ +---------+ |
+ | | < | | > | | Exit | |
+ | +---+-------------------------------------+---+ +---------+ |
+ +-----------------------------------------------------------------+
+
+ Listbox contains list of current wrapped programs. Initially it is
+ empty.
+
+ To wrap a program, press button "wrap". You'll get following dialog.
+
+ +---+-------------------------------------------------+---+---+---+
+ | | idn wrapper - Wrap Executable | _ | O | X |
+ +---+-------------------------------------------------+---+---+---+
+ | +----------------------------------------+ +--------+ |
+ | Program: | | |Browse..| |
+ | +----------------------------------------+ +--------+ |
+ | +----------+ |
+ | Encoding: | | o Default o UTF-8 |
+ | +----------+ |
+ | [] Force local DLL reference |
+ +-----------------------------------------------------------------+
+ | +--------+ +--------+ |
+ | | Wrap | | Cancel | |
+ | +--------+ +--------+ |
+ +-----------------------------------------------------------------+
+
+ First, enter program (executable name with full path) or browse
+ wrapping exectable from file browser. Then set local encoding of
+ that program. Usually use "Default" as local encoding. If target
+ program uses internationalized encoding, then specify "UFT-8".
+
+ The "Force local DLL reference" button controls the DLL search
+ order of the program to be wrapped (Windows95 does not have this
+ capability, hence this button does not appear). If it is checked,
+ DLLs in the local directory (the directory which the executable
+ file is in) are always preferred, even if the executable specifies
+ otherwise. If you have problem with wrapping, checking this
+ button may solve the problem, but it is also possible that it
+ causes other problem.
+
+ Finally, put "wrap" button to wrap specified program with given
+ encoding. Wrapped program will be listed in listbox of the first
+ window.
+
+ When you install a new version of idn wrapper, you have to re-wrap
+ your programs in order to update DLLs used for wrapping. "Rewrap
+ all" button is provided for this purpose. Just press the button,
+ and all the currently wrapped programs will be re-wrapped.
+
+ To unwrap a program, press button "unwrap". You'll get following
+ confirmating dialog.
+
+ +---+-------------------------------------------------+---+---+---+
+ | | idn wrapper - Unwrap Executable | _ | O | X |
+ +---+-------------------------------------------------+---+---+---+
+ | +---------------------------------------------------+ |
+ | Program: | | |
+ | +---------------------------------------------------+ |
+ +-----------------------------------------------------------------+
+ | +--------+ +--------+ |
+ | | Unwrap | | Cancel | |
+ | +--------+ +--------+ |
+ +-----------------------------------------------------------------+
+
+ If you unwrap a program, the program will be vanished from listbox
+ of the first window.
+
+ Also "Unwrap all" button is provided to unwrap all the programs
+ that are currently wrapped.
+
+ To configure logging, press button "log". You'll get the following
+ dialog.
+
+ +---+-------------------------------------------------+---+---+---+
+ | | idn wrapper - Log Configuration | _ | O | X |
+ +---+-------------------------------------------------+---+---+---+
+ | Log Level: o None o Fatal o Error o Warning o Info o Trace |
+ | |
+ | +------------------------------------+ +---------+ |
+ | Log File:| | | Browse..| |
+ | +------------------------------------+ +---------+ |
+ | +------+ +--------+ |
+ |Log Operation: | View | | Delete | |
+ | +------+ +--------+ |
+ +-----------------------------------------------------------------+
+ | +--------+ +--------+ |
+ | | OK | | Cancel | |
+ | +--------+ +--------+ |
+ +-----------------------------------------------------------------+
+
+ Logging level can be selected from the followings.
+ None no logging at all
+ Fatal only records fatal errors
+ Error also records non-fatal errors
+ Warning also records warning mssages
+ Info also records informational messages
+ Trace also records trace information
+ Note that these levels are for log output from IDN library (idnkit.dll).
+ idn wrapper itself supports only off (None) and on (the rest).
+
+ Pathname of the log file can also be specified with this dialog.
+
+ You can view the current log file contents by pressing "View" button,
+ or delete it by "Delete" button.
+
+ Note that log level and log file configuration doesn't affect already
+ running processes.
+
+ Press "advanced" button to invoke the advanced configuration dialog.
+ This dialog is for advanced users and enables customization for
+ some basic parameters which normal users need not change, since
+ appropriate defaults are provided.
+
+ +---+-------------------------------------------------+---+---+---+
+ | | idn wrapper - Advanced Configuration | _ | O | X |
+ +---+-------------------------------------------------+---+---+---+
+ | IDN Wrapping Mode |
+ | o Wrap both WINSOCK 1.1 and WINSOCK 2.0 |
+ | o Wrap only WINSOCK 1.1 |
+ | o Wrap only WINSOCK 2.0 |
+ | o Wrap only WINSOCK 2.0 if it exists. |
+ | Otherwise wrap only WINSOCK 1.1 |
+ +-----------------------------------------------------------------+
+ | IDN Configuration |
+ | +--------------------------------+ +----------+ |
+ | Config File: | | | Browse.. | |
+ | +--------------------------------+ +----------+ |
+ | +------+ |
+ | | Edit | |
+ | +------+ |
+ +-----------------------------------------------------------------+
+ | +--------+ +--------+ |
+ | | OK | | Cancel | |
+ | +--------+ +--------+ |
+ +-----------------------------------------------------------------+
+
+ With the dialog users can do the following configuration.
+
+ Wrapping Mode
+ Customize wrapping mode. Normally the default item should be
+ appropriate. Changing it to other item may help when you
+ have problems.
+
+ IDN Configuration
+ Set the configuration file for multilingual domain name handling.
+ By pressing "Edit" button, you can edit then contents of the file.
+
+4. Limitations
+
+4.1. DLL Versions
+
+ Wrapper DLL is tightly coupled with specific DLL version, because
+ it must export all the entries including un-documented ones.
+ If WINSOCK DLL version changed, idn wrapper may not work correctly.
+
+ Current idn wrapper is tested on
+
+ Win2000 (WINSOCK 1.1 + 2.0)
+ WinME (WINSOCK 1.1 + 2.0)
+
+ But there are no assuarance for future versions of Windows.
+
+4.2. DNS, WINS, LMHOSTS
+
+ There are three name resolving methods in windows, DNS, WINS and
+ LMHOSTS. Using idn wrapper, domain name conversion will performed
+ on all of thoses methods. It may cause some trouble if windows
+ using WINS or LMHOSTS. We recommend use DNS oly if you want to use
+ idn wrapper.
+
+4.3. Converting Names other than Domain Name
+
+ In WINSOCK 2.0, there are generic name resolution APIs are
+ introduced.
+
+ WSALookupServiceBeginA
+ WSALookupServiceNextA
+ WSALookupServiceEnd
+
+ They are use mainly domain name conversion now, but not limited to
+ resolving domain name. idn wrapper hooks this API and convert
+ given name anyway. This causes some trouble if conversion name is
+ not domain name.
+
+4.4. Applications don't use these APIa
+
+ Some applications don't use these APIs to resolving domain names.
+ For example, 'nslookup' issue DNS request locally. For these
+ applications, idn wrapper does not work.
+
+4.5. Applications bound to specific WINSOCK DLL
+
+ Some applications are bound to specific DLL, not relying on
+ standard DLL search path. Netscape Communicator seems to be one of
+ such programs. idn wrapper in standard installation cannot wrap
+ such programs.
+
+ If you want to wrap those programs, you may use installation into
+ system directory. But this installation is very dangerous, for
+ it is possible that your system cannot boot again.
+
+5. Registry Setting - Summary
+
+5.1. Priority of Setting
+
+ Settings of idn wrapper is placed on registry
+
+ Software\JPNIC\IDN
+
+ under HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER. idn wrapper first
+ read HKEY_LOCAL_MACHINE, and if HKEY_CURRENT_USER exist, overwrite
+ with this one. Usually set HKEY_LOCAL_MACHINE only. But if you
+ need per user setting, then set HKEY_CURRENT_USER.
+
+ Note that the configuration program reads/writes only
+ HKEY_LOCAL_MACHINE.
+
+5.2. Registry Key
+
+ There's common settings and per program settings.
+
+_Common Settings
+
+ Software\JPNIC\IDN\InstallDir Installation directory
+ Software\JPNIC\IDN\Where Where to convert encoding
+ 0: both WINSOCK 1.1 and WINSOCK 2.0
+ 1: if WINSOCK 2.0 exist, convert at 2.0 DLL
+ if WINSOCK 1.1 only, convert at 1.1 DLL
+ 2: only in WINSOCK1.1
+ 3: only in WINSOCK2.0
+ Software\JPNIC\IDN\ConfFile idnkit Configuration File
+ Software\JPNIC\IDN\LogFile Log File
+ Software\JPNIC\IDN\LogLevel Log Level
+
+_Per Program Settings
+
+ Converting position and program's local encoding may be set per
+ program bases.
+
+ Software\JPNIC\IDN\PerProg\<name>\Where
+ Software\JPNIC\IDN\PerProg\<name>\Encoding
+
+ If not specified, the following values are assumed.
+
+ Where 0 (both 1.1 DLL and 2.0 DLL)
+ Encoding [process's code page]
diff --git a/contrib/idn/idnkit-1.0-src/wsock/README_j.txt b/contrib/idn/idnkit-1.0-src/wsock/README_j.txt
new file mode 100644
index 0000000..354f46c
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/README_j.txt
@@ -0,0 +1,717 @@
+
+ idn wrapper - Windows ‚É‚¨‚¯‚éƒNƒ‰ƒCƒAƒ“ƒg‘¤‚Å‚Ì IDN •ÏŠ·ƒ\ƒtƒgƒEƒFƒA
+
+ Copyright (c) 2000,2001,2002 Japan Network Information Center.
+ All rights reserved.
+
+ *** ’ˆÓ **********************************************************
+ ‚à‚µ‚à‚·‚Å‚É mDN Wrapper (idn wrapper ‚Ì‘Og) ‚ªƒCƒ“ƒXƒg[ƒ‹‚³‚ê‚Ä
+ ‚¢‚éƒ}ƒVƒ“‚É idn wrapper ‚ðƒCƒ“ƒXƒg[ƒ‹‚·‚éꇂɂÍAƒCƒ“ƒXƒg[ƒ‹‘O
+ ‚ÉAƒ‰ƒbƒv‚³‚ê‚Ä‚¢‚é‚·‚ׂẴvƒƒOƒ‰ƒ€‚ðƒAƒ“ƒ‰ƒbƒv‚µ‚Ä‚­‚¾‚³‚¢B
+ *******************************************************************
+
+
+1. ‚Í‚¶‚ß‚É
+
+ Windows ‚Å‘Û‰»ƒhƒƒCƒ“–¼‚ðˆµ‚¦‚é‚悤‚É‚·‚邽‚ß‚É‚ÍAWindows ã‚Ì
+ ƒNƒ‰ƒCƒAƒ“ƒgƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚É‚¨‚¢‚ÄA‰ðŒˆ‚µ‚悤‚Æ‚·‚é–¼‘O‚̃Gƒ“ƒR[
+ ƒfƒBƒ“ƒO‚ðADNS ƒT[ƒo‚ªŽó•t‚¯‚éŒ`Ž®‚Ì‚à‚Ì‚É•ÏŠ·‚·‚é•K—v‚ª‚ ‚è‚Ü‚·B
+ ‚±‚ê‚ÍAWindows ã‚̃AƒvƒŠƒP[ƒVƒ‡ƒ“‚ªA‚«‚¿‚ñ‚Æ‘Û‰»ƒhƒƒCƒ“–¼‚ð
+ ˆµ‚¦‚é‚悤‚É‚È‚Á‚Ä‚¢‚È‚¯‚ê‚΂Ȃç‚È‚¢A‚Æ‚¢‚¤‚±‚Æ‚Å‚ ‚èA–{—ˆ‚Í‚»‚ê
+ ‚¼‚ê‚̃vƒƒOƒ‰ƒ€‚Ì쬎҂ªs‚È‚¤‚ׂ«‚±‚Æ‚Å‚·B
+
+ Œ»Ý IETF ‚É‚Ä‘Û‰»ƒhƒƒCƒ“–¼‚̃tƒŒ[ƒ€ƒ[ƒN‚ð•W€‰»‚·‚é“w—Í‚ª‘±
+ ‚¯‚ç‚ê‚Ä‚¨‚èA‚»‚ÌŒ‹‰Ê‚Æ‚µ‚Ĉê˜A‚Ì RFC ‚ª‚à‚¤‚·‚®”­s‚³‚ê‚邱‚Æ‚É
+ ‚È‚Á‚Ä‚¢‚Ü‚·‚ªA‚»‚ê‚Å‚à‘Û‰»ƒhƒƒCƒ“–¼‚ɑΉž‚µ‚½ƒAƒvƒŠƒP[ƒVƒ‡ƒ“
+ ‚Í‚Ü‚¾‚Ü‚¾­‚È‚¢‚Ì‚ªŒ»ó‚Å‚·B
+
+ ‚»‚±‚ÅAŠù‘¶‚̃AƒvƒŠƒP[ƒVƒ‡ƒ“‚ð‘Û‰»ƒhƒƒCƒ“–¼‚ɑΉž‚³‚¹‚邽‚ß‚Ì
+ ƒwƒ‹ƒp[ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ª•K—v‚É‚È‚è‚Ü‚·Bidnkit ‚ÉŠÜ‚Ü‚ê‚é runidn
+ ƒRƒ}ƒ“ƒh‚Í Unix Œn‚Ì OS ‚ł̈ê‚‚̉ðŒˆô‚Å‚·‚µAWindows ‚ɑ΂·‚é‰ð
+ Œˆô‚Æ‚µ‚Ä‚Í‚±‚±‚Åà–¾‚·‚é idn wrapper ‚ª‚ ‚è‚Ü‚·B
+
+ Windows ‚É‚¨‚¢‚ÄA‘½‚­‚Ìê‡AƒhƒƒCƒ“–¼‰ðŒˆ‚Ì—v‹‚ÍWINSOCK DLL ‚É
+ “n‚³‚ê‚Ü‚·B‚»‚±‚ÅAWINSOCK DLL ‚ð‘Û‰»ƒhƒƒCƒ“–¼‘Ήž‚Ì‚à‚Ì‚É’u‚«
+ Š·‚¦‚Ä‚â‚ê‚ÎAŠù‘¶‚̃vƒƒOƒ‰ƒ€‚©‚ç‚Å‚à‘Û‰»ƒhƒƒCƒ“–¼‚ðŽg‚¤‚±‚Æ‚ª
+ ‚Å‚«‚é‚悤‚É‚È‚è‚Ü‚·B
+
+2. ŽÀŒ»•û–@
+
+2.1. ƒ‰ƒbƒp[DLL
+
+ ƒ‰ƒbƒp[DLL ‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ÆŒ³‚ÌDLL ‚Æ‚ÌŠÔ‚ÉŠ„‚èž‚ñ‚ÅAƒAƒvƒŠ
+ ƒP[ƒVƒ‡ƒ“‚©‚ç‚ÌDLL ‚̌ĂÑo‚µ‚ð‰¡Žæ‚肵‚ÄA–{—ˆ‚ÌDLL ‚Ƃ͈قȂÁ‚½ˆ
+ —‚ð‚³‚¹‚é‚à‚Ì‚Å‚·B
+
+ +------------+ Call +------------+ Call +------------+
+ | |------->| |------->| |
+ |Application | |Wrapper DLL | |Original DLL|
+ | |<-------| |<-------| |
+ +------------+ Return +------------+ Return +------------+
+ additional
+ processing
+ here
+
+ ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚©‚ç‚ÌDLL ‚̌ĂÑo‚µ‚̓‰ƒbƒp[ DLL‚É“n‚³‚ê‚Ü‚·Bƒ‰ƒb
+ ƒp[ DLL‚Í‚»‚±‚ÅA•t‰Á“I‚Ȉ—‚ðs‚È‚Á‚ÄAŒ³‚ÌDLL ‚̃Gƒ“ƒgƒŠ‚ðŒÄ‚Ño
+ ‚µ‚Ü‚·B‚Ü‚½AŒ³‚ÌDLL ‚̈—Œ‹‰Ê‚͈ê’Uƒ‰ƒbƒp[ DLL‚É•Ô‚³‚êA‚±‚±‚Å‚à
+ •t‰Á“I‚Ȉ—‚ðs‚È‚Á‚ÄAÅI“I‚ÈŒ‹‰Ê‚ªƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚É•Ô‚³‚ê‚邱‚Æ
+ ‚É‚È‚è‚Ü‚·B
+
+ idn wrapper ‚Å‚ÍAWINSOCK DLL‚Ì
+
+ WSOCK32.DLL WINSOCK V1.1
+ WS2_32.DLL WINSOCK V2.0
+
+ ‚ɑ΂·‚郉ƒbƒp[DLL ‚ð’ñ‹Ÿ‚µ‚ÄA‘Û‰»ƒhƒƒCƒ“–¼‚Ì–¼‘O‰ðŒˆ‚ª‚Å‚«‚é‚æ
+ ‚¤‚É‚µ‚Ü‚·B16ƒrƒbƒg”Å‚ÌWINSOCK (WINSOCK.DLL) ‚Í‘ÎÛŠO‚Å‚·B
+
+2.2. ˆ—‘ÎÛ‚ÌAPI
+
+ idn wrapper ‚ÍWINSOCK ‚Ì–¼‘O‰ðŒˆ‚ÉŠÖ˜A‚µ‚½API ‚ɂ‚¢‚Ä‚Ì‚Ý•t‰Á“I‚Ȉ
+ —‚ðs‚È‚¢‚Ü‚·Bˆ—‚Ì‘ÎÛ‚Æ‚È‚éWINSOCK API‚͈ȉº‚Ì‚à‚Ì‚Å‚·B
+
+ WINSOCK 1.1, WINSOCK 2.0 ‚Ì—¼•û‚É‚ ‚é‚à‚Ì
+
+ gethostbyaddr
+ gethostbyname
+ WSAAsyncGetHostByAddr
+ WSAAsyncGetHostByName
+
+ WINSOCK 2.0 ‚¾‚¯‚É‚ ‚é‚à‚Ì
+
+ WSALookupServiceBeginA
+ WSALookupServiceNextA
+ WSALookupServiceEnd
+
+ ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚É‚æ‚Á‚Ä‚ÍA‚±‚ê‚ç‚ÌAPI ‚ðŽg‚í‚È‚¢‚Å“ÆŽ©‚ɃhƒƒCƒ“–¼
+ ‚Ì‰ðŒˆ‚ðs‚È‚¤‚à‚Ì‚à‚ ‚è‚Ü‚·B—Ⴆ‚ÎAnslookup‚ÍA‚±‚ê‚ç‚ÌAPI ‚ðŽg‚í
+ ‚È‚¢‚ÅA“à•”‚Å“ÆŽ©‚ÉDNS ƒŠƒNƒGƒXƒg‚̶¬A‰ðŽß‚ðs‚È‚Á‚Ä‚¢‚Ü‚·B“–‘R
+ ‚Ì‚±‚Æ‚È‚ª‚çA‚±‚ê‚ç‚̃AƒvƒŠƒP[ƒVƒ‡ƒ“‚ɂ‚¢‚Ä‚ÍAidn wrapper ‚Å‚Í‘½
+ Œ¾Œê‰»‘Ήž‚³‚¹‚邱‚Æ‚Í‚Å‚«‚Ü‚¹‚ñB
+
+ ’FWINSOCK 2.0 ‚É‚ÍAWIDE CHARACTER ƒx[ƒX‚Ì–¼‘O‰ðŒˆ‚ÌAPI ‚Æ‚µ‚Ä
+
+ WSALookupServiceBeginW
+ WSALookupServiceNextW
+
+ ‚à‚ ‚è‚Ü‚·‚ªA‚±‚ê‚ç‚ɂ‚¢‚Ă̓‰ƒbƒv‚µ‚Ü‚¹‚ñB‚±‚ê‚ç‚ÌAPI ‚̓}
+ ƒCƒNƒƒ\ƒtƒgŽd—l‚É‚æ‚é‘Û‰»‚ɑΉž‚µ‚½‚à‚Ì‚Å‚·‚©‚çA‚»‚̃tƒŒ[
+ ƒ€ƒ[ƒNã‚ÅŽg‚¤‚ׂ«‚à‚Ì‚Å‚·B‚±‚ê‚ç‚ɂ‚¢‚Ä‚Í‘¼‚Ì‘½Œ¾Œê‰»ƒtƒŒ[
+ ƒ€ƒ[ƒN‚É•ÏŠ·‚µ‚Ä‚µ‚Ü‚¤‚̂͊댯‚Å‚Í‚È‚¢‚Æ”»’f‚µ‚Ü‚µ‚½B
+
+2.3. ˆ—‘ÎÛŠO‚ÌAPI
+
+ ã‹LˆÈŠO‚ÌWINSOCK API ‚ɂ‚¢‚Ä‚ÍAidn wrapper ‚Í‚È‚É‚à‚µ‚È‚¢‚ÅAŒ³‚Ì
+ WINSOCK API ‚ðŒÄ‚Ño‚µ‚Ü‚·B
+
+ idn wrapper ‚Å‚ÍAŒ³‚ÌWINSOCK DLL ‚𖼑O‚ð•Ï‚¦‚ăRƒs[‚µA‚»‚ê‚ð
+ ŒÄ‚Ño‚·‚悤‚Éì‚ç‚ê‚Ä‚¢‚Ü‚·B
+
+ wsock32.dll -> wsock32o.dll
+ ws2_32.dll -> ws2_32o.dll
+
+ ƒ‰ƒbƒp[DLL ‚ÍŒ³‚ÌWINSOCK DLL ‚Æ“¯‚¶–¼‘O‚Å쬂³‚ê‚Ü‚·B]‚Á‚Äidn
+ wrapper ‚ªƒCƒ“ƒXƒg[ƒ‹‚³‚ꂽó‘Ô‚Å‚ÍA
+
+ wsock32.dll idn wrapper for WINSOCK V1.1
+ ws2_32.dll idn wrapper for WINSOCK V2.0
+ wsock32o.dll Original WINSOCK V1.1 DLL
+ ws2_32o.dll Original WINSOCK V2.0 DLL
+
+ ‚Æ‚È‚è‚Ü‚·B
+
+2.4. ”ñ“¯Šú API
+
+ ƒhƒƒCƒ“–¼‚Ì•ÏŠ·‚ÍAˆÈ‰º‚̃^ƒCƒ~ƒ“ƒO‚Ås‚È‚í‚ê‚é•K—v‚ª‚ ‚è‚Ü‚·B
+
+ DNS ‚ւ̃ŠƒNƒGƒXƒgŽž
+
+ ƒ[ƒJƒ‹ƒGƒ“ƒR[ƒfƒBƒ“ƒO -> DNS ƒGƒ“ƒR[ƒfƒBƒ“ƒO
+
+ DNS ‚©‚ç‚̉ž“šŽóMŽž
+
+ DNS ƒGƒ“ƒR[ƒfƒBƒ“ƒO -> ƒ[ƒJƒ‹ƒGƒ“ƒR[ƒfƒBƒ“ƒO
+
+ “¯ŠúAPI ‚É‚¨‚¢‚Ä‚ÍAƒ[ƒJƒ‹ƒGƒ“ƒR[ƒfƒBƒ“ƒO‚©‚çDNS ƒGƒ“ƒR[ƒfƒBƒ“ƒO
+ ‚Ö‚Ì•ÏŠ·‚ÍAŒ³‚ÌAPI ‚ðŒÄ‚Ño‚·‘O‚És‚í‚êADNS ƒGƒ“ƒR[ƒfƒBƒ“ƒO‚©‚çƒ[
+ ƒJƒ‹ƒGƒ“ƒR[ƒfƒBƒ“ƒO‚Ö‚Ì•ÏŠ·‚ÍAŒ³‚ÌAPI ‚©‚ç•œ‹A‚µ‚Ä‚«‚½‚Æ‚±‚ë‚Ås‚È
+ ‚í‚ê‚Ü‚·B
+
+ ‚µ‚©‚µAWINSOCK ‚̈ȉº‚ÌAPI ‚Í”ñ“¯ŠúAPI ‚ÅADNS ‚©‚ç‚̉ž“šŽóM‘O‚É•œ
+ ‹A‚µ‚Ä‚µ‚Ü‚¢‚Ü‚·B
+
+ WSAAsyncGetHostByAddr
+ WSAAsyncGetHostByName
+
+ ‚±‚ê‚ç‚ÌAPI ‚É‚¨‚¢‚Ä‚ÍA–¼‘O‰ðŒˆ‚ÌŠ®—¹‚ÍAWindows ‚ւ̃ƒbƒZ[ƒW‚É‚æ‚Á
+ ‚Ä’Ê’m‚³‚ê‚Ü‚·B‚±‚Ì‚½‚ßADNS ƒGƒ“ƒR[ƒfƒBƒ“ƒO‚©‚çƒ[ƒJƒ‹ƒGƒ“ƒR[ƒfƒBƒ“
+ ƒO‚Ö‚Ì•ÏŠ·‚ðs‚È‚¤‚É‚ÍAƒ‰ƒbƒp[‚Í’Ê’mæ‚̃EƒBƒ“ƒhƒEƒvƒƒVƒWƒƒ‚̃ƒb
+ ƒZ[ƒWƒLƒ…[‚ðƒtƒbƒN‚µ‚ÄA‚±‚ÌŠ®—¹ƒƒbƒZ[ƒW‚ð•ßŠl‚·‚é•K—v‚ª‚ ‚è‚Ü‚·B
+
+ ‚»‚±‚ÅA”ñ“¯ŠúAPI ‚ªŒÄ‚Ño‚³‚ꂽꇂɂÍAidn wrapper ‚ÍA’Ê’mæ‚̃EƒBƒ“
+ ƒhƒEƒvƒƒVƒWƒƒi‚±‚ê‚ÍAPI ‚̃pƒ‰ƒƒ^‚ÅŽwŽ¦‚³‚ê‚Ü‚·j‚ɃtƒbƒN‚ðݒ肵
+ ‚Ü‚·BƒtƒbƒN‚ªŠ®—¹ƒƒbƒZ[ƒWi‚±‚ê‚àAPI ‚̃pƒ‰ƒƒ^‚ÅŽwŽ¦‚³‚ê‚Ü‚·j‚ð
+ ŒŸo‚µ‚½‚È‚çAƒtƒbƒN‚ÍŒ‹‰Ê‚ÌŠi”[—̈æi‚±‚ê‚àAPI ‚̃pƒ‰ƒƒ^‚ÅŽwŽ¦‚³‚ê
+ ‚Ä‚¢‚Ü‚·j‚̃hƒƒCƒ“–¼‚ðADNS ‘¤‚̃Gƒ“ƒR[ƒfƒBƒ“ƒO‚©‚çƒ[ƒJƒ‹ƒGƒ“ƒR[
+ ƒfƒBƒ“ƒO‚É•ÏŠ·‚·‚é‚à‚Ì‚Æ‚µ‚Ü‚·B
+
+2.5. Wrapper DLL ‚̃Cƒ“ƒXƒg[ƒ‹
+
+ WINSOCK DLL ‚ÍWindows ‚̃VƒXƒeƒ€ƒfƒBƒŒƒNƒgƒŠ‚É’u‚©‚ê‚Ä‚¢‚Ü‚·B
+ WINSOCK ‚ðŠmŽÀ‚Ƀ‰ƒbƒv‚·‚é‚É‚ÍAƒVƒXƒeƒ€ƒfƒBƒŒƒNƒgƒŠ‚É‚¨‚¢‚Ä
+
+ ƒIƒŠƒWƒiƒ‹WINSOCK DLL ‚Ì–¼‘O‚Ì•ÏX
+
+ ren wsock32.dll wsock32o.dll
+ ren ws2_32.dll ws2_32o.dll
+
+ ƒ‰ƒbƒp[DLL ‚Ì“±“ü
+
+ copy somewhere\wsock32.dll wsock32.dll
+ copy somewhere\ws2_32.dll ws2_32.dll
+ copy another DLLs also
+
+ ‚ðs‚È‚¤•K—v‚ª‚ ‚è‚Ü‚·B
+
+ ‚µ‚©‚µAƒVƒXƒeƒ€ƒfƒBƒŒƒNƒgƒŠ‚Å‚±‚̂悤‚ÈDLL ‚Ì’u‚«Š·‚¦‚ðs‚È‚¤‚Ì‚Í‘å
+ •ÏŠëŒ¯‚È‘€ì‚É‚È‚è‚Ü‚·B
+
+ a) DLL ‚ð“ü‚ê‘Ö‚¦‚½ó‘Ô‚ÅA‚à‚¤‚¢‚¿‚Ç“¯‚¶‘€ì‚ðs‚È‚¤‚ÆAƒIƒŠƒWƒiƒ‹
+ ‚ÌWINSOCK DLL ‚ªŽ¸‚í‚ê‚Ä‚µ‚Ü‚¤‚±‚Æ‚É‚È‚è‚Ü‚·B
+
+ b) ƒT[ƒrƒXƒpƒbƒN‚âƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚È‚Ç‚ÅAWINSOCK DLL ‚ðÄ“±“ü‚·‚é
+ ‚à‚Ì‚ª‚ ‚è‚Ü‚·‚ªA‚±‚ê‚É‚æ‚Á‚Ä‚àWINSOCK ‚ª—˜—p•s”\‚ɂȂ邱‚Æ‚ª‚ 
+ ‚è‚Ü‚·B
+
+ ‚±‚̂悤‚Èó‘Ô‚É‚È‚é‚ÆAƒlƒbƒgƒ[ƒN‹@”\‚ª‘S‚­Žg‚¦‚È‚­‚È‚Á‚½‚èAň«
+ ‚ÍWindows ‚Ì‹N“®‚·‚ço—ˆ‚È‚­‚È‚é‰Â”\«‚ª‚ ‚è‚Ü‚·B
+
+ ‚»‚±‚ÅAidn wrapper ‚Å‚ÍAã‚̂悤‚ȃVƒXƒeƒ€ƒŒƒxƒ‹‚̃‰ƒbƒv‚Å‚Í‚È‚­A
+ ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ɑ΂·‚郉ƒbƒv‚ðŠî–{‹@”\‚Æ‚µ‚Ä’ñ‹Ÿ‚·‚é‚à‚Ì‚Æ‚µ‚Ü‚·B
+
+ Windows ‚É‚¨‚¢‚ÄADLL ‚ÍAŠî–{“I‚É‚Í
+
+ ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚̃[ƒhƒfƒBƒŒƒNƒgƒŠ
+ %SystemRoot%\System32
+ %SystemRoot%
+ PATH ‚ÅŽwŽ¦‚³‚ê‚éƒfƒBƒŒƒNƒgƒŠ
+
+ ‚̇˜‚ÅŒŸõ‚³‚ê‚ÄAʼn‚ÉŒ©‚‚©‚Á‚½‚à‚Ì‚ªƒ[ƒh‚³‚ê‚Ü‚·B‚Å‚·‚©‚çA
+ ˆê”Ê“I‚É‚ÍADLL ‚ðƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚̃[ƒhƒfƒBƒŒƒNƒgƒŠ‚ɃCƒ“ƒXƒg[ƒ‹
+ ‚·‚ê‚ÎA‚»‚̃AƒvƒŠƒP[ƒVƒ‡ƒ“‚©‚ç‚ÌWINSOCK ‚̌ĂÑo‚µ‚ðƒ‰ƒbƒv‚·‚邱‚Æ
+ ‚ª‚Å‚«‚Ü‚·B
+
+ ‚½‚¾‚µA‚¢‚­‚‚©‚̃AƒvƒŠƒP[ƒVƒ‡ƒ“ADLL ‚Å‚ÍAŒŸõƒpƒX‚ðŒo—R‚¹‚¸‚É“Á
+ ’è‚ÌDLL ‚ðƒŠƒ“ƒN‚·‚é‚悤‚É‚È‚Á‚Ä‚¢‚é‚à‚Ì‚ª‚ ‚è‚Ü‚·B‚±‚̂悤‚È\¬‚Ì
+ ƒAƒvƒŠƒP[ƒVƒ‡ƒ“ADLL ‚ªŽg‚í‚ê‚½ê‡‚É‚Í idn wrapper‚ł͑Έ‚·‚邱‚Æ
+ ‚Í‚Å‚«‚Ü‚¹‚ñB
+
+ ’FNetscape‚Í“Á’èDLL ‚ɃoƒCƒ“ƒh‚³‚ê‚Ä‚¢‚é‚悤‚ÅAƒAƒvƒŠƒP[ƒVƒ‡ƒ“ƒfƒB
+ ƒŒƒNƒgƒŠ‚ւ̃Cƒ“ƒXƒg[ƒ‹‚ł̓‰ƒbƒv‚Å‚«‚Ü‚¹‚ñBWINSOCK DLL Ž©‘Ì‚à
+ ƒVƒXƒeƒ€ƒfƒBƒŒƒNƒgƒŠ‚ÌŠÖ˜ADLL ‚ɃoƒCƒ“ƒh‚³‚ê‚Ä‚¢‚é‚悤‚Å‚·Bˆê•ûA
+ Internet Explore‚âWindows Media Player‚Í•W€‚̃T[ƒ`ƒpƒX‚É]‚Á‚Ä
+ ‚¢‚é‚Ì‚ÅAƒ‰ƒbƒv‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·B
+
+2.6. ƒGƒ“ƒR[ƒfƒBƒ“ƒO‚Ì•ÏŠ·ˆÊ’u
+
+ WINSOCK 2.0 ‚ðƒTƒ|[ƒg‚µ‚Ä‚¢‚éWindows ‚É‚ÍAWINSOCK ‚Ì1.1 ‚Æ2.0 ‚Ì‚»
+ ‚ꂼ‚ê‚ɑΉž‚·‚éDLL ‚ª‚ ‚èAWINSOCK 1.1 ‚ÌAPI ‚̌ĂÑo‚µ‚Í2.0 ‚Ì“¯‚¶
+ ƒGƒ“ƒgƒŠ‚ɃŠƒ_ƒCƒŒƒNƒg‚³‚ê‚é‚悤‚É‚È‚Á‚Ä‚¢‚Ü‚·B
+
+ +------------+ Call +------------+ Call +------------+
+ | |------->| |------->| |
+ |Application | |WINSOCK 1.1 | |WINSOCK 2.0 |
+ | |<-------| |<-------| |
+ +------------+ Return +------------+ Return +------------+
+
+ ‚±‚ÌꇂɂÍ1.1 ‚ɑ΂·‚éŒÄ‚Ño‚µ‚à2.0 ‚ɑ΂·‚éŒÄ‚Ño‚µ‚àA‚Æ‚à‚ÉV2.0
+ —p‚ÌDLL ‚É“n‚³‚ê‚é‚Ì‚ÅA2.0—p‚̃‰ƒbƒp[DLL ‘¤‚¾‚¯‚ŃGƒ“ƒR[ƒfƒBƒ“ƒO‚Ì
+ •ÏŠ·‚ðs‚È‚¤‚悤‚É‚·‚é‚ׂ«‚Å‚µ‚傤B
+
+ ˆê•ûAWINSOCK 1.1 ‚µ‚©ƒTƒ|[ƒg‚µ‚Ä‚¢‚È‚¢ê‡(Win95)‚É‚ÍA1.1 ‚ɑΉž‚µ
+ ‚½DLL ‚µ‚©‚ ‚è‚Ü‚¹‚ñB
+
+ +------------+ Call +------------+
+ | |------->| |
+ |Application | |WINSOCK 1.1 |
+ | |<-------| |
+ +------------+ Return +------------+
+
+ ‚±‚Ìꇂɂ͕K‘R“I‚É1.1 —p‚̃‰ƒbƒp[DLL ‚ŃGƒ“ƒR[ƒfƒBƒ“ƒO‚ð•ÏŠ·‚µ‚È
+ ‚¯‚ê‚΂Ȃè‚Ü‚¹‚ñB
+
+ idn Wrapepr ‚ªwindows ‚̃VƒXƒeƒ€ƒfƒBƒŒƒNƒgƒŠ‚ɃCƒ“ƒXƒg[ƒ‹‚³‚ꂽê‡
+ ‚É‚ÍAã‚Ì’Ê‚è‚É“®ì‚·‚é‚Ì‚ÅA
+
+ WINSOCK 2.0 ‚ ‚è 2.0 ƒ‰ƒbƒp[‚Å•ÏŠ·
+ WINSOCK 1.1 ‚Ì‚Ý 1.1 ƒ‰ƒbƒp[‚Å•ÏŠ·
+
+ ‚·‚é•K—v‚ª‚ ‚è‚Ü‚·B
+
+ ‚µ‚©‚µAƒAƒvƒŠƒP[ƒVƒ‡ƒ“ƒfƒBƒŒƒNƒgƒŠ‚ɃCƒ“ƒXƒg[ƒ‹‚³‚ꂽꇂɂ͓®ì
+ ‚ª•Ï‚í‚Á‚Ä‚«‚Ü‚·BWindows •t‘®‚Ì WINSOCK 1.1 DLL‚ÍAƒVƒXƒeƒ€ƒfƒBƒŒƒN
+ ƒgƒŠ‚ÌWINSOCK 2.0 ‚ɃoƒCƒ“ƒh‚³‚ê‚Ä‚¢‚邽‚ßAƒAƒvƒŠƒP[ƒVƒ‡ƒ“ƒfƒBƒŒƒN
+ ƒgƒŠ‘¤‚ÌWINSOCK 2.0 ƒ‰ƒbƒp[DLL ‚ɂ̓Šƒ_ƒCƒŒƒNƒg‚³‚ê‚Ä‚«‚Ü‚¹‚ñB‚±‚Ì
+ ‚½‚ßAƒAƒvƒŠƒP[ƒVƒ‡ƒ“ƒfƒBƒŒƒNƒgƒŠ‚ւ̃Cƒ“ƒXƒg[ƒ‹‚É‚¨‚¢‚Ä‚ÍA1.1DLLA
+ 2.0DLL‚Ì—¼•û‚ŃGƒ“ƒR[ƒfƒBƒ“ƒO‚ð•ÏŠ·‚·‚é•K—v‚ª‚ ‚è‚Ü‚·B
+
+ ‚±‚̂悤‚ÈDLL ŠÔ‚̃oƒCƒ“ƒfƒBƒ“ƒO‚̓hƒLƒ…ƒƒ“ƒg‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ‚Ì‚ÅAŠÂ
+ ‹«Aƒo[ƒWƒ‡ƒ“‚É‚æ‚Á‚Ă͈قȂÁ‚½“®ì‚ð‚·‚é‚©‚à’m‚ê‚Ü‚¹‚ñB‚»‚±‚Åidn
+ wrapper ‚Å‚ÍAƒŒƒWƒXƒgƒŠ’l‚É‚æ‚Á‚ÄAƒ‰ƒbƒp[DLL ‚Ì‚Ç‚±‚Å•ÏŠ·‚ðs‚È‚¤
+ ‚©‚ðŒˆ’è‚·‚é‚悤‚É‚µ‚ÄAƒCƒ“ƒXƒg[ƒ‹æ‚É‚æ‚é·ˆÙA‚ ‚é‚¢‚̓o[ƒWƒ‡ƒ“
+ ‚É‚æ‚é·ˆÙ‚ð‹zŽû‚·‚é‚悤‚É‚µ‚Ü‚·B
+
+ idn wrapper —p‚̃ŒƒWƒXƒgƒŠÝ’è‚Í
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\IDN
+ HKEY_CURRENT_USER\SOFTWARE\JPNIC\IDN
+
+ ˆÈ‰º‚É”z’u‚³‚ê‚Ü‚·BƒGƒ“ƒR[ƒfƒBƒ“ƒO•ÏŠ·‚ðs‚È‚¤ˆÊ’u‚ɂ‚¢‚Ä‚ÍA‚±‚Ì
+ ’¼‰º‚̃ŒƒWƒXƒgƒŠ’l WhereiREG_DWORDj ‚É‚æ‚Á‚ÄŒˆ’肵‚Ü‚·B—LŒø‚È’l‚ÍA
+
+ ƒŒƒWƒXƒgƒŠ Where (REG_DWORD)
+
+ 0 WINSOCK 1.1AWINSOCK 2.0 ‚Ì—¼•û‚Å•ÏŠ·‚·‚é
+ 1 WINSOCK 2.0 ‚ª‚ ‚ê‚ÎAWINSOCK 2.0‚¾‚¯‚Å•ÏŠ·‚·‚é
+ WINSOCK 1.1 ‚¾‚¯‚Ìê‡‚É‚Í WINSOCK 1.1 ‚Å•ÏŠ·‚·‚é
+ 2 WINSOCK 1.1 ‚¾‚¯‚Å•ÏŠ·‚·‚é
+ 3 WINSOCK 2.0 ‚¾‚¯‚Å•ÏŠ·‚·‚é
+
+ ‚Ì‚S’Ê‚è‚Å‚·BƒAƒvƒŠƒP[ƒVƒ‡ƒ“ƒfƒBƒŒƒNƒgƒŠ‚ɃCƒ“ƒXƒg[ƒ‹‚·‚éꇂɂÍ
+ u‚Ov‚ðAƒVƒXƒeƒ€ƒfƒBƒŒƒNƒgƒŠ‚ɃCƒ“ƒXƒg[ƒ‹‚·‚éꇂɂÍu‚Pv‚ðÝ’è
+ ‚·‚é•K—v‚ª‚ ‚è‚Ü‚·BƒŒƒWƒXƒgƒŠ’l‚ª‘¶Ý‚µ‚È‚¢ê‡‚É‚Íu‚Ov‚ð‘z’肵‚Ü
+ ‚·B‚±‚ê‚̓AƒvƒŠƒP[ƒVƒ‡ƒ“ƒfƒBƒŒƒNƒgƒŠ‚ւ̃Cƒ“ƒXƒg[ƒ‹‚ð•W€‚Æ‚µ‚½‚à
+ ‚Ì‚Å‚·B
+
+2.7. •ÏŠ·Œ³/æ‚̃Gƒ“ƒNƒR[ƒfƒBƒ“ƒO
+
+ ƒ‰ƒbƒp[DLL ‚Å‚ÍA‰ðŒˆ‚µ‚悤‚Æ‚·‚éƒhƒƒCƒ“–¼‚ðAƒ}ƒVƒ“‚̃[ƒJƒ‹ƒGƒ“
+ ƒR[ƒfƒBƒ“ƒO‚©‚çDNS ƒT[ƒo‚̃Gƒ“ƒR[ƒfƒBƒ“ƒO‚É•ÏŠ·‚µA‚Ü‚½ADNS ‚ª•Ô
+ ‚µ‚Ä‚«‚½ƒhƒƒCƒ“–¼(DNS ƒT[ƒo‚̃Gƒ“ƒR[ƒfƒBƒ“ƒO)‚ðƒ}ƒVƒ“‚̃[ƒJƒ‹ƒGƒ“
+ ƒR[ƒfƒBƒ“ƒO‚É–ß‚µ‚Ü‚·B
+
+ Œ»ÝADNS ‘¤‚Ì‘Û‰»ƒGƒ“ƒR[ƒfƒBƒ“ƒO‚ɂ‚¢‚Ä‚ÍA‚¢‚­‚‚à‚Ì•ûŽ®‚ª’ñ
+ ˆÄ‚³‚ê‚Ä‚¢‚Ü‚·Bƒ‰ƒbƒp[DLL ‚Í‚»‚ê‚ç‚ÌDNS ‘¤ƒGƒ“ƒR[ƒfƒBƒ“ƒO‚Ì‚Ç‚ê‚©
+ ‚ЂƂ‚ɕϊ·‚·‚é‚悤‚É\¬‚³‚ê‚Ü‚·B‚±‚ÌDNS ‘¤ƒGƒ“ƒR[ƒfƒBƒ“ƒO‚̓ŒƒW
+ ƒXƒgƒŠ‚ÅŽwŽ¦‚³‚ê‚Ü‚·B‚±‚̃ŒƒWƒXƒgƒŠ‚É‚ÍAidn wrapper ‚̃Cƒ“ƒXƒg[ƒ‹
+ Žž‚ÉiŒ»Žž“_‚Å‚Í–¢’è‚ÌjƒfƒtƒHƒ‹ƒgƒGƒ“ƒR[ƒfƒBƒ“ƒO‚ªÝ’肳‚ê‚Ü‚·B“–
+ ‘RA‚±‚̃ŒƒWƒXƒgƒŠ‚ÍAŒã‚Å‘¼‚Ì‚à‚Ì‚É•ÏX‚·‚邱‚Æ‚à‚Å‚«‚Ü‚·B
+
+ idn wrapper —p‚̃ŒƒWƒXƒgƒŠÝ’è‚Í
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\IDN
+ HKEY_CURRENT_USER\SOFTWARE\JPNIC\IDN
+
+ ˆÈ‰º‚É”z’u‚³‚ê‚Ü‚·BDNS ‘¤‚̃Gƒ“ƒR[ƒfƒBƒ“ƒO‚̓ŒƒWƒXƒgƒŠ’l Encoding
+ iREG_SZj‚ÅŽwŽ¦‚³‚ê‚Ü‚·B‚±‚̃Gƒ“ƒR[ƒfƒBƒ“ƒO–¼‚ÍAlibmdn‚Å”FŽ¯‚³‚ê
+ ‚é‚à‚Ì‚Å‚È‚¯‚ê‚΂Ȃè‚Ü‚¹‚ñB
+
+ ƒŒƒWƒXƒgƒŠ Encoding (REG_SZ)
+ DNS ƒT[ƒo‘¤‚̃Gƒ“ƒR[ƒfƒBƒ“ƒO–¼‚ðݒ肵‚Ü‚·
+
+ ˆê•ûAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŽg—p‚µ‚Ä‚¢‚éƒ[ƒJƒ‹ƒGƒ“ƒR[ƒfƒBƒ“ƒO‚ÍA’Êí
+ ‚̓vƒƒZƒX‚̃R[ƒhƒy[ƒW‚©‚ç‹‚ß‚Ü‚·Bƒ‰ƒbƒp[DLL ‚ªŽg—p‚·‚é 'iconv'
+ ƒ‰ƒCƒuƒ‰ƒŠ‚ÍAwindows ‚̃R[ƒhƒy[ƒW–¼‚ðƒGƒ“ƒR[ƒfƒBƒ“ƒO–¼‚Æ‚µ‚ÄŽó•t
+ ‚¯‚邱‚Æ‚ª‚Å‚«‚é‚Ì‚ÅAƒR[ƒhƒy[ƒW–¼‚ð‚»‚Ì‚Ü‚Üƒ[ƒJƒ‹ƒGƒ“ƒR[ƒfƒBƒ“
+ ƒO–¼‚Æ‚µ‚ÄŽg—p‚µ‚Ü‚·B
+
+ ‚µ‚©‚µAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚É‚æ‚Á‚Ä‚ÍA“Á’è‚Ì‘Û‰»ƒGƒ“ƒR[ƒfƒBƒ“ƒO‚Å
+ ƒhƒƒCƒ“–¼‚ðƒGƒ“ƒR[ƒfƒBƒ“ƒO‚µ‚Ä‚µ‚Ü‚¤‚à‚Ì‚à‚ ‚è‚Ü‚·B—Ⴆ‚ÎAIE‚Å‚Í
+ ƒhƒƒCƒ“–¼‚ðUTF-8 ‚Å•\‹L‚·‚é‚悤‚ÉŽwŽ¦‚·‚邱‚Æ‚ª‚Å‚«‚é‚悤‚É‚È‚Á‚Ä‚¢
+ ‚Ü‚·BUTF-8 ‚É‚æ‚éƒGƒ“ƒR[ƒfƒBƒ“ƒO‚ÍA’ñˆÄ‚³‚ê‚Ä‚¢‚é‘Û‰»•ûŽ®‚Ì‚Ð
+ ‚Ƃ‚ł·‚ªA‘Û‰»‚³‚ꂽDNS ƒT[ƒo‚Í‘¼‚̃Gƒ“ƒR[ƒfƒBƒ“ƒO‚µ‚©Žó•t‚¯
+ ‚È‚¢‚©‚à’m‚ê‚Ü‚¹‚ñB
+
+ ‚±‚̂悤‚È󋵂ɑΈ‚·‚邽‚ßAidn ƒ‰ƒbƒp[‚ÍAƒ[ƒJƒ‹ƒGƒ“ƒR[ƒfƒBƒ“
+ ƒO‚Æ‚µ‚ăvƒƒOƒ‰ƒ€“Á—L‚̃Gƒ“ƒR[ƒfƒBƒ“ƒO‚àŽó•t‚¯‚邱‚Æ‚ª‚Å‚«‚é‚悤‚É
+ ‚µ‚Ü‚·B‚±‚̂悤‚ȃvƒƒOƒ‰ƒ€“Á—L‚̃[ƒJƒ‹ƒGƒ“ƒR[ƒfƒBƒ“ƒO‚̓ŒƒWƒXƒg
+ ƒŠ‹LÚ‚³‚ê‚é‚à‚Ì‚Æ‚µ‚Ü‚·B
+
+ idn wrapper —p‚̃vƒƒOƒ‰ƒ€“Á—L‚̃ŒƒWƒXƒgƒŠÝ’è‚Í
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\IDN\PerProg
+ HKEY_CURRENT_USER\SOFTWARE\JPNIC\IDN\PerProg
+
+ ˆÈ‰º‚ÉAƒvƒƒOƒ‰ƒ€–¼iŽÀsƒ‚ƒWƒ…[ƒ‹ƒtƒ@ƒCƒ‹–¼j‚ðƒL[‚Æ‚µ‚Ä”z’u‚³‚ê
+ ‚Ü‚·B—Ⴆ‚ÎAInternet Explore ‚ÌꇂɂÍAŽÀsƒ‚ƒWƒ…[ƒ‹–¼‚Ì
+ IEXPLORE‚ðƒL[‚Æ‚µ‚Ä
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\IDN\PerProg\IEXPLORE
+
+ ˆÈ‰º‚É’u‚©‚ê‚Ü‚·Bƒ[ƒJƒ‹ƒGƒ“ƒR[ƒfƒBƒ“ƒO–¼‚ÍAƒŒƒWƒXƒgƒŠ’l
+ Encoding iREG_SZj‚ÅŽwŽ¦‚µ‚Ü‚·B‚±‚ê‚àlibmdn‚Å”FŽ¯‚³‚ê‚é‚à‚Ì‚Å‚È‚¯‚ê
+ ‚΂Ȃè‚Ü‚¹‚ñB
+
+ ƒŒƒWƒXƒgƒŠ Encoding (REG_SZ)
+
+ ƒAƒvƒŠƒP[ƒVƒ‡ƒ“ƒvƒƒOƒ‰ƒ€“Á—L‚̃Gƒ“ƒR[ƒfƒBƒ“ƒO–¼iƒfƒtƒHƒ‹
+ ƒg‚̃Gƒ“ƒR[ƒfƒBƒ“ƒOˆÈŠO‚ð•K—v‚Æ‚·‚éê‡j‚ðŽw’肵‚Ü‚·B
+
+3.ƒZƒbƒgƒAƒbƒv‚ƃRƒ“ƒtƒBƒMƒ…ƒŒ[ƒVƒ‡ƒ“
+
+ idn wrapper ‚ÍAŠî–{ƒCƒ“ƒXƒgƒŒ[ƒVƒ‡ƒ“‚Æ‚µ‚ÄAƒAƒvƒŠƒP[ƒVƒ‡ƒ“ƒfƒBƒŒ
+ ƒNƒgƒŠ‚ÅWINSOCK ‚ðƒ‰ƒbƒv‚µ‚Ü‚·B‚±‚ê‚ɇ‚킹‚ÄAƒZƒbƒgƒAƒbƒvƒvƒƒOƒ‰
+ ƒ€‚ƃRƒ“ƒtƒBƒMƒ…ƒŒ[ƒVƒ‡ƒ“ƒvƒƒOƒ‰ƒ€‚Æ‚ð’ñ‹Ÿ‚µ‚Ü‚·B
+
+ ’FƒVƒXƒeƒ€ƒfƒBƒŒƒNƒgƒŠ‚ł̃‰ƒbƒv‚à‰Â”\‚Å‚·‚ªA‚±‚ê‚͊댯‚ÈÝ’è‚Å‚·
+ ‚Ì‚ÅA•W€ƒCƒ“ƒXƒgƒŒ[ƒVƒ‡ƒ“‚Æ‚µ‚Ä‚Í’ñ‹Ÿ‚µ‚Ü‚¹‚ñBƒVƒXƒeƒ€ƒfƒBƒŒ
+ ƒNƒgƒŠ‚ւ̃Cƒ“ƒXƒg[ƒ‹‚ðs‚È‚¤ê‡‚É‚ÍAŽ©ŒÈÓ”C‚Å‚â‚Á‚Ä‚­‚¾‚³‚¢B
+
+3.1.ƒZƒbƒgƒAƒbƒvƒvƒƒOƒ‰ƒ€
+
+ idn wrapper ‚ðƒCƒ“ƒXƒg[ƒ‹‚·‚é‚É‚Í"setup.exe" ‚ðŽÀs‚µ‚Ü‚·BƒZƒbƒgƒAƒb
+ ƒvƒvƒƒOƒ‰ƒ€‚͈ȉº‚̈—‚ðŽÀs‚µ‚Ü‚·B
+
+ ƒtƒ@ƒCƒ‹‚̃Cƒ“ƒXƒg[ƒ‹
+
+ ƒfƒBƒŒƒNƒgƒŠu\Program Files\JPNIC\idn wrapperv i ƒZƒbƒgƒAƒbƒv
+ Žž“_‚Å•ÏX‰Â”\jˆÈ‰º‚ÉAidn wrapper ‚ð\¬‚·‚éƒtƒ@ƒCƒ‹‚ðƒRƒs[‚µ
+ ‚Ü‚·B
+
+ ƒŒƒWƒXƒgƒŠ‚ÌÝ’è
+
+ HKEY_LOCAL_MACHINE\Software\JPNIC\IDN ˆÈ‰º‚É•K—v‚ȃŒƒWƒXƒgƒŠƒL[A
+ ƒŒƒWƒXƒgƒŠ’l‚ðì¬Aݒ肵‚Ü‚·B
+
+ InstallDir REG_SZ "<ƒCƒ“ƒXƒg[ƒ‹ƒfƒBƒŒƒNƒgƒŠ>"
+ idn wrapper ‚̃Cƒ“ƒXƒg[ƒ‹ƒfƒBƒŒƒNƒgƒŠ‚̃pƒX–¼‚Å‚·BƒZƒbƒg
+ ƒAƒbƒvƒvƒƒOƒ‰ƒ€‚Í‚±‚̃fƒBƒŒƒNƒgƒŠ‚ɃIƒŠƒWƒiƒ‹‚ÌWINSOCK
+ DLL ‚̃Rƒs[‚ð쬂µ‚Ü‚·Bidn wrapper ‚̃‰ƒbƒp[ DLL ‚ÍŽÀ
+ sŽž‚É‚±‚Ì DLL ‚ðŽQÆ‚µ‚Ü‚·B
+
+ ConfFile REG_SZ "<ƒCƒ“ƒXƒg[ƒ‹ƒfƒBƒŒƒNƒgƒŠ>\idn.conf"
+ idn wrapper ‚ª‘Û‰»ƒhƒƒCƒ“–¼‚Ì•ÏŠ·ˆ—‚ÉŽg—p‚µ‚Ä‚¢‚é
+ idnkit ‚̃Rƒ“ƒtƒBƒMƒ…ƒŒ[ƒVƒ‡ƒ“ƒtƒ@ƒCƒ‹‚Ì–¼‘O‚Å‚·B‚±‚̃tƒ@
+ ƒCƒ‹‚Í‘Û‰»ƒhƒƒCƒ“–¼‚̈—‚É•K—v‚ÈŠeŽí‚̃pƒ‰ƒ[ƒ^‚ðÝ’è
+ ‚·‚邽‚ß‚Ì‚à‚Ì‚Å‚·BÚ‚µ‚­‚̓tƒ@ƒCƒ‹‚Ì“à—e‚ð‚²——‚­‚¾‚³‚¢B
+ ‚±‚Ì’l‚ÍŒãq‚·‚éƒRƒ“ƒtƒBƒMƒ…ƒŒ[ƒVƒ‡ƒ“ƒvƒƒOƒ‰ƒ€‚Å•ÏX‚·‚é
+ ‚±‚Æ‚ª‚Å‚«‚Ü‚·B
+
+ LogFile REG_SZ "<ƒCƒ“ƒXƒg[ƒ‹ƒfƒBƒŒƒNƒgƒŠ>\idn_wrapper.log"
+ idn wrapper ‚̃ƒOƒtƒ@ƒCƒ‹‚Ì–¼‘O‚Å‚·B‚±‚Ì’l‚àƒRƒ“ƒtƒBƒMƒ…
+ ƒŒ[ƒVƒ‡ƒ“ƒvƒƒOƒ‰ƒ€‚Å•ÏX‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·B
+
+ LogLevel DWORD -1
+ ƒƒOƒŒƒxƒ‹‚ÌŽw’è‚Å‚·BƒfƒtƒHƒ‹ƒg‚Í -1 ‚ÅA‚±‚ê‚Í‘S‚­ƒƒO‚ð
+ o—Í‚µ‚È‚¢‚Æ‚¢‚¤ˆÓ–¡‚Å‚·B‚±‚Ì’l‚àƒRƒ“ƒtƒBƒMƒ…ƒŒ[ƒVƒ‡ƒ“ƒv
+ ƒƒOƒ‰ƒ€‚Å•ÏX‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·B
+
+ PerProg ƒL[
+
+ ƒvƒƒOƒ‰ƒ€–ˆ‚ÌÝ’è’l‚ðŠi”[‚·‚邽‚߂̃L[‚Å‚·B‚±‚̉º‚ÉAƒvƒ
+ ƒOƒ‰ƒ€‚ÌŽÀsƒ‚ƒWƒ…[ƒ‹–¼‚ðƒL[‚Æ‚µ‚ăvƒƒOƒ‰ƒ€ŒÂ•Ê‚Ìݒ肪‹L
+ ˜^‚³‚ê‚Ü‚·Bݒ肳‚ê‚éî•ñ‚͈ȉº‚Ì“ñ‚‚ł·B
+
+ PerProg\<progname>\Where REG_DWORD •ÏŠ·ˆÊ’u
+ PerProg\<progname>\Encoding REG_SZ ƒGƒ“ƒR[ƒfƒBƒ“ƒO–¼
+
+ ƒGƒ“ƒR[ƒfƒBƒ“ƒO–¼‚Í’ÊíƒRƒ“ƒtƒBƒMƒ…ƒŒ[ƒVƒ‡ƒ“ƒvƒƒOƒ‰ƒ€‚É‚æ‚Á
+ ‚Äݒ肳‚ê‚Ü‚·B•ÏŠ·ˆÊ’u‚ÍA•W€ƒCƒ“ƒXƒg[ƒ‹‚Å‚Í•s—v‚Å‚·BƒV
+ ƒXƒeƒ€ƒfƒBƒŒƒNƒgƒŠ‚ւ̃Cƒ“ƒXƒg[ƒ‹‚ðs‚È‚Á‚½ê‡‚É‚ÍAƒŒƒWƒX
+ ƒgƒŠƒGƒfƒBƒ^‚Ŋ‹«‚ɇ‚킹‚ÄÝ’è‚·‚é•K—v‚ª‚ ‚è‚Ü‚·B
+
+ ƒAƒCƒRƒ“‚Ìì¬
+
+ ƒRƒ“ƒtƒBƒMƒ…ƒŒ[ƒVƒ‡ƒ“ƒvƒƒOƒ‰ƒ€‚̃AƒCƒRƒ“‚ð쬂µAƒXƒ^[ƒgƒƒjƒ…[
+ ‚É“o˜^‚µ‚Ü‚·B‚±‚ê‚É‚æ‚Á‚ăRƒ“ƒtƒBƒMƒ…ƒŒ[ƒVƒ‡ƒ“ƒvƒƒOƒ‰ƒ€‚ð‹N“®
+ ‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·B
+
+ ƒAƒ“ƒCƒ“ƒXƒg[ƒ‹‚·‚é‚É‚ÍAƒRƒ“ƒgƒ[ƒ‹ƒpƒlƒ‹‚ÌuƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚Ì’Ç
+ ‰Á‚Æíœv‚ÅAuidn wrapperv ‚ð‘I‘ð‚µ‚Äíœiu’ljÁ‚Æíœvƒ{ƒ^ƒ“j
+ ‚µ‚Ü‚·B
+
+3.2.ƒRƒ“ƒtƒBƒMƒ…ƒŒ[ƒVƒ‡ƒ“ƒvƒƒOƒ‰ƒ€
+
+ ƒRƒ“ƒtƒBƒMƒ…ƒŒ[ƒVƒ‡ƒ“ƒvƒƒOƒ‰ƒ€‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ð“Á’肵‚ă‰ƒbƒv
+ ‚µ‚½‚èAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚̃‰ƒbƒv‚ð‰ðœ‚·‚邽‚߂̃c[ƒ‹‚Å‚·B
+
+ ‹N“®‚·‚é‚ƈȉº‚̂悤‚ȉæ–Ê‚ª•\Ž¦‚³‚ê‚Ü‚·B
+
+ „¡„Ÿ„¦„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¦„Ÿ„¦„Ÿ„¦„Ÿ„¢
+ „ @„ idn wrapper - Configuration „ Q„  „ ~„ 
+ „¥„Ÿ„¨„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¨„Ÿ„¨„Ÿ„¨„Ÿ„§
+ „  idn wrapper Configuration Program version X.X „ 
+ „¥„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„§
+ „  Wrapped Program „¡„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¢„ 
+ „ „¡„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¦„Ÿ„¢„  Wrap.. „ „ 
+ „ „  „ È„ „¤„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„£„ 
+ „ „  „¥„Ÿ„§„¡„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¢„ 
+ „ „  „  „ „  Unwrap.. „ „ 
+ „ „  „  „ „¤„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„£„ 
+ „ „  „  „ „¡„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¢„ 
+ „ „  „  „ „ UnwrapAll.„ „ 
+ „ „  „  „ „¤„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„£„ 
+ „ „  „  „ „¡„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¢„ 
+ „ „  „  „ „ RewrapAll.„ „ 
+ „ „  „  „ „¤„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„£„ 
+ „ „  „  „ „¡„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¢„ 
+ „ „  „  „ „  Log.. „ „ 
+ „ „  „  „ „¤„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„£„ 
+ „ „  „  „ „¡„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¢„ 
+ „ „  „¥„Ÿ„§„ Advanced..„ „ 
+ „ „  „ É„ „¤„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„£„ 
+ „ „¥„Ÿ„¦„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¦„Ÿ„©„Ÿ„£„¡„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¢„ 
+ „ „ q„  „ r„  „  Exit „ „ 
+ „ „¤„Ÿ„¨„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¨„Ÿ„£ „¤„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„£„ 
+ „¤„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„£
+
+ ƒŠƒXƒgƒ{ƒbƒNƒX‚É‚ÍA‚»‚ÌŽž“_‚щƒbƒv‚³‚ê‚Ä‚¢‚éƒvƒƒOƒ‰ƒ€‚ª•\Ž¦‚³‚ê‚Ü
+ ‚·Bʼn‚ÉŽÀs‚µ‚½ê‡‚É‚Í‹ó‚É‚È‚Á‚Ä‚¢‚Ü‚·B
+
+ ƒvƒƒOƒ‰ƒ€‚ðƒ‰ƒbƒv‚·‚é‚É‚ÍA"wrap"ƒ{ƒ^ƒ“‚ð‰Ÿ‚µ‚Ü‚·B"wrap"ƒ{ƒ^ƒ“‚ð‰Ÿ
+ ‚·‚ƈȉº‚̂悤‚ȃ_ƒCƒAƒƒO‚ª•\Ž¦‚³‚ê‚Ü‚·B
+
+ „¡„Ÿ„¦„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¦„Ÿ„¦„Ÿ„¦„Ÿ„¢
+ „ @„ idn wrapper - Wrap Executable „ Q„  „ ~„ 
+ „¥„Ÿ„¨„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¨„Ÿ„¨„Ÿ„¨„Ÿ„§
+ „  „¡„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¢„¡„Ÿ„Ÿ„Ÿ„Ÿ„¢„ 
+ „  Program: „  „ „ Browse..„ „ 
+ „  „¤„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„£„¤„Ÿ„Ÿ„Ÿ„Ÿ„£„ 
+ „  „¡„Ÿ„Ÿ„Ÿ„¢ „ 
+ „ Encoding: „  „  ›Default ›UTF-8 „ 
+ „  „¤„Ÿ„Ÿ„Ÿ„£ „ 
+ „    Force local DLL reference „ 
+ „¥„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„§
+ „  „¡„Ÿ„Ÿ„Ÿ„Ÿ„¢„¡„Ÿ„Ÿ„Ÿ„Ÿ„¢„ 
+ „  „  wrap „ „  cancel „ „ 
+ „  „¤„Ÿ„Ÿ„Ÿ„Ÿ„£„¤„Ÿ„Ÿ„Ÿ„Ÿ„£„ 
+ „¤„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„£
+
+ ʼn‚ÉAƒ‰ƒbƒv‚·‚éƒvƒƒOƒ‰ƒ€‚ÌŽÀsƒtƒ@ƒCƒ‹–¼‚ðݒ肵‚Ü‚·B’¼Ú“ü—Í
+ ‚·‚é‚©Aƒuƒ‰ƒEƒYƒ{ƒ^ƒ“‚Ńtƒ@ƒCƒ‹‚ð’T‚µ‚Ä‚­‚¾‚³‚¢BŽŸ‚É‚»‚̃vƒƒOƒ‰
+ ƒ€‚̃[ƒJƒ‹ƒGƒ“ƒR[ƒfƒBƒ“ƒO‚ðŽw’肵‚Ü‚·B’Êí‚ÍuDefaultv ‚Å‚©‚Ü
+ ‚¢‚Ü‚¹‚ñBƒvƒƒOƒ‰ƒ€‚ª‘Û‰»ƒGƒ“ƒR[ƒfƒBƒ“ƒO‚É]‚Á‚Ä‚¢‚éꇂɂ̂Ý
+ uUTF-8v ‚ðŽwŽ¦‚µ‚Ü‚·B
+
+ uForce local DLL referencevƒ{ƒ^ƒ“‚É‚æ‚èAƒ‰ƒbƒv‚·‚éƒvƒƒOƒ‰ƒ€‚Ì
+ DLL ‚Ì’Tõ‡˜‚ð•ÏX‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚· (‚½‚¾‚µ Windows95 ‚É‚Í‚±‚Ì
+ ‹@”\‚ª‚È‚¢‚½‚ßA‚±‚̃{ƒ^ƒ“‚à•\Ž¦‚³‚ê‚Ü‚¹‚ñ)B‚±‚̃{ƒ^ƒ“‚ðƒ`ƒFƒbƒN
+ ‚·‚é‚ÆA‚½‚Æ‚¦ƒvƒƒOƒ‰ƒ€‚ª•Ê‚ÌêŠ‚Ì DLL ‚ðŽw’肵‚Ä‚¢‚Ä‚àAí‚ÉŽÀ
+ sƒtƒ@ƒCƒ‹‚ª‚ ‚éƒfƒBƒŒƒNƒgƒŠ‚Ì DLL ‚ª—D悳‚ê‚é‚悤‚É‚È‚è‚Ü‚·B‚à
+ ‚µƒvƒƒOƒ‰ƒ€‚ª‚¤‚Ü‚­ƒ‰ƒbƒv‚Å‚«‚È‚¢ê‡‚É‚ÍA‚±‚̃{ƒ^ƒ“‚ðƒ`ƒFƒbƒN‚·
+ ‚é‚Æ‚¤‚Ü‚­‚¢‚­‚©‚à‚µ‚ê‚Ü‚¹‚ñB‚½‚¾‚µ“¯Žž‚É‘¼‚Ì–â‘肪”­¶‚·‚é‰Â”\«
+ ‚à‚ ‚è‚Ü‚·B
+
+ ÅŒã‚Éuwrapvƒ{ƒ^ƒ“‚ð‰Ÿ‚¹‚ÎAƒvƒƒOƒ‰ƒ€‚ªAŽw’肳‚ꂽƒGƒ“ƒR[ƒfƒB
+ ƒ“ƒO‚щƒbƒv‚³‚ê‚Ü‚·Bƒ‰ƒbƒv‚³‚ꂽƒvƒƒOƒ‰ƒ€‚ÍAʼn‚̃EƒBƒ“ƒhƒE‚Ì
+ ƒŠƒXƒgƒ{ƒbƒNƒX‚É”½‰f‚³‚ê‚Ü‚·B
+
+ idn wrapper ‚ðƒo[ƒWƒ‡ƒ“ƒAƒbƒv‚µ‚½ê‡‚É‚ÍAƒ‰ƒbƒv—p‚Ì DLL ‚ðƒAƒbƒv
+ ƒf[ƒg‚·‚邽‚ß‚ÉAƒvƒƒOƒ‰ƒ€‚ðă‰ƒbƒv‚·‚é•K—v‚ª‚ ‚è‚Ü‚·B‚±‚Ì‚½‚ß‚ÉA
+ Œ»Ýƒ‰ƒbƒv‚³‚ê‚Ä‚¢‚éƒvƒƒOƒ‰ƒ€‚ɑ΂µ‚ÄÄ“xƒ‰ƒbƒv‚ðs‚¤‚½‚ß‚Ìurewrap
+ allvƒ{ƒ^ƒ“‚ª—pˆÓ‚³‚ê‚Ä‚¢‚Ü‚·B
+
+ ƒvƒƒOƒ‰ƒ€‚ɑ΂·‚郉ƒbƒv‚ð‰ðœ‚·‚é‚É‚ÍAƒŠƒXƒgƒ{ƒbƒNƒX‚ʼn𜂷‚éƒvƒ
+ ƒOƒ‰ƒ€‚ð‘I‘ð‚µ‚ÄAuunwrapvƒ{ƒ^ƒ“‚ð‰Ÿ‚µ‚Ü‚·BˆÈ‰º‚ÌŠm”F—p‚̃_ƒCƒAƒ
+ ƒO‚ª•\Ž¦‚³‚ê‚Ü‚·‚Ì‚ÅAŠÔˆá‚¢‚ª‚È‚¯‚ê‚Îuunwrapvƒ{ƒ^ƒ“‚ð‰Ÿ‚µ‚Ä‚­‚¾‚³
+ ‚¢B
+
+ „¡„Ÿ„¦„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¦„Ÿ„¦„Ÿ„¦„Ÿ„¢
+ „ @„ idn wrapper - Unwrap Executable „ Q„  „ ~„ 
+ „¥„Ÿ„¨„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¨„Ÿ„¨„Ÿ„¨„Ÿ„§
+ „  „¡„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¢„ 
+ „ Program: „  „ „ 
+ „  „¤„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„£„ 
+ „¥„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„§
+ „  „¡„Ÿ„Ÿ„Ÿ„Ÿ„¢„¡„Ÿ„Ÿ„Ÿ„Ÿ„¢„ 
+ „  „  Unwrap „ „  Cancel „ „ 
+ „  „¤„Ÿ„Ÿ„Ÿ„Ÿ„£„¤„Ÿ„Ÿ„Ÿ„Ÿ„£„ 
+ „¤„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„£
+
+ ƒ‰ƒbƒv‚ª‰ðœ‚³‚ê‚é‚ÆA‚»‚̃vƒƒOƒ‰ƒ€‚Íʼn‚̃EƒBƒ“ƒhƒE‚̃ŠƒXƒgƒ{ƒbƒN
+ ƒX‚©‚ç‚à휂³‚ê‚Ü‚·B
+
+ ƒvƒƒOƒ‰ƒ€‚ɑ΂µ‚ÄŒ»Ýݒ肳‚ê‚Ä‚¢‚郉ƒbƒv‚ð‚·‚×‚Ä‰ðœ‚·‚邽‚ß‚Ì
+ uunwrap allvƒ{ƒ^ƒ“‚à—pˆÓ‚³‚ê‚Ä‚¢‚Ü‚·B
+
+ ƒƒO‚ÌÝ’è‚ðs‚¤‚É‚ÍA"log" ƒ{ƒ^ƒ“‚ð‰Ÿ‚µ‚Ü‚·BŽŸ‚̂悤‚ȃ_ƒCƒAƒƒO‚ª
+ •\Ž¦‚³‚ê‚Ü‚·B
+
+ „¡„Ÿ„¦„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¦„Ÿ„¦„Ÿ„¦„Ÿ„¢
+ „ @„ idn wrapper - Log Configuration „ Q„  „ ~„ 
+ „¥„Ÿ„¨„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¨„Ÿ„¨„Ÿ„¨„Ÿ„§
+ „  Log Level: ›None ›Fatal ›Error ›Warning ›Info ›Trace „ 
+ „  „¡„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¢„¡„Ÿ„Ÿ„Ÿ„Ÿ„¢„ 
+ „  Log File:„  „ „ Browse..„ „ 
+ „  „¤„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„£„¤„Ÿ„Ÿ„Ÿ„Ÿ„£„ 
+ „  „¡„Ÿ„Ÿ„Ÿ„¢ „¡„Ÿ„Ÿ„Ÿ„¢ „ 
+ „ Log Operation:„  View „  „ Delete„  „ 
+ „  „¤„Ÿ„Ÿ„Ÿ„£ „¤„Ÿ„Ÿ„Ÿ„£ „ 
+ „¥„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„§
+ „  „¡„Ÿ„Ÿ„Ÿ„Ÿ„¢„¡„Ÿ„Ÿ„Ÿ„Ÿ„¢„ 
+ „  „  OK „ „  Cancel „ „ 
+ „  „¤„Ÿ„Ÿ„Ÿ„Ÿ„£„¤„Ÿ„Ÿ„Ÿ„Ÿ„£„ 
+ „¤„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„£
+
+ ƒƒOƒŒƒxƒ‹‚ÍŽŸ‚Ì’†‚©‚ç‘I‘ð‚·‚é‚±‚Æ‚ª‚Å‚«‚Ü‚·B
+ None ƒƒO‚ðo—Í‚µ‚È‚¢
+ Fatal ’v–½“IƒGƒ‰[‚Ì‚Ý‹L˜^‚·‚é
+ Error ’v–½“I‚Å‚È‚¢ƒGƒ‰[‚à‹L˜^‚·‚é
+ Warning ŒxƒƒbƒZ[ƒW‚à‹L˜^‚·‚é
+ Info ‚»‚Ì‘¼‚Ìî•ñ‚à‹L˜^‚·‚é
+ Trace ƒgƒŒ[ƒXo—Í‚à‹L˜^‚·‚é
+ ‚±‚±‚É‚ ‚°‚½ƒƒOƒŒƒxƒ‹‚ÌÝ’è‚ÍAIDN ƒ‰ƒCƒuƒ‰ƒŠ (idnkit.dll) ‚ªo—Í‚·‚é
+ ƒƒO‚ɑ΂µ‚Ä‚Ì‚Ý—LŒø‚Å‚·Bidn wrapper Ž©g‚ªo—Í‚·‚郃O‚Í ON/OFF
+ ‚µ‚©‚Å‚«‚Ü‚¹‚ñBNone ‚ðŽw’è‚·‚é‚Æ OFF ‚ÉA‚»‚êˆÈŠO‚̃Œƒxƒ‹‚ðŽw’è‚·‚é‚Æ
+ ON ‚É‚È‚è‚Ü‚·B
+
+ ‚±‚̃_ƒCƒAƒƒO‚ð—p‚¢‚ÄAƒƒOƒtƒ@ƒCƒ‹‚̃pƒX–¼‚ðŽw’è‚·‚邱‚Æ‚à‚Å‚«‚Ü‚·B
+
+ ‚Ü‚½AƒƒOƒtƒ@ƒCƒ‹‚Ì“à—e‚ð•\Ž¦‚³‚¹‚½‚èAƒƒOƒtƒ@ƒCƒ‹‚ð휂·‚邱‚Æ‚à
+ ‰Â”\‚Å‚·B
+
+ ƒƒOƒŒƒxƒ‹‚⃃Oƒtƒ@ƒCƒ‹‚ÌÝ’è‚ÍAݒ莞‚É‚·‚Å‚É“®ì‚µ‚Ä‚¢‚éƒvƒƒZƒX
+ ‚ɂ͉e‹¿‚ð—^‚¦‚È‚¢‚±‚Æ‚É‹C‚ð‚‚¯‚Ä‚­‚¾‚³‚¢B
+
+ "advanced" ƒ{ƒ^ƒ“‚ð‰Ÿ‚·‚Æuadvanced configurationv—p‚̃_ƒCƒAƒƒO
+ ‚ª•\Ž¦‚³‚ê‚Ü‚·B‚±‚̃_ƒCƒAƒƒO‚Í㋉ƒ†[ƒU‚Ì‚½‚ß‚Ì‚à‚Ì‚ÅA“K؂ȃf
+ ƒtƒHƒ‹ƒg‚ªÝ’肳‚ê‚Ä‚¢‚邽‚ß‚É’Ê탆[ƒU‚ª•ÏX‚·‚é•K—v‚Ì‚È‚¢‚悤‚È
+ Šî–{“I‚ȃpƒ‰ƒ[ƒ^‚ð•ÏX‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·B
+
+ „¡„Ÿ„¦„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¦„Ÿ„¦„Ÿ„¦„Ÿ„¢
+ „ @„ idn wrapper - Advanced Configuration „ Q„  „ ~„ 
+ „¥„Ÿ„¨„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¨„Ÿ„¨„Ÿ„¨„Ÿ„§
+ „  IDN Wrapping Mode „ 
+ „  ›Wrap both WINSOCK 1.1 and WINSOCK 2.0 „ 
+ „  ›Wrap only WINSOCK 1.1 „ 
+ „  ›Wrap only WINSOCK 2.0 „ 
+ „  ›Wrap only WINSOCK 2.0 if it exists. „ 
+ „  Otherwise wrap only WINSOCK 1.1 „ 
+ „¥„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„§
+ „  IDN Configuration „ 
+ „  „¡„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„¢„¡„Ÿ„Ÿ„Ÿ„Ÿ„¢„ 
+ „  Log File:„  „ „ Browse..„ „ 
+ „  „¤„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„£„¤„Ÿ„Ÿ„Ÿ„Ÿ„£„ 
+ „  „¡„Ÿ„Ÿ„Ÿ„¢ „ 
+ „  „  Edit „  „ 
+ „  „¤„Ÿ„Ÿ„Ÿ„£ „ 
+ „¥„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„§
+ „  „¡„Ÿ„Ÿ„Ÿ„Ÿ„¢„¡„Ÿ„Ÿ„Ÿ„Ÿ„¢„ 
+ „  „  OK „ „  Cancel „ „ 
+ „  „¤„Ÿ„Ÿ„Ÿ„Ÿ„£„¤„Ÿ„Ÿ„Ÿ„Ÿ„£„ 
+ „¤„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„Ÿ„£
+
+ ‚±‚̃_ƒCƒAƒƒO‚ðŽg—p‚µ‚ÄAŽŸ‚Ì3Ží—Þ‚ÌÝ’è‚ðs‚¤‚±‚Æ‚ª‚Å‚«‚Ü‚·B
+
+ Wrapping Mode
+ ƒ‰ƒbƒv•û–@‚ðݒ肵‚Ü‚·B’Êí‚̓fƒtƒHƒ‹ƒg‚Åݒ肳‚ê‚Ä‚¢‚逖ڂð
+ ‘I‘ð‚µ‚Ä‚¨‚¯‚΂悢‚Í‚¸‚Å‚·‚ªA–â‘肪‹N‚Á‚½‚Æ‚«‚É‚Í•Ê‚Ì€–Ú‚É‚·
+ ‚é‚Æ“®‚­‚悤‚É‚È‚é‚©‚à‚µ‚ê‚Ü‚¹‚ñB
+
+ IDN Configuration
+ ƒRƒ“ƒtƒBƒMƒ…ƒŒ[ƒVƒ‡ƒ“ƒtƒ@ƒCƒ‹–¼‚ðŽw’肵‚Ü‚·B‚Ü‚½ "Edit" ƒ{ƒ^
+ ƒ“‚ð‰Ÿ‚·‚±‚Æ‚É‚æ‚èAƒtƒ@ƒCƒ‹‚Ì“à—e‚ð•ÒW‚·‚邱‚Æ‚à‰Â”\‚Å‚·B
+
+4. §ŒÀŽ–€
+
+4.1. DLL ƒo[ƒWƒ‡ƒ“
+
+ ƒ‰ƒbƒp[DLL ‚ÍAŒ³‚ÌWINSOCK ‚ÌDLL ‚̃o[ƒWƒ‡ƒ“‚É‹­‚­ˆË‘¶‚µ‚Ü‚·B‚±‚ê
+ ‚ÍA”ñŒöŠJ‚̃Gƒ“ƒgƒŠ‚àŠÜ‚ß‚Ä‚·‚ׂẴGƒ“ƒgƒŠ‚ð’ñ‹Ÿ‚·‚é•K—v‚ª‚ ‚邽‚ß
+ ‚Å‚·B‚±‚Ì‚½‚ßWINSOCK DLL ‚̃o[ƒWƒ‡ƒ“‚ª•Ï‚í‚é‚ÆAidn wrapper ‚ª“®ì
+ ‚µ‚È‚­‚È‚é‰Â”\«‚ª‚ ‚è‚Ü‚·B
+
+ ¡‰ñ쬂³‚ꂽidn wrapper ‚ÍA
+
+ Win2000 (WINSOCK 1.1 + 2.0)
+ WinME (WINSOCK 1.1 + 2.0)
+
+ ‚Å“®ì‚ðŠm”F‚µ‚Ä‚¢‚Ü‚·B‚½‚¾A«—ˆ‚ɂ킽‚Á‚Ä“®ì‚·‚é•ÛØ‚Í‚ ‚è‚Ü‚¹‚ñB
+
+4.2. DNS, WINS, LMHOSTS
+
+ Windows ‚Å‚ÍADNS ‚¾‚¯‚Å‚Í‚È‚­AWINS‚âLMHOSTS ‚É‚æ‚Á‚Ä‚àƒhƒƒCƒ“–¼A
+ ƒzƒXƒg–¼‚Ì‰ðŒˆ‚ªs‚È‚í‚ê‚Ü‚·Bidn wrapper ‚ðŽg‚Á‚½ê‡‚É‚ÍAƒhƒƒCƒ“
+ –¼‚Ì•ÏŠ·‚ªA‚±‚ê‚ç‚Ì•ûŽ®‚ւ̃fƒBƒXƒpƒbƒ`‚ðs‚È‚¤êŠ‚æ‚è‚àãˆÊ‘w‚Ås
+ ‚È‚í‚ê‚é‚Ì‚ÅA‚±‚ê‚ç‚Ì‚·‚ׂĂ̕ûŽ®‚ɂ‚¢‚ÄAƒhƒƒCƒ“–¼AƒzƒXƒg–¼‚Ì•Ï
+ Š·‚ªs‚È‚í‚ê‚邱‚Æ‚É‚È‚è‚Ü‚·B‚±‚Ì‚½‚ßAWindows ‚ªAWINS‚âLMHOSTS ‚ð
+ Žg‚Á‚Ä‚¢‚éꇂɂÍA—\Šú‚µ‚È‚¢–â‘肪”­¶‚·‚é‰Â”\«‚ª‚ ‚è‚Ü‚·B‚±‚ê‚É
+ ‚‚¢‚Ä‚ÍAidn wrapper ‚ðŽg‚¤ê‡‚É‚ÍA–¼‘O‰ðŒˆ‚ÉDNS ‚¾‚¯‚ðŽg—p‚·‚邱
+ ‚Æ‚ð‚¨Š©‚ß‚µ‚Ü‚·B
+
+3.3. ƒhƒƒCƒ“–¼ˆÈŠO‚Ì–¼‘O‚̉ðŒˆ
+
+ WINSOCK 2.0 ‚Ì–¼‘O‰ðŒˆAPI
+
+ WSALookupServiceBeginA
+ WSALookupServiceNextA
+ WSALookupServiceEnd
+
+ ‚ÍAƒhƒƒCƒ“–¼ˆÈŠO‚Å‚àŽg—p‚Å‚«‚éA”Ä—p‚Ì–¼‘O‰ðŒˆ—p‚ÌAPI ‚Æ‚µ‚Ä’è‹`‚³
+ ‚ê‚Ä‚¢‚Ü‚·BŒ»Žž“_‚Å‚ÍA‚±‚ê‚ç‚Í‚à‚Á‚Ï‚çƒhƒƒCƒ“–¼‚Ì‰ðŒˆ‚ÅŽg—p‚³‚ê‚Ä
+ ‚¢‚Ü‚·‚ªA‘¼‚Ì–¼‘O(—Ⴆ‚΃T[ƒrƒX–¼)‚Ì‰ðŒˆ‚É‚àŽg—p‚Å‚«‚邱‚Æ‚É‚È‚Á‚Ä
+ ‚¢‚Ü‚·B
+
+ idn wrapper ‚ÍA–¼‘O‚Ì‘ÎÛ‚Ì”@‰½‚É‚©‚©‚í‚炸A–¼‘O‚̃Gƒ“ƒR[ƒfƒBƒ“ƒO
+ ‚ð•ÏŠ·‚µ‚Ä‚µ‚Ü‚¤‚Ì‚ÅA‚±‚ê‚ç‚ÌAPI ‚ªAƒhƒƒCƒ“–¼ˆÈŠO‚Ì‰ðŒˆ‚ÉŽg‚í‚ê‚Ä
+ ‚¢‚éꇂɂÍA–â‘è‚ðˆø‚«‹N‚±‚·‰Â”\«‚ª‚ ‚è‚Ü‚·B
+
+4.4. –¼‘O‰ðŒˆAPI ‚ðŽg‚í‚È‚¢ƒvƒƒOƒ‰ƒ€
+
+ ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚É‚æ‚Á‚Ä‚ÍAƒhƒƒCƒ“–¼‚Ì‰ðŒˆ‚É‚±‚ê‚ç‚ÌAPI ‚ðŽg—p‚µ‚È
+ ‚¢‚à‚Ì‚à‚ ‚è‚Ü‚·B—Ⴆ‚ÎA'nslookup'‚ÍA‚±‚ê‚ç‚ÌAPI ‚ðŽg—p‚µ‚È‚¢‚ÅA
+ ’¼ÚDNS ƒT[ƒo‚Æ’ÊM‚µ‚Ä‚µ‚Ü‚¢‚Ü‚·B‚±‚̂悤‚ȃAƒvƒŠƒP[ƒVƒ‡ƒ“‚ɂ‚¢
+ ‚Ä‚ÍAidn wrapper ‚Í–ð‚É—§‚¿‚Ü‚¹‚ñB
+
+4.5. “Á’èWINSOCK DLL ‚ɃoƒCƒ“ƒh‚³‚ꂽƒAƒvƒŠƒP[ƒVƒ‡ƒ“
+
+ ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚É‚æ‚Á‚Ä‚ÍA•W€‚ÌDLL ƒT[ƒ`ƒpƒX‚É]‚í‚È‚¢‚ÅA“Á’è‚Ì
+ ƒpƒX‚ÌDLL ‚ɃoƒCƒ“ƒh‚³‚ê‚Ä‚¢‚é‚à‚Ì‚ª‚ ‚è‚Ü‚·B‚æ‚­Žg‚í‚ê‚éƒvƒƒOƒ‰ƒ€
+ ‚Ì’†‚Å‚ÍANetscape Communicator ‚ª‚»‚¤‚È‚Á‚Ä‚¢‚Ü‚·B‚±‚̂悤‚ȃvƒƒO
+ ƒ‰ƒ€‚ɂ‚¢‚Ä‚ÍA•W€‚̃Cƒ“ƒXƒg[ƒ‹^ƒRƒ“ƒtƒBƒMƒ…ƒŒ[ƒVƒ‡ƒ“‚ł̓‰ƒbƒv
+ ‚·‚邱‚Æ‚Í‚Å‚«‚Ü‚¹‚ñB
+
+ ‚±‚̂悤‚ȃvƒƒOƒ‰ƒ€‚ɂ‚¢‚ÄA‚Ç‚¤‚µ‚Ä‚àƒ‰ƒbƒv‚·‚é•K—v‚ª‚ ‚é‚È‚çAƒV
+ ƒXƒeƒ€ƒfƒBƒŒƒNƒgƒŠ‚ւ̃Cƒ“ƒXƒg[ƒ‹‚ðs‚È‚¤‚±‚Æ‚ª‚Å‚«‚Ü‚·B‚½‚¾‚µA‚±
+ ‚̃Cƒ“ƒXƒg[ƒ‹‚Í‘å•ÏŠëŒ¯‚ÅAꇂɂæ‚Á‚Ă̓VƒXƒeƒ€‚ðÄ‹N“®•s”\‚É‚µ‚Ä
+ ‚µ‚Ü‚¤‰Â”\«‚à‚ ‚è‚Ü‚·B
+
+5. ƒŒƒWƒXƒgƒŠÝ’è - ‚Ü‚Æ‚ß
+
+5.1. ƒŒƒWƒXƒgƒŠ‚Ì—D懈Ê
+
+ idn wrapper ‚ÌÝ’èî•ñ‚ÍAHKEY_LOCAL_MACHINEAHKEY_CURRENT_USER‚Ì
+
+ Software\JPNIC\IDN
+
+ ˆÈ‰º‚ÉŠi”[‚³‚ê‚Ü‚·Bidn wrapper‚Íʼn‚ÉHKEY_LOCAL_MACHINE‚ÌÝ’è‚ð“Ç
+ ‚Ýž‚ÝAHKEY_CURRENT_USER‘¤‚É‚àݒ肪‚ ‚ê‚ÎA‚±‚ê‚Åã‘‚«‚µ‚Ü‚·B’Ê
+ í‚ÍAHKEY_LOCAL_MACHINE ‘¤‚¾‚¯‚ðݒ肵‚Ü‚·Bƒ†[ƒUŒÂ•Ê‚ɈقȂÁ‚½Ý
+ ’è‚ðŽg‚¢‚½‚¢ê‡‚Ì‚ÝAHKEY_CURRENT_USER‚ðÝ’è‚·‚é‚悤‚É‚µ‚Ä‚­‚¾‚³‚¢B
+
+ ‚È‚¨AƒRƒ“ƒtƒBƒMƒ…ƒŒ[ƒVƒ‡ƒ“ƒvƒƒOƒ‰ƒ€‚Í HKEY_LOCAL_MACHINE ‚ÌÝ’è
+ ‚¾‚¯‚ð“Ç‚Ý‘‚«‚·‚é‚悤‚É‚È‚Á‚Ä‚¢‚Ü‚·B
+
+4.2. ƒŒƒWƒXƒgƒŠƒL[
+
+ ‘S‘Ì‚Ì‹¤’Ê‚ÌÝ’è‚ÆAƒvƒƒOƒ‰ƒ€ŒÂ•ÊÝ’è‚Æ‚ª‚ ‚è‚Ü‚·B
+
+Q‹¤’Ê’è‹`
+
+ Software\JPNIC\IDN\InstallDir ƒCƒ“ƒXƒg[ƒ‹ƒfƒBƒŒƒNƒgƒŠ
+ Software\JPNIC\IDN\Where •ÏŠ·ˆÊ’u
+ 0:WINSOCK1.1 WINSOCK2.0‚Ì—¼•û‚Å
+ 1:WINSOCK2.0 ‚ª‚ ‚ê‚΂»‚¿‚ç‚Å
+ 2:WINSOCK1.1 ‚¾‚¯‚Å
+ 3:WINSOCK2.0 ‚¾‚¯‚Å
+ Software\JPNIC\IDN\ConfFile idnkit ‚ÌÝ’èƒtƒ@ƒCƒ‹
+ Software\JPNIC\IDN\LogLevel ƒƒOƒŒƒxƒ‹
+ Software\JPNIC\IDN\LogFile ƒƒOƒtƒ@ƒCƒ‹
+
+QƒvƒƒOƒ‰ƒ€ŒÂ•ÊÝ’è
+
+ •ÏŠ·ˆÊ’uA‚¨‚æ‚уvƒƒOƒ‰ƒ€‘¤‚̃Gƒ“ƒR[ƒfƒBƒ“ƒO‚̓vƒƒOƒ‰ƒ€–ˆ‚É“Á’è‚·
+ ‚邱‚Æ‚à‚Å‚«‚Ü‚·B‚±‚ê‚ç‚ÍAˆÈ‰º‚̃L[ƒnƒCƒu‚̉º‚ÉAƒvƒƒOƒ‰ƒ€–¼‚ðƒL[
+ ‚Æ‚·‚é’l‚Åݒ肵‚Ü‚·B
+
+ Software\JPNIC\IDN\PerProg\<name>\Where
+ Software\JPNIC\IDN\PerProg\<name>\Encoding
+
+ Žw’肳‚ê‚Ä‚¢‚È‚¢ê‡‚É‚ÍA
+
+ Where 0 1.1A2.0 ‚Ì—¼•û‚Å•ÏŠ·
+ Encoding ƒvƒƒZƒX‚̃R[ƒhƒy[ƒW
+
+ ‚Æ‚Ý‚È‚µ‚Ü‚·B
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/common/checkdll.c b/contrib/idn/idnkit-1.0-src/wsock/common/checkdll.c
new file mode 100644
index 0000000..a620cc9
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/common/checkdll.c
@@ -0,0 +1,242 @@
+/*
+ * checkdll.c - Winsock DLL/IDN processing status
+ */
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "wrapcommon.h"
+
+static int winsock_idx; /* index of winsock_info[] */
+
+static struct winsock_type {
+ char *version; /* winsock version */
+ char *name; /* wrapper DLL name */
+ char *original_name; /* original DLL name */
+} winsock_info[] = {
+#define IDN_IDX_WS11 0
+ { "1.1", "WSOCK32", "WSOCK32O" },
+#define IDN_IDX_WS20 1
+ { "2.0", "WS2_32", "WS2_32O" },
+ { NULL, NULL, NULL },
+};
+
+static HINSTANCE load_original_dll(void);
+static BOOL check_idn_processing(void);
+static BOOL check_dll(const char *name);
+
+BOOL
+idnWinsockVersion(const char *version) {
+ int i;
+ for (i = 0; winsock_info[i].version != NULL; i++) {
+ if (strcmp(winsock_info[i].version, version) == 0) {
+ winsock_idx = i;
+ idnLogPrintf(idn_log_level_trace,
+ "idnWinsockVersion: version %s\n",
+ version);
+ return (TRUE);
+ }
+ }
+ idnLogPrintf(idn_log_level_fatal,
+ "idnWinsockVersion: unknown winsock version %s\n",
+ version);
+ return (FALSE);
+}
+
+HINSTANCE
+idnWinsockHandle(void) {
+ static HINSTANCE dll_handle = NULL;
+ static int initialized = 0;
+
+ if (!initialized) {
+ /* Get the handle of the original winsock DLL */
+ idnLogPrintf(idn_log_level_trace,
+ "idnWinsockHandle: loading original DLL..\n");
+ dll_handle = load_original_dll();
+ }
+ initialized = 1;
+ return (dll_handle);
+}
+
+idn_resconf_t
+idnGetContext(void) {
+ static int initialized = 0;
+ static idn_resconf_t ctx = NULL;
+
+ if (!initialized) {
+ /*
+ * Check whether IDN processing should be done
+ * in this wrapper DLL.
+ */
+ idnLogPrintf(idn_log_level_trace,
+ "idnGetContext: checking IDN status..\n");
+ if (check_idn_processing()) {
+ /* Initialize idnkit */
+ ctx = idnConvInit();
+ idnLogPrintf(idn_log_level_info,
+ "Processing context: %08x\n", ctx);
+ } else {
+ idnLogPrintf(idn_log_level_info,
+ "NOT process IDN here\n");
+ ctx = NULL;
+ }
+ initialized = 1;
+ }
+
+ return (ctx);
+}
+
+static HINSTANCE
+load_original_dll(void) {
+ /*
+ * Load Original DLL
+ */
+ char dllpath[MAX_PATH];
+ const char *dll_name = winsock_info[winsock_idx].original_name;
+ HINSTANCE handle;
+
+ /*
+ * Get idn wrapper's install directory, where the copies of
+ * the original winsock DLLs are saved.
+ */
+ dllpath[0] = '\0';
+ if (idnGetInstallDir(dllpath, sizeof(dllpath)) != TRUE) {
+ idnLogPrintf(idn_log_level_fatal,
+ "idnWinsockHandle: cannot find idn wrapper's "
+ "install directory\n");
+ abort();
+ return (NULL); /* for lint */
+ }
+ /* Strip the trailing backslash. */
+ if (dllpath[0] != '\0' &&
+ dllpath[strlen(dllpath) - 1] == '\\') {
+ dllpath[strlen(dllpath) - 1] = '\0';
+ }
+ /* Is the pathname is insanely long? */
+ if (strlen(dllpath) + strlen(dll_name) + 1 + 4 >= sizeof(dllpath)) {
+ idnLogPrintf(idn_log_level_fatal,
+ "idnWinsockHandle: idn wrapper's install path is "
+ "too long to be true\n");
+ abort();
+ return (NULL); /* for lint */
+ }
+ /* Append the DLL name to form a full pathname of the DLL. */
+ strcat(dllpath, "\\");
+ strcat(dllpath, dll_name);
+ strcat(dllpath, ".DLL");
+
+ idnLogPrintf(idn_log_level_trace,
+ "idnWinsockHandle: loading original winsock DLL (%s)\n",
+ dllpath);
+ if ((handle = LoadLibrary(dllpath)) == NULL) {
+ idnLogPrintf(idn_log_level_fatal,
+ "idnWinsockHandle: no DLL %-.100s\n", dllpath);
+ abort();
+ return (NULL); /* font lint */
+ }
+ return (handle);
+}
+
+static BOOL
+check_idn_processing(void) {
+ int where = idnEncodeWhere();
+ BOOL here = FALSE;
+
+ idnLogPrintf(idn_log_level_trace,
+ "idnGetContext: Winsock%s, where=%d\n",
+ winsock_info[winsock_idx].version, where);
+
+ switch (winsock_idx) {
+ case IDN_IDX_WS11:
+ switch (where) {
+ case IDN_ENCODE_ALWAYS:
+ case IDN_ENCODE_ONLY11:
+ return (TRUE);
+ case IDN_ENCODE_CHECK:
+ if (!check_dll(winsock_info[winsock_idx].name)) {
+ return (TRUE);
+ }
+ break;
+ }
+ break;
+ case IDN_IDX_WS20:
+ switch (where) {
+ case IDN_ENCODE_ALWAYS:
+ case IDN_ENCODE_ONLY20:
+ case IDN_ENCODE_CHECK:
+ return (TRUE);
+ break;
+ }
+ break;
+ }
+ return (FALSE);
+}
+
+static BOOL
+check_dll(const char *name) {
+ HINSTANCE hdll = NULL;
+
+#if 1
+ hdll = LoadLibrary(name);
+#else
+ /*
+ * Just check the existence of the named DLL, without taking
+ * the trouble of calling DllMain.
+ */
+ hdll = LoadLibraryEx(name, NULL, LOAD_LIBRARY_AS_DATAFILE);
+#endif
+ if (hdll == NULL) {
+ idnLogPrintf(idn_log_level_trace,
+ "idnGetContext: DLL %s does not exist\n");
+ return (FALSE);
+ } else {
+ idnLogPrintf(idn_log_level_trace,
+ "idnGetContext: DLL %s exists\n");
+ FreeLibrary(hdll);
+ return (TRUE);
+ }
+}
diff --git a/contrib/idn/idnkit-1.0-src/wsock/common/convert.c b/contrib/idn/idnkit-1.0-src/wsock/common/convert.c
new file mode 100644
index 0000000..b2c202e
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/common/convert.c
@@ -0,0 +1,180 @@
+/*
+ * convert.c - convert domain name
+ */
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "wrapcommon.h"
+
+/*
+ * prepare/dispose conversion context
+ */
+
+void
+idnConvDone(idn_resconf_t ctx)
+{
+ if (ctx != NULL) {
+ idnLogReset();
+ idn_resconf_destroy(ctx);
+ }
+}
+
+idn_resconf_t
+idnConvInit(void)
+{
+ char encoding[256];
+ idn_resconf_t ctx;
+ idn_result_t r;
+
+ idnLogReset();
+
+ idnLogPrintf(idn_log_level_info, "idnkit version: %-.20s\n",
+ idn_version_getstring());
+
+ /*
+ * Initialize.
+ */
+ if ((r = idn_resconf_initialize()) != idn_success) {
+ idnPrintf("idnConvInit: cannot initialize idn library: %s\n",
+ idn_result_tostring(r));
+ return NULL;
+ }
+ if ((r = idn_resconf_create(&ctx)) != idn_success) {
+ idnPrintf("idnConvInit: cannot create context: %s\n",
+ idn_result_tostring(r));
+ return NULL;
+ }
+ /*
+ * load configuration file.
+ */
+ if ((r = idn_resconf_loadfile(ctx, NULL)) != idn_success) {
+ idnPrintf("idnConvInit: cannot read configuration file: %s\n",
+ idn_result_tostring(r));
+ if ((r = idn_resconf_setdefaults(ctx)) != idn_success) {
+ idnPrintf("idnConvInit: setting default configuration"
+ " failed: %s\n",
+ idn_result_tostring(r));
+ idnConvDone(ctx);
+ return (NULL);
+ }
+ idnPrintf("idnConvInit: using default configuration\n");
+ }
+ /*
+ * Set local codeset.
+ */
+ if (idnGetPrgEncoding(encoding, sizeof(encoding)) == TRUE) {
+ idnPrintf("Encoding PRG <%-.100s>\n", encoding);
+ r = idn_resconf_setlocalconvertername(ctx, encoding,
+ IDN_CONVERTER_RTCHECK);
+ if (r != idn_success) {
+ idnPrintf("idnConvInit: invalid local codeset "
+ "\"%-.100s\": %s\n",
+ encoding, idn_result_tostring(r));
+ idnConvDone(ctx);
+ return NULL;
+ }
+ }
+ return ctx;
+}
+
+/*
+ * idnConvReq - convert domain name in a DNS request
+ *
+ * convert local encoding to DNS encoding
+ */
+
+BOOL
+idnConvReq(idn_resconf_t ctx, const char FAR *from, char FAR *to, size_t tolen)
+{
+ idn_result_t r;
+
+ idnLogReset();
+
+ idnLogPrintf(idn_log_level_trace, "idnConvReq(from=%-.100s)\n", from);
+ if (ctx == NULL) {
+ idnLogPrintf(idn_log_level_trace, "idnConvReq: ctx is NULL\n");
+ if (strlen(from) >= tolen)
+ return FALSE;
+ strcpy(to, from);
+ return TRUE;
+ }
+
+ r = idn_res_encodename(ctx, IDN_ENCODE_APP, from, to, tolen);
+
+ if (r == idn_success) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+/*
+ * idnConvRsp - convert domain name in a DNS response
+ *
+ * convert DNS encoding to local encoding
+ */
+
+BOOL
+idnConvRsp(idn_resconf_t ctx, const char FAR *from, char FAR *to, size_t tolen)
+{
+ idnLogReset();
+
+ idnLogPrintf(idn_log_level_trace, "idnConvRsp(from=%-.100s)\n", from);
+ if (ctx == NULL) {
+ if (strlen(from) >= tolen)
+ return FALSE;
+ strcpy(to, from);
+ return TRUE;
+ } else if (idn_res_decodename(ctx, IDN_DECODE_APP,
+ from, to, tolen) == idn_success) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
diff --git a/contrib/idn/idnkit-1.0-src/wsock/common/dump.c b/contrib/idn/idnkit-1.0-src/wsock/common/dump.c
new file mode 100644
index 0000000..1f16bd5
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/common/dump.c
@@ -0,0 +1,118 @@
+/*
+ * dump.c - dump data
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "wrapcommon.h"
+
+char *
+dumpAddr(const char FAR *addr, int len, char *buff, size_t size) {
+ int i;
+ char *p;
+
+ buff[0] = '\0';
+ for (i = 0, p = buff; i < len; i++) {
+ char digits[8];
+
+ sprintf(digits, "%d", (addr[i] & 0xff));
+ if (i + 1 < len) {
+ strcat(digits, ".");
+ }
+ if (strlen(digits) >= size) {
+ break;
+ }
+ strcpy(p, digits);
+ p += strlen(digits);
+ size -= strlen(digits);
+ }
+ return (buff);
+}
+
+char *
+dumpHost(const struct hostent FAR *hp, char *buff, size_t size) {
+ char *p = buff;
+
+ p[0] = '\0';
+ if (strlen(hp->h_name) + 1 < size) {
+ sprintf(p, "%s ", hp->h_name);
+ p += strlen(p);
+ size -= strlen(p);
+ }
+ dumpAddr(hp->h_addr_list[0], hp->h_length, p, size);
+ return (buff);
+}
+
+char *
+dumpName(const char *name, char *buff, size_t size) {
+ const char *sp;
+ char *dp;
+
+ for (sp = name, dp = buff; *sp != '\0'; sp++) {
+ if (*sp >= 0x21 && *sp <= 0x7e) {
+ if (size < 2) {
+ break;
+ }
+ *dp++ = *sp;
+ size--;
+ } else {
+ if (size < 5) {
+ break;
+ }
+ dp[0] = '\\';
+ dp[1] = 'x';
+ sprintf(dp + 2, "%02x", *sp & 0xff);
+ dp += 4;
+ size -= 4;
+ }
+ }
+ *dp = '\0';
+
+ return (buff);
+}
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/common/encoding.c b/contrib/idn/idnkit-1.0-src/wsock/common/encoding.c
new file mode 100644
index 0000000..f8ad9e7
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/common/encoding.c
@@ -0,0 +1,271 @@
+/*
+ * encoding.c - get DNS/Local encodings
+ *
+ * Software\JPNIC\IDN\Where
+ * \LogFile
+ * \LogLevel
+ * \InstallDir
+ * \PerProg\<name>\Where
+ * \PerProg\<name>\Encoding
+ */
+
+/*
+ * Copyright (c) 2000,2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "wrapcommon.h"
+
+#define IDN_GLOBAL 1
+#define IDN_PERPROG 2
+#define IDN_CURUSER 4
+
+/*
+ * Registry of Encodings
+ */
+
+#define IDNKEY_WRAPPER "Software\\JPNIC\\IDN"
+#define IDNKEY_PERPROG "Software\\JPNIC\\IDN\\PerProg"
+#define IDNVAL_WHERE "Where"
+#define IDNVAL_ENCODE "Encoding"
+#define IDNVAL_LOGLVL "LogLevel"
+#define IDNVAL_LOGFILE "LogFile"
+#define IDNVAL_INSDIR "InstallDir"
+
+static int GetRegistry(HKEY top, const char *key, const char *name,
+ DWORD type, void *param, DWORD length);
+static char *GetPerProgKey(char *buf, size_t len);
+static int GetFromRegistry(const char *name, int where, DWORD type,
+ void *param, DWORD length);
+static int GetIntFromRegistry(const char *name, int defvalue, int where);
+static BOOL GetStringFromRegistry(const char *name, char *result,
+ size_t length, int where);
+
+static int
+GetRegistry(HKEY top, const char *key, const char *name, DWORD type,
+ void *param, DWORD length)
+{
+ LONG stat;
+ HKEY hk;
+ DWORD realtype;
+
+ stat = RegOpenKeyEx(top, key, 0, KEY_READ, &hk);
+ if (stat != ERROR_SUCCESS) {
+ return 0;
+ }
+
+ stat = RegQueryValueEx(hk, (LPCTSTR)name, NULL,
+ &realtype, (LPBYTE)param, &length);
+
+ RegCloseKey(hk);
+
+ if (stat != ERROR_SUCCESS || realtype != type)
+ return 0;
+
+ return 1;
+}
+
+static char *
+GetPerProgKey(char *buf, size_t len)
+{
+ char exename[256];
+ char prgname[256];
+ char *p, *last;
+
+ GetModuleFileName(NULL, exename, 256);
+
+ for (p = exename, last = NULL; *p != '\0'; p++) {
+ if (*p == '/' || *p == '\\') {
+ last = p;
+ }
+ }
+ strcpy(prgname, (last == NULL) ? exename : (last + 1));
+ if ((p = strrchr(prgname, '.')) != NULL) {
+ *p = '\0';
+ }
+
+ if (strlen(IDNKEY_PERPROG) + 1 + strlen(prgname) >= len) {
+ return (NULL);
+ }
+ sprintf(buf, "%s\\%s", IDNKEY_PERPROG, prgname);
+ return buf;
+}
+
+static int
+GetFromRegistry(const char *name, int where, DWORD type,
+ void *param, DWORD length)
+{
+ if (where & IDN_PERPROG) {
+ /*
+ * First, try program specific setting.
+ */
+ char keyname[256];
+
+ /*
+ * Try HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE.
+ */
+ if (GetPerProgKey(keyname, sizeof(keyname)) != NULL) {
+ if (((where & IDN_CURUSER) &&
+ GetRegistry(HKEY_CURRENT_USER, keyname, name,
+ type, param, length)) ||
+ GetRegistry(HKEY_LOCAL_MACHINE, keyname, name,
+ type, param, length)) {
+ return (1);
+ }
+ }
+ }
+
+ if (where & IDN_GLOBAL) {
+ /*
+ * Try global setting.
+ */
+ if (((where & IDN_CURUSER) &&
+ GetRegistry(HKEY_CURRENT_USER, IDNKEY_WRAPPER, name,
+ type, param, length)) ||
+ GetRegistry(HKEY_LOCAL_MACHINE, IDNKEY_WRAPPER, name,
+ type, param, length)) {
+ return (1);
+ }
+ }
+
+ /*
+ * Not found.
+ */
+ return (0);
+}
+
+static int
+GetIntFromRegistry(const char *name, int defvalue, int where)
+{
+ DWORD param;
+
+ if (GetFromRegistry(name, where, REG_DWORD, &param, sizeof(param))) {
+ return ((int)param);
+ }
+ return (defvalue);
+}
+
+static BOOL
+GetStringFromRegistry(const char *name, char *result, size_t length, int where)
+{
+ if (GetFromRegistry(name, where, REG_SZ, result, (DWORD)length)) {
+ return (TRUE);
+ }
+ return (FALSE);
+}
+
+/*
+ * idnEncodeWhere - which module should convert domain name
+ */
+int
+idnEncodeWhere(void)
+{
+ int v = GetIntFromRegistry(IDNVAL_WHERE, IDN_ENCODE_ALWAYS,
+ IDN_GLOBAL|IDN_PERPROG|IDN_CURUSER);
+
+ idnLogPrintf(idn_log_level_trace, "idnEncodeWhere: %d\n", v);
+ return (v);
+}
+
+/*
+ * idnGetLogFile - refer to log file
+ */
+BOOL
+idnGetLogFile(char *file, size_t len)
+{
+ BOOL v = GetStringFromRegistry(IDNVAL_LOGFILE, file, len,
+ IDN_GLOBAL|IDN_CURUSER);
+
+ idnLogPrintf(idn_log_level_trace, "idnGetLogFile: %-.100s\n",
+ (v == TRUE) ? file : "<none>");
+ return (v);
+}
+
+/*
+ * idnGetPrgEncoding - refer to Program's Local Encoding
+ *
+ * use program name as registry key
+ */
+BOOL
+idnGetPrgEncoding(char *enc, size_t len)
+{
+ if (GetStringFromRegistry(IDNVAL_ENCODE, enc, len,
+ IDN_PERPROG|IDN_CURUSER) != TRUE ||
+ enc[0] == '\0') {
+ sprintf(enc, "CP%d", GetACP());
+ }
+ idnLogPrintf(idn_log_level_trace,
+ "idnGetPrgEncoding: %-.30s\n", enc);
+ return (TRUE);
+}
+
+/*
+ * idnGetLogLevel
+ */
+int
+idnGetLogLevel(void)
+{
+ int v = GetIntFromRegistry(IDNVAL_LOGLVL, 0,
+ IDN_GLOBAL|IDN_CURUSER);
+
+ idnLogPrintf(idn_log_level_trace, "idnGetLogLevel: %d\n", v);
+ return (v);
+}
+
+/*
+ * idnGetInstallDir - get idn wrapper install directory
+ */
+BOOL
+idnGetInstallDir(char *dir, size_t len)
+{
+ /* No need to look at HKEY_CURRENT_USER */
+ BOOL v = GetStringFromRegistry(IDNVAL_INSDIR, dir, len, IDN_GLOBAL);
+
+ idnLogPrintf(idn_log_level_trace, "idnGetInstallDir: %-.100s\n",
+ (v == TRUE) ? dir : "<none>");
+ return (v);
+}
diff --git a/contrib/idn/idnkit-1.0-src/wsock/common/hook.c b/contrib/idn/idnkit-1.0-src/wsock/common/hook.c
new file mode 100644
index 0000000..b520f10
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/common/hook.c
@@ -0,0 +1,224 @@
+/*
+ * hook.c - Hooking Asynchronous Completion
+ */
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "wrapcommon.h"
+
+/*
+ * Hook Managements
+ */
+
+static HHOOK hookHandle = NULL ;
+
+typedef struct _HOOK *HOOKPTR;
+
+typedef struct _HOOK {
+ HOOKPTR prev;
+ HOOKPTR next;
+ idn_resconf_t ctx;
+ HWND hWnd;
+ u_int wMsg;
+ char FAR *pBuf;
+} HOOKREC;
+
+static HOOKREC hookList = { 0 } ;
+
+static void
+hookListInit(void) {
+ if (hookList.prev == NULL || hookList.next == NULL) {
+ hookList.prev = &hookList;
+ hookList.next = &hookList;
+ }
+}
+
+static HOOKPTR
+hookListSearch(HWND hWnd, u_int wMsg) {
+ HOOKPTR hp;
+
+ for (hp = hookList.next ; hp != &hookList ; hp = hp->next) {
+ if (hp->hWnd == hWnd && hp->wMsg == wMsg) {
+ return (hp);
+ }
+ }
+ return (NULL);
+}
+
+static BOOL
+hookListAppend(HWND hWnd, u_int wMsg, char FAR *buf, idn_resconf_t ctx) {
+ HOOKPTR hp, prev, next;
+
+ if ((hp = (HOOKPTR)malloc(sizeof(HOOKREC))) == NULL) {
+ idnPrintf("cannot create hook record\n");
+ return (FALSE);
+ }
+ memset(hp, 0, sizeof(*hp));
+
+ hp->ctx = ctx;
+ hp->hWnd = hWnd;
+ hp->wMsg = wMsg;
+ hp->pBuf = buf;
+
+ prev = hookList.prev;
+ next = prev->next;
+ prev->next = hp;
+ next->prev = hp;
+ hp->next = next;
+ hp->prev = prev;
+
+ return (TRUE);
+}
+
+static void
+hookListDelete(HOOKPTR hp)
+{
+ HOOKPTR prev, next;
+
+ prev = hp->prev;
+ next = hp->next;
+ prev->next = next;
+ next->prev = prev;
+
+ free(hp);
+}
+
+static void
+hookListDone(void)
+{
+ HOOKPTR hp;
+
+ while ((hp = hookList.next) != &hookList) {
+ hookListDelete(hp);
+ }
+}
+
+/*
+ * idnHookInit - initialize Hook Management
+ */
+void
+idnHookInit(void) {
+ hookListInit();
+}
+
+/*
+ * idnHookDone - finalize Hook Management
+ */
+void
+idnHookDone(void) {
+ if (hookHandle != NULL) {
+ UnhookWindowsHookEx(hookHandle);
+ hookHandle = NULL;
+ }
+ hookListDone();
+}
+
+/*
+ * hookProc - hookprocedure, used as WH_GETMESSAGE hook
+ */
+LRESULT CALLBACK
+hookProc(int nCode, WPARAM wParam, LPARAM lParam) {
+ MSG *pMsg;
+ HOOKPTR pHook;
+ struct hostent *pHost;
+ char nbuff[256];
+ char hbuff[256];
+
+ if (nCode < 0) {
+ return (CallNextHookEx(hookHandle, nCode, wParam, lParam));
+ } else if (nCode != HC_ACTION) {
+ return (0);
+ }
+ if ((pMsg = (MSG *)lParam) == NULL) {
+ return (0);
+ }
+ if ((pHook = hookListSearch(pMsg->hwnd, pMsg->message)) == NULL) {
+ return (0);
+ }
+
+ /*
+ * Convert the Host Name
+ */
+ pHost = (struct hostent *)pHook->pBuf;
+ idnPrintf("AsyncComplete Resulting <%s>\n",
+ dumpName(pHost->h_name, hbuff, sizeof(hbuff)));
+ if (idnConvRsp(pHook->ctx, pHost->h_name,
+ nbuff, sizeof(nbuff)) == TRUE) {
+ idnPrintf("AsyncComplete Converted <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ strcpy(pHost->h_name, nbuff);
+ }
+
+ /*
+ * Delete target
+ */
+ hookListDelete(pHook);
+
+ return (0);
+}
+
+/*
+ * idnHook - hook async. completion message
+ */
+BOOL
+idnHook(HWND hWnd, u_int wMsg, char FAR *buf, idn_resconf_t ctx)
+{
+ if (hookHandle == NULL) {
+ hookHandle = SetWindowsHookEx(WH_GETMESSAGE, hookProc,
+ NULL, GetCurrentThreadId());
+ }
+ if (hookHandle == NULL) {
+ idnPrintf("idnHook: cannot set hook\n");
+ return (FALSE);
+ }
+ if (hookListAppend(hWnd, wMsg, buf, ctx) != TRUE) {
+ return (FALSE);
+ }
+ return (TRUE);
+}
diff --git a/contrib/idn/idnkit-1.0-src/wsock/common/make.wnt b/contrib/idn/idnkit-1.0-src/wsock/common/make.wnt
new file mode 100644
index 0000000..4dde4dd
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/common/make.wnt
@@ -0,0 +1,102 @@
+#
+# Makefile for WinSock Wrapper (common part)
+#
+
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+!include <win32.mak>
+
+SYSLIBS = $(libcdll) kernel32.lib advapi32.lib user32.lib
+
+#
+# Files to use
+#
+
+HDRS = wrapcommon.h
+SRCS = printf.c dump.c checkdll.c encoding.c convert.c hook.c
+OBJS = printf.obj dump.obj checkdll.obj encoding.obj convert.obj hook.obj
+LIBS = ..\..\lib\idnkit.lib ..\..\win\iconv.lib
+
+cflags = $(cflags) -I..\..\include
+
+#
+# Targets to Build
+#
+
+TARGETS = wrapcommon.lib
+
+all : $(TARGETS)
+
+wrapcommon.lib : $(OBJS)
+ -del wrapcommon.lib
+ lib /out:wrapcommon.lib $(OBJS)
+
+install :
+
+clean : force
+ -del *.obj
+ -del *.lib
+ -del *.exp
+
+#
+# Dependencies
+#
+
+printf.obj : printf.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+dump.obj : dump.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+checkdll.obj : checkdll.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+encoding.obj : encoding.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+convert.obj : convert.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+hook.obj : hook.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+force :
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/common/printf.c b/contrib/idn/idnkit-1.0-src/wsock/common/printf.c
new file mode 100644
index 0000000..7d6d2e4
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/common/printf.c
@@ -0,0 +1,138 @@
+/*
+ * printf.c - printf like debug print function
+ */
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <process.h>
+
+#include "wrapcommon.h"
+
+/*
+ * Debug Tracer for DLL
+ */
+
+static char logfile_name[256];
+static int log_level = -1;
+static char log_header[30];
+
+void
+idnPrintf(char *fmt, ...) {
+ va_list arg_ptr;
+ FILE *fp;
+ char msg[512];
+
+ if (log_level < 0 || logfile_name[0] == '\0')
+ return;
+
+ va_start(arg_ptr, fmt);
+ vsprintf(msg, fmt, arg_ptr);
+ va_end(arg_ptr);
+
+ if ((fp = fopen(logfile_name, "a")) != NULL) {
+ fputs(log_header, fp);
+ fputs(msg, fp);
+ fclose(fp);
+ }
+}
+
+void
+idnLogPrintf(int level, char *fmt, ...) {
+ va_list arg_ptr;
+ FILE *fp;
+ char msg[512];
+
+ if (level > log_level || logfile_name[0] == '\0')
+ return;
+
+ va_start(arg_ptr, fmt);
+ vsprintf(msg, fmt, arg_ptr);
+ va_end(arg_ptr);
+
+ if ((fp = fopen(logfile_name, "a")) != NULL) {
+ fputs(log_header, fp);
+ fputs(msg, fp);
+ fclose(fp);
+ }
+}
+
+static void
+log_proc(int level, const char *msg) {
+ FILE *fp;
+
+ if (log_level < 0 || logfile_name[0] == '\0')
+ return;
+
+ if ((fp = fopen(logfile_name, "a")) != NULL) {
+ fputs(msg, fp);
+ fclose(fp);
+ }
+}
+
+void
+idnLogInit(const char *title) {
+ log_level = idnGetLogLevel();
+ /* If log file is not stored in the registry, don't do logging. */
+ if (idnGetLogFile(logfile_name, sizeof(logfile_name)) == FALSE) {
+ log_level = -1;
+ }
+ sprintf(log_header, "%08x %-.16s: ", getpid(), title);
+ idn_log_setproc(log_proc);
+ idn_log_setlevel(log_level < 0 ? 0 : log_level);
+}
+
+void
+idnLogReset(void) {
+ idn_log_setproc(log_proc);
+}
+
+void
+idnLogFinish(void) {
+ idn_log_setproc(NULL);
+ /* idn_log_setlevel(0); */
+}
diff --git a/contrib/idn/idnkit-1.0-src/wsock/common/wrapcommon.h b/contrib/idn/idnkit-1.0-src/wsock/common/wrapcommon.h
new file mode 100644
index 0000000..c186a33
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/common/wrapcommon.h
@@ -0,0 +1,109 @@
+/*
+ * wrapcommon.h
+ */
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef _WRAPCOMMON_H
+#define _WRAPCOMMON_H
+
+#include <idn/res.h>
+#include <idn/log.h>
+#include <idn/version.h>
+
+#define WRAPPER_EXPORT extern __declspec(dllexport)
+
+extern void idnPrintf(char *fmt, ...);
+extern void idnLogPrintf(int level, char *fmt, ...);
+extern void idnLogInit(const char *title);
+extern void idnLogReset(void);
+extern void idnLogFinish(void);
+
+extern char *dumpAddr(const char FAR *addr, int len, char *buff, size_t size);
+extern char *dumpHost(const struct hostent FAR *hp, char *buff, size_t size);
+extern char *dumpName(const char *name, char *buff, size_t size);
+
+extern int idnEncodeWhere(void);
+
+#define IDN_ENCODE_ALWAYS 0
+#define IDN_ENCODE_CHECK 1
+#define IDN_ENCODE_ONLY11 2
+#define IDN_ENCODE_ONLY20 3
+
+extern BOOL idnGetPrgEncoding(char *enc, size_t len);
+extern BOOL idnGetLogFile(char *file, size_t len);
+
+extern int idnGetLogLevel(void); /* 0 : fatal */
+ /* 1 : error */
+ /* 2 : warning */
+ /* 3 : info */
+ /* 4 : trace */
+ /* 5 : dump */
+extern int idnGetInstallDir(char *dir, size_t len);
+
+extern idn_resconf_t idnConvInit(void);
+extern void idnConvDone(idn_resconf_t ctx);
+
+extern BOOL idnWinsockVersion(const char *version);
+extern HINSTANCE idnWinsockHandle(void);
+extern idn_resconf_t idnGetContext(void);
+
+/*
+ * Converting Request/Response
+ */
+
+extern BOOL idnConvReq(idn_resconf_t ctx, const char FAR *from,
+ char FAR *to, size_t tolen);
+extern BOOL idnConvRsp(idn_resconf_t ctx, const char FAR *from,
+ char FAR *to, size_t tolen);
+
+/*
+ * Hook for Asynchronouse Query
+ */
+
+extern void idnHookInit(void);
+extern void idnHookDone(void);
+extern BOOL idnHook(HWND hWnd, u_int wMsg, char FAR *buf, idn_resconf_t ctx);
+
+#endif /* _WRAPCOMMON_H */
diff --git a/contrib/idn/idnkit-1.0-src/wsock/config/idnconf.tcl b/contrib/idn/idnkit-1.0-src/wsock/config/idnconf.tcl
new file mode 100644
index 0000000..d73bb77
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/config/idnconf.tcl
@@ -0,0 +1,1123 @@
+# $Id: idnconf.tcl,v 1.1.1.1 2003/06/04 00:27:42 marka Exp $
+#
+# idnconf.tcl - configure idn wrapper
+#
+
+#############################################################################
+# Copyright (c) 2000,2002 Japan Network Information Center.
+# All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+#############################################################################
+
+global configFile configBack
+global registryKey registryEnc registryDef
+global filesCpy filesRen filesDel
+
+# idnkit version
+set version "1.0"
+
+set configFile "idnconf.lst" ;# list of wrapped program
+set configBack "idnconf.bak" ;# backup of previous data
+
+set serverKey "HKEY_LOCAL_MACHINE\\Software\\JPNIC\\IDN"
+set serverLogLevel LogLevel
+set serverLogLevelDef -1
+set serverLogLevelNone -1
+set serverLogFile LogFile
+set serverLogFileDef {C:\idn_wrapper.log}
+set serverConfFile ConfFile
+
+set perprogKey "HKEY_LOCAL_MACHINE\\Software\\JPNIC\\IDN\\PerProg\\"
+set perprogEnc Encoding
+set perprogDef Default
+
+set logFileNameDef idn_wrapper.log
+set confFileNameDef idn.conf
+
+set filesCpy11 { "wsock32.dll" }
+set filesCpy20 { "wsock32.dll" "ws2_32.dll" }
+set filesDel11 { "wsock32.dll" }
+set filesDel20 { "wsock32.dll" "ws2_32.dll" }
+
+set local_dll 0
+
+########################################################################
+#
+# OS version check
+#
+
+proc get_os_version {} {
+ global os_version tcl_platform
+
+ if {[llength [info globals os_version]] > 0} {
+ return $os_version
+ }
+
+ switch -- $tcl_platform(os) {
+ "Windows 95" {
+ switch -- $tcl_platform(osVersion) {
+ 4.0 {
+ set os_version {Windows 95}
+ }
+ 4.10 {
+ set os_version {Windows 98}
+ }
+ 4.90 {
+ set os_version {Windows Me}
+ }
+ }
+ }
+ "Windows NT" {
+ switch -- $tcl_platform(osVersion) {
+ 3.51 -
+ 4.0 {
+ set os_version {Windows NT}
+ }
+ 5.0 {
+ set os_version {Windows 2000}
+ }
+ default {
+ # XP or .NET
+ set os_version {Windows XP}
+ }
+ }
+ }
+ "Win32s" {
+ error "idn wrapper does not support Windows 3.1"
+ }
+ default {
+ set os_version "Unknown"
+ }
+ }
+ set os_version
+}
+
+proc support_dll_redirection {} {
+ global dll_redirection
+
+ if {[llength [info globals dll_redirection]] > 0} {
+ return $dll_redirection
+ }
+
+ switch -- [get_os_version] {
+ {Windows 95} -
+ {Windows NT} {
+ # cannot force local DLL reference by .local file.
+ set dll_redirection 0
+ }
+ default {
+ set dll_redirection 1
+ }
+ }
+ set dll_redirection
+}
+
+########################################################################
+#
+# handling pathname
+#
+
+proc getExeName { prg } {
+ set elem [file split $prg]
+ set leng [expr {[llength $elem] - 1}]
+ set name [lindex $elem $leng]
+ set exe [file rootname $name]
+ return $exe
+}
+
+proc getDirName { prg } {
+ file dirname $prg
+}
+
+proc getSystemDir {} {
+ global env
+ switch -- [get_os_version] {
+ "Windows 95" -
+ "Windows 98" -
+ "Windows Me" {
+ set sysDir $env(windir)/system
+ }
+ default {
+ set sysDir $env(SystemRoot)/system32
+ }
+ }
+ return $sysDir
+}
+
+########################################################################
+#
+# loadList / saveList
+#
+# loadList - load list of wrapped executables from $configFile
+# saveList - save list of wrapped executables into $configFile
+#
+
+proc loadList {} {
+
+ global configFile configBack
+
+ if { [file exists $configFile] } {
+ file copy -force $configFile $configBack
+ }
+
+ set aList {}
+ set fd [open $configFile {CREAT RDONLY}]
+ while { ! [eof $fd]} {
+ set line [gets $fd]
+ if { [string length $line] > 0} {
+ lappend aList "$line"
+ }
+ }
+ close $fd
+ return $aList
+}
+
+proc saveList { aList } {
+ global configFile
+ file delete -force $configFile
+ set fd [open $configFile {CREAT WRONLY}]
+ foreach e $aList {
+ puts $fd $e
+ }
+ close $fd
+}
+
+########################################################################
+#
+# putList / getList - set/get list to/from listbox
+#
+
+proc putList { lb aList } {
+ foreach e $aList {
+ $lb insert end $e
+ }
+}
+
+proc getList { lb } {
+ $lb get 0 end
+}
+
+########################################################################
+#
+# checkList / appendList / deleteList - check / append / delete program from/to listbox
+#
+
+proc checkList { lb prg } {
+ set cnt 0
+ set lst [getList $lb]
+
+ foreach n $lst {
+ if { [string compare $prg $n] == 0 } {
+ incr cnt
+ }
+ }
+ return $cnt
+}
+
+proc appendList { lb prg } {
+
+ if { [checkList $lb $prg] == 0 } {
+ $lb insert end $prg
+ }
+}
+
+proc deleteList { lb prg } {
+ set cnt 0
+ set lst [getList $lb]
+
+ foreach n $lst {
+ if { [string compare $n $prg] == 0 } {
+ $lb delete $cnt
+ }
+ incr cnt
+ }
+}
+
+########################################################################
+#
+# registry operations
+#
+
+proc regGetEncode { prg } {
+
+ global perprogKey perprogEnc perprogDef
+
+ if { [string compare $prg "" ] == 0 } {
+ return $perprogDef
+ }
+
+ if {![isWindows]} {
+ return $perprogDef
+ }
+ package require registry 1.0
+
+ set name [getExeName $prg]
+ set key $perprogKey$name
+
+ if { [catch {set enc [registry get $key $perprogEnc]} err] } {
+ return $perprogDef
+ }
+ if { [string compare $enc ""] == 0 } {
+ return $perprogDef
+ }
+ return $enc
+}
+
+proc regSetEncode { prg enc } {
+
+ global perprogKey perprogEnc perprogDef
+
+ if {![isWindows]} {
+ return 1
+ }
+
+ package require registry 1.0
+
+ set name [getExeName $prg]
+ set key $perprogKey$name
+
+ if { [string compare $enc $perprogDef] == 0 } {
+ set enc ""
+ }
+ if { [catch {registry set $key $perprogEnc $enc sz} ] } {
+ return 2
+ }
+ return 0
+}
+
+proc regGetLogLevel {} {
+ global serverKey serverLogLevel serverLogLevelDef
+ regGetValue $serverKey $serverLogLevel $serverLogLevelDef
+}
+
+proc regSetLogLevel {level} {
+ global serverKey serverLogLevel
+ regSetValue $serverKey $serverLogLevel $level dword
+}
+
+proc regGetLogFile {} {
+ global serverKey serverLogFile serverLogFileDef
+ set file [regGetValue $serverKey $serverLogFile $serverLogFileDef]
+ if {[catch {file attributes $file -longname} lfile]} {
+ # Maybe $file doesn't exist (yet). Get the longname of
+ # directory portion.
+ set dir [file dirname $file]
+ if {[catch {file attributes $dir -longname} ldir]} {
+ set ldir $dir
+ }
+ set lfile [file join $ldir [file tail $file]]
+ }
+ file nativename $lfile
+}
+
+proc regSetLogFile {file} {
+ global serverKey serverLogFile
+ regSetValue $serverKey $serverLogFile [file nativename $file]
+}
+
+proc regGetConfFile {} {
+ global serverKey serverConfFile
+ set file [regGetValue $serverKey $serverConfFile {}]
+ if {[string compare $file {}] == 0} {
+ return {}
+ }
+ if {[catch {file attributes $file -longname} lfile]} {
+ # Maybe $file doesn't exist (yet). Get the longname of
+ # directory portion.
+ set dir [file dirname $file]
+ if {[catch {file attributes $dir -longname} ldir]} {
+ set ldir $dir
+ }
+ set lfile [file join $ldir [file tail $file]]
+ }
+ file nativename $lfile
+}
+
+proc regSetConfFile {file} {
+ global serverKey serverConfFile
+ regSetValue $serverKey $serverConfFile [file nativename $file]
+}
+
+proc regGetWhere {} {
+ global serverKey
+ regGetValue $serverKey Where 0
+}
+
+proc regSetWhere {where} {
+ global serverKey
+ regSetValue $serverKey Where $where dword
+}
+
+proc regGetValue {key name default} {
+ if {![isWindows]} {
+ puts "--regGetValue $key $name"
+ return $default
+ }
+ package require registry 1.0
+
+ if {[catch {registry get $key $name} value]} {
+ return $default
+ }
+ if {[string compare $value {}] == 0} {
+ return $default
+ }
+ return $value
+}
+
+proc regSetValue {key name value {type sz}} {
+ if {![isWindows]} {
+ puts "--regSetValue $key $name $value"
+ return 1
+ }
+
+ package require registry 1.0
+
+ if {[catch {registry set $key $name $value $type}]} {
+ return 2
+ }
+ return 0
+}
+
+########################################################################
+#
+# install / uninstall DLL s
+#
+
+proc fileInstall { prg } {
+
+ global env
+ global filesCpy11 filesCpy20
+
+ if {![isWindows]} {
+ return 1
+ }
+
+ switch -- [get_os_version] {
+ "Windows 95" -
+ "Windows 98" -
+ "Windows Me" {
+ set winDir $env(windir)
+ set sysDir $winDir/system
+ set filesCpy $filesCpy11
+ }
+ default {
+ set winDir $env(SystemRoot)
+ set sysDir $winDir/system32
+ set filesCpy $filesCpy20
+ }
+ }
+
+ set toDir [getDirName $prg ]
+
+ foreach n $filesCpy {
+ file copy -force $n $toDir
+ }
+ return 0
+}
+
+proc fileRemove { prg } {
+
+ global filesDel11 filesDel20
+
+ if {![isWindows]} {
+ return 1
+ }
+
+ switch -- [get_os_version] {
+ "Windows 95" {
+ set filesDel $filesDel11
+ }
+ "Windows 98" -
+ "Windows Me" {
+ set filesDel $filesDel20
+ }
+ default {
+ set filesDel $filesDel20
+ }
+ }
+
+ set fromDir [getDirName $prg ]
+
+ foreach n $filesDel {
+ file delete -force $fromDir/$n
+ }
+ return 0
+}
+
+########################################################################
+#
+# Wrap/Unwrap program
+#
+
+proc execWrap { pw lb dlg prg enc } {
+
+ set prgName [$prg get]
+ set encName [$enc get]
+
+ # Make sure the program name is not empty
+ if {[string compare $prgName {}] == 0} {
+ confErrorDialog $dlg "Program must be specified.\nClick \"Browse..\" button for browsing."
+ return
+ }
+
+ # It is dangerous to wrap programs in the system directory.
+ set prgdir [file nativename [getDirName $prgName]]
+ set sysdir [file nativename [getSystemDir]]
+ if {[string compare -nocase $prgdir $sysdir] == 0} {
+ tk_messageBox -icon error -type ok -title "Directory Error" \
+ -parent $dlg \
+ -message "Cannot wrap applications in the system directory.\nPlease copy the EXE file to elsewhere and wrap the copied one."
+ destroy $dlg
+ return 1
+ }
+
+ # Okay, copy the wrapper DLLs.
+ if { [fileInstall $prgName] } {
+ tk_messageBox -icon warning -type ok \
+ -title "Warning" \
+ -message "Cannot install DLLs" \
+ -parent $dlg
+ destroy $dlg
+ return 1
+ }
+ if { [regSetEncode $prgName $encName] } {
+ tk_messageBox -icon warning -type ok \
+ -title "Warning" \
+ -message "Cannot set encoding" \
+ -parent $dlg
+ fileRemove $prgName
+ destroy $dlg
+ return 2
+ }
+
+ # if local flag is on, create $prgName.local.
+ global local_dll
+ if {$local_dll} {
+ create_dot_local $prgName $dlg
+ } else {
+ remove_dot_local $prgName $dlg
+ }
+
+ if { [checkList $lb $prgName] == 0 } {
+ appendList $lb $prgName
+ }
+ saveList [getList $lb]
+ destroy $dlg
+}
+
+proc execUnwrap { pw lb dlg prg } {
+
+ set prgName [$prg get]
+
+ if {[support_dll_redirection] && [file exists $prgName.local]} {
+ set ans [tk_messageBox -icon question -type yesno \
+ -title "Confirmation" \
+ -message "Also remove $prgName.local file?" \
+ -parent $dlg]
+ if {[string compare $ans yes] == 0} {
+ remove_dot_local $prgName $dlg
+ }
+ }
+
+ if { [checkList $lb $prgName] == 1 } {
+ fileRemove $prgName
+ }
+ deleteList $lb $prgName
+ saveList [getList $lb]
+ destroy $dlg
+}
+
+proc create_dot_local {path {parent .}} {
+ set dotlocal $path.local
+ if {[file exists $dotlocal]} {
+ return 0
+ }
+ if {[catch {open $dotlocal w} fh]} {
+ tk_messageBox -icon warning -type ok -title "Warning" \
+ -message "Cannot create $dotlocal" -parent $parent
+ return -1
+ }
+ close $fh
+ return 0
+}
+
+proc remove_dot_local {path {parent .}} {
+ set dotlocal $path.local
+ if {[file exists $dotlocal] && [catch {file delete $dotlocal}]} {
+ tk_messageBox -icon warning -type ok -title "Warning" \
+ -message "Cannot remove $dotlocal" -parent $parent
+ return -1
+ }
+ return 0
+}
+
+########################################################################
+#
+# dialog for Wrap / Unwrap
+#
+
+proc syncEncode { v i op } {
+ global prgName encName
+ set enc [regGetEncode $prgName]
+ if { [string compare $encName $enc] != 0 } {
+ set encName $enc
+ }
+}
+
+proc confBrowse { p ePrg eEnc } {
+
+ set types {
+ { "Executable" .exe }
+ }
+
+ set file [tk_getOpenFile -filetypes $types -parent $p ]
+
+ if { [string compare $file ""] == 0 } {
+ return
+ }
+ set enc [regGetEncode $file]
+ $ePrg delete 0 end
+ $ePrg insert 0 $file
+}
+
+proc confWrap { pw lb } {
+
+ global prgName encName local_dll
+
+ set idx [$lb curselection]
+ if { [llength $idx] == 1 } {
+ set prg [$lb get $idx]
+ set local_dll [file exists $prg.local]
+ } else {
+ set prg ""
+ }
+
+ set top .wrap
+ toplevel $top
+ grab $top
+ wm title $top "idn wrapper - Wrap Executable"
+
+ frame $top.f1 -bd 1 -relief raised
+ frame $top.f2 -bd 1 -relief raised
+ pack $top.f1 -side top -fill x -expand on
+ pack $top.f2 -side top -fill x -expand on
+
+ frame $top.f1.f
+ pack $top.f1.f -fill both -expand on -padx 4 -pady 4
+
+ set w $top.f1.f
+ label $w.prgtitle -text "Program:"
+ label $w.enctitle -text "Encoding:"
+
+ entry $w.prgname -relief sunken -width 56 -textvariable prgName
+ entry $w.encname -relief sunken -width 8 -textvariable encName
+ set w_prgname $w.prgname
+ set w_encname $w.encname
+ button $w.browse -text "Browse.." \
+ -command [list confBrowse $w $w_prgname $w_encname]
+
+ frame $w.rbf
+ radiobutton $w.rbf.encdef -text "Default" -variable encName \
+ -value "Default"
+ radiobutton $w.rbf.encutf -text "UTF-8" -variable encName \
+ -value "UTF-8"
+ pack $w.rbf.encdef $w.rbf.encutf -side left -padx 4
+
+ grid $w.prgtitle -row 0 -column 0 -sticky e
+ grid $w.enctitle -row 1 -column 0 -sticky e
+ grid $w.prgname -row 0 -column 1 -sticky we -pady 4 -padx 2 -columnspan 2
+ grid $w.browse -row 0 -column 3 -sticky w -pady 4 -padx 4
+ grid $w.encname -row 1 -column 1 -sticky we -pady 4 -padx 2
+ grid $w.rbf -row 1 -column 2 -sticky w -padx 2
+ if {[support_dll_redirection]} {
+ checkbutton $w.local -text "Force local DLL reference" \
+ -variable local_dll
+ grid $w.local -row 2 -column 1 -sticky w -padx 4 -pady 4
+ }
+ grid columnconfig $w 1 -weight 1 -minsize 20
+ grid columnconfig $w 2 -weight 2 -minsize 20
+
+ trace variable prgName w syncEncode
+
+ $w.prgname delete 0 end
+ $w.prgname insert 0 $prg
+
+ focus $w.prgname
+
+ set w $top.f2
+ button $w.wrap -text "Wrap" \
+ -command [list execWrap $pw $lb $top $w_prgname $w_encname]
+ button $w.cancel -text "Cancel" \
+ -command [list destroy $top]
+ pack $w.cancel -side right -fill y -padx 12 -pady 4
+ pack $w.wrap -side right -fill y -padx 12 -pady 4
+
+ tkwait window $top
+}
+
+proc confUnwrap { pw lb } {
+
+ set idx [$lb curselection]
+ if { [llength $idx] != 1 } {
+ tk_messageBox -icon warning -type ok \
+ -title "Warning" \
+ -message "first, select unwrapping executable" \
+ -parent $pw
+ return 0
+ }
+ set prg [$lb get $idx]
+ if { [string length $prg] == 0 } {
+ tk_messageBox -icon warning -type ok \
+ -title "Warning" \
+ -message "first, select unwrapping executable" \
+ -parent $pw
+ return 0
+ }
+
+ set top .unwrap
+ toplevel $top
+ grab $top
+ wm title $top "idn wrapper - Unwrap Executable"
+
+ frame $top.f1 -bd 1 -relief raised
+ frame $top.f2 -bd 1 -relief raised
+ pack $top.f2 -side bottom -fill x
+ pack $top.f1 -side bottom -fill x -expand on
+
+ frame $top.f1.f
+ pack $top.f1.f -padx 4 -pady 4 -fill both -expand on
+ set w $top.f1.f
+ label $w.prgtitle -text "Program:"
+ entry $w.prgname -relief sunken -width 56 -textvariable prgName
+ $w.prgname delete 0 end
+ $w.prgname insert 0 $prg
+
+ set w_prgname $w.prgname
+
+ grid $w.prgtitle -row 0 -column 0 -sticky w
+ grid $w.prgname -row 0 -column 1 -sticky we -pady 4
+ grid columnconfig $w 1 -weight 1 -minsize 20
+
+ set w $top.f2
+ button $w.wrap -text "Unwrap" \
+ -command [list execUnwrap $pw $lb $top $w_prgname]
+ button $w.cancel -text "Cancel" \
+ -command [list destroy $top]
+
+ pack $w.cancel -side right -padx 12 -pady 6
+ pack $w.wrap -side right -padx 12 -pady 6
+
+ focus $w.wrap
+ tkwait window $top
+}
+
+proc unwrapAll {pw lb} {
+ set ans [tk_messageBox -type yesno -default no -icon question \
+ -parent $pw -title {idn wrapper Configuration} \
+ -message {Really unwrap all programs?}]
+ if {[string compare $ans yes] != 0} {
+ return
+ }
+
+ foreach prog [$lb get 0 end] {
+ fileRemove $prog
+ }
+
+ if {[support_dll_redirection]} {
+ set delete_type yes
+ foreach prog [$lb get 0 end] {
+ if {![file exists $prog.local]} continue
+ switch -- $delete_type {
+ yes -
+ no {
+ set delete_type [dotLocalDialog $prog $delete_type]
+ }
+ }
+ switch -- $delete_type {
+ yes -
+ yesall {
+ remove_dot_local $prog $pw
+ }
+ }
+ }
+ }
+
+ $lb delete 0 end
+ saveList {}
+}
+
+proc rewrapAll {pw lb} {
+ set ans [tk_messageBox -type yesno -default yes -icon question \
+ -parent $pw -title {idn wrapper Configuration} \
+ -message {Really rewrap all programs?}]
+ if {[string compare $ans yes] != 0} {
+ return
+ }
+ foreach prog [$lb get 0 end] {
+ fileInstall $prog
+ }
+}
+
+proc confLog {pw} {
+ global _logLevel _logFile
+
+ set top .log
+ catch {destroy $top}
+ toplevel $top
+ wm title $top "idn wrapper - Log Configuration"
+ # wm transient $top $pw
+
+ set _logLevel [regGetLogLevel]
+ set _logFile [regGetLogFile]
+
+ frame $top.f1 -bd 1 -relief raised
+ frame $top.f2 -bd 1 -relief raised
+ pack $top.f2 -side bottom -fill x
+ pack $top.f1 -side top -fill both -expand on
+
+ set w $top.f1
+ label $w.lv_l -text "Log Level:"
+ frame $w.lv_v
+ global serverLogLevelNone
+ set i 0
+ foreach {lvl text} [list $serverLogLevelNone None \
+ 0 Fatal 1 Error 2 Warning 3 Info 4 Trace] {
+ radiobutton $w.lv_v.btn$i -text $text -value $lvl -variable _logLevel
+ pack $w.lv_v.btn$i -side left -padx 3
+ incr i
+ }
+ label $w.ld_l -text "Log File:"
+ frame $w.ld_v
+ entry $w.ld_v.e -width 40 -textvariable _logFile
+ focus $w.ld_v.e
+ button $w.ld_v.b -text "Browse.." -command [list selectLog $top $w.ld_v.e]
+ pack $w.ld_v.b -side right -fill y -padx 6
+ pack $w.ld_v.e -side left -fill both -expand yes
+ #label $w.lo_l -text "Log Operation:"
+ frame $w.lo_v
+ button $w.lo_v.show -text "View" -command [list showLog $top]
+ button $w.lo_v.delete -text "Delete" -command [list deleteLog $top]
+ pack $w.lo_v.show $w.lo_v.delete -side left -padx 4
+
+ grid $w.lv_l -row 0 -column 0 -sticky e -padx 4
+ grid $w.ld_l -row 1 -column 0 -sticky e -padx 4
+ #grid $w.lo_l -row 2 -column 0 -sticky e -padx 4
+ grid $w.lv_v -row 0 -column 1 -sticky w -padx 4 -pady 4
+ grid $w.ld_v -row 1 -column 1 -sticky we -padx 4 -pady 4
+ grid $w.lo_v -row 2 -column 1 -sticky w -padx 4 -pady 4
+
+ set w $top.f2
+ button $w.ok -text "OK" -command [list configureLog $top]
+ button $w.cancel -text "Cancel" -command [list destroy $top]
+ pack $w.cancel -side right -padx 12 -pady 6
+ pack $w.ok -side right -padx 12 -pady 6
+}
+
+proc configureLog {top} {
+ global _logLevel _logFile
+
+ if {$_logLevel != [regGetLogLevel] ||
+ [string compare $_logFile [regGetLogFile]] != 0} {
+ set dir [file dirname $_logFile]
+ if {[string compare $dir {}]} {
+ if {![file exists $dir]} {
+ confErrorDialog $top "Directory $dir doesn't exist"
+ return
+ } elseif {![file isdirectory $dir]} {
+ confErrorDialog $top "$dir is not a directory"
+ return
+ }
+ }
+ regSetLogLevel $_logLevel
+ regSetLogFile $_logFile
+ tk_messageBox -type ok -default ok -icon info -parent $top \
+ -title "idn wrapper Configuration" \
+ -message "Changing log level or file does not affect already running processes."
+ }
+ destroy $top
+}
+
+proc selectLog {top e} {
+ global logFileNameDef
+ set file [tk_getSaveFile -title {idn wrapper Logfile Selection} \
+ -defaultextension .log \
+ -filetypes {{{Log Files} .log} {{All Files} *}} \
+ -initialfile $logFileNameDef \
+ -parent $top]
+ if {[string compare $file {}]} {
+ $e delete 0 end
+ $e insert insert $file
+ }
+}
+
+proc showLog {top} {
+ global _logFile
+ if {[catch {exec notepad.exe $_logFile &} r]} {
+ confErrorDialog $top "Cannot execute notepad"
+ }
+}
+
+proc deleteLog {top} {
+ global _logFile
+ set ans [tk_messageBox -type yesno -default no -icon question \
+ -parent $top -title "idn wrapper Configuration" \
+ -message "Really delete $_logFile?"]
+ if {[string compare $ans yes] == 0} {
+ file delete $_logFile
+ }
+}
+
+########################################################################
+#
+# dialog for .local deletion
+#
+
+proc dotLocalDialog {path {default yes}} {
+ set parent .
+ set dlg .dotlocaldlg
+ catch {destroy $dlg}
+ toplevel $dlg
+
+ wm iconname $dlg Dialog
+ wm title $dlg Confirmation
+ wm transient $dlg $parent
+ wm protocol $dlg WM_DELETE_WINDOW {}
+
+ frame $dlg.f1 -bd 1 -relief raised
+ frame $dlg.f2 -bd 1 -relief raised
+ pack $dlg.f1 -side top -fill x -expand on -ipadx 2m -ipady 4m
+ pack $dlg.f2 -side top -fill x -ipadx 2m
+
+ label $dlg.f1.bm -bitmap question -bd 0
+ label $dlg.f1.msg -text "Remove $path.local?" -wraplength 10c
+ pack $dlg.f1.bm -side left -padx 3m -pady 2m
+ pack $dlg.f1.msg -side left -padx 2m -pady 2m
+
+ global dotlocal_selection
+ foreach {btn lbl} {yes Yes no No yesall {Yes to All} noall {No to All}} {
+ set bw $dlg.f2.btn$btn
+ button $bw -text $lbl -default normal \
+ -command [list set dotlocal_selection $btn]
+ if {[string compare $default $btn] == 0} {
+ $bw configure -default active
+ focus $bw
+ }
+ bind $bw <Return> {%W flash; %W invoke}
+ pack $bw -side left -padx 3m -pady 2m
+ }
+
+ grab $dlg
+ ::tk::PlaceWindow $dlg widget $parent
+
+ vwait dotlocal_selection
+ destroy $dlg
+ return $dotlocal_selection
+}
+
+########################################################################
+#
+# dialog for advanced configuration
+#
+
+proc advancedConf {pw} {
+ set top .adv
+ catch {destroy $top}
+ toplevel $top
+ wm title $top "idn wrapper - Advanced Configuration"
+
+ global _mdnOperation _confFile
+ set _mdnOperation [regGetWhere]
+ set _confFile [regGetConfFile]
+
+ foreach f {f1 f2 f3} {
+ frame $top.$f -bd 1 -relief raised
+ pack $top.$f -side top -fill x
+ }
+
+ set f $top.f1
+ label $f.lbl -text {IDN Wrapping Mode}
+ set w $f.f
+ frame $w
+ foreach {rb val txt} [list \
+ rb1 0 {Wrap both WINSOCK 1.1 and WINSOCK 2.0} \
+ rb2 2 {Wrap only WINSOCK 1.1} \
+ rb3 3 {Wrap only WINSOCK 2.0} \
+ rb4 1 "Wrap only WINSOCK2.0 if it exists.\nOtherwise wrap only WINSOCK1.1"] {
+ radiobutton $w.$rb -text $txt -variable _mdnOperation -value $val \
+ -anchor w -justify left
+ pack $w.$rb -side top -fill x -pady 1
+ }
+ pack $f.lbl -side top -fill x -pady 4
+ pack $w -side top -fill both -padx 20 -pady 10
+
+ set f $top.f2
+ label $f.lbl -text {IDN Configuration}
+ pack $f.lbl -side top -fill x -pady 6
+
+ set w $f.f
+ frame $w
+ pack $w -side top -fill both -padx 10 -pady 6
+ label $w.l1 -text {Config File:}
+ #label $w.l2 -text {Config Operation:}
+ entry $w.e -width 40 -textvariable _confFile
+ focus $w.e
+ button $w.br -text "Browse.." -command [list selectConf $top $w.e]
+ button $w.b -text Edit -command [list editConf $top]
+ grid $w.l1 -row 0 -column 0 -sticky e -padx 4
+ #grid $w.l2 -row 1 -column 0 -sticky e -padx 4
+ grid $w.e -row 0 -column 1 -sticky we -padx 4 -pady 4
+ grid $w.b -row 1 -column 1 -sticky w -padx 4 -pady 4
+ grid $w.br -row 0 -column 2 -sticky w -padx 4 -pady 4
+
+ set w $top.f3
+ button $w.ok -text "OK" -command [list advConf $top]
+ button $w.cancel -text "Cancel" -command [list destroy $top]
+ pack $w.cancel -side right -padx 12 -pady 8
+ pack $w.ok -side right -padx 12 -pady 8
+}
+
+proc editConf {top} {
+ global _confFile
+ if {[catch {exec notepad.exe $_confFile &} r]} {
+ confErrorDialog $top "Cannot execute notepad"
+ }
+}
+
+proc selectConf {top e} {
+ global confFileNameDef
+ set file [tk_getOpenFile -title {idn wrapper Config File Selection} \
+ -defaultextension .conf \
+ -filetypes {{{Config Files} .conf} {{All Files} *}} \
+ -initialfile $confFileNameDef \
+ -parent $top]
+ if {[string compare $file {}]} {
+ $e delete 0 end
+ $e insert insert $file
+ }
+}
+
+proc advConf {top} {
+ global _mdnOperation _confFile
+ regSetWhere $_mdnOperation
+ regSetConfFile $_confFile
+ destroy $top
+}
+
+########################################################################
+#
+# utility
+#
+
+proc confErrorDialog {top message} {
+ tk_messageBox -default ok -icon error -parent $top -type ok \
+ -title {idn wrapper Configuration Error} -message $message
+}
+
+proc isWindows {} {
+ global tcl_platform
+ expr {[string compare $tcl_platform(platform) "windows"] == 0}
+}
+
+########################################################################
+#
+# config program start here
+#
+
+wm title . "idn wrapper - Configuration"
+wm iconname . "idn wrapper - Configuration"
+
+
+label .title -bd 1 -relief raised -pady 5 \
+ -text "idn wrapper Configuration Program version $version"
+
+frame .left -bd 1 -relief raised
+frame .right -bd 1 -relief raised
+
+frame .lst
+label .lst.title -text "Wrapped Programs" -pady 3
+listbox .lst.list -width 64 -height 16 -setgrid 1 \
+ -xscrollcommand ".lst.xscroll set" \
+ -yscrollcommand ".lst.yscroll set"
+scrollbar .lst.yscroll -orient vertical -command ".lst.list yview"
+scrollbar .lst.xscroll -orient horizontal -command ".lst.list xview"
+grid .lst.title -row 0 -column 0 -columnspan 2 -sticky news
+grid .lst.list -row 1 -column 0 -sticky news
+grid .lst.xscroll -row 2 -column 0 -sticky news
+grid .lst.yscroll -row 1 -column 1 -sticky news
+grid rowconfig .lst 1 -weight 1
+grid columnconfig .lst 0 -weight 1
+
+frame .btn
+button .btn.wrap -text "Wrap.." -command [list confWrap . .lst.list]
+button .btn.unwrap -text "Unwrap.." -command [list confUnwrap . .lst.list]
+button .btn.unwrapall -text "Unwrap All" -command [list unwrapAll . .lst.list]
+button .btn.rewrapall -text "Rewrap All" -command [list rewrapAll . .lst.list]
+frame .btn.spacing1 -width 1 -height 12 -bd 0
+button .btn.log -text "Log.." -command [list confLog .]
+frame .btn.spacing2 -width 1 -height 12 -bd 0
+button .btn.adv -text "Advanced.." -command [list advancedConf .]
+button .btn.exit -text Exit -command exit
+pack .btn.wrap -side top -fill x -pady 4
+pack .btn.unwrap -side top -fill x -pady 4
+pack .btn.unwrapall -side top -fill x -pady 4
+pack .btn.rewrapall -side top -fill x -pady 4
+pack .btn.spacing1 -side top
+pack .btn.log -side top -fill x -pady 4
+pack .btn.spacing2 -side top
+pack .btn.adv -side top -fill x -pady 4
+pack .btn.exit -side bottom -fill x -pady 4
+
+pack .lst -in .left -padx 4 -pady 4 -fill both -expand on
+pack .btn -in .right -padx 6 -pady 4 -fill both -expand on
+
+pack .title -side top -fill x
+pack .right -side right -fill y
+pack .left -side left -fill y -expand on
+
+#
+# then set current list into listbox
+#
+
+set theList [loadList]
+#saveList $theList
+putList .lst.list $theList
+
+#
+########################################################################
diff --git a/contrib/idn/idnkit-1.0-src/wsock/config/make.wnt b/contrib/idn/idnkit-1.0-src/wsock/config/make.wnt
new file mode 100644
index 0000000..1099fbe
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/config/make.wnt
@@ -0,0 +1,58 @@
+#
+# Makefile for building mDNS Wrapper Configuration Tool
+#
+
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+TARGETS = idnconf.exe
+
+all : $(TARGETS)
+
+idnconf.exe : idnconf.tcl
+ freewrap idnconf.tcl
+
+install : $(TARGETS)
+ copy idnconf.exe ..\bin
+
+clean : force
+ -del idnconf.exe
+
+force :
diff --git a/contrib/idn/idnkit-1.0-src/wsock/make.wnt b/contrib/idn/idnkit-1.0-src/wsock/make.wnt
new file mode 100644
index 0000000..3c45432
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/make.wnt
@@ -0,0 +1,97 @@
+#
+# Top Level Makefile for building WINSOCK idn wrapper
+#
+
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+all : force
+ cd common
+ $(MAKE) -f make.wnt all
+ cd ..
+ cd wsock11
+ $(MAKE) -f make.wnt all
+ cd ..
+ cd wsock20
+ $(MAKE) -f make.wnt all
+ cd ..
+ cd config
+ $(MAKE) -f make.wnt all
+ cd ..
+
+install : force
+ copy ..\win\iconv.dll bin
+ copy ..\lib\idnkit.dll bin
+ copy ..\lib\idnkitlite.dll bin
+ copy ..\map\jp.map bin
+ cd common
+ $(MAKE) -f make.wnt install
+ cd ..
+ cd wsock11
+ $(MAKE) -f make.wnt install
+ cd ..
+ cd wsock20
+ $(MAKE) -f make.wnt install
+ cd ..
+ cd config
+ $(MAKE) -f make.wnt install
+ cd ..
+
+setup : force
+ cd bin
+ iscc idn_wrapper.iss
+ cd ..
+
+clean : force
+ cd common
+ $(MAKE) -f make.wnt clean
+ cd ..
+ cd wsock11
+ $(MAKE) -f make.wnt clean
+ cd ..
+ cd wsock20
+ $(MAKE) -f make.wnt clean
+ cd ..
+ cd config
+ $(MAKE) -f make.wnt clean
+ cd ..
+
+force :
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock11/dlldef.h b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dlldef.h
new file mode 100644
index 0000000..569a264
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dlldef.h
@@ -0,0 +1,86 @@
+/*
+ * dlldef.h
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef _DLLDEF_H
+#define _DLLDEF_H
+
+#include "../common/wrapcommon.h"
+
+/*
+ * Execution Tracing
+ */
+
+extern int procPid;
+
+#ifdef DEBUG
+#define TRACE idnPrintf
+#define FATAL idnPrintf
+#else
+#define TRACE
+#define FATAL idnPrintf
+#endif
+
+/*
+ * Stub functions for calling original version.
+ */
+extern int PASCAL
+_org_gethostname(char FAR * name, int namelen);
+
+extern struct hostent FAR * PASCAL
+_org_gethostbyname(const char FAR * name);
+
+extern struct hostent FAR * PASCAL
+_org_gethostbyaddr(const char FAR * addr, int len, int type);
+
+extern HANDLE PASCAL
+_org_WSAAsyncGetHostByName(HWND hWnd, u_int wMsg, const char FAR * name,
+ char FAR * buf, int buflen);
+extern HANDLE PASCAL
+_org_WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, const char FAR * addr,
+ int len, int type, char FAR * buf, int buflen);
+
+
+#endif /* _DLLDEF_H */
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllfunc.c b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllfunc.c
new file mode 100644
index 0000000..4b709f6
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllfunc.c
@@ -0,0 +1,212 @@
+/*
+ * dllfunc.c - wrapper functions
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <process.h>
+
+#include "dlldef.h"
+
+WRAPPER_EXPORT int PASCAL FAR
+gethostname(char FAR * name, int namelen) {
+ int ret;
+
+ TRACE("ENTER gethostname\n");
+ ret = _org_gethostname(name, namelen);
+ TRACE("LEAVE gethostname %d <%-.100s>\n", ret, name);
+
+ return (ret);
+}
+
+WRAPPER_EXPORT struct hostent FAR * PASCAL FAR
+gethostbyname(const char FAR * name) {
+ struct hostent FAR *ret;
+ char nbuff[256];
+ char hbuff[256];
+ BOOL stat;
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER gethostbyname <%-.100s>\n",
+ (name != NULL ? name : "NULL"));
+
+ encodeCtx = idnGetContext();
+
+ if (encodeCtx == NULL) {
+ TRACE("gethostbyname: not encode here\n");
+ ret = _org_gethostbyname(name);
+ } else if (name == NULL) {
+ TRACE("gethostbyname: name is NULL\n");
+ ret = _org_gethostbyname(name);
+ } else {
+ stat = idnConvReq(encodeCtx, name, nbuff, sizeof(nbuff));
+ if (stat == FALSE) {
+ TRACE("idnConvReq failed\n");
+ ret = NULL;
+ } else {
+ TRACE("Converted Name <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ ret = _org_gethostbyname(nbuff);
+ }
+ }
+
+ if (ret != NULL && encodeCtx != NULL) {
+ TRACE("Resulting Name <%s>\n",
+ dumpName(ret->h_name, hbuff, sizeof(hbuff)));
+ stat = idnConvRsp(encodeCtx, ret->h_name, nbuff,
+ sizeof(nbuff));
+ if (stat == FALSE) {
+ TRACE("Decoding failed - return the name verbatim\n");
+ } else {
+ TRACE("Converted Back <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ strcpy(ret->h_name, nbuff);
+ }
+ }
+
+ if (ret == NULL) {
+ TRACE("LEAVE gethostbyname NULL\n");
+ } else {
+ TRACE("LEAVE gethostbyname <%s>\n",
+ dumpHost(ret, hbuff, sizeof(hbuff)));
+ }
+ return (ret);
+}
+
+WRAPPER_EXPORT struct hostent FAR * PASCAL FAR
+gethostbyaddr(const char FAR * addr, int len, int type) {
+ struct hostent FAR *ret;
+ char nbuff[256];
+ char abuff[256];
+ char hbuff[256];
+ BOOL stat;
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER gethostbyaddr <%s>\n",
+ dumpAddr(addr, len, abuff, sizeof(abuff)));
+
+ encodeCtx = idnGetContext();
+
+ ret = _org_gethostbyaddr(addr, len, type);
+
+ if (ret != NULL && encodeCtx != NULL) {
+ TRACE("Resulting Name <%s>\n",
+ dumpName(ret->h_name, hbuff, sizeof(hbuff)));
+ stat = idnConvRsp(encodeCtx, ret->h_name,
+ nbuff, sizeof(nbuff));
+ if (stat == FALSE) {
+ TRACE("Decoding failed - return the name verbatim\n");
+ } else {
+ TRACE("Converted Back <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ strcpy(ret->h_name, nbuff);
+ }
+ }
+
+ if (ret == NULL) {
+ TRACE("LEAVE gethostbyaddr NULL\n") ;
+ } else {
+ TRACE("LEAVE gethostbyaddr <%s>\n",
+ dumpHost(ret, hbuff, sizeof(hbuff)));
+ }
+ return (ret);
+}
+
+WRAPPER_EXPORT HANDLE PASCAL FAR
+WSAAsyncGetHostByName(HWND hWnd, u_int wMsg,
+ const char FAR * name, char FAR * buf, int buflen)
+{
+ HANDLE ret;
+ char nbuff[256];
+ char hbuff[256];
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER WSAAsyncGetHostByName <%-.100s>\n", name);
+
+ encodeCtx = idnGetContext();
+
+ if (encodeCtx == NULL || name == NULL) {
+ ret = _org_WSAAsyncGetHostByName(hWnd, wMsg, name,
+ buf, buflen);
+ } else {
+ idnHook(hWnd, wMsg, buf, encodeCtx);
+ idnConvReq(encodeCtx, name, nbuff, sizeof(nbuff));
+ TRACE("Converted Name <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ ret = _org_WSAAsyncGetHostByName(hWnd, wMsg, nbuff,
+ buf, buflen);
+ }
+
+ TRACE("LEAVE WSAAsyncGetHostByName HANDLE %08x\n", ret);
+
+ return (ret);
+}
+
+WRAPPER_EXPORT HANDLE PASCAL FAR
+WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, const char FAR * addr,
+ int len, int type, char FAR * buf, int buflen)
+{
+ HANDLE ret;
+ char abuff[256];
+ idn_resconf_t encodeCtx;
+
+ encodeCtx = idnGetContext();
+
+ if (encodeCtx != NULL) {
+ idnHook(hWnd, wMsg, buf, encodeCtx);
+ }
+
+ TRACE("ENTER WSAAsyncGetHostByAddr <%s>\n",
+ dumpAddr(addr, len, abuff, sizeof(abuff)));
+ ret = _org_WSAAsyncGetHostByAddr(hWnd, wMsg, addr, len, type,
+ buf, buflen);
+ TRACE("LEAVE WSAAsyncGetHostByAddr HANDLE %08x\n", ret);
+
+ return (ret);
+}
+
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllload.c b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllload.c
new file mode 100644
index 0000000..68c2a7e
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllload.c
@@ -0,0 +1,63 @@
+/*
+ * dllload.c - load original entries
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <winsock.h>
+#include <nspapi.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <process.h>
+
+#include "dlldef.h"
+
+/*
+ * Manages original DLL
+ */
+
+#define DLLHANDLE idnWinsockHandle()
+
+#include "dllstub.c"
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllmain.c b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllmain.c
new file mode 100644
index 0000000..177f722
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllmain.c
@@ -0,0 +1,96 @@
+/*
+ * dllmain.c - entry for DLL
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <process.h>
+
+#include "dlldef.h"
+
+/*
+ * Control Variables
+ */
+
+int procPid = 0;
+
+static char procExe[256];
+
+/*
+ * DLL Entry
+ */
+
+BOOL APIENTRY
+DllMain(HMODULE hmod, DWORD reason, LPVOID *resv) {
+ switch (reason) {
+
+ case DLL_PROCESS_ATTACH:
+ procPid = getpid();
+ GetModuleFileName(NULL, procExe, 256);
+
+ idnLogInit("ws11");
+ idnHookInit();
+
+ TRACE("Attached to Process <%s>\n", procExe);
+ return (idnWinsockVersion("1.1"));
+
+ case DLL_PROCESS_DETACH:
+ idnConvDone(idnGetContext());
+ idnHookDone();
+ TRACE("Detached from Process\n");
+ idnLogFinish();
+ break;
+
+ case DLL_THREAD_ATTACH:
+ break;
+ case DLL_THREAD_DETACH:
+ break;
+ }
+
+ return (TRUE);
+}
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllstub.c b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllstub.c
new file mode 100644
index 0000000..534abc4
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllstub.c
@@ -0,0 +1,1541 @@
+/* $Id: dllstub.c,v 1.1.1.1 2003/06/04 00:27:45 marka Exp $ */
+
+SOCKET PASCAL
+accept(SOCKET a0, struct sockaddr* a1, int* a2)
+{
+ static SOCKET (PASCAL *fp)(SOCKET a0, struct sockaddr* a1, int* a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub accept() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "accept")) == NULL) {
+ FATAL("cannot find entry accept (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+bind(SOCKET a0, const struct sockaddr* a1, int a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, const struct sockaddr* a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub bind() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "bind")) == NULL) {
+ FATAL("cannot find entry bind (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+closesocket(SOCKET a0)
+{
+ static int (PASCAL *fp)(SOCKET a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub closesocket() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "closesocket")) == NULL) {
+ FATAL("cannot find entry closesocket (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+connect(SOCKET a0, const struct sockaddr* a1, int a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, const struct sockaddr* a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub connect() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "connect")) == NULL) {
+ FATAL("cannot find entry connect (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+getpeername(SOCKET a0, struct sockaddr* a1, int* a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, struct sockaddr* a1, int* a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getpeername() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getpeername")) == NULL) {
+ FATAL("cannot find entry getpeername (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+getsockname(SOCKET a0, struct sockaddr* a1, int* a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, struct sockaddr* a1, int* a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getsockname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getsockname")) == NULL) {
+ FATAL("cannot find entry getsockname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+getsockopt(SOCKET a0, int a1, int a2, char* a3, int* a4)
+{
+ static int (PASCAL *fp)(SOCKET a0, int a1, int a2, char* a3, int* a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getsockopt() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getsockopt")) == NULL) {
+ FATAL("cannot find entry getsockopt (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+u_long PASCAL
+htonl(u_long a0)
+{
+ static u_long (PASCAL *fp)(u_long a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub htonl() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "htonl")) == NULL) {
+ FATAL("cannot find entry htonl (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+u_short PASCAL
+htons(u_short a0)
+{
+ static u_short (PASCAL *fp)(u_short a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub htons() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "htons")) == NULL) {
+ FATAL("cannot find entry htons (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+unsigned long PASCAL
+inet_addr(const char* a0)
+{
+ static unsigned long (PASCAL *fp)(const char* a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub inet_addr() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "inet_addr")) == NULL) {
+ FATAL("cannot find entry inet_addr (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+ char * PASCAL
+inet_ntoa(struct in_addr a0)
+{
+ static char * (PASCAL *fp)(struct in_addr a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub inet_ntoa() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "inet_ntoa")) == NULL) {
+ FATAL("cannot find entry inet_ntoa (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+ioctlsocket(SOCKET a0, long a1, u_long * a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, long a1, u_long * a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub ioctlsocket() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "ioctlsocket")) == NULL) {
+ FATAL("cannot find entry ioctlsocket (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+listen(SOCKET a0, int a1)
+{
+ static int (PASCAL *fp)(SOCKET a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub listen() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "listen")) == NULL) {
+ FATAL("cannot find entry listen (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+u_long PASCAL
+ntohl(u_long a0)
+{
+ static u_long (PASCAL *fp)(u_long a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub ntohl() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "ntohl")) == NULL) {
+ FATAL("cannot find entry ntohl (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+u_short PASCAL
+ntohs(u_short a0)
+{
+ static u_short (PASCAL *fp)(u_short a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub ntohs() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "ntohs")) == NULL) {
+ FATAL("cannot find entry ntohs (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+recv(SOCKET a0, char* a1, int a2, int a3)
+{
+ static int (PASCAL *fp)(SOCKET a0, char* a1, int a2, int a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub recv() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "recv")) == NULL) {
+ FATAL("cannot find entry recv (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int PASCAL
+recvfrom(SOCKET a0, char* a1, int a2, int a3, struct sockaddr* a4, int* a5)
+{
+ static int (PASCAL *fp)(SOCKET a0, char* a1, int a2, int a3, struct sockaddr* a4, int* a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub recvfrom() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "recvfrom")) == NULL) {
+ FATAL("cannot find entry recvfrom (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+int PASCAL
+select(int a0, fd_set* a1, fd_set* a2, fd_set* a3, const struct timeval* a4)
+{
+ static int (PASCAL *fp)(int a0, fd_set* a1, fd_set* a2, fd_set* a3, const struct timeval* a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub select() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "select")) == NULL) {
+ FATAL("cannot find entry select (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+int PASCAL
+send(SOCKET a0, const char* a1, int a2, int a3)
+{
+ static int (PASCAL *fp)(SOCKET a0, const char* a1, int a2, int a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub send() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "send")) == NULL) {
+ FATAL("cannot find entry send (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int PASCAL
+sendto(SOCKET a0, const char* a1, int a2, int a3, const struct sockaddr* a4, int a5)
+{
+ static int (PASCAL *fp)(SOCKET a0, const char* a1, int a2, int a3, const struct sockaddr* a4, int a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub sendto() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "sendto")) == NULL) {
+ FATAL("cannot find entry sendto (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+int PASCAL
+setsockopt(SOCKET a0, int a1, int a2, const char* a3, int a4)
+{
+ static int (PASCAL *fp)(SOCKET a0, int a1, int a2, const char* a3, int a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub setsockopt() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "setsockopt")) == NULL) {
+ FATAL("cannot find entry setsockopt (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+int PASCAL
+shutdown(SOCKET a0, int a1)
+{
+ static int (PASCAL *fp)(SOCKET a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub shutdown() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "shutdown")) == NULL) {
+ FATAL("cannot find entry shutdown (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+SOCKET PASCAL
+socket(int a0, int a1, int a2)
+{
+ static SOCKET (PASCAL *fp)(int a0, int a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub socket() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "socket")) == NULL) {
+ FATAL("cannot find entry socket (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+MigrateWinsockConfiguration(int a0, int a1, int a2)
+{
+ static int (PASCAL *fp)(int a0, int a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub MigrateWinsockConfiguration() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "MigrateWinsockConfiguration")) == NULL) {
+ FATAL("cannot find entry MigrateWinsockConfiguration (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+ struct hostent * PASCAL
+_org_gethostbyaddr(const char* a0, int a1, int a2)
+{
+ static struct hostent * (PASCAL *fp)(const char* a0, int a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_gethostbyaddr() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "gethostbyaddr")) == NULL) {
+ FATAL("cannot find entry gethostbyaddr (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+ struct hostent * PASCAL
+_org_gethostbyname(const char* a0)
+{
+ static struct hostent * (PASCAL *fp)(const char* a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_gethostbyname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "gethostbyname")) == NULL) {
+ FATAL("cannot find entry gethostbyname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+ struct protoent * PASCAL
+getprotobyname(const char* a0)
+{
+ static struct protoent * (PASCAL *fp)(const char* a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getprotobyname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getprotobyname")) == NULL) {
+ FATAL("cannot find entry getprotobyname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+ struct protoent * PASCAL
+getprotobynumber(int a0)
+{
+ static struct protoent * (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getprotobynumber() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getprotobynumber")) == NULL) {
+ FATAL("cannot find entry getprotobynumber (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+ struct servent * PASCAL
+getservbyname(const char* a0, const char* a1)
+{
+ static struct servent * (PASCAL *fp)(const char* a0, const char* a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getservbyname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getservbyname")) == NULL) {
+ FATAL("cannot find entry getservbyname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+ struct servent * PASCAL
+getservbyport(int a0, const char* a1)
+{
+ static struct servent * (PASCAL *fp)(int a0, const char* a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getservbyport() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getservbyport")) == NULL) {
+ FATAL("cannot find entry getservbyport (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+_org_gethostname(char* a0, int a1)
+{
+ static int (PASCAL *fp)(char* a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_gethostname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "gethostname")) == NULL) {
+ FATAL("cannot find entry gethostname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+WSAAsyncSelect(SOCKET a0, HWND a1, u_int a2, long a3)
+{
+ static int (PASCAL *fp)(SOCKET a0, HWND a1, u_int a2, long a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncSelect() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncSelect")) == NULL) {
+ FATAL("cannot find entry WSAAsyncSelect (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+HANDLE PASCAL
+_org_WSAAsyncGetHostByAddr(HWND a0, u_int a1, const char* a2, int a3, int a4, char* a5, int a6)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, const char* a2, int a3, int a4, char* a5, int a6);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_WSAAsyncGetHostByAddr() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetHostByAddr")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetHostByAddr (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6);
+}
+
+HANDLE PASCAL
+_org_WSAAsyncGetHostByName(HWND a0, u_int a1, const char* a2, char* a3, int a4)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, const char* a2, char* a3, int a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_WSAAsyncGetHostByName() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetHostByName")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetHostByName (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+HANDLE PASCAL
+WSAAsyncGetProtoByNumber(HWND a0, u_int a1, int a2, char* a3, int a4)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, int a2, char* a3, int a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncGetProtoByNumber() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetProtoByNumber")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetProtoByNumber (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+HANDLE PASCAL
+WSAAsyncGetProtoByName(HWND a0, u_int a1, const char* a2, char* a3, int a4)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, const char* a2, char* a3, int a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncGetProtoByName() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetProtoByName")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetProtoByName (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+HANDLE PASCAL
+WSAAsyncGetServByPort(HWND a0, u_int a1, int a2, const char* a3, char* a4, int a5)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, int a2, const char* a3, char* a4, int a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncGetServByPort() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetServByPort")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetServByPort (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+HANDLE PASCAL
+WSAAsyncGetServByName(HWND a0, u_int a1, const char* a2, const char* a3, char* a4, int a5)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, const char* a2, const char* a3, char* a4, int a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncGetServByName() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetServByName")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetServByName (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+int PASCAL
+WSACancelAsyncRequest(HANDLE a0)
+{
+ static int (PASCAL *fp)(HANDLE a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSACancelAsyncRequest() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSACancelAsyncRequest")) == NULL) {
+ FATAL("cannot find entry WSACancelAsyncRequest (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+FARPROC PASCAL
+WSASetBlockingHook(FARPROC a0)
+{
+ static FARPROC (PASCAL *fp)(FARPROC a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASetBlockingHook() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASetBlockingHook")) == NULL) {
+ FATAL("cannot find entry WSASetBlockingHook (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+WSAUnhookBlockingHook(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAUnhookBlockingHook() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAUnhookBlockingHook")) == NULL) {
+ FATAL("cannot find entry WSAUnhookBlockingHook (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int PASCAL
+WSAGetLastError(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAGetLastError() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAGetLastError")) == NULL) {
+ FATAL("cannot find entry WSAGetLastError (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+void PASCAL
+WSASetLastError(int a0)
+{
+ static void (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASetLastError() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASetLastError")) == NULL) {
+ FATAL("cannot find entry WSASetLastError (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ (*fp)(a0);
+}
+
+int PASCAL
+WSACancelBlockingCall(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSACancelBlockingCall() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSACancelBlockingCall")) == NULL) {
+ FATAL("cannot find entry WSACancelBlockingCall (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+BOOL PASCAL
+WSAIsBlocking(void)
+{
+ static BOOL (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAIsBlocking() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAIsBlocking")) == NULL) {
+ FATAL("cannot find entry WSAIsBlocking (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int PASCAL
+WSAStartup(WORD a0, LPWSADATA a1)
+{
+ static int (PASCAL *fp)(WORD a0, LPWSADATA a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAStartup() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAStartup")) == NULL) {
+ FATAL("cannot find entry WSAStartup (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+WSACleanup(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSACleanup() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSACleanup")) == NULL) {
+ FATAL("cannot find entry WSACleanup (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int PASCAL
+__WSAFDIsSet(SOCKET a0, fd_set* a1)
+{
+ static int (PASCAL *fp)(SOCKET a0, fd_set* a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub __WSAFDIsSet() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "__WSAFDIsSet")) == NULL) {
+ FATAL("cannot find entry __WSAFDIsSet (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+WEP(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WEP() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WEP")) == NULL) {
+ FATAL("cannot find entry WEP (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int PASCAL
+WSApSetPostRoutine(int a0)
+{
+ static int (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSApSetPostRoutine() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSApSetPostRoutine")) == NULL) {
+ FATAL("cannot find entry WSApSetPostRoutine (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+WsControl(int a0, int a1, int a2, int a3, int a4, int a5)
+{
+ static int (PASCAL *fp)(int a0, int a1, int a2, int a3, int a4, int a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WsControl() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WsControl")) == NULL) {
+ FATAL("cannot find entry WsControl (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+int PASCAL
+closesockinfo(int a0)
+{
+ static int (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub closesockinfo() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "closesockinfo")) == NULL) {
+ FATAL("cannot find entry closesockinfo (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+Arecv(int a0, int a1, int a2, int a3)
+{
+ static int (PASCAL *fp)(int a0, int a1, int a2, int a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub Arecv() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "Arecv")) == NULL) {
+ FATAL("cannot find entry Arecv (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int PASCAL
+Asend(int a0, int a1, int a2, int a3)
+{
+ static int (PASCAL *fp)(int a0, int a1, int a2, int a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub Asend() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "Asend")) == NULL) {
+ FATAL("cannot find entry Asend (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int PASCAL
+WSHEnumProtocols(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSHEnumProtocols() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSHEnumProtocols")) == NULL) {
+ FATAL("cannot find entry WSHEnumProtocols (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int PASCAL
+inet_network(int a0)
+{
+ static int (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub inet_network() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "inet_network")) == NULL) {
+ FATAL("cannot find entry inet_network (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+getnetbyname(int a0)
+{
+ static int (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getnetbyname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getnetbyname")) == NULL) {
+ FATAL("cannot find entry getnetbyname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+rcmd(int a0, int a1, int a2, int a3, int a4, int a5)
+{
+ static int (PASCAL *fp)(int a0, int a1, int a2, int a3, int a4, int a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub rcmd() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "rcmd")) == NULL) {
+ FATAL("cannot find entry rcmd (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+int PASCAL
+rexec(int a0, int a1, int a2, int a3, int a4, int a5)
+{
+ static int (PASCAL *fp)(int a0, int a1, int a2, int a3, int a4, int a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub rexec() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "rexec")) == NULL) {
+ FATAL("cannot find entry rexec (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+int PASCAL
+rresvport(int a0)
+{
+ static int (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub rresvport() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "rresvport")) == NULL) {
+ FATAL("cannot find entry rresvport (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+sethostname(int a0, int a1)
+{
+ static int (PASCAL *fp)(int a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub sethostname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "sethostname")) == NULL) {
+ FATAL("cannot find entry sethostname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+dn_expand(int a0, int a1, int a2, int a3, int a4)
+{
+ static int (PASCAL *fp)(int a0, int a1, int a2, int a3, int a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub dn_expand() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "dn_expand")) == NULL) {
+ FATAL("cannot find entry dn_expand (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+int PASCAL
+WSARecvEx(SOCKET a0, char* a1, int a2, int* a3)
+{
+ static int (PASCAL *fp)(SOCKET a0, char* a1, int a2, int* a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSARecvEx() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSARecvEx")) == NULL) {
+ FATAL("cannot find entry WSARecvEx (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int PASCAL
+s_perror(int a0, int a1)
+{
+ static int (PASCAL *fp)(int a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub s_perror() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "s_perror")) == NULL) {
+ FATAL("cannot find entry s_perror (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+INT PASCAL
+GetAddressByNameA(DWORD a0, LPGUID a1, LPSTR a2, LPINT a3, DWORD a4, LPSERVICE_ASYNC_INFO a5, LPVOID a6, LPDWORD a7, LPSTR a8, LPDWORD a9)
+{
+ static INT (PASCAL *fp)(DWORD a0, LPGUID a1, LPSTR a2, LPINT a3, DWORD a4, LPSERVICE_ASYNC_INFO a5, LPVOID a6, LPDWORD a7, LPSTR a8, LPDWORD a9);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub GetAddressByNameA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "GetAddressByNameA")) == NULL) {
+ FATAL("cannot find entry GetAddressByNameA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
+}
+
+INT PASCAL
+GetAddressByNameW(DWORD a0, LPGUID a1, LPWSTR a2, LPINT a3, DWORD a4, LPSERVICE_ASYNC_INFO a5, LPVOID a6, LPDWORD a7, LPWSTR a8, LPDWORD a9)
+{
+ static INT (PASCAL *fp)(DWORD a0, LPGUID a1, LPWSTR a2, LPINT a3, DWORD a4, LPSERVICE_ASYNC_INFO a5, LPVOID a6, LPDWORD a7, LPWSTR a8, LPDWORD a9);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub GetAddressByNameW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "GetAddressByNameW")) == NULL) {
+ FATAL("cannot find entry GetAddressByNameW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
+}
+
+INT PASCAL
+EnumProtocolsA(LPINT a0, LPVOID a1, LPDWORD a2)
+{
+ static INT (PASCAL *fp)(LPINT a0, LPVOID a1, LPDWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub EnumProtocolsA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "EnumProtocolsA")) == NULL) {
+ FATAL("cannot find entry EnumProtocolsA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT PASCAL
+EnumProtocolsW(LPINT a0, LPVOID a1, LPDWORD a2)
+{
+ static INT (PASCAL *fp)(LPINT a0, LPVOID a1, LPDWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub EnumProtocolsW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "EnumProtocolsW")) == NULL) {
+ FATAL("cannot find entry EnumProtocolsW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT PASCAL
+GetTypeByNameA(LPSTR a0, LPGUID a1)
+{
+ static INT (PASCAL *fp)(LPSTR a0, LPGUID a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub GetTypeByNameA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "GetTypeByNameA")) == NULL) {
+ FATAL("cannot find entry GetTypeByNameA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+INT PASCAL
+GetTypeByNameW(LPWSTR a0, LPGUID a1)
+{
+ static INT (PASCAL *fp)(LPWSTR a0, LPGUID a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub GetTypeByNameW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "GetTypeByNameW")) == NULL) {
+ FATAL("cannot find entry GetTypeByNameW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+INT PASCAL
+GetNameByTypeA(LPGUID a0, LPSTR a1, DWORD a2)
+{
+ static INT (PASCAL *fp)(LPGUID a0, LPSTR a1, DWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub GetNameByTypeA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "GetNameByTypeA")) == NULL) {
+ FATAL("cannot find entry GetNameByTypeA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT PASCAL
+GetNameByTypeW(LPGUID a0, LPWSTR a1, DWORD a2)
+{
+ static INT (PASCAL *fp)(LPGUID a0, LPWSTR a1, DWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub GetNameByTypeW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "GetNameByTypeW")) == NULL) {
+ FATAL("cannot find entry GetNameByTypeW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT PASCAL
+SetServiceA(DWORD a0, DWORD a1, DWORD a2, LPSERVICE_INFOA a3, LPSERVICE_ASYNC_INFO a4, LPDWORD a5)
+{
+ static INT (PASCAL *fp)(DWORD a0, DWORD a1, DWORD a2, LPSERVICE_INFOA a3, LPSERVICE_ASYNC_INFO a4, LPDWORD a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub SetServiceA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "SetServiceA")) == NULL) {
+ FATAL("cannot find entry SetServiceA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+INT PASCAL
+SetServiceW(DWORD a0, DWORD a1, DWORD a2, LPSERVICE_INFOW a3, LPSERVICE_ASYNC_INFO a4, LPDWORD a5)
+{
+ static INT (PASCAL *fp)(DWORD a0, DWORD a1, DWORD a2, LPSERVICE_INFOW a3, LPSERVICE_ASYNC_INFO a4, LPDWORD a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub SetServiceW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "SetServiceW")) == NULL) {
+ FATAL("cannot find entry SetServiceW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+INT PASCAL
+GetServiceA(DWORD a0, LPGUID a1, LPSTR a2, DWORD a3, LPVOID a4, LPDWORD a5, LPSERVICE_ASYNC_INFO a6)
+{
+ static INT (PASCAL *fp)(DWORD a0, LPGUID a1, LPSTR a2, DWORD a3, LPVOID a4, LPDWORD a5, LPSERVICE_ASYNC_INFO a6);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub GetServiceA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "GetServiceA")) == NULL) {
+ FATAL("cannot find entry GetServiceA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6);
+}
+
+INT PASCAL
+GetServiceW(DWORD a0, LPGUID a1, LPWSTR a2, DWORD a3, LPVOID a4, LPDWORD a5, LPSERVICE_ASYNC_INFO a6)
+{
+ static INT (PASCAL *fp)(DWORD a0, LPGUID a1, LPWSTR a2, DWORD a3, LPVOID a4, LPDWORD a5, LPSERVICE_ASYNC_INFO a6);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub GetServiceW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "GetServiceW")) == NULL) {
+ FATAL("cannot find entry GetServiceW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6);
+}
+
+int PASCAL
+NPLoadNameSpaces(int a0, int a1, int a2)
+{
+ static int (PASCAL *fp)(int a0, int a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub NPLoadNameSpaces() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "NPLoadNameSpaces")) == NULL) {
+ FATAL("cannot find entry NPLoadNameSpaces (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+NSPStartup(int a0, int a1)
+{
+ static int (PASCAL *fp)(int a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub NSPStartup() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "NSPStartup")) == NULL) {
+ FATAL("cannot find entry NSPStartup (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+BOOL PASCAL
+TransmitFile(SOCKET a0, HANDLE a1, DWORD a2, DWORD a3, LPOVERLAPPED a4, LPTRANSMIT_FILE_BUFFERS a5, DWORD a6)
+{
+ static BOOL (PASCAL *fp)(SOCKET a0, HANDLE a1, DWORD a2, DWORD a3, LPOVERLAPPED a4, LPTRANSMIT_FILE_BUFFERS a5, DWORD a6);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub TransmitFile() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "TransmitFile")) == NULL) {
+ FATAL("cannot find entry TransmitFile (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6);
+}
+
+BOOL PASCAL
+AcceptEx(SOCKET a0, SOCKET a1, PVOID a2, DWORD a3, DWORD a4, DWORD a5, LPDWORD a6, LPOVERLAPPED a7)
+{
+ static BOOL (PASCAL *fp)(SOCKET a0, SOCKET a1, PVOID a2, DWORD a3, DWORD a4, DWORD a5, LPDWORD a6, LPOVERLAPPED a7);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub AcceptEx() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "AcceptEx")) == NULL) {
+ FATAL("cannot find entry AcceptEx (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6, a7);
+}
+
+VOID PASCAL
+GetAcceptExSockaddrs(PVOID a0, DWORD a1, DWORD a2, DWORD a3, struct sockaddr** a4, LPINT a5, struct sockaddr** a6, LPINT a7)
+{
+ static VOID (PASCAL *fp)(PVOID a0, DWORD a1, DWORD a2, DWORD a3, struct sockaddr** a4, LPINT a5, struct sockaddr** a6, LPINT a7);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub GetAcceptExSockaddrs() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "GetAcceptExSockaddrs")) == NULL) {
+ FATAL("cannot find entry GetAcceptExSockaddrs (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ (*fp)(a0, a1, a2, a3, a4, a5, a6, a7);
+}
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock11/make.wnt b/contrib/idn/idnkit-1.0-src/wsock/wsock11/make.wnt
new file mode 100644
index 0000000..5543a6d
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock11/make.wnt
@@ -0,0 +1,98 @@
+#
+# Makefile for WinSock Wrapper (for WinSock 1.1)
+#
+
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+!include <win32.mak>
+
+SYSLIBS = $(libcdll) kernel32.lib advapi32.lib user32.lib
+
+#
+# Files to use
+#
+
+HDRS = dlldef.h ..\common\wrapcommon.h
+SRCS = dllmain.c dllload.c dllfunc.c dllstub.c
+OBJS = dllmain.obj dllload.obj dllfunc.obj
+LIBS = ..\common\wrapcommon.lib ..\..\lib\idnkit.lib ..\..\win\iconv.lib
+
+cflags = $(cflags) -I..\..\include
+
+#
+# Targets to Build
+#
+
+TARGETS = wsock32.dll
+
+all : $(TARGETS)
+
+wsock32.dll : wsock32.def $(OBJS) $(LIBS)
+ $(link) $(dlllflags) /OUT:wsock32.dll /DEF:wsock32.def $(OBJS) $(LIBS) $(SYSLIBS)
+
+install : $(TARGETS)
+ copy wsock32.dll ..\bin
+
+clean : force
+ -del *.obj
+ -del *.lib
+ -del *.dll
+ -del *.exp
+
+#
+# Dependencies
+#
+
+dllmain.obj : dllmain.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+dllload.obj : dllload.c dllstub.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+
+dllfunc.obj : dllfunc.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+wsock32o.lib : wsock32o.def
+ LIB /DEF:wsock32o.def /MACHINE:IX86
+
+force :
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock11/wsock32.def b/contrib/idn/idnkit-1.0-src/wsock/wsock11/wsock32.def
new file mode 100644
index 0000000..5501d26
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock11/wsock32.def
@@ -0,0 +1,87 @@
+;
+; Library Defition for idn wrapper's wrapper DLL
+;
+LIBRARY wsock32
+DESCRIPTION "JPNIC idn wrapper DLL for WSOCK32"
+EXPORTS
+ accept @1
+ bind @2
+ closesocket @3
+ connect @4
+ getpeername @5
+ getsockname @6
+ getsockopt @7
+ htonl @8
+ htons @9
+ inet_addr @10
+ inet_ntoa @11
+ ioctlsocket @12
+ listen @13
+ ntohl @14
+ ntohs @15
+ recv @16
+ recvfrom @17
+ select @18
+ send @19
+ sendto @20
+ setsockopt @21
+ shutdown @22
+ socket @23
+ MigrateWinsockConfiguration @24
+ gethostbyaddr @51
+ gethostbyname @52
+ getprotobyname @53
+ getprotobynumber @54
+ getservbyname @55
+ getservbyport @56
+ gethostname @57
+ WSAAsyncSelect @101
+ WSAAsyncGetHostByAddr @102
+ WSAAsyncGetHostByName @103
+ WSAAsyncGetProtoByNumber @104
+ WSAAsyncGetProtoByName @105
+ WSAAsyncGetServByPort @106
+ WSAAsyncGetServByName @107
+ WSACancelAsyncRequest @108
+ WSASetBlockingHook @109
+ WSAUnhookBlockingHook @110
+ WSAGetLastError @111
+ WSASetLastError @112
+ WSACancelBlockingCall @113
+ WSAIsBlocking @114
+ WSAStartup @115
+ WSACleanup @116
+ __WSAFDIsSet @151
+ WEP @500
+ WSApSetPostRoutine @1000
+ WsControl @1001
+ closesockinfo @1002
+ Arecv @1003
+ Asend @1004
+ WSHEnumProtocols @1005
+ inet_network @1100
+ getnetbyname @1101
+ rcmd @1102
+ rexec @1103
+ rresvport @1104
+ sethostname @1105
+ dn_expand @1106
+ WSARecvEx @1107
+ s_perror @1108
+ GetAddressByNameA @1109
+ GetAddressByNameW @1110
+ EnumProtocolsA @1111
+ EnumProtocolsW @1112
+ GetTypeByNameA @1113
+ GetTypeByNameW @1114
+ GetNameByTypeA @1115
+ GetNameByTypeW @1116
+ SetServiceA @1117
+ SetServiceW @1118
+ GetServiceA @1119
+ GetServiceW @1120
+ NPLoadNameSpaces @1130
+ NSPStartup @1131
+ TransmitFile @1140
+ AcceptEx @1141
+ GetAcceptExSockaddrs @1142
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock20/dlldef.h b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dlldef.h
new file mode 100644
index 0000000..52a2567
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dlldef.h
@@ -0,0 +1,123 @@
+/*
+ * dlldef.h
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef _DLLDEF_H
+#define _DLLDEF_H
+
+#include "../common/wrapcommon.h"
+
+/*
+ * Execution Tracing
+ */
+
+extern int procPid;
+
+#ifdef DEBUG
+#define TRACE idnPrintf
+#define FATAL idnPrintf
+#else
+#define TRACE
+#define FATAL idnPrintf
+#endif
+
+/*
+ * entry points to wrap
+ */
+
+extern int WSAAPI
+_org_gethostname(char FAR * name, int namelen);
+
+extern struct hostent FAR * WSAAPI
+_org_gethostbyaddr(const char FAR * addr, int len, int type);
+
+extern struct hostent FAR * WSAAPI
+_org_gethostbyname(const char FAR * name);
+
+extern HANDLE WSAAPI
+_org_WSAAsyncGetHostByName(HWND hWnd, u_int wMsg, const char FAR * name,
+ char FAR * buf,int buflen);
+
+extern HANDLE WSAAPI
+_org_WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, const char FAR * addr,
+ int len, int type, char FAR * buf, int buflen);
+
+extern INT WSAAPI
+_org_WSALookupServiceBeginA(LPWSAQUERYSETA lpqsRestrictions,
+ DWORD dwControlFlags,
+ LPHANDLE lphLookup);
+
+extern INT WSAAPI
+_org_WSALookupServiceBeginW(LPWSAQUERYSETW lpqsRestrictions,
+ DWORD dwControlFlags,
+ LPHANDLE lphLookup);
+
+extern INT WSAAPI
+_org_WSALookupServiceNextA(HANDLE hLookup,
+ DWORD dwControlFlags,
+ LPDWORD lpdwBufferLength,
+ LPWSAQUERYSETA lpqsResults);
+
+extern INT WSAAPI
+_org_WSALookupServiceNextW(HANDLE hLookup,
+ DWORD dwControlFlags,
+ LPDWORD lpdwBufferLength,
+ LPWSAQUERYSETW lpqsResults);
+
+extern INT WSAAPI
+_org_WSALookupServiceEnd(HANDLE hLookup);
+
+extern int WSAAPI
+_org_getaddrinfo(const char *nodename, const char *servname,
+ LPVOID hints, LPVOID res);
+
+extern void WSAAPI
+_org_freeaddrinfo(LPVOID aip);
+
+extern int WSAAPI
+_org_getnameinfo(LPVOID sa, DWORD salen, char* host, DWORD hostlen,
+ char* serv, DWORD servlen, int flags);
+
+#endif /* _DLLDEF_H */
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllfunc.c b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllfunc.c
new file mode 100644
index 0000000..cec2d06
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllfunc.c
@@ -0,0 +1,592 @@
+/*
+ * dllfunc.c - wrapper functions
+ */
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <svcguid.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <process.h>
+
+#include "dlldef.h"
+
+#ifndef EAI_MEMORY
+#define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
+#endif
+#ifndef EAI_FAIL
+#define EAI_FAIL WSANO_RECOVERY
+#endif
+
+static GUID guid_habn = SVCID_INET_HOSTADDRBYNAME;
+static GUID guid_habis = SVCID_INET_HOSTADDRBYINETSTRING;
+
+#define SVCID_IS_HABN(p) (memcmp(p, &guid_habn, sizeof(GUID)) == 0)
+#define SVCID_IS_HABIS(p) (memcmp(p, &guid_habis, sizeof(GUID)) == 0)
+
+/*
+ * Rename addrinfo to my_addrinfo for avoiding possible name conflict.
+ */
+struct my_addrinfo {
+ int ai_flags;
+ int ai_family;
+ int ai_socktype;
+ int ai_protocol;
+ size_t ai_addrlen;
+ char *ai_canonname;
+ struct sockaddr *ai_addr;
+ struct my_addrinfo *ai_next;
+};
+
+typedef struct obj_lock {
+ void *key;
+ struct obj_lock *next;
+} obj_lock_t;
+
+#define OBJLOCKHASH_SIZE 127
+static obj_lock_t *obj_lock_hash[OBJLOCKHASH_SIZE];
+
+static int obj_hash(void *key);
+static int obj_islocked(void *key);
+static void obj_lock(void *key);
+static void obj_unlock(void *key);
+static char *decode_name_dynamic(const char *name, idn_resconf_t idnctx);
+static struct my_addrinfo
+ *copy_decode_addrinfo_dynamic(struct my_addrinfo *aip,
+ idn_resconf_t idnctx);
+static void free_copied_addrinfo(struct my_addrinfo *aip);
+
+WRAPPER_EXPORT int WSAAPI
+gethostname(char FAR * name, int namelen) {
+ int ret;
+
+ TRACE("ENTER gethostname\n");
+ ret = _org_gethostname(name, namelen);
+ TRACE("LEAVE gethostname %d <%-.100s>\n", ret, name);
+
+ return (ret);
+}
+
+WRAPPER_EXPORT struct hostent FAR * WSAAPI
+gethostbyname(const char FAR * name) {
+ struct hostent FAR *ret;
+ char nbuff[256];
+ char hbuff[256];
+ BOOL stat;
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER gethostbyname <%-.100s>\n",
+ (name != NULL ? name : "NULL"));
+
+ encodeCtx = idnGetContext();
+
+ if (encodeCtx == NULL || name == NULL) {
+ ret = _org_gethostbyname(name);
+ } else {
+ stat = idnConvReq(encodeCtx, name, nbuff, sizeof(nbuff));
+ if (stat == FALSE) {
+ TRACE("idnConvReq failed\n");
+ ret = NULL;
+ } else {
+ TRACE("Converted Name <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ ret = _org_gethostbyname(nbuff);
+ }
+ }
+
+ if (ret != NULL && encodeCtx != NULL) {
+ TRACE("Resulting Name <%s>\n",
+ dumpName(ret->h_name, hbuff, sizeof(hbuff)));
+ stat = idnConvRsp(encodeCtx, ret->h_name,
+ nbuff, sizeof(nbuff));
+ if (stat == FALSE) {
+ TRACE("Decoding failed - return the name verbatim\n");
+ } else {
+ TRACE("Converted Back <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ strcpy(ret->h_name, nbuff);
+ }
+ }
+
+ if (ret == NULL) {
+ TRACE("LEAVE gethostbyname NULL\n");
+ } else {
+ TRACE("LEAVE gethostbyname <%s>\n",
+ dumpHost(ret, hbuff, sizeof(hbuff)));
+ }
+ return (ret);
+}
+
+WRAPPER_EXPORT struct hostent FAR * WSAAPI
+gethostbyaddr(const char FAR * addr, int len, int type) {
+ struct hostent FAR *ret;
+ char nbuff[256];
+ char abuff[256];
+ char hbuff[256];
+ BOOL stat;
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER gethostbyaddr <%s>\n",
+ dumpAddr(addr, len, abuff, sizeof(abuff)));
+
+ encodeCtx = idnGetContext();
+
+ ret = _org_gethostbyaddr(addr, len, type);
+
+ if (ret != NULL && encodeCtx != NULL) {
+ TRACE("Resulting Name <%s>\n",
+ dumpName(ret->h_name, hbuff, sizeof(hbuff)));
+ stat = idnConvRsp(encodeCtx, ret->h_name,
+ nbuff, sizeof(nbuff));
+ if (stat == FALSE) {
+ TRACE("Decoding failed - return the name verbatim\n");
+ } else {
+ TRACE("Converted Back <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ strcpy(ret->h_name, nbuff);
+ }
+ }
+
+ if (ret == NULL) {
+ TRACE("LEAVE gethostbyaddr NULL\n");
+ } else {
+ TRACE("LEAVE gethostbyaddr <%s>\n",
+ dumpHost(ret, hbuff, sizeof(hbuff)));
+ }
+ return (ret);
+}
+
+WRAPPER_EXPORT HANDLE WSAAPI
+WSAAsyncGetHostByName(HWND hWnd, u_int wMsg,
+ const char FAR * name, char FAR * buf, int buflen)
+{
+ HANDLE ret;
+ char nbuff[256];
+ char hbuff[256];
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER WSAAsyncGetHostByName <%-.100s>\n", name);
+
+ encodeCtx = idnGetContext();
+
+ if (encodeCtx == NULL || name == NULL) {
+ ret = _org_WSAAsyncGetHostByName(hWnd, wMsg,
+ name, buf, buflen);
+ } else {
+ idnHook(hWnd, wMsg, buf, encodeCtx);
+ idnConvReq(encodeCtx, name, nbuff, sizeof(nbuff));
+ TRACE("Converted Name <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ ret = _org_WSAAsyncGetHostByName(hWnd, wMsg, nbuff,
+ buf, buflen);
+ }
+
+ TRACE("LEAVE WSAAsyncGetHostByName HANDLE %08x\n", ret);
+
+ return (ret);
+}
+
+WRAPPER_EXPORT HANDLE WSAAPI
+WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, const char FAR * addr,
+ int len, int type, char FAR * buf, int buflen)
+{
+ HANDLE ret;
+ char abuff[256];
+ idn_resconf_t encodeCtx;
+
+ encodeCtx = idnGetContext();
+
+ if (encodeCtx != NULL) {
+ idnHook(hWnd, wMsg, buf, encodeCtx);
+ }
+
+ TRACE("ENTER WSAAsyncGetHostByAddr <%s>\n",
+ dumpAddr(addr, len, abuff, sizeof(abuff)));
+ ret = _org_WSAAsyncGetHostByAddr(hWnd, wMsg, addr, len, type,
+ buf, buflen);
+ TRACE("LEAVE WSAAsyncGetHostByAddr HANDLE %08x\n", ret);
+
+ return (ret);
+}
+
+WRAPPER_EXPORT INT WSAAPI
+WSALookupServiceBeginA(LPWSAQUERYSETA lpqsRestrictions,
+ DWORD dwControlFlags, LPHANDLE lphLookup)
+{
+ INT ret;
+ char nbuff[256];
+ char hbuff[256];
+ LPSTR name = lpqsRestrictions->lpszServiceInstanceName;
+ LPGUID class = lpqsRestrictions->lpServiceClassId;
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER WSALookupServiceBeginA <%-.100s>\n",
+ name == NULL ? "<NULL>" : name);
+
+ encodeCtx = idnGetContext();
+
+ if (name != NULL && encodeCtx != NULL && SVCID_IS_HABN(class) == 0) {
+ idnConvReq(encodeCtx, name, nbuff, sizeof(nbuff));
+ TRACE("Converted Name <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ /* strcpy(lpqsRestrictions->lpszQueryString, nbuff); */
+ lpqsRestrictions->lpszServiceInstanceName = nbuff;
+ }
+ ret = _org_WSALookupServiceBeginA(lpqsRestrictions,
+ dwControlFlags, lphLookup);
+ TRACE("LEAVE WSALookupServiceBeginA %d\n", ret);
+
+ return (ret);
+}
+
+WRAPPER_EXPORT INT WSAAPI
+WSALookupServiceNextA(HANDLE hLookup, DWORD dwControlFlags,
+ LPDWORD lpdwBufferLength, LPWSAQUERYSETA lpqsResults)
+{
+ INT ret;
+ char nbuff[256];
+ char hbuff[256];
+ LPGUID class;
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER WSALookupServiceNextA\n");
+
+ encodeCtx = idnGetContext();
+
+ ret = _org_WSALookupServiceNextA(hLookup, dwControlFlags,
+ lpdwBufferLength, lpqsResults);
+ class = lpqsResults->lpServiceClassId;
+
+ if (ret == 0 &&
+ encodeCtx != NULL &&
+ (dwControlFlags & LUP_RETURN_NAME) &&
+ (SVCID_IS_HABN(class) || SVCID_IS_HABIS(class))) {
+ TRACE("Resulting Name <%s>\n",
+ dumpName(lpqsResults->lpszServiceInstanceName,
+ hbuff, sizeof(hbuff)));
+ if (idnConvRsp(encodeCtx,
+ lpqsResults->lpszServiceInstanceName,
+ nbuff, sizeof(nbuff)) == FALSE) {
+ TRACE("Decoding failed - return the name verbatim\n");
+ } else {
+ TRACE("Converted Back <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ strcpy(lpqsResults->lpszServiceInstanceName, nbuff);
+ }
+ }
+ TRACE("LEAVE WSALookupServiceNextA %d <%s>\n", ret, nbuff);
+
+ return (ret);
+}
+
+WRAPPER_EXPORT INT WSAAPI
+WSALookupServiceBeginW(LPWSAQUERYSETW lpqsRestrictions,
+ DWORD dwControlFlags, LPHANDLE lphLookup)
+{
+ INT ret;
+
+ TRACE("ENTER WSALookupServiceBeginW\n");
+ ret = _org_WSALookupServiceBeginW(lpqsRestrictions,
+ dwControlFlags,lphLookup);
+ TRACE("LEAVE WSALookupServiceBeginW %d\n", ret);
+
+ return (ret);
+}
+
+WRAPPER_EXPORT INT WSAAPI
+WSALookupServiceNextW(HANDLE hLookup, DWORD dwControlFlags,
+ LPDWORD lpdwBufferLength, LPWSAQUERYSETW lpqsResults)
+{
+ INT ret;
+
+ TRACE("ENTER WSALookupServiceNextW\n");
+ ret = _org_WSALookupServiceNextW(hLookup, dwControlFlags,
+ lpdwBufferLength, lpqsResults);
+ TRACE("LEAVE WSALookupServiceNextW %d\n", ret);
+
+ return (ret);
+}
+
+WRAPPER_EXPORT INT WSAAPI
+WSALookupServiceEnd(HANDLE hLookup) {
+ INT ret;
+
+ TRACE("ENTER WSALookupServiceEnd\n");
+ ret = _org_WSALookupServiceEnd(hLookup);
+ TRACE("LEAVE WSALookupServiceEnd %d\n", ret);
+
+ return (ret);
+}
+
+static int
+obj_hash(void *key) {
+ /*
+ * Hash function for obj_*.
+ * 'key' is supposed to be an address.
+ */
+ unsigned long v = (unsigned long)key;
+
+ return ((v >> 3) % OBJLOCKHASH_SIZE);
+}
+
+static int
+obj_islocked(void *key)
+{
+ /*
+ * Check if the object specified by 'key' is locked.
+ * Return 1 if so, 0 otherwise.
+ */
+ int h = obj_hash(key);
+ obj_lock_t *olp = obj_lock_hash[h];
+
+ while (olp != NULL) {
+ if (olp->key == key)
+ return (1);
+ olp = olp->next;
+ }
+ return (0);
+}
+
+static void
+obj_lock(void *key)
+{
+ /*
+ * Lock an object specified by 'key'.
+ */
+ int h = obj_hash(key);
+ obj_lock_t *olp;
+
+ olp = malloc(sizeof(obj_lock_t));
+ if (olp != NULL) {
+ olp->key = key;
+ olp->next = obj_lock_hash[h];
+ obj_lock_hash[h] = olp;
+ }
+}
+
+static void
+obj_unlock(void *key)
+{
+ /*
+ * Unlock an object specified by 'key'.
+ */
+ int h = obj_hash(key);
+ obj_lock_t *olp, *olp0;
+
+ olp = obj_lock_hash[h];
+ olp0 = NULL;
+ while (olp != NULL) {
+ if (olp->key == key) {
+ if (olp0 == NULL)
+ obj_lock_hash[h] = olp->next;
+ else
+ olp0->next = olp->next;
+ free(olp);
+ return;
+ }
+ olp0 = olp;
+ olp = olp->next;
+ }
+}
+
+static char *
+decode_name_dynamic(const char *name, idn_resconf_t idnctx) {
+ BOOL stat;
+ char buf[256], tmp[256];
+ char *s;
+
+ if (idnConvRsp(idnctx, name, buf, sizeof(buf)) == TRUE) {
+ TRACE("Converted Back <%s>\n",
+ dumpName(buf, tmp, sizeof(tmp)));
+ name = buf;
+ } else {
+ TRACE("Decoding failed - return the name verbatim\n");
+ }
+ s = malloc(strlen(name) + 1);
+ if (s == NULL)
+ return (NULL);
+ else
+ return (strcpy(s, name));
+}
+
+static struct my_addrinfo *
+copy_decode_addrinfo_dynamic(struct my_addrinfo *aip, idn_resconf_t idnctx)
+{
+ struct my_addrinfo *newaip;
+
+ if (aip == NULL)
+ return (NULL);
+
+ newaip = malloc(sizeof(struct my_addrinfo) + aip->ai_addrlen);
+ if (newaip == NULL)
+ return (NULL);
+
+ *newaip = *aip;
+ newaip->ai_addr = (struct sockaddr *)(newaip + 1);
+ memcpy(newaip->ai_addr, aip->ai_addr, aip->ai_addrlen);
+
+ if (newaip->ai_canonname != NULL)
+ newaip->ai_canonname = decode_name_dynamic(aip->ai_canonname,
+ idnctx);
+
+ newaip->ai_next = copy_decode_addrinfo_dynamic(aip->ai_next, idnctx);
+ return (newaip);
+}
+
+static void
+free_copied_addrinfo(struct my_addrinfo *aip) {
+ while (aip != NULL) {
+ struct my_addrinfo *next = aip->ai_next;
+
+ if (aip->ai_canonname != NULL)
+ free(aip->ai_canonname);
+ free(aip);
+ aip = next;
+ }
+}
+
+WRAPPER_EXPORT int WSAAPI
+getaddrinfo(const char *nodename, const char *servname,
+ const struct my_addrinfo *hints, struct my_addrinfo **res)
+{
+ char namebuf[256];
+ BOOL stat;
+ struct my_addrinfo *aip;
+ int err;
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER getaddrinfo <%-.100s>\n", nodename ? nodename : "NULL");
+
+ encodeCtx = idnGetContext();
+
+ if (nodename == NULL || encodeCtx == NULL) {
+ TRACE("conversion unnecessary\n");
+ err = _org_getaddrinfo(nodename, servname, hints, res);
+ } else {
+ stat = idnConvReq(encodeCtx, nodename,
+ namebuf, sizeof(namebuf));
+ if (stat == TRUE) {
+ nodename = namebuf;
+ TRACE("Converted Name <%-.100s>\n", namebuf);
+ }
+
+ err = _org_getaddrinfo(nodename, servname, hints, &aip);
+ if (err == 0 && aip != NULL) {
+ *res = copy_decode_addrinfo_dynamic(aip, encodeCtx);
+ if (*res == NULL)
+ err = EAI_FAIL;
+ else
+ obj_lock(*res);
+ if (aip != NULL)
+ _org_freeaddrinfo(aip);
+ }
+ }
+
+ TRACE("LEAVE getaddrinfo %d\n", err);
+ return (err);
+}
+
+WRAPPER_EXPORT void WSAAPI
+freeaddrinfo(struct my_addrinfo *aip) {
+ TRACE("ENTER freeaddrinfo aip=%p\n", (void *)aip);
+
+ if (obj_islocked(aip)) {
+ /*
+ * We allocated the data.
+ */
+ obj_unlock(aip);
+ free_copied_addrinfo(aip);
+ } else {
+ /*
+ * It was allocated the original getaddrinfo().
+ */
+ TRACE("Not allocated by the wrapper\n");
+ _org_freeaddrinfo(aip);
+ }
+ TRACE("LEAVE freeaddrinfo\n");
+}
+
+WRAPPER_EXPORT int WSAAPI
+getnameinfo(const struct sockaddr *sa, DWORD salen,
+ char *host, DWORD hostlen, char *serv,
+ DWORD servlen, int flags)
+{
+ char name[256];
+ size_t namelen = sizeof(name);
+ int code;
+ BOOL stat;
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER getnameinfo\n");
+
+ encodeCtx = idnGetContext();
+
+ if (host == NULL || hostlen == 0 || encodeCtx == NULL) {
+ TRACE("conversion unnecessary\n");
+ code = _org_getnameinfo(sa, salen, host, hostlen,
+ serv, servlen, flags);
+ } else {
+ code = _org_getnameinfo(sa, salen, name, namelen,
+ serv, servlen, flags);
+ if (code == 0 && name[0] != '\0') {
+ stat = idnConvRsp(encodeCtx, name, host, hostlen);
+ if (stat == FALSE) {
+ TRACE("Decoding failed - return the name verbatim\n");
+ if (strlen(name) >= hostlen) {
+ code = EAI_FAIL;
+ } else {
+ strcpy(host, name);
+ }
+ } else {
+ TRACE("Converted Back <%s>\n",
+ dumpName(host, name, sizeof(name)));
+ }
+ }
+ }
+
+ TRACE("LEAVE getnameinfo %d\n", code);
+ return (code);
+}
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllload.c b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllload.c
new file mode 100644
index 0000000..0f1257e
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllload.c
@@ -0,0 +1,62 @@
+/*
+ * dllload.c - load original entries
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <winsock2.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <process.h>
+
+#include "dlldef.h"
+
+/*
+ * Manages original DLL
+ */
+
+#define DLLHANDLE idnWinsockHandle()
+
+#include "dllstub.c"
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllmain.c b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllmain.c
new file mode 100644
index 0000000..c6609bc
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllmain.c
@@ -0,0 +1,94 @@
+/*
+ * dllmain.c - entry for DLL
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <process.h>
+
+#include "dlldef.h"
+
+/*
+ * Control Variables
+ */
+
+int procPid = 0;
+
+static char procExe[256];
+
+/*
+ * DLL Entry
+ */
+
+BOOL APIENTRY
+DllMain(HMODULE hmod, DWORD reason, LPVOID *resv) {
+ switch (reason) {
+ case DLL_PROCESS_ATTACH:
+ procPid = getpid();
+ GetModuleFileName(NULL, procExe, 256);
+
+ idnLogInit("ws20");
+ idnHookInit();
+
+ TRACE("Attached to Process <%s>\n", procExe);
+ return (idnWinsockVersion("2.0"));
+
+ case DLL_PROCESS_DETACH:
+ idnConvDone(idnGetContext());
+ idnHookDone();
+ TRACE("Detached from Process\n");
+ idnLogFinish();
+ break;
+
+ case DLL_THREAD_ATTACH:
+ break;
+ case DLL_THREAD_DETACH:
+ break;
+ }
+
+ return (TRUE);
+}
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllstub.c b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllstub.c
new file mode 100644
index 0000000..afc4537
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllstub.c
@@ -0,0 +1,2168 @@
+/* $Id: dllstub.c,v 1.1.1.1 2003/06/04 00:27:51 marka Exp $ */
+
+SOCKET PASCAL
+accept(SOCKET a0, struct sockaddr* a1, int* a2)
+{
+ static SOCKET (PASCAL *fp)(SOCKET a0, struct sockaddr* a1, int* a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub accept() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "accept")) == NULL) {
+ FATAL("cannot find entry accept (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+bind(SOCKET a0, const struct sockaddr* a1, int a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, const struct sockaddr* a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub bind() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "bind")) == NULL) {
+ FATAL("cannot find entry bind (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+closesocket(SOCKET a0)
+{
+ static int (PASCAL *fp)(SOCKET a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub closesocket() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "closesocket")) == NULL) {
+ FATAL("cannot find entry closesocket (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+connect(SOCKET a0, const struct sockaddr* a1, int a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, const struct sockaddr* a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub connect() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "connect")) == NULL) {
+ FATAL("cannot find entry connect (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+getpeername(SOCKET a0, struct sockaddr* a1, int* a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, struct sockaddr* a1, int* a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getpeername() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getpeername")) == NULL) {
+ FATAL("cannot find entry getpeername (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+getsockname(SOCKET a0, struct sockaddr* a1, int* a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, struct sockaddr* a1, int* a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getsockname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getsockname")) == NULL) {
+ FATAL("cannot find entry getsockname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+getsockopt(SOCKET a0, int a1, int a2, char* a3, int* a4)
+{
+ static int (PASCAL *fp)(SOCKET a0, int a1, int a2, char* a3, int* a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getsockopt() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getsockopt")) == NULL) {
+ FATAL("cannot find entry getsockopt (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+u_long PASCAL
+htonl(u_long a0)
+{
+ static u_long (PASCAL *fp)(u_long a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub htonl() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "htonl")) == NULL) {
+ FATAL("cannot find entry htonl (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+u_short PASCAL
+htons(u_short a0)
+{
+ static u_short (PASCAL *fp)(u_short a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub htons() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "htons")) == NULL) {
+ FATAL("cannot find entry htons (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+ioctlsocket(SOCKET a0, long a1, u_long * a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, long a1, u_long * a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub ioctlsocket() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "ioctlsocket")) == NULL) {
+ FATAL("cannot find entry ioctlsocket (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+unsigned long PASCAL
+inet_addr(const char* a0)
+{
+ static unsigned long (PASCAL *fp)(const char* a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub inet_addr() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "inet_addr")) == NULL) {
+ FATAL("cannot find entry inet_addr (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+ char * PASCAL
+inet_ntoa(struct in_addr a0)
+{
+ static char * (PASCAL *fp)(struct in_addr a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub inet_ntoa() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "inet_ntoa")) == NULL) {
+ FATAL("cannot find entry inet_ntoa (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+listen(SOCKET a0, int a1)
+{
+ static int (PASCAL *fp)(SOCKET a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub listen() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "listen")) == NULL) {
+ FATAL("cannot find entry listen (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+u_long PASCAL
+ntohl(u_long a0)
+{
+ static u_long (PASCAL *fp)(u_long a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub ntohl() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "ntohl")) == NULL) {
+ FATAL("cannot find entry ntohl (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+u_short PASCAL
+ntohs(u_short a0)
+{
+ static u_short (PASCAL *fp)(u_short a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub ntohs() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "ntohs")) == NULL) {
+ FATAL("cannot find entry ntohs (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+recv(SOCKET a0, char* a1, int a2, int a3)
+{
+ static int (PASCAL *fp)(SOCKET a0, char* a1, int a2, int a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub recv() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "recv")) == NULL) {
+ FATAL("cannot find entry recv (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int PASCAL
+recvfrom(SOCKET a0, char* a1, int a2, int a3, struct sockaddr* a4, int* a5)
+{
+ static int (PASCAL *fp)(SOCKET a0, char* a1, int a2, int a3, struct sockaddr* a4, int* a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub recvfrom() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "recvfrom")) == NULL) {
+ FATAL("cannot find entry recvfrom (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+int PASCAL
+select(int a0, fd_set* a1, fd_set* a2, fd_set* a3, const struct timeval* a4)
+{
+ static int (PASCAL *fp)(int a0, fd_set* a1, fd_set* a2, fd_set* a3, const struct timeval* a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub select() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "select")) == NULL) {
+ FATAL("cannot find entry select (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+int PASCAL
+send(SOCKET a0, const char* a1, int a2, int a3)
+{
+ static int (PASCAL *fp)(SOCKET a0, const char* a1, int a2, int a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub send() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "send")) == NULL) {
+ FATAL("cannot find entry send (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int PASCAL
+sendto(SOCKET a0, const char* a1, int a2, int a3, const struct sockaddr* a4, int a5)
+{
+ static int (PASCAL *fp)(SOCKET a0, const char* a1, int a2, int a3, const struct sockaddr* a4, int a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub sendto() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "sendto")) == NULL) {
+ FATAL("cannot find entry sendto (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+int PASCAL
+setsockopt(SOCKET a0, int a1, int a2, const char* a3, int a4)
+{
+ static int (PASCAL *fp)(SOCKET a0, int a1, int a2, const char* a3, int a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub setsockopt() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "setsockopt")) == NULL) {
+ FATAL("cannot find entry setsockopt (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+int PASCAL
+shutdown(SOCKET a0, int a1)
+{
+ static int (PASCAL *fp)(SOCKET a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub shutdown() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "shutdown")) == NULL) {
+ FATAL("cannot find entry shutdown (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+SOCKET PASCAL
+socket(int a0, int a1, int a2)
+{
+ static SOCKET (PASCAL *fp)(int a0, int a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub socket() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "socket")) == NULL) {
+ FATAL("cannot find entry socket (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+WSApSetPostRoutine(int a0)
+{
+ static int (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSApSetPostRoutine() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSApSetPostRoutine")) == NULL) {
+ FATAL("cannot find entry WSApSetPostRoutine (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+WSAEVENT WSAAPI
+WPUCompleteOverlappedRequest(SOCKET a0, LPWSAOVERLAPPED a1, DWORD a2, DWORD a3, LPINT a4)
+{
+ static WSAEVENT (WSAAPI *fp)(SOCKET a0, LPWSAOVERLAPPED a1, DWORD a2, DWORD a3, LPINT a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WPUCompleteOverlappedRequest() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WPUCompleteOverlappedRequest")) == NULL) {
+ FATAL("cannot find entry WPUCompleteOverlappedRequest (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+SOCKET WINAPI
+WSAAccept(SOCKET a0, struct sockaddr * a1, LPINT a2, LPCONDITIONPROC a3, DWORD a4)
+{
+ static SOCKET (WINAPI *fp)(SOCKET a0, struct sockaddr * a1, LPINT a2, LPCONDITIONPROC a3, DWORD a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAccept() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAccept")) == NULL) {
+ FATAL("cannot find entry WSAAccept (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+INT WINAPI
+WSAAddressToStringA(LPSOCKADDR a0, DWORD a1, LPWSAPROTOCOL_INFOA a2, LPSTR a3, LPDWORD a4)
+{
+ static INT (WINAPI *fp)(LPSOCKADDR a0, DWORD a1, LPWSAPROTOCOL_INFOA a2, LPSTR a3, LPDWORD a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAddressToStringA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAddressToStringA")) == NULL) {
+ FATAL("cannot find entry WSAAddressToStringA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+INT WINAPI
+WSAAddressToStringW(LPSOCKADDR a0, DWORD a1, LPWSAPROTOCOL_INFOW a2, LPWSTR a3, LPDWORD a4)
+{
+ static INT (WINAPI *fp)(LPSOCKADDR a0, DWORD a1, LPWSAPROTOCOL_INFOW a2, LPWSTR a3, LPDWORD a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAddressToStringW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAddressToStringW")) == NULL) {
+ FATAL("cannot find entry WSAAddressToStringW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+BOOL WINAPI
+WSACloseEvent(WSAEVENT a0)
+{
+ static BOOL (WINAPI *fp)(WSAEVENT a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSACloseEvent() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSACloseEvent")) == NULL) {
+ FATAL("cannot find entry WSACloseEvent (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int WINAPI
+WSAConnect(SOCKET a0, const struct sockaddr * a1, int a2, LPWSABUF a3, LPWSABUF a4, LPQOS a5, LPQOS a6)
+{
+ static int (WINAPI *fp)(SOCKET a0, const struct sockaddr * a1, int a2, LPWSABUF a3, LPWSABUF a4, LPQOS a5, LPQOS a6);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAConnect() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAConnect")) == NULL) {
+ FATAL("cannot find entry WSAConnect (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6);
+}
+
+WSAEVENT WINAPI
+WSACreateEvent(void)
+{
+ static WSAEVENT (WINAPI *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSACreateEvent() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSACreateEvent")) == NULL) {
+ FATAL("cannot find entry WSACreateEvent (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int WINAPI
+WSADuplicateSocketA(SOCKET a0, DWORD a1, LPWSAPROTOCOL_INFOA a2)
+{
+ static int (WINAPI *fp)(SOCKET a0, DWORD a1, LPWSAPROTOCOL_INFOA a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSADuplicateSocketA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSADuplicateSocketA")) == NULL) {
+ FATAL("cannot find entry WSADuplicateSocketA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int WINAPI
+WSADuplicateSocketW(SOCKET a0, DWORD a1, LPWSAPROTOCOL_INFOW a2)
+{
+ static int (WINAPI *fp)(SOCKET a0, DWORD a1, LPWSAPROTOCOL_INFOW a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSADuplicateSocketW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSADuplicateSocketW")) == NULL) {
+ FATAL("cannot find entry WSADuplicateSocketW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT WINAPI
+WSAEnumNameSpaceProvidersA(LPDWORD a0, LPWSANAMESPACE_INFOA a1)
+{
+ static INT (WINAPI *fp)(LPDWORD a0, LPWSANAMESPACE_INFOA a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAEnumNameSpaceProvidersA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAEnumNameSpaceProvidersA")) == NULL) {
+ FATAL("cannot find entry WSAEnumNameSpaceProvidersA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+INT WINAPI
+WSAEnumNameSpaceProvidersW(LPDWORD a0, LPWSANAMESPACE_INFOW a1)
+{
+ static INT (WINAPI *fp)(LPDWORD a0, LPWSANAMESPACE_INFOW a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAEnumNameSpaceProvidersW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAEnumNameSpaceProvidersW")) == NULL) {
+ FATAL("cannot find entry WSAEnumNameSpaceProvidersW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int WINAPI
+WSAEnumNetworkEvents(SOCKET a0, WSAEVENT a1, LPWSANETWORKEVENTS a2)
+{
+ static int (WINAPI *fp)(SOCKET a0, WSAEVENT a1, LPWSANETWORKEVENTS a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAEnumNetworkEvents() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAEnumNetworkEvents")) == NULL) {
+ FATAL("cannot find entry WSAEnumNetworkEvents (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int WINAPI
+WSAEnumProtocolsA(LPINT a0, LPWSAPROTOCOL_INFOA a1, LPDWORD a2)
+{
+ static int (WINAPI *fp)(LPINT a0, LPWSAPROTOCOL_INFOA a1, LPDWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAEnumProtocolsA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAEnumProtocolsA")) == NULL) {
+ FATAL("cannot find entry WSAEnumProtocolsA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int WINAPI
+WSAEnumProtocolsW(LPINT a0, LPWSAPROTOCOL_INFOW a1, LPDWORD a2)
+{
+ static int (WINAPI *fp)(LPINT a0, LPWSAPROTOCOL_INFOW a1, LPDWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAEnumProtocolsW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAEnumProtocolsW")) == NULL) {
+ FATAL("cannot find entry WSAEnumProtocolsW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int WINAPI
+WSAEventSelect(SOCKET a0, WSAEVENT a1, long a2)
+{
+ static int (WINAPI *fp)(SOCKET a0, WSAEVENT a1, long a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAEventSelect() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAEventSelect")) == NULL) {
+ FATAL("cannot find entry WSAEventSelect (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+BOOL WINAPI
+WSAGetOverlappedResult(SOCKET a0, LPWSAOVERLAPPED a1, LPDWORD a2, BOOL a3, LPDWORD a4)
+{
+ static BOOL (WINAPI *fp)(SOCKET a0, LPWSAOVERLAPPED a1, LPDWORD a2, BOOL a3, LPDWORD a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAGetOverlappedResult() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAGetOverlappedResult")) == NULL) {
+ FATAL("cannot find entry WSAGetOverlappedResult (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+BOOL WINAPI
+WSAGetQOSByName(SOCKET a0, LPWSABUF a1, LPQOS a2)
+{
+ static BOOL (WINAPI *fp)(SOCKET a0, LPWSABUF a1, LPQOS a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAGetQOSByName() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAGetQOSByName")) == NULL) {
+ FATAL("cannot find entry WSAGetQOSByName (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT WINAPI
+WSAGetServiceClassInfoA(LPGUID a0, LPGUID a1, LPDWORD a2, LPWSASERVICECLASSINFOA a3)
+{
+ static INT (WINAPI *fp)(LPGUID a0, LPGUID a1, LPDWORD a2, LPWSASERVICECLASSINFOA a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAGetServiceClassInfoA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAGetServiceClassInfoA")) == NULL) {
+ FATAL("cannot find entry WSAGetServiceClassInfoA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+INT WINAPI
+WSAGetServiceClassInfoW(LPGUID a0, LPGUID a1, LPDWORD a2, LPWSASERVICECLASSINFOW a3)
+{
+ static INT (WINAPI *fp)(LPGUID a0, LPGUID a1, LPDWORD a2, LPWSASERVICECLASSINFOW a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAGetServiceClassInfoW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAGetServiceClassInfoW")) == NULL) {
+ FATAL("cannot find entry WSAGetServiceClassInfoW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+INT WINAPI
+WSAGetServiceClassNameByClassIdA(LPGUID a0, LPSTR a1, LPDWORD a2)
+{
+ static INT (WINAPI *fp)(LPGUID a0, LPSTR a1, LPDWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAGetServiceClassNameByClassIdA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAGetServiceClassNameByClassIdA")) == NULL) {
+ FATAL("cannot find entry WSAGetServiceClassNameByClassIdA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT WINAPI
+WSAGetServiceClassNameByClassIdW(LPGUID a0, LPWSTR a1, LPDWORD a2)
+{
+ static INT (WINAPI *fp)(LPGUID a0, LPWSTR a1, LPDWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAGetServiceClassNameByClassIdW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAGetServiceClassNameByClassIdW")) == NULL) {
+ FATAL("cannot find entry WSAGetServiceClassNameByClassIdW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int WINAPI
+WSAHtonl(SOCKET a0, unsigned long a1, unsigned long * a2)
+{
+ static int (WINAPI *fp)(SOCKET a0, unsigned long a1, unsigned long * a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAHtonl() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAHtonl")) == NULL) {
+ FATAL("cannot find entry WSAHtonl (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int WINAPI
+WSAHtons(SOCKET a0, unsigned short a1, unsigned short * a2)
+{
+ static int (WINAPI *fp)(SOCKET a0, unsigned short a1, unsigned short * a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAHtons() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAHtons")) == NULL) {
+ FATAL("cannot find entry WSAHtons (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT WINAPI
+WSAInstallServiceClassA(LPWSASERVICECLASSINFOA a0)
+{
+ static INT (WINAPI *fp)(LPWSASERVICECLASSINFOA a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAInstallServiceClassA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAInstallServiceClassA")) == NULL) {
+ FATAL("cannot find entry WSAInstallServiceClassA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+INT WINAPI
+WSAInstallServiceClassW(LPWSASERVICECLASSINFOW a0)
+{
+ static INT (WINAPI *fp)(LPWSASERVICECLASSINFOW a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAInstallServiceClassW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAInstallServiceClassW")) == NULL) {
+ FATAL("cannot find entry WSAInstallServiceClassW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int WINAPI
+WSAIoctl(SOCKET a0, DWORD a1, LPVOID a2, DWORD a3, LPVOID a4, DWORD a5, LPDWORD a6, LPWSAOVERLAPPED a7, LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+{
+ static int (WINAPI *fp)(SOCKET a0, DWORD a1, LPVOID a2, DWORD a3, LPVOID a4, DWORD a5, LPDWORD a6, LPWSAOVERLAPPED a7, LPWSAOVERLAPPED_COMPLETION_ROUTINE a8);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAIoctl() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAIoctl")) == NULL) {
+ FATAL("cannot find entry WSAIoctl (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+}
+
+ struct hostent * PASCAL
+_org_gethostbyaddr(const char* a0, int a1, int a2)
+{
+ static struct hostent * (PASCAL *fp)(const char* a0, int a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_gethostbyaddr() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "gethostbyaddr")) == NULL) {
+ FATAL("cannot find entry gethostbyaddr (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+ struct hostent * PASCAL
+_org_gethostbyname(const char* a0)
+{
+ static struct hostent * (PASCAL *fp)(const char* a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_gethostbyname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "gethostbyname")) == NULL) {
+ FATAL("cannot find entry gethostbyname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+ struct protoent * PASCAL
+getprotobyname(const char* a0)
+{
+ static struct protoent * (PASCAL *fp)(const char* a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getprotobyname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getprotobyname")) == NULL) {
+ FATAL("cannot find entry getprotobyname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+ struct protoent * PASCAL
+getprotobynumber(int a0)
+{
+ static struct protoent * (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getprotobynumber() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getprotobynumber")) == NULL) {
+ FATAL("cannot find entry getprotobynumber (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+ struct servent * PASCAL
+getservbyname(const char* a0, const char* a1)
+{
+ static struct servent * (PASCAL *fp)(const char* a0, const char* a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getservbyname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getservbyname")) == NULL) {
+ FATAL("cannot find entry getservbyname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+ struct servent * PASCAL
+getservbyport(int a0, const char* a1)
+{
+ static struct servent * (PASCAL *fp)(int a0, const char* a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getservbyport() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getservbyport")) == NULL) {
+ FATAL("cannot find entry getservbyport (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+_org_gethostname(char* a0, int a1)
+{
+ static int (PASCAL *fp)(char* a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_gethostname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "gethostname")) == NULL) {
+ FATAL("cannot find entry gethostname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+SOCKET WINAPI
+WSAJoinLeaf(SOCKET a0, const struct sockaddr * a1, int a2, LPWSABUF a3, LPWSABUF a4, LPQOS a5, LPQOS a6, DWORD a7)
+{
+ static SOCKET (WINAPI *fp)(SOCKET a0, const struct sockaddr * a1, int a2, LPWSABUF a3, LPWSABUF a4, LPQOS a5, LPQOS a6, DWORD a7);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAJoinLeaf() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAJoinLeaf")) == NULL) {
+ FATAL("cannot find entry WSAJoinLeaf (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6, a7);
+}
+
+INT WINAPI
+_org_WSALookupServiceBeginA(LPWSAQUERYSETA a0, DWORD a1, LPHANDLE a2)
+{
+ static INT (WINAPI *fp)(LPWSAQUERYSETA a0, DWORD a1, LPHANDLE a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_WSALookupServiceBeginA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSALookupServiceBeginA")) == NULL) {
+ FATAL("cannot find entry WSALookupServiceBeginA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT WINAPI
+_org_WSALookupServiceBeginW(LPWSAQUERYSETW a0, DWORD a1, LPHANDLE a2)
+{
+ static INT (WINAPI *fp)(LPWSAQUERYSETW a0, DWORD a1, LPHANDLE a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_WSALookupServiceBeginW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSALookupServiceBeginW")) == NULL) {
+ FATAL("cannot find entry WSALookupServiceBeginW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT WINAPI
+_org_WSALookupServiceEnd(HANDLE a0)
+{
+ static INT (WINAPI *fp)(HANDLE a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_WSALookupServiceEnd() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSALookupServiceEnd")) == NULL) {
+ FATAL("cannot find entry WSALookupServiceEnd (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+INT WINAPI
+_org_WSALookupServiceNextA(HANDLE a0, DWORD a1, LPDWORD a2, LPWSAQUERYSETA a3)
+{
+ static INT (WINAPI *fp)(HANDLE a0, DWORD a1, LPDWORD a2, LPWSAQUERYSETA a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_WSALookupServiceNextA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSALookupServiceNextA")) == NULL) {
+ FATAL("cannot find entry WSALookupServiceNextA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+INT WINAPI
+_org_WSALookupServiceNextW(HANDLE a0, DWORD a1, LPDWORD a2, LPWSAQUERYSETW a3)
+{
+ static INT (WINAPI *fp)(HANDLE a0, DWORD a1, LPDWORD a2, LPWSAQUERYSETW a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_WSALookupServiceNextW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSALookupServiceNextW")) == NULL) {
+ FATAL("cannot find entry WSALookupServiceNextW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int WINAPI
+WSANtohl(SOCKET a0, unsigned long a1, unsigned long * a2)
+{
+ static int (WINAPI *fp)(SOCKET a0, unsigned long a1, unsigned long * a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSANtohl() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSANtohl")) == NULL) {
+ FATAL("cannot find entry WSANtohl (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int WINAPI
+WSANtohs(SOCKET a0, unsigned short a1, unsigned short * a2)
+{
+ static int (WINAPI *fp)(SOCKET a0, unsigned short a1, unsigned short * a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSANtohs() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSANtohs")) == NULL) {
+ FATAL("cannot find entry WSANtohs (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int WSAAPI
+WSAProviderConfigChange(LPHANDLE a0, LPWSAOVERLAPPED a1, LPWSAOVERLAPPED_COMPLETION_ROUTINE a2)
+{
+ static int (WSAAPI *fp)(LPHANDLE a0, LPWSAOVERLAPPED a1, LPWSAOVERLAPPED_COMPLETION_ROUTINE a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAProviderConfigChange() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAProviderConfigChange")) == NULL) {
+ FATAL("cannot find entry WSAProviderConfigChange (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int WINAPI
+WSARecv(SOCKET a0, LPWSABUF a1, DWORD a2, LPDWORD a3, LPDWORD a4, LPWSAOVERLAPPED a5, LPWSAOVERLAPPED_COMPLETION_ROUTINE a6)
+{
+ static int (WINAPI *fp)(SOCKET a0, LPWSABUF a1, DWORD a2, LPDWORD a3, LPDWORD a4, LPWSAOVERLAPPED a5, LPWSAOVERLAPPED_COMPLETION_ROUTINE a6);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSARecv() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSARecv")) == NULL) {
+ FATAL("cannot find entry WSARecv (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6);
+}
+
+int WINAPI
+WSARecvDisconnect(SOCKET a0, LPWSABUF a1)
+{
+ static int (WINAPI *fp)(SOCKET a0, LPWSABUF a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSARecvDisconnect() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSARecvDisconnect")) == NULL) {
+ FATAL("cannot find entry WSARecvDisconnect (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int WINAPI
+WSARecvFrom(SOCKET a0, LPWSABUF a1, DWORD a2, LPDWORD a3, LPDWORD a4, struct sockaddr * a5, LPINT a6, LPWSAOVERLAPPED a7, LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+{
+ static int (WINAPI *fp)(SOCKET a0, LPWSABUF a1, DWORD a2, LPDWORD a3, LPDWORD a4, struct sockaddr * a5, LPINT a6, LPWSAOVERLAPPED a7, LPWSAOVERLAPPED_COMPLETION_ROUTINE a8);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSARecvFrom() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSARecvFrom")) == NULL) {
+ FATAL("cannot find entry WSARecvFrom (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+}
+
+INT WINAPI
+WSARemoveServiceClass(LPGUID a0)
+{
+ static INT (WINAPI *fp)(LPGUID a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSARemoveServiceClass() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSARemoveServiceClass")) == NULL) {
+ FATAL("cannot find entry WSARemoveServiceClass (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+BOOL WINAPI
+WSAResetEvent(WSAEVENT a0)
+{
+ static BOOL (WINAPI *fp)(WSAEVENT a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAResetEvent() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAResetEvent")) == NULL) {
+ FATAL("cannot find entry WSAResetEvent (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int WINAPI
+WSASend(SOCKET a0, LPWSABUF a1, DWORD a2, LPDWORD a3, DWORD a4, LPWSAOVERLAPPED a5, LPWSAOVERLAPPED_COMPLETION_ROUTINE a6)
+{
+ static int (WINAPI *fp)(SOCKET a0, LPWSABUF a1, DWORD a2, LPDWORD a3, DWORD a4, LPWSAOVERLAPPED a5, LPWSAOVERLAPPED_COMPLETION_ROUTINE a6);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASend() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASend")) == NULL) {
+ FATAL("cannot find entry WSASend (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6);
+}
+
+int WINAPI
+WSASendDisconnect(SOCKET a0, LPWSABUF a1)
+{
+ static int (WINAPI *fp)(SOCKET a0, LPWSABUF a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASendDisconnect() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASendDisconnect")) == NULL) {
+ FATAL("cannot find entry WSASendDisconnect (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int WINAPI
+WSASendTo(SOCKET a0, LPWSABUF a1, DWORD a2, LPDWORD a3, DWORD a4, const struct sockaddr * a5, int a6, LPWSAOVERLAPPED a7, LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+{
+ static int (WINAPI *fp)(SOCKET a0, LPWSABUF a1, DWORD a2, LPDWORD a3, DWORD a4, const struct sockaddr * a5, int a6, LPWSAOVERLAPPED a7, LPWSAOVERLAPPED_COMPLETION_ROUTINE a8);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASendTo() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASendTo")) == NULL) {
+ FATAL("cannot find entry WSASendTo (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+}
+
+BOOL WINAPI
+WSASetEvent(WSAEVENT a0)
+{
+ static BOOL (WINAPI *fp)(WSAEVENT a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASetEvent() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASetEvent")) == NULL) {
+ FATAL("cannot find entry WSASetEvent (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+INT WSAAPI
+WSASetServiceA(LPWSAQUERYSETA a0, WSAESETSERVICEOP a1, DWORD a2)
+{
+ static INT (WSAAPI *fp)(LPWSAQUERYSETA a0, WSAESETSERVICEOP a1, DWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASetServiceA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASetServiceA")) == NULL) {
+ FATAL("cannot find entry WSASetServiceA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT WINAPI
+WSASetServiceW(LPWSAQUERYSETW a0, WSAESETSERVICEOP a1, DWORD a2)
+{
+ static INT (WINAPI *fp)(LPWSAQUERYSETW a0, WSAESETSERVICEOP a1, DWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASetServiceW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASetServiceW")) == NULL) {
+ FATAL("cannot find entry WSASetServiceW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+SOCKET WINAPI
+WSASocketA(int a0, int a1, int a2, LPWSAPROTOCOL_INFOA a3, GROUP a4, DWORD a5)
+{
+ static SOCKET (WINAPI *fp)(int a0, int a1, int a2, LPWSAPROTOCOL_INFOA a3, GROUP a4, DWORD a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASocketA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASocketA")) == NULL) {
+ FATAL("cannot find entry WSASocketA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+SOCKET WINAPI
+WSASocketW(int a0, int a1, int a2, LPWSAPROTOCOL_INFOW a3, GROUP a4, DWORD a5)
+{
+ static SOCKET (WINAPI *fp)(int a0, int a1, int a2, LPWSAPROTOCOL_INFOW a3, GROUP a4, DWORD a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASocketW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASocketW")) == NULL) {
+ FATAL("cannot find entry WSASocketW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+INT WINAPI
+WSAStringToAddressA(LPSTR a0, INT a1, LPWSAPROTOCOL_INFOA a2, LPSOCKADDR a3, LPINT a4)
+{
+ static INT (WINAPI *fp)(LPSTR a0, INT a1, LPWSAPROTOCOL_INFOA a2, LPSOCKADDR a3, LPINT a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAStringToAddressA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAStringToAddressA")) == NULL) {
+ FATAL("cannot find entry WSAStringToAddressA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+INT WINAPI
+WSAStringToAddressW(LPWSTR a0, INT a1, LPWSAPROTOCOL_INFOW a2, LPSOCKADDR a3, LPINT a4)
+{
+ static INT (WINAPI *fp)(LPWSTR a0, INT a1, LPWSAPROTOCOL_INFOW a2, LPSOCKADDR a3, LPINT a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAStringToAddressW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAStringToAddressW")) == NULL) {
+ FATAL("cannot find entry WSAStringToAddressW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+DWORD WINAPI
+WSAWaitForMultipleEvents(DWORD a0, const WSAEVENT * a1, BOOL a2, DWORD a3, BOOL a4)
+{
+ static DWORD (WINAPI *fp)(DWORD a0, const WSAEVENT * a1, BOOL a2, DWORD a3, BOOL a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAWaitForMultipleEvents() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAWaitForMultipleEvents")) == NULL) {
+ FATAL("cannot find entry WSAWaitForMultipleEvents (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+int WINAPI
+WSCDeinstallProvider(LPGUID a0, LPINT a1)
+{
+ static int (WINAPI *fp)(LPGUID a0, LPINT a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCDeinstallProvider() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCDeinstallProvider")) == NULL) {
+ FATAL("cannot find entry WSCDeinstallProvider (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int WINAPI
+WSCEnableNSProvider(LPGUID a0, BOOL a1)
+{
+ static int (WINAPI *fp)(LPGUID a0, BOOL a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCEnableNSProvider() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCEnableNSProvider")) == NULL) {
+ FATAL("cannot find entry WSCEnableNSProvider (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int WINAPI
+WSCEnumProtocols(LPINT a0, LPWSAPROTOCOL_INFOW a1, LPDWORD a2, LPINT a3)
+{
+ static int (WINAPI *fp)(LPINT a0, LPWSAPROTOCOL_INFOW a1, LPDWORD a2, LPINT a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCEnumProtocols() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCEnumProtocols")) == NULL) {
+ FATAL("cannot find entry WSCEnumProtocols (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int WINAPI
+WSCGetProviderPath(LPGUID a0, LPWSTR a1, LPINT a2, LPINT a3)
+{
+ static int (WINAPI *fp)(LPGUID a0, LPWSTR a1, LPINT a2, LPINT a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCGetProviderPath() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCGetProviderPath")) == NULL) {
+ FATAL("cannot find entry WSCGetProviderPath (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int WINAPI
+WSCInstallNameSpace(LPWSTR a0, LPWSTR a1, DWORD a2, DWORD a3, LPGUID a4)
+{
+ static int (WINAPI *fp)(LPWSTR a0, LPWSTR a1, DWORD a2, DWORD a3, LPGUID a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCInstallNameSpace() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCInstallNameSpace")) == NULL) {
+ FATAL("cannot find entry WSCInstallNameSpace (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+int WINAPI
+WSCInstallProvider(const LPGUID a0, const LPWSTR a1, const LPWSAPROTOCOL_INFOW a2, DWORD a3, LPINT a4)
+{
+ static int (WINAPI *fp)(const LPGUID a0, const LPWSTR a1, const LPWSAPROTOCOL_INFOW a2, DWORD a3, LPINT a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCInstallProvider() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCInstallProvider")) == NULL) {
+ FATAL("cannot find entry WSCInstallProvider (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+int WINAPI
+WSCUnInstallNameSpace(LPGUID a0)
+{
+ static int (WINAPI *fp)(LPGUID a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCUnInstallNameSpace() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCUnInstallNameSpace")) == NULL) {
+ FATAL("cannot find entry WSCUnInstallNameSpace (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+WSAAsyncSelect(SOCKET a0, HWND a1, u_int a2, long a3)
+{
+ static int (PASCAL *fp)(SOCKET a0, HWND a1, u_int a2, long a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncSelect() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncSelect")) == NULL) {
+ FATAL("cannot find entry WSAAsyncSelect (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+HANDLE PASCAL
+_org_WSAAsyncGetHostByAddr(HWND a0, u_int a1, const char* a2, int a3, int a4, char* a5, int a6)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, const char* a2, int a3, int a4, char* a5, int a6);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_WSAAsyncGetHostByAddr() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetHostByAddr")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetHostByAddr (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6);
+}
+
+HANDLE PASCAL
+_org_WSAAsyncGetHostByName(HWND a0, u_int a1, const char* a2, char* a3, int a4)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, const char* a2, char* a3, int a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_WSAAsyncGetHostByName() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetHostByName")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetHostByName (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+HANDLE PASCAL
+WSAAsyncGetProtoByNumber(HWND a0, u_int a1, int a2, char* a3, int a4)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, int a2, char* a3, int a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncGetProtoByNumber() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetProtoByNumber")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetProtoByNumber (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+HANDLE PASCAL
+WSAAsyncGetProtoByName(HWND a0, u_int a1, const char* a2, char* a3, int a4)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, const char* a2, char* a3, int a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncGetProtoByName() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetProtoByName")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetProtoByName (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+HANDLE PASCAL
+WSAAsyncGetServByPort(HWND a0, u_int a1, int a2, const char* a3, char* a4, int a5)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, int a2, const char* a3, char* a4, int a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncGetServByPort() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetServByPort")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetServByPort (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+HANDLE PASCAL
+WSAAsyncGetServByName(HWND a0, u_int a1, const char* a2, const char* a3, char* a4, int a5)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, const char* a2, const char* a3, char* a4, int a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncGetServByName() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetServByName")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetServByName (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+int PASCAL
+WSACancelAsyncRequest(HANDLE a0)
+{
+ static int (PASCAL *fp)(HANDLE a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSACancelAsyncRequest() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSACancelAsyncRequest")) == NULL) {
+ FATAL("cannot find entry WSACancelAsyncRequest (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+FARPROC PASCAL
+WSASetBlockingHook(FARPROC a0)
+{
+ static FARPROC (PASCAL *fp)(FARPROC a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASetBlockingHook() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASetBlockingHook")) == NULL) {
+ FATAL("cannot find entry WSASetBlockingHook (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+WSAUnhookBlockingHook(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAUnhookBlockingHook() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAUnhookBlockingHook")) == NULL) {
+ FATAL("cannot find entry WSAUnhookBlockingHook (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int PASCAL
+WSAGetLastError(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAGetLastError() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAGetLastError")) == NULL) {
+ FATAL("cannot find entry WSAGetLastError (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+void PASCAL
+WSASetLastError(int a0)
+{
+ static void (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASetLastError() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASetLastError")) == NULL) {
+ FATAL("cannot find entry WSASetLastError (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ (*fp)(a0);
+}
+
+int PASCAL
+WSACancelBlockingCall(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSACancelBlockingCall() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSACancelBlockingCall")) == NULL) {
+ FATAL("cannot find entry WSACancelBlockingCall (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+BOOL PASCAL
+WSAIsBlocking(void)
+{
+ static BOOL (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAIsBlocking() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAIsBlocking")) == NULL) {
+ FATAL("cannot find entry WSAIsBlocking (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int PASCAL
+WSAStartup(WORD a0, LPWSADATA a1)
+{
+ static int (PASCAL *fp)(WORD a0, LPWSADATA a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAStartup() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAStartup")) == NULL) {
+ FATAL("cannot find entry WSAStartup (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+WSACleanup(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSACleanup() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSACleanup")) == NULL) {
+ FATAL("cannot find entry WSACleanup (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int PASCAL
+__WSAFDIsSet(SOCKET a0, fd_set* a1)
+{
+ static int (PASCAL *fp)(SOCKET a0, fd_set* a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub __WSAFDIsSet() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "__WSAFDIsSet")) == NULL) {
+ FATAL("cannot find entry __WSAFDIsSet (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+WEP(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WEP() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WEP")) == NULL) {
+ FATAL("cannot find entry WEP (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int PASCAL
+WSCWriteNameSpaceOrder(int a0, int a1)
+{
+ static int (PASCAL *fp)(int a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCWriteNameSpaceOrder() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCWriteNameSpaceOrder")) == NULL) {
+ FATAL("cannot find entry WSCWriteNameSpaceOrder (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+WSCWriteProviderOrder(LPDWORD a0, DWORD a1)
+{
+ static int (PASCAL *fp)(LPDWORD a0, DWORD a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCWriteProviderOrder() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCWriteProviderOrder")) == NULL) {
+ FATAL("cannot find entry WSCWriteProviderOrder (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+WSANSPIoctl(HANDLE a0, DWORD a1, LPVOID a2, DWORD a3, LPVOID a4, DWORD a5, LPDWORD a6, LPVOID a7)
+{
+ static int (PASCAL *fp)(HANDLE a0, DWORD a1, LPVOID a2, DWORD a3, LPVOID a4, DWORD a5, LPDWORD a6, LPVOID a7);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSANSPIoctl() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSANSPIoctl")) == NULL) {
+ FATAL("cannot find entry WSANSPIoctl (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6, a7);
+}
+
+int PASCAL
+WSCUpdateProvider(LPGUID a0, const WCHAR FAR* a1, const LPVOID a2, DWORD a3, LPINT a4)
+{
+ static int (PASCAL *fp)(LPGUID a0, const WCHAR FAR* a1, const LPVOID a2, DWORD a3, LPINT a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCUpdateProvider() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCUpdateProvider")) == NULL) {
+ FATAL("cannot find entry WSCUpdateProvider (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+int PASCAL
+_org_getaddrinfo(const char* a0, const char* a1, LPVOID a2, LPVOID a3)
+{
+ static int (PASCAL *fp)(const char* a0, const char* a1, LPVOID a2, LPVOID a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_getaddrinfo() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getaddrinfo")) == NULL) {
+ FATAL("cannot find entry getaddrinfo (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+void PASCAL
+_org_freeaddrinfo(LPVOID a0)
+{
+ static void (PASCAL *fp)(LPVOID a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_freeaddrinfo() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "freeaddrinfo")) == NULL) {
+ FATAL("cannot find entry freeaddrinfo (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ (*fp)(a0);
+}
+
+int PASCAL
+_org_getnameinfo(LPVOID a0, DWORD a1, char* a2, DWORD a3, char* a4, DWORD a5, int a6)
+{
+ static int (PASCAL *fp)(LPVOID a0, DWORD a1, char* a2, DWORD a3, char* a4, DWORD a5, int a6);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_getnameinfo() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getnameinfo")) == NULL) {
+ FATAL("cannot find entry getnameinfo (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6);
+}
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock20/make.wnt b/contrib/idn/idnkit-1.0-src/wsock/wsock20/make.wnt
new file mode 100644
index 0000000..b5283aa
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock20/make.wnt
@@ -0,0 +1,97 @@
+#
+# Makefile for WinSock Wrapper (for WinSock 2.0)
+#
+
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+!include <win32.mak>
+
+SYSLIBS = $(libcdll) kernel32.lib advapi32.lib user32.lib
+
+#
+# Files to use
+#
+
+HDRS = dlldef.h ..\common\wrapcommon.h
+SRCS = dllmain.c dllload.obj dllfunc.c dllstub.c
+OBJS = dllmain.obj dllload.obj dllfunc.obj
+LIBS = ..\common\wrapcommon.lib ..\..\lib\idnkit.lib ..\..\win\iconv.lib
+
+cflags = $(cflags) -I..\..\include
+
+#
+# Targets to Build
+#
+
+TARGETS = ws2_32.dll
+
+all : $(TARGETS)
+
+ws2_32.dll : ws2_32.def $(OBJS) $(LIBS)
+ $(link) $(dlllflags) /OUT:ws2_32.dll /DEF:ws2_32.def $(OBJS) $(LIBS) $(SYSLIBS)
+
+install : $(TARGETS)
+ copy ws2_32.dll ..\bin
+
+clean : force
+ -del *.obj
+ -del *.lib
+ -del *.dll
+ -del *.exp
+
+#
+# Dependencies
+#
+
+dllmain.obj : dllmain.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+dllload.obj : dllload.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+dllfunc.obj : dllfunc.c dllstub.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+ws2_32o.lib : ws2_32o.def
+ LIB /DEF:ws2_32o.def /MACHINE:IX86
+
+force:
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock20/ws2_32.def b/contrib/idn/idnkit-1.0-src/wsock/wsock20/ws2_32.def
new file mode 100644
index 0000000..ba9a44c
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock20/ws2_32.def
@@ -0,0 +1,120 @@
+;
+; Library Defition for idn wrapper's wrapper DLL
+;
+LIBRARY ws2_32
+DESCRIPTION "JPNIC idn warpper DLL for WS2_32"
+EXPORTS
+ accept @1
+ bind @2
+ closesocket @3
+ connect @4
+ getpeername @5
+ getsockname @6
+ getsockopt @7
+ htonl @8
+ htons @9
+ ioctlsocket @10
+ inet_addr @11
+ inet_ntoa @12
+ listen @13
+ ntohl @14
+ ntohs @15
+ recv @16
+ recvfrom @17
+ select @18
+ send @19
+ sendto @20
+ setsockopt @21
+ shutdown @22
+ socket @23
+ WSApSetPostRoutine @24
+ WPUCompleteOverlappedRequest @25
+ WSAAccept @26
+ WSAAddressToStringA @27
+ WSAAddressToStringW @28
+ WSACloseEvent @29
+ WSAConnect @30
+ WSACreateEvent @31
+ WSADuplicateSocketA @32
+ WSADuplicateSocketW @33
+ WSAEnumNameSpaceProvidersA @34
+ WSAEnumNameSpaceProvidersW @35
+ WSAEnumNetworkEvents @36
+ WSAEnumProtocolsA @37
+ WSAEnumProtocolsW @38
+ WSAEventSelect @39
+ WSAGetOverlappedResult @40
+ WSAGetQOSByName @41
+ WSAGetServiceClassInfoA @42
+ WSAGetServiceClassInfoW @43
+ WSAGetServiceClassNameByClassIdA @44
+ WSAGetServiceClassNameByClassIdW @45
+ WSAHtonl @46
+ WSAHtons @47
+ WSAInstallServiceClassA @48
+ WSAInstallServiceClassW @49
+ WSAIoctl @50
+ gethostbyaddr @51
+ gethostbyname @52
+ getprotobyname @53
+ getprotobynumber @54
+ getservbyname @55
+ getservbyport @56
+ gethostname @57
+ WSAJoinLeaf @58
+ WSALookupServiceBeginA @59
+ WSALookupServiceBeginW @60
+ WSALookupServiceEnd @61
+ WSALookupServiceNextA @62
+ WSALookupServiceNextW @63
+ WSANtohl @64
+ WSANtohs @65
+ WSAProviderConfigChange @66
+ WSARecv @67
+ WSARecvDisconnect @68
+ WSARecvFrom @69
+ WSARemoveServiceClass @70
+ WSAResetEvent @71
+ WSASend @72
+ WSASendDisconnect @73
+ WSASendTo @74
+ WSASetEvent @75
+ WSASetServiceA @76
+ WSASetServiceW @77
+ WSASocketA @78
+ WSASocketW @79
+ WSAStringToAddressA @80
+ WSAStringToAddressW @81
+ WSAWaitForMultipleEvents @82
+ WSCDeinstallProvider @83
+ WSCEnableNSProvider @84
+ WSCEnumProtocols @85
+ WSCGetProviderPath @86
+ WSCInstallNameSpace @87
+ WSCInstallProvider @88
+ WSCUnInstallNameSpace @89
+ WSCWriteNameSpaceOrder @90
+ WSCWriteProviderOrder @91
+ freeaddrinfo @94
+ getaddrinfo @95
+ getnameinfo @96
+ WSAAsyncSelect @101
+ WSAAsyncGetHostByAddr @102
+ WSAAsyncGetHostByName @103
+ WSAAsyncGetProtoByNumber @104
+ WSAAsyncGetProtoByName @105
+ WSAAsyncGetServByPort @106
+ WSAAsyncGetServByName @107
+ WSACancelAsyncRequest @108
+ WSASetBlockingHook @109
+ WSAUnhookBlockingHook @110
+ WSAGetLastError @111
+ WSASetLastError @112
+ WSACancelBlockingCall @113
+ WSAIsBlocking @114
+ WSAStartup @115
+ WSACleanup @116
+ __WSAFDIsSet @151
+ WEP @500
+ WSANSPIoctl @600
+ WSCUpdateProvider @601
diff --git a/contrib/linux/coredump-patch b/contrib/linux/coredump-patch
new file mode 100644
index 0000000..d179290
--- /dev/null
+++ b/contrib/linux/coredump-patch
@@ -0,0 +1,12 @@
+--- binfmt_elf.c.old Mon Dec 11 10:49:57 2000
++++ binfmt_elf.c Wed Nov 1 13:05:23 2000
+@@ -1091,7 +1091,8 @@
+
+ if (!current->dumpable ||
+ limit < ELF_EXEC_PAGESIZE ||
+- atomic_read(&current->mm->count) != 1)
++/* atomic_read(&current->mm->count) != 1) */
++ test_and_set_bit(31, &current->mm->def_flags) != 0)
+ return 0;
+ current->dumpable = 0;
+
diff --git a/contrib/named-bootconf/named-bootconf.sh b/contrib/named-bootconf/named-bootconf.sh
new file mode 100644
index 0000000..029e35b
--- /dev/null
+++ b/contrib/named-bootconf/named-bootconf.sh
@@ -0,0 +1,314 @@
+#!/bin/sh
+#
+# Portions Copyright (C) 2004, 2006, 2007 Internet Systems Consortium, Inc. ("ISC")
+# Portions Copyright (C) 1999-2001 Internet Software Consortium.
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+# $Id: named-bootconf.sh,v 1.12 2007/06/19 23:47:07 tbox Exp $
+
+# $NetBSD: named-bootconf.sh,v 1.5 1998/12/15 01:00:53 tron Exp $
+#
+# Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Matthias Scheler.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by the NetBSD
+# Foundation, Inc. and its contributors.
+# 4. Neither the name of The NetBSD Foundation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+if [ ${OPTIONFILE-X} = X ]; then
+ WORKDIR=/tmp/`date +%s`.$$
+ ( umask 077 ; mkdir $WORKDIR ) || {
+ echo "unable to create work directory '$WORKDIR'" >&2
+ exit 1
+ }
+ OPTIONFILE=$WORKDIR/options
+ ZONEFILE=$WORKDIR/zones
+ COMMENTFILE=$WORKDIR/comments
+ export OPTIONFILE ZONEFILE COMMENTFILE
+ touch $OPTIONFILE $ZONEFILE $COMMENTFILE
+ DUMP=1
+else
+ DUMP=0
+fi
+
+while read CMD ARGS; do
+ class=
+ CMD=`echo "${CMD}" | tr '[A-Z]' '[a-z]'`
+ case $CMD in
+ \; )
+ echo \# $ARGS >>$COMMENTFILE
+ ;;
+ cache )
+ set - X $ARGS
+ shift
+ if [ $# -eq 2 ]; then
+ (echo ""
+ cat $COMMENTFILE
+ echo "zone \"$1\" {"
+ echo " type hint;"
+ echo " file \"$2\";"
+ echo "};") >>$ZONEFILE
+ rm -f $COMMENTFILE
+ touch $COMMENTFILE
+ fi
+ ;;
+ directory )
+ set - X $ARGS
+ shift
+ if [ $# -eq 1 ]; then
+ (cat $COMMENTFILE
+ echo " directory \"$1\";") >>$OPTIONFILE
+ rm -f $COMMENTFILE
+ touch $COMMENTFILE
+
+ DIRECTORY=$1
+ export DIRECTORY
+ fi
+ ;;
+ forwarders )
+ (cat $COMMENTFILE
+ echo " forwarders {"
+ for ARG in $ARGS; do
+ echo " $ARG;"
+ done
+ echo " };") >>$OPTIONFILE
+ rm -f $COMMENTFILE
+ touch $COMMENTFILE
+ ;;
+ include )
+ if [ "$ARGS" != "" ]; then
+ (cd ${DIRECTORY-.}; cat $ARGS) | $0
+ fi
+ ;;
+ limit )
+ ARGS=`echo "${ARGS}" | tr '[A-Z]' '[a-z]'`
+ set - X $ARGS
+ shift
+ if [ $# -eq 2 ]; then
+ cat $COMMENTFILE >>$OPTIONFILE
+ case $1 in
+ datasize | files | transfers-in | transfers-per-ns )
+ echo " $1 $2;" >>$OPTIONFILE
+ ;;
+ esac
+ rm -f $COMMENTFILE
+ touch $COMMENTFILE
+ fi
+ ;;
+ options )
+ ARGS=`echo "${ARGS}" | tr '[A-Z]' '[a-z]'`
+ cat $COMMENTFILE >>$OPTIONFILE
+ for ARG in $ARGS; do
+ case $ARG in
+ fake-iquery )
+ echo " fake-iquery yes;" >>$OPTIONFILE
+ ;;
+ forward-only )
+ echo " forward only;" >>$OPTIONFILE
+ ;;
+ no-fetch-glue )
+ echo " fetch-glue no;" >>$OPTIONFILE
+ ;;
+ no-recursion )
+ echo " recursion no;" >>$OPTIONFILE
+ ;;
+ esac
+ done
+ rm -f $COMMENTFILE
+ touch $COMMENTFILE
+ ;;
+ primary|primary/* )
+ case $CMD in
+ primary/chaos )
+ class="chaos "
+ ;;
+ primary/hs )
+ class="hesiod "
+ ;;
+ esac
+ set - X $ARGS
+ shift
+ if [ $# -eq 2 ]; then
+ (echo ""
+ cat $COMMENTFILE
+ echo "zone \"$1\" ${class}{"
+ echo " type master;"
+ echo " file \"$2\";"
+ echo "};") >>$ZONEFILE
+ rm -f $COMMENTFILE
+ touch $COMMENTFILE
+ fi
+ ;;
+ secondary|secondary/* )
+ case $CMD in
+ secondary/chaos )
+ class="chaos "
+ ;;
+ secondary/hs )
+ class="hesiod "
+ ;;
+ esac
+ set - X $ARGS
+ shift
+ if [ $# -gt 2 ]; then
+ ZONE=$1
+ shift
+ PRIMARIES=$1
+ while [ $# -gt 2 ]; do
+ shift
+ PRIMARIES="$PRIMARIES $1"
+ done
+ (echo ""
+ cat $COMMENTFILE
+ echo "zone \"$ZONE\" ${class}{"
+ echo " type slave;"
+ echo " file \"$2\";"
+ echo " masters {"
+ for PRIMARY in $PRIMARIES; do
+ echo " $PRIMARY;"
+ done
+ echo " };"
+ echo "};") >>$ZONEFILE
+ rm -f $COMMENTFILE
+ touch $COMMENTFILE
+ fi
+ ;;
+ stub|stub/* )
+ case $CMD in
+ stub/chaos )
+ class="chaos "
+ ;;
+ stub/hs )
+ class="hesiod "
+ ;;
+ esac
+ set - X $ARGS
+ shift
+ if [ $# -gt 2 ]; then
+ ZONE=$1
+ shift
+ PRIMARIES=$1
+ while [ $# -gt 2 ]; do
+ shift
+ PRIMARIES="$PRIMARIES $1"
+ done
+ (echo ""
+ cat $COMMENTFILE
+ echo "zone \"$ZONE\" ${class}{"
+ echo " type stub;"
+ echo " file \"$2\";"
+ echo " masters {"
+ for PRIMARY in $PRIMARIES; do
+ echo " $PRIMARY;"
+ done
+ echo " };"
+ echo "};") >>$ZONEFILE
+ rm -f $COMMENTFILE
+ touch $COMMENTFILE
+ fi
+ ;;
+ slave )
+ cat $COMMENTFILE >>$OPTIONFILE
+ echo " forward only;" >>$OPTIONFILE
+ rm -f $COMMENTFILE
+ touch $COMMENTFILE
+ ;;
+ sortlist )
+ (cat $COMMENTFILE
+ echo " topology {"
+ for ARG in $ARGS; do
+ case $ARG in
+ *.0.0.0 )
+ echo " $ARG/8;"
+ ;;
+ *.0.0 )
+ echo " $ARG/16;"
+ ;;
+ *.0 )
+ echo " $ARG/24;"
+ ;;
+ * )
+ echo " $ARG;"
+ ;;
+ esac
+ done
+ echo " };") >>$OPTIONFILE
+ rm -f $COMMENTFILE
+ touch $COMMENTFILE
+ ;;
+ tcplist | xfrnets )
+ (cat $COMMENTFILE
+ echo " allow-transfer {"
+ for ARG in $ARGS; do
+ case $ARG in
+ *.0.0.0 )
+ echo " $ARG/8;"
+ ;;
+ *.0.0 )
+ echo " $ARG/16;"
+ ;;
+ *.0 )
+ echo " $ARG/24;"
+ ;;
+ * )
+ echo " $ARG;"
+ ;;
+ esac
+ done
+ echo " };") >>$OPTIONFILE
+ rm -f $COMMENTFILE
+ touch $COMMENTFILE
+ ;;
+ esac
+done
+
+if [ $DUMP -eq 1 ]; then
+ echo ""
+ echo "options {"
+ cat $OPTIONFILE
+ echo "};"
+ cat $ZONEFILE $COMMENTFILE
+
+ rm -f $OPTIONFILE $ZONEFILE $COMMENTFILE
+ rmdir $WORKDIR
+fi
+
+exit 0
diff --git a/contrib/nanny/nanny.pl b/contrib/nanny/nanny.pl
new file mode 100644
index 0000000..16ecf1f
--- /dev/null
+++ b/contrib/nanny/nanny.pl
@@ -0,0 +1,55 @@
+#!/usr/bin/perl
+#
+# Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2000, 2001 Internet Software Consortium.
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+# $Id: nanny.pl,v 1.11 2007/06/19 23:47:07 tbox Exp $
+
+# A simple nanny to make sure named stays running.
+
+$pid_file_location = '/var/run/named.pid';
+$nameserver_location = 'localhost';
+$dig_program = 'dig';
+$named_program = 'named';
+
+fork() && exit();
+
+for (;;) {
+ $pid = 0;
+ open(FILE, $pid_file_location) || goto restart;
+ $pid = <FILE>;
+ close(FILE);
+ chomp($pid);
+
+ $res = kill 0, $pid;
+
+ goto restart if ($res == 0);
+
+ $dig_command =
+ "$dig_program +short . \@$nameserver_location > /dev/null";
+ $return = system($dig_command);
+ goto restart if ($return == 9);
+
+ sleep 30;
+ next;
+
+ restart:
+ if ($pid != 0) {
+ kill 15, $pid;
+ sleep 30;
+ }
+ system ($named_program);
+ sleep 120;
+}
diff --git a/contrib/nslint-2.1a3/CHANGES b/contrib/nslint-2.1a3/CHANGES
new file mode 100644
index 0000000..c425e01
--- /dev/null
+++ b/contrib/nslint-2.1a3/CHANGES
@@ -0,0 +1,191 @@
+@(#) $Id: CHANGES,v 1.1 2001/12/21 04:12:02 marka Exp $ (LBL)
+
+v2.1 Wed Aug 22 18:30:35 PDT 2001
+
+- Handle "srv" records.
+
+- Fix some ttl parsing problems.
+
+- Add "ignore" option
+
+v2.0.2 Tue Mar 20 17:49:13 PST 2001
+
+- Allow missing trailing dot in certain special cases.
+
+- Include zone names when checking NS records.
+
+- Document nslint.conf network keyword.
+
+v2.0.1 Tue Dec 14 11:24:31 PST 1999
+
+- Handle $ttl.
+
+- Fix some minor portability/compiler problems for OSF 4.
+
+- Correctly detect mx records that point to themselves but not a
+ real "a" record.
+
+- Fix file descriptor leak in doconf(). Thanks to Paul McIlfatrick
+ (paul.mcilfatrick@bt.com)
+
+v2.0 Wed Dec 9 16:48:54 PST 1998
+
+- Add support for BIND 8 named.conf file.
+
+- Support protocols in addition to tcp and udp for WKS records.
+ Resulted from a bug report from Petter Reinholdtsen (pere@td.org.uit.no)
+
+- Support dotted serial numbers in SOA records. Resulted from a
+ bug report from Frank Ederveen (frank@our.domaintje.com)
+
+- Ignore unknown statements and options in named.boot and named.conf
+ (instead of issuing warnings).
+
+- Handle '#' and C style named.conf comments.
+
+- Handle optional "in" in named.conf zone statements. Reported by
+ DJ Coster (djc@discoverbrokerage.com)
+
+- Add support for include directives in named.boot and named.conf.
+
+- Redo differing ttls check and do mx records in addition to a
+ records. Change place where soa values gets zeroed so they don't
+ get clobbered when we use includes.
+
+- Allow "@" abbr. for ptr, mx, cname and ns records.
+
+- Detect cname referenced by another cname or mx record.
+
+- Handle chaos records (to some minor extent).
+
+v1.7 Tue Jul 22 14:26:21 PDT 1997
+
+- Report differing ttls in A records. Check SOA records.
+
+- Detect hosts with more than one ip address on a subnet.
+
+v1.6.1 Sat Jun 7 03:12:01 PDT 1997
+
+- Fix "unknown service" printf format.
+
+- Fix off-by-one error in the ptr parsing code. Thanks to Andreas
+ Lamprecht (andreas.lamprecht@siemens.at)
+
+- Fix broken $origin code.
+
+v1.6 Mon Apr 7 19:09:52 PDT 1997
+
+- Add support for classless delegation.
+
+- Fix some case sensitive bugs.
+
+- Report domain names outside the current zone.
+
+- Fixed off-by-one bug that broke single character hostnames.
+
+- Increase size of hash table.
+
+- Make tcp and udp service name tables dynamic.
+
+- Improved error message for garbage in /etc/services.
+
+v1.5.1 Thu Jul 18 21:44:44 PDT 1996
+
+- Use $CC when checking gcc version. Thanks to Carl Lindberg
+ (carl_lindberg@blacksmith.com)
+
+- Raise size of hash table to 65K.
+
+v1.5 Fri Jul 12 18:58:47 PDT 1996
+
+- Detect extra octets and other garbage in PTR records.
+
+- Handle multi-line WKS records.
+
+- Allow multple WKS records (since we can have udp and tcp).
+
+- Convert to autoconf.
+
+- Declare optarg, optind and opterr extern. Thanks to Howard Moftich
+ (howardm@lsil.com).
+
+- BS/DOS does not have malloc.h. Thanks to Jordan Hayes
+ (jordan@thinkbank.com).
+
+- Correctly handle named.boot comments with leading whitespace.
+
+- Handle fully specified in-addr.arpa records. Resulted from a bug
+ report from Joe Kelly (joe@gol.com).
+
+- Fix endian problems. Thanks to Carl Lindberg (carl_lindberg@blacksmith.com).
+
+- Fixed some mixed case problems.
+
+- Update man page to describe how nslint.boot works.
+
+v1.4 Sat Jun 3 23:38:14 PDT 1995
+
+- Allow TXT records to exist with no other records.
+
+- Full system prototypes.
+
+- Complain about extra arguments.
+
+- Detect MX record chains.
+
+- Handle single line SOA records correctly. Thanks to Edward J. O'Brien
+ (ejobrie@sam.wal-mart.com)
+
+v1.3 Wed Mar 8 17:27:20 PST 1995
+
+- Add "allowdupa" record type for use with nslint.boot. This allows ip
+ addresses to have multiple A records.
+
+- Fixed bug that caused dangling cname references to not be reported
+ properly. Thanks to Edward J. O'Brien (ejobrie@sam.wal-mart.com).
+
+v1.2 Thu Sep 1 15:55:38 PDT 1994
+
+- Allow hostnames with a leading numeric as per rfc1123. Thanks to Bill
+ Gianopoulos (wag@sccux1.msd.ray.com).
+
+- Remove (undocumented) -u flag and allow uppercase.
+
+- Support TXT records. Thanks to Paul Pomes (paul@uxc.cso.uiuc.edu).
+
+- Support RP records.
+
+- Ignore new bind keywords.
+
+- Fix bug where we could exit with a zero status even though errors had
+ been detected
+
+- Complain about hosts that have smtp/tcp WKS entries but no MX records.
+
+- Add -B flag to handle PTR records that point outside the domains
+ listed in named.boot.
+
+v1.1 Sun May 22 20:43:03 PDT 1994
+
+- Allow ns records with no a records (the preferred way to go).
+
+- Fix typos in the sawstr array.
+
+- Use string.h instead of strings.h and add rindex(), index() and
+ bzero() macros for SYSV compatibility. Thanks to Bill King
+ (wrk@cle.ab.com).
+
+- Handle $origin directives. Thanks to Bill Gianopoulos
+ (wag@sccux1.msd.ray.com).
+
+- Fix add_domain() to work for the root. Thanks to Bill Gianopoulos.
+
+- Handle quotes in hinfo records. Thanks to Bill Gianopoulos.
+
+- Fix endian problems in parseinaddr() and parseptr().
+
+- Check non in-addr.arpa names for cname conflicts.
+
+v1.0 Thu Apr 21 11:02:59 PDT 1994
+
+- Initial release.
diff --git a/contrib/nslint-2.1a3/FILES b/contrib/nslint-2.1a3/FILES
new file mode 100644
index 0000000..ddb8d44
--- /dev/null
+++ b/contrib/nslint-2.1a3/FILES
@@ -0,0 +1,24 @@
+CHANGES
+FILES
+INSTALL
+Makefile.in
+README
+VERSION
+aclocal.m4
+config.guess
+config.sub
+configure
+configure.in
+install-sh
+lbl/gnuc.h
+lbl/os-irix5.h
+lbl/os-osf3.h
+lbl/os-solaris2.h
+lbl/os-sunos4.h
+lbl/os-ultrix4.h
+mkdep
+nslint.8
+nslint.c
+savestr.c
+savestr.h
+strerror.c
diff --git a/contrib/nslint-2.1a3/INSTALL b/contrib/nslint-2.1a3/INSTALL
new file mode 100644
index 0000000..c92bfbe
--- /dev/null
+++ b/contrib/nslint-2.1a3/INSTALL
@@ -0,0 +1,42 @@
+@(#) $Header: /proj/cvs/prod/bind9/contrib/nslint-2.1a3/INSTALL,v 1.1 2001/12/21 04:12:02 marka Exp $ (LBL)
+
+You will need an ANSI C compiler to build nslint. The configure
+script will abort if your compiler is not ANSI compliant. If this
+happens, use the GNU C compiler, available via anonymous ftp:
+
+ ftp://prep.ai.mit.edu/pub/gnu/gcc.tar.gz
+
+If necessary, edit the BINDEST and MANDEST paths in Makefile.in
+and run ./configure (a shell script). "configure" will determine
+your system attributes and generate an appropriate Makefile from
+Makefile.in. Now build nslint by running "make".
+
+If everything builds ok, su and type "make install" (and optionally
+"make install-man). This will install nslint and its manual entry.
+
+If your system is not one which we have tested nslint on, you may
+have to modify the configure script and Makefile.in. Please send
+us patches for any modifications you need to make.
+
+FILES
+-----
+CHANGES - description of differences between releases
+FILES - list of files exported as part of the distribution
+INSTALL - this file
+Makefile.in - compilation rules (input to the configure script)
+README - description of distribution
+VERSION - version of this release
+aclocal.m4 - autoconf macros
+config.guess - autoconf support
+config.sub - autoconf support
+configure - configure script (run this first)
+configure.in - configure script source
+install-sh - BSD style install script
+lbl/gnuc.h - gcc macros and defines
+lbl/os-*.h - os dependent defines and prototypes
+mkdep - construct Makefile dependency list
+nslint.8 - manual entry
+nslint.c - main program
+savestr.c - strdup() replacement
+savestr.h - savestr prototypes
+strerror.c - missing routine
diff --git a/contrib/nslint-2.1a3/Makefile.in b/contrib/nslint-2.1a3/Makefile.in
new file mode 100644
index 0000000..60ed017
--- /dev/null
+++ b/contrib/nslint-2.1a3/Makefile.in
@@ -0,0 +1,122 @@
+# Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997, 2000
+# The Regents of the University of California. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that: (1) source code distributions
+# retain the above copyright notice and this paragraph in its entirety, (2)
+# distributions including binary code include the above copyright notice and
+# this paragraph in its entirety in the documentation or other materials
+# provided with the distribution, and (3) all advertising materials mentioning
+# features or use of this software display the following acknowledgement:
+# ``This product includes software developed by the University of California,
+# Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+# the University nor the names of its contributors may be used to endorse
+# or promote products derived from this software without specific prior
+# written permission.
+# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+#
+# @(#) $Id: Makefile.in,v 1.2 2004/07/20 07:13:40 marka Exp $ (LBL)
+
+#
+# Various configurable paths (remember to edit Makefile.in, not Makefile)
+#
+
+# Top level hierarchy
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+# Pathname of directory to install the binary
+BINDEST = @bindir@
+# Pathname of directory to install the man page
+MANDEST = @mandir@
+
+# VPATH
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+#
+# You shouldn't need to edit anything below here.
+#
+
+PROG = nslint
+CC = @CC@
+CCOPT = @V_CCOPT@
+INCLS = @V_INCLS@
+DEFS = @DEFS@
+
+# Standard CFLAGS
+CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
+
+# Standard LIBS
+LIBS = @LIBS@
+
+INSTALL = @INSTALL@
+
+# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
+# Also, gcc does not remove the .o before forking 'as', which can be a
+# problem if you don't own the file but can write to the directory.
+.c.o:
+ @rm -f $@
+ $(CC) $(CFLAGS) -c $(srcdir)/$*.c
+
+CSRC = nslint.c savestr.c
+GENSRC = version.c
+
+SRC = $(CSRC) $(GENSRC)
+
+# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
+# hack the extra indirection
+OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o) @LIBOBJS@
+
+TAGHDR = \
+ /usr/include/sys/types.h \
+ /usr/include/netinet/in.h
+
+TAGFILES = $(SRC) $(TAGHDR)
+
+CLEANFILES = $(PROG) $(OBJ) $(GENSRC)
+
+$(PROG): $(OBJ)
+ @rm -f $@
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
+
+version.o: version.c
+version.c: $(srcdir)/VERSION
+ @rm -f $@
+ sed -e 's/.*/char version[] = "&";/' $(srcdir)/VERSION > $@
+
+install: force
+ $(INSTALL) -m 555 -o bin -g bin $(PROG) $(DESTDIR)$(BINDEST)/$(PROG)
+
+install-man: force
+ $(INSTALL) -m 444 -o bin -g bin $(srcdir)/$(PROG).8 \
+ $(DESTDIR)$(MANDEST)/man8/$(PROG).8
+
+clean: force
+ rm -f $(CLEANFILES)
+
+distclean: force
+ rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
+ gnuc.h os-proto.h
+
+tags: $(TAGFILES)
+ ctags -wtd $(TAGFILES)
+
+tar: force
+ @cwd=`pwd` ; name=$(PROG)-`cat VERSION` ; \
+ list="" ; tar="tar chf" ; temp="$$name.tar.gz" ; \
+ for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
+ echo \
+ "rm -f $$name; ln -s . $$name" ; \
+ rm -f $$name; ln -s . $$name ; \
+ echo \
+ "$$tar - [lots of files] | gzip > $$temp" ; \
+ $$tar - $$list | gzip > $$temp ; \
+ echo \
+ "rm -f $$name" ; \
+ rm -f $$name
+
+force: /tmp
+depend: $(GENSRC) force
+ ./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
diff --git a/contrib/nslint-2.1a3/README b/contrib/nslint-2.1a3/README
new file mode 100644
index 0000000..39f0202
--- /dev/null
+++ b/contrib/nslint-2.1a3/README
@@ -0,0 +1,14 @@
+@(#) $Id: README,v 1.1 2001/12/21 04:12:02 marka Exp $ (LBL)
+
+NSLINT 2.0
+Lawrence Berkeley National Laboratory
+Network Research Group
+nslint@ee.lbl.gov
+ftp://ftp.ee.lbl.gov/nslint.tar.gz
+
+This directory contains source code for nslint, a lint program for dns
+files.
+
+Please send bugs and comments to nslint@ee.lbl.gov.
+
+ - Craig Leres
diff --git a/contrib/nslint-2.1a3/VERSION b/contrib/nslint-2.1a3/VERSION
new file mode 100644
index 0000000..375279c
--- /dev/null
+++ b/contrib/nslint-2.1a3/VERSION
@@ -0,0 +1 @@
+2.1a3
diff --git a/contrib/nslint-2.1a3/aclocal.m4 b/contrib/nslint-2.1a3/aclocal.m4
new file mode 100644
index 0000000..9f1d33f
--- /dev/null
+++ b/contrib/nslint-2.1a3/aclocal.m4
@@ -0,0 +1,765 @@
+dnl @(#) $Header: /proj/cvs/prod/bind9/contrib/nslint-2.1a3/aclocal.m4,v 1.1 2001/12/21 04:12:03 marka Exp $ (LBL)
+dnl
+dnl Copyright (c) 1995, 1996, 1997, 1998, 1999
+dnl The Regents of the University of California. All rights reserved.
+dnl
+dnl Redistribution and use in source and binary forms, with or without
+dnl modification, are permitted provided that: (1) source code distributions
+dnl retain the above copyright notice and this paragraph in its entirety, (2)
+dnl distributions including binary code include the above copyright notice and
+dnl this paragraph in its entirety in the documentation or other materials
+dnl provided with the distribution, and (3) all advertising materials mentioning
+dnl features or use of this software display the following acknowledgement:
+dnl ``This product includes software developed by the University of California,
+dnl Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+dnl the University nor the names of its contributors may be used to endorse
+dnl or promote products derived from this software without specific prior
+dnl written permission.
+dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+dnl WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+dnl
+dnl LBL autoconf macros
+dnl
+
+dnl
+dnl Determine which compiler we're using (cc or gcc)
+dnl If using gcc, determine the version number
+dnl If using cc, require that it support ansi prototypes
+dnl If using gcc, use -O2 (otherwise use -O)
+dnl If using cc, explicitly specify /usr/local/include
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_C_INIT(copt, incls)
+dnl
+dnl results:
+dnl
+dnl $1 (copt set)
+dnl $2 (incls set)
+dnl CC
+dnl LDFLAGS
+dnl LBL_CFLAGS
+dnl
+AC_DEFUN(AC_LBL_C_INIT,
+ [AC_PREREQ(2.12)
+ AC_BEFORE([$0], [AC_PROG_CC])
+ AC_BEFORE([$0], [AC_LBL_FIXINCLUDES])
+ AC_BEFORE([$0], [AC_LBL_DEVEL])
+ AC_ARG_WITH(gcc, [ --without-gcc don't use gcc])
+ $1="-O"
+ $2=""
+ if test "${srcdir}" != "." ; then
+ $2="-I\$\(srcdir\)"
+ fi
+ if test "${CFLAGS+set}" = set; then
+ LBL_CFLAGS="$CFLAGS"
+ fi
+ if test -z "$CC" ; then
+ case "$target_os" in
+
+ bsdi*)
+ AC_CHECK_PROG(SHLICC2, shlicc2, yes, no)
+ if test $SHLICC2 = yes ; then
+ CC=shlicc2
+ export CC
+ fi
+ ;;
+ esac
+ fi
+ if test -z "$CC" -a "$with_gcc" = no ; then
+ CC=cc
+ export CC
+ fi
+ AC_PROG_CC
+ if test "$GCC" != yes ; then
+ AC_MSG_CHECKING(that $CC handles ansi prototypes)
+ AC_CACHE_VAL(ac_cv_lbl_cc_ansi_prototypes,
+ AC_TRY_COMPILE(
+ [#include <sys/types.h>],
+ [int frob(int, char *)],
+ ac_cv_lbl_cc_ansi_prototypes=yes,
+ ac_cv_lbl_cc_ansi_prototypes=no))
+ AC_MSG_RESULT($ac_cv_lbl_cc_ansi_prototypes)
+ if test $ac_cv_lbl_cc_ansi_prototypes = no ; then
+ case "$target_os" in
+
+ hpux*)
+ AC_MSG_CHECKING(for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE))
+ savedcflags="$CFLAGS"
+ CFLAGS="-Aa -D_HPUX_SOURCE $CFLAGS"
+ AC_CACHE_VAL(ac_cv_lbl_cc_hpux_cc_aa,
+ AC_TRY_COMPILE(
+ [#include <sys/types.h>],
+ [int frob(int, char *)],
+ ac_cv_lbl_cc_hpux_cc_aa=yes,
+ ac_cv_lbl_cc_hpux_cc_aa=no))
+ AC_MSG_RESULT($ac_cv_lbl_cc_hpux_cc_aa)
+ if test $ac_cv_lbl_cc_hpux_cc_aa = no ; then
+ AC_MSG_ERROR(see the INSTALL doc for more info)
+ fi
+ CFLAGS="$savedcflags"
+ $1="-Aa $$1"
+ AC_DEFINE(_HPUX_SOURCE)
+ ;;
+
+ *)
+ AC_MSG_ERROR(see the INSTALL doc for more info)
+ ;;
+ esac
+ fi
+ $2="$$2 -I/usr/local/include"
+ LDFLAGS="$LDFLAGS -L/usr/local/lib"
+
+ case "$target_os" in
+
+ irix*)
+ $1="$$1 -xansi -signed -g3"
+ ;;
+
+ osf*)
+ $1="$$1 -std1 -g3"
+ ;;
+
+ ultrix*)
+ AC_MSG_CHECKING(that Ultrix $CC hacks const in prototypes)
+ AC_CACHE_VAL(ac_cv_lbl_cc_const_proto,
+ AC_TRY_COMPILE(
+ [#include <sys/types.h>],
+ [struct a { int b; };
+ void c(const struct a *)],
+ ac_cv_lbl_cc_const_proto=yes,
+ ac_cv_lbl_cc_const_proto=no))
+ AC_MSG_RESULT($ac_cv_lbl_cc_const_proto)
+ if test $ac_cv_lbl_cc_const_proto = no ; then
+ AC_DEFINE(const,)
+ fi
+ ;;
+ esac
+ fi
+])
+
+dnl
+dnl Use pfopen.c if available and pfopen() not in standard libraries
+dnl Require libpcap
+dnl Look for libpcap in ..
+dnl Use the installed libpcap if there is no local version
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_LIBPCAP(pcapdep, incls)
+dnl
+dnl results:
+dnl
+dnl $1 (pcapdep set)
+dnl $2 (incls appended)
+dnl LIBS
+dnl LDFLAGS
+dnl LBL_LIBS
+dnl
+AC_DEFUN(AC_LBL_LIBPCAP,
+ [AC_REQUIRE([AC_LBL_LIBRARY_NET])
+ dnl
+ dnl save a copy before locating libpcap.a
+ dnl
+ LBL_LIBS="$LIBS"
+ pfopen=/usr/examples/packetfilter/pfopen.c
+ if test -f $pfopen ; then
+ AC_CHECK_FUNCS(pfopen)
+ if test $ac_cv_func_pfopen = "no" ; then
+ AC_MSG_RESULT(Using $pfopen)
+ LIBS="$LIBS $pfopen"
+ fi
+ fi
+ AC_MSG_CHECKING(for local pcap library)
+ libpcap=FAIL
+ lastdir=FAIL
+ places=`ls .. | sed -e 's,/$,,' -e 's,^,../,' | \
+ egrep '/libpcap-[[0-9]]*\.[[0-9]]*(\.[[0-9]]*)?([[ab]][[0-9]]*)?$'`
+ for dir in $places ../libpcap libpcap ; do
+ basedir=`echo $dir | sed -e 's/[[ab]][[0-9]]*$//'`
+ if test $lastdir = $basedir ; then
+ dnl skip alphas when an actual release is present
+ continue;
+ fi
+ lastdir=$dir
+ if test -r $dir/pcap.c ; then
+ libpcap=$dir/libpcap.a
+ d=$dir
+ dnl continue and select the last one that exists
+ fi
+ done
+ if test "x$libpcap" = xFAIL ; then
+ AC_MSG_RESULT(not found)
+ unset ac_cv_lbl_lib_pcap_pcap_open_live_
+ AC_LBL_CHECK_LIB(pcap, pcap_open_live, libpcap="-lpcap")
+ if test "x$libpcap" = xFAIL ; then
+ unset ac_cv_lbl_lib_pcap_pcap_open_live_
+ CFLAGS="$CFLAGS -I/usr/local/include"
+ LIBS="$LIBS -L/usr/local/lib"
+ AC_LBL_CHECK_LIB(pcap, pcap_open_live, libpcap="-lpcap")
+ if test "x$libpcap" = xFAIL ; then
+ AC_MSG_ERROR(see the INSTALL doc for more info)
+ fi
+ $2="$$2 -I/usr/local/include"
+ fi
+ LIBS="$LIBS -lpcap"
+ else
+ $1=$libpcap
+ $2="-I$d $$2"
+ AC_MSG_RESULT($libpcap)
+ fi
+ if test "x$libpcap" != "x-lpcap" ; then
+ LIBS="$libpcap $LIBS"
+ fi
+ case "$target_os" in
+
+ aix*)
+ pseexe="/lib/pse.exp"
+ AC_MSG_CHECKING(for $pseexe)
+ if test -f $pseexe ; then
+ AC_MSG_RESULT(yes)
+ LIBS="$LIBS -I:$pseexe"
+ fi
+ ;;
+ esac])
+
+dnl
+dnl Define RETSIGTYPE and RETSIGVAL
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_TYPE_SIGNAL
+dnl
+dnl results:
+dnl
+dnl RETSIGTYPE (defined)
+dnl RETSIGVAL (defined)
+dnl
+AC_DEFUN(AC_LBL_TYPE_SIGNAL,
+ [AC_BEFORE([$0], [AC_LBL_LIBPCAP])
+ AC_TYPE_SIGNAL
+ if test "$ac_cv_type_signal" = void ; then
+ AC_DEFINE(RETSIGVAL,)
+ else
+ AC_DEFINE(RETSIGVAL,(0))
+ fi
+ case "$target_os" in
+
+ irix*)
+ AC_DEFINE(_BSD_SIGNALS)
+ ;;
+
+ *)
+ dnl prefer sigset() to sigaction()
+ AC_CHECK_FUNCS(sigset)
+ if test $ac_cv_func_sigset = yes ; then
+ AC_DEFINE(signal,sigset)
+ else
+ AC_CHECK_FUNCS(sigaction)
+ fi
+ ;;
+ esac])
+
+dnl
+dnl If using gcc, make sure we have ANSI ioctl definitions
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_FIXINCLUDES
+dnl
+AC_DEFUN(AC_LBL_FIXINCLUDES,
+ [if test "$GCC" = yes ; then
+ AC_MSG_CHECKING(for ANSI ioctl definitions)
+ AC_CACHE_VAL(ac_cv_lbl_gcc_fixincludes,
+ AC_TRY_COMPILE(
+ [/*
+ * This generates a "duplicate case value" when fixincludes
+ * has not be run.
+ */
+# include <sys/types.h>
+# include <sys/time.h>
+# include <sys/ioctl.h>
+# ifdef HAVE_SYS_IOCCOM_H
+# include <sys/ioccom.h>
+# endif],
+ [switch (0) {
+ case _IO('A', 1):;
+ case _IO('B', 1):;
+ }],
+ ac_cv_lbl_gcc_fixincludes=yes,
+ ac_cv_lbl_gcc_fixincludes=no))
+ AC_MSG_RESULT($ac_cv_lbl_gcc_fixincludes)
+ if test $ac_cv_lbl_gcc_fixincludes = no ; then
+ # Don't cache failure
+ unset ac_cv_lbl_gcc_fixincludes
+ AC_MSG_ERROR(see the INSTALL for more info)
+ fi
+ fi])
+
+dnl
+dnl Check for flex, default to lex
+dnl Require flex 2.4 or higher
+dnl Check for bison, default to yacc
+dnl Default to lex/yacc if both flex and bison are not available
+dnl Define the yy prefix string if using flex and bison
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_LEX_AND_YACC(lex, yacc, yyprefix)
+dnl
+dnl results:
+dnl
+dnl $1 (lex set)
+dnl $2 (yacc appended)
+dnl $3 (optional flex and bison -P prefix)
+dnl
+AC_DEFUN(AC_LBL_LEX_AND_YACC,
+ [AC_ARG_WITH(flex, [ --without-flex don't use flex])
+ AC_ARG_WITH(bison, [ --without-bison don't use bison])
+ if test "$with_flex" = no ; then
+ $1=lex
+ else
+ AC_CHECK_PROGS($1, flex, lex)
+ fi
+ if test "$$1" = flex ; then
+ # The -V flag was added in 2.4
+ AC_MSG_CHECKING(for flex 2.4 or higher)
+ AC_CACHE_VAL(ac_cv_lbl_flex_v24,
+ if flex -V >/dev/null 2>&1; then
+ ac_cv_lbl_flex_v24=yes
+ else
+ ac_cv_lbl_flex_v24=no
+ fi)
+ AC_MSG_RESULT($ac_cv_lbl_flex_v24)
+ if test $ac_cv_lbl_flex_v24 = no ; then
+ s="2.4 or higher required"
+ AC_MSG_WARN(ignoring obsolete flex executable ($s))
+ $1=lex
+ fi
+ fi
+ if test "$with_bison" = no ; then
+ $2=yacc
+ else
+ AC_CHECK_PROGS($2, bison, yacc)
+ fi
+ if test "$$2" = bison ; then
+ $2="$$2 -y"
+ fi
+ if test "$$1" != lex -a "$$2" = yacc -o "$$1" = lex -a "$$2" != yacc ; then
+ AC_MSG_WARN(don't have both flex and bison; reverting to lex/yacc)
+ $1=lex
+ $2=yacc
+ fi
+ if test "$$1" = flex -a -n "$3" ; then
+ $1="$$1 -P$3"
+ $2="$$2 -p $3"
+ fi])
+
+dnl
+dnl Checks to see if union wait is used with WEXITSTATUS()
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_UNION_WAIT
+dnl
+dnl results:
+dnl
+dnl DECLWAITSTATUS (defined)
+dnl
+AC_DEFUN(AC_LBL_UNION_WAIT,
+ [AC_MSG_CHECKING(if union wait is used)
+ AC_CACHE_VAL(ac_cv_lbl_union_wait,
+ AC_TRY_COMPILE([
+# include <sys/types.h>
+# include <sys/wait.h>],
+ [int status;
+ u_int i = WEXITSTATUS(status);
+ u_int j = waitpid(0, &status, 0);],
+ ac_cv_lbl_union_wait=no,
+ ac_cv_lbl_union_wait=yes))
+ AC_MSG_RESULT($ac_cv_lbl_union_wait)
+ if test $ac_cv_lbl_union_wait = yes ; then
+ AC_DEFINE(DECLWAITSTATUS,union wait)
+ else
+ AC_DEFINE(DECLWAITSTATUS,int)
+ fi])
+
+dnl
+dnl Checks to see if the sockaddr struct has the 4.4 BSD sa_len member
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_SOCKADDR_SA_LEN
+dnl
+dnl results:
+dnl
+dnl HAVE_SOCKADDR_SA_LEN (defined)
+dnl
+AC_DEFUN(AC_LBL_SOCKADDR_SA_LEN,
+ [AC_MSG_CHECKING(if sockaddr struct has sa_len member)
+ AC_CACHE_VAL(ac_cv_lbl_sockaddr_has_sa_len,
+ AC_TRY_COMPILE([
+# include <sys/types.h>
+# include <sys/socket.h>],
+ [u_int i = sizeof(((struct sockaddr *)0)->sa_len)],
+ ac_cv_lbl_sockaddr_has_sa_len=yes,
+ ac_cv_lbl_sockaddr_has_sa_len=no))
+ AC_MSG_RESULT($ac_cv_lbl_sockaddr_has_sa_len)
+ if test $ac_cv_lbl_sockaddr_has_sa_len = yes ; then
+ AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
+ fi])
+
+dnl
+dnl Checks to see if the IFF_LOOPBACK exists as a define or enum
+dnl
+dnl (stupidly some versions of linux use an enum...)
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_IFF_LOOPBACK
+dnl
+dnl results:
+dnl
+dnl HAVE_IFF_LOOPBACK (defined)
+dnl
+AC_DEFUN(AC_LBL_IFF_LOOPBACK,
+ [AC_MSG_CHECKING(for IFF_LOOPBACK define/enum)
+ AC_CACHE_VAL(ac_cv_lbl_have_iff_loopback,
+ AC_TRY_COMPILE([
+# include <sys/param.h>
+# include <sys/file.h>
+# include <sys/ioctl.h>
+# include <sys/socket.h>
+# ifdef HAVE_SYS_SOCKIO_H
+# include <sys/sockio.h>
+# endif
+# include <sys/time.h>
+# include <net/if.h>
+# include <netinet/in.h>],
+ [int i = IFF_LOOPBACK],
+ ac_cv_lbl_have_iff_loopback=yes,
+ ac_cv_lbl_have_iff_loopback=no))
+ AC_MSG_RESULT($ac_cv_lbl_have_iff_loopback)
+ if test $ac_cv_lbl_have_iff_loopback = yes ; then
+ AC_DEFINE(HAVE_IFF_LOOPBACK)
+ fi])
+
+dnl
+dnl Checks to see if -R is used
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_HAVE_RUN_PATH
+dnl
+dnl results:
+dnl
+dnl ac_cv_lbl_have_run_path (yes or no)
+dnl
+AC_DEFUN(AC_LBL_HAVE_RUN_PATH,
+ [AC_MSG_CHECKING(for ${CC-cc} -R)
+ AC_CACHE_VAL(ac_cv_lbl_have_run_path,
+ [echo 'main(){}' > conftest.c
+ ${CC-cc} -o conftest conftest.c -R/a1/b2/c3 >conftest.out 2>&1
+ if test ! -s conftest.out ; then
+ ac_cv_lbl_have_run_path=yes
+ else
+ ac_cv_lbl_have_run_path=no
+ fi
+ rm -f conftest*])
+ AC_MSG_RESULT($ac_cv_lbl_have_run_path)
+ ])
+
+dnl
+dnl Due to the stupid way it's implemented, AC_CHECK_TYPE is nearly useless.
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_CHECK_TYPE
+dnl
+dnl results:
+dnl
+dnl int32_t (defined)
+dnl u_int32_t (defined)
+dnl
+AC_DEFUN(AC_LBL_CHECK_TYPE,
+ [AC_MSG_CHECKING(for $1 using $CC)
+ AC_CACHE_VAL(ac_cv_lbl_have_$1,
+ AC_TRY_COMPILE([
+# include "confdefs.h"
+# include <sys/types.h>
+# if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+# endif],
+ [$1 i],
+ ac_cv_lbl_have_$1=yes,
+ ac_cv_lbl_have_$1=no))
+ AC_MSG_RESULT($ac_cv_lbl_have_$1)
+ if test $ac_cv_lbl_have_$1 = no ; then
+ AC_DEFINE($1, $2)
+ fi])
+
+dnl
+dnl Checks to see if unaligned memory accesses fail
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_UNALIGNED_ACCESS
+dnl
+dnl results:
+dnl
+dnl LBL_ALIGN (DEFINED)
+dnl
+AC_DEFUN(AC_LBL_UNALIGNED_ACCESS,
+ [AC_MSG_CHECKING(if unaligned accesses fail)
+ AC_CACHE_VAL(ac_cv_lbl_unaligned_fail,
+ [case "$target_cpu" in
+
+ alpha|hp*|mips|sparc)
+ ac_cv_lbl_unaligned_fail=yes
+ ;;
+
+ *)
+ cat >conftest.c <<EOF
+# include <sys/types.h>
+# include <sys/wait.h>
+# include <stdio.h>
+ unsigned char a[[5]] = { 1, 2, 3, 4, 5 };
+ main() {
+ unsigned int i;
+ pid_t pid;
+ int status;
+ /* avoid "core dumped" message */
+ pid = fork();
+ if (pid < 0)
+ exit(2);
+ if (pid > 0) {
+ /* parent */
+ pid = waitpid(pid, &status, 0);
+ if (pid < 0)
+ exit(3);
+ exit(!WIFEXITED(status));
+ }
+ /* child */
+ i = *(unsigned int *)&a[[1]];
+ printf("%d\n", i);
+ exit(0);
+ }
+EOF
+ ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \
+ conftest.c $LIBS >/dev/null 2>&1
+ if test ! -x conftest ; then
+ dnl failed to compile for some reason
+ ac_cv_lbl_unaligned_fail=yes
+ else
+ ./conftest >conftest.out
+ if test ! -s conftest.out ; then
+ ac_cv_lbl_unaligned_fail=yes
+ else
+ ac_cv_lbl_unaligned_fail=no
+ fi
+ fi
+ rm -f conftest* core core.conftest
+ ;;
+ esac])
+ AC_MSG_RESULT($ac_cv_lbl_unaligned_fail)
+ if test $ac_cv_lbl_unaligned_fail = yes ; then
+ AC_DEFINE(LBL_ALIGN)
+ fi])
+
+dnl
+dnl add all warning option to CFLAGS
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_CHECK_WALL(copt)
+dnl
+dnl results:
+dnl
+dnl $1 (copt appended)
+dnl ac_cv_lbl_gcc_vers
+dnl
+AC_DEFUN(AC_LBL_CHECK_WALL,
+ [ if test "$GCC" = yes ; then
+ if test "$SHLICC2" = yes ; then
+ ac_cv_lbl_gcc_vers=2
+ $1="`echo $$1 | sed -e 's/-O/-O2/'`"
+ else
+ AC_MSG_CHECKING(gcc version)
+ AC_CACHE_VAL(ac_cv_lbl_gcc_vers,
+ ac_cv_lbl_gcc_vers=`$CC --version 2>&1 | \
+ sed -e 's/\..*//'`)
+ AC_MSG_RESULT($ac_cv_lbl_gcc_vers)
+ if test $ac_cv_lbl_gcc_vers -gt 1 ; then
+ $1="`echo $$1 | sed -e 's/-O/-O2/'`"
+ fi
+ fi
+ if test "${LBL_CFLAGS+set}" != set; then
+ if test "$ac_cv_prog_cc_g" = yes ; then
+ $1="-g $$1"
+ fi
+ $1="$$1 -Wall"
+ if test $ac_cv_lbl_gcc_vers -gt 1 ; then
+ $1="$$1 -Wmissing-prototypes -Wstrict-prototypes"
+ fi
+ fi
+ else
+ case "$target_os" in
+
+ irix6*)
+ $1="$$1 -fullwarn -n32"
+ ;;
+
+ *)
+ ;;
+ esac
+ fi])
+
+dnl
+dnl If using gcc and the file .devel exists:
+dnl Compile with -g (if supported) and -Wall
+dnl If using gcc 2, do extra prototype checking
+dnl If an os prototype include exists, symlink os-proto.h to it
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_DEVEL(copt)
+dnl
+dnl results:
+dnl
+dnl $1 (copt appended)
+dnl HAVE_OS_PROTO_H (defined)
+dnl os-proto.h (symlinked)
+dnl
+AC_DEFUN(AC_LBL_DEVEL,
+ [rm -f os-proto.h
+ if test "${LBL_CFLAGS+set}" = set; then
+ $1="$$1 ${LBL_CFLAGS}"
+ fi
+ if test -f .devel ; then
+ AC_LBL_CHECK_WALL($1)
+ os=`echo $target_os | sed -e 's/\([[0-9]][[0-9]]*\)[[^0-9]].*$/\1/'`
+ name="lbl/os-$os.h"
+ if test -f $name ; then
+ ln -s $name os-proto.h
+ AC_DEFINE(HAVE_OS_PROTO_H)
+ else
+ AC_MSG_WARN(can't find $name)
+ fi
+ fi])
+
+dnl
+dnl Improved version of AC_CHECK_LIB
+dnl
+dnl Thanks to John Hawkinson (jhawk@mit.edu)
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [,
+dnl ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
+dnl
+dnl results:
+dnl
+dnl LIBS
+dnl
+
+define(AC_LBL_CHECK_LIB,
+[AC_MSG_CHECKING([for $2 in -l$1])
+dnl Use a cache variable name containing both the library and function name,
+dnl because the test really is for library $1 defining function $2, not
+dnl just for library $1. Separate tests with the same $1 and different $2's
+dnl may have different results.
+ac_lib_var=`echo $1['_']$2['_']$5 | sed 'y%./+- %__p__%'`
+AC_CACHE_VAL(ac_cv_lbl_lib_$ac_lib_var,
+[ac_save_LIBS="$LIBS"
+LIBS="-l$1 $5 $LIBS"
+AC_TRY_LINK(dnl
+ifelse([$2], [main], , dnl Avoid conflicting decl of main.
+[/* Override any gcc2 internal prototype to avoid an error. */
+]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
+extern "C"
+#endif
+])dnl
+[/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $2();
+]),
+ [$2()],
+ eval "ac_cv_lbl_lib_$ac_lib_var=yes",
+ eval "ac_cv_lbl_lib_$ac_lib_var=no")
+LIBS="$ac_save_LIBS"
+])dnl
+if eval "test \"`echo '$ac_cv_lbl_lib_'$ac_lib_var`\" = yes"; then
+ AC_MSG_RESULT(yes)
+ ifelse([$3], ,
+[changequote(, )dnl
+ ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+changequote([, ])dnl
+ AC_DEFINE_UNQUOTED($ac_tr_lib)
+ LIBS="-l$1 $LIBS"
+], [$3])
+else
+ AC_MSG_RESULT(no)
+ifelse([$4], , , [$4
+])dnl
+fi
+])
+
+dnl
+dnl AC_LBL_LIBRARY_NET
+dnl
+dnl This test is for network applications that need socket() and
+dnl gethostbyname() -ish functions. Under Solaris, those applications
+dnl need to link with "-lsocket -lnsl". Under IRIX, they need to link
+dnl with "-lnsl" but should *not* link with "-lsocket" because
+dnl libsocket.a breaks a number of things (for instance:
+dnl gethostbyname() under IRIX 5.2, and snoop sockets under most
+dnl versions of IRIX).
+dnl
+dnl Unfortunately, many application developers are not aware of this,
+dnl and mistakenly write tests that cause -lsocket to be used under
+dnl IRIX. It is also easy to write tests that cause -lnsl to be used
+dnl under operating systems where neither are necessary (or useful),
+dnl such as SunOS 4.1.4, which uses -lnsl for TLI.
+dnl
+dnl This test exists so that every application developer does not test
+dnl this in a different, and subtly broken fashion.
+
+dnl It has been argued that this test should be broken up into two
+dnl seperate tests, one for the resolver libraries, and one for the
+dnl libraries necessary for using Sockets API. Unfortunately, the two
+dnl are carefully intertwined and allowing the autoconf user to use
+dnl them independantly potentially results in unfortunate ordering
+dnl dependancies -- as such, such component macros would have to
+dnl carefully use indirection and be aware if the other components were
+dnl executed. Since other autoconf macros do not go to this trouble,
+dnl and almost no applications use sockets without the resolver, this
+dnl complexity has not been implemented.
+dnl
+dnl The check for libresolv is in case you are attempting to link
+dnl statically and happen to have a libresolv.a lying around (and no
+dnl libnsl.a).
+dnl
+AC_DEFUN(AC_LBL_LIBRARY_NET, [
+ # Most operating systems have gethostbyname() in the default searched
+ # libraries (i.e. libc):
+ AC_CHECK_FUNC(gethostbyname, ,
+ # Some OSes (eg. Solaris) place it in libnsl:
+ AC_LBL_CHECK_LIB(nsl, gethostbyname, ,
+ # Some strange OSes (SINIX) have it in libsocket:
+ AC_LBL_CHECK_LIB(socket, gethostbyname, ,
+ # Unfortunately libsocket sometimes depends on libnsl.
+ # AC_CHECK_LIB's API is essentially broken so the
+ # following ugliness is necessary:
+ AC_LBL_CHECK_LIB(socket, gethostbyname,
+ LIBS="-lsocket -lnsl $LIBS",
+ AC_CHECK_LIB(resolv, gethostbyname),
+ -lnsl))))
+ AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, ,
+ AC_LBL_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", ,
+ -lnsl)))
+ # DLPI needs putmsg under HPUX so test for -lstr while we're at it
+ AC_CHECK_LIB(str, putmsg)
+ ])
diff --git a/contrib/nslint-2.1a3/config.guess b/contrib/nslint-2.1a3/config.guess
new file mode 100644
index 0000000..e9e4455
--- /dev/null
+++ b/contrib/nslint-2.1a3/config.guess
@@ -0,0 +1,693 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Written by Per Bothner <bothner@cygnus.com>.
+# The master version of this file is at the FSF in /home/gd/gnu/lib.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit system type (host/target name).
+#
+# Only a few systems have been added to this list; please add others
+# (but try to keep the structure clean).
+#
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 8/24/94.)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ alpha:OSF1:*:*)
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-cbm-sysv4
+ exit 0;;
+ amiga:NetBSD:*:*)
+ echo m68k-cbm-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ amiga:OpenBSD:*:*)
+ echo m68k-cbm-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit 0 ;;
+ NILE:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit 0 ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit 0 ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:NetBSD:*:*)
+ echo m68k-atari-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:OpenBSD:*:*)
+ echo m68k-atari-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:NetBSD:*:*)
+ echo m68k-sun-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:OpenBSD:*:*)
+ echo m68k-sun-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:NetBSD:*:*)
+ echo m68k-apple-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-apple-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ sed 's/^ //' << EOF >dummy.c
+ int main (argc, argv) int argc; char **argv; {
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ ${CC-cc} dummy.c -o dummy \
+ && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit 0 ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit 0 ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit 0 ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
+ -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit 0 ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit 0 ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit 0 ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit 0 ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i?86:AIX:*:*)
+ echo i386-ibm-aix
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ sed 's/^ //' << EOF >dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ echo rs6000-ibm-aix3.2.5
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit 0 ;;
+ *:AIX:*:4)
+ if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=4.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit 0 ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit 0 ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit 0 ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit 0 ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit 0 ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit 0 ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit 0 ;;
+ 9000/[3478]??:HP-UX:*:*)
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
+ 9000/8?? ) HP_ARCH=hppa1.0 ;;
+ esac
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ 3050*:HI-UX:*:*)
+ sed 's/^ //' << EOF >dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ echo unknown-hitachi-hiuxwe2
+ exit 0 ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit 0 ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit 0 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit 0 ;;
+ i?86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit 0 ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit 0 ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ CRAY*X-MP:*:*:*)
+ echo xmp-cray-unicos
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY-2:*:*:*)
+ echo cray2-cray-unicos
+ exit 0 ;;
+ F300:UNIX_System_V:*:*)
+ FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ F301:UNIX_System_V:*:*)
+ echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
+ exit 0 ;;
+ hp3[0-9][05]:NetBSD:*:*)
+ echo m68k-hp-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hp3[0-9][05]:OpenBSD:*:*)
+ echo m68k-hp-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ i?86:BSD/386:*:* | *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit 0 ;;
+ *:NetBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo i386-pc-cygwin32
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin32
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ *:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us.
+ ld_help_string=`ld --help 2>&1`
+ if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then
+ echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0
+ elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0
+ elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0
+ elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
+ echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0
+ elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
+ echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0
+ elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then
+ echo "powerpc-unknown-linux-gnu" ; exit 0
+ elif test "${UNAME_MACHINE}" = "alpha" ; then
+ echo alpha-unknown-linux-gnu ; exit 0
+ elif test "${UNAME_MACHINE}" = "sparc" ; then
+ echo sparc-unknown-linux-gnu ; exit 0
+ else
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us
+ # useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout.
+ test ! -d /usr/lib/ldscripts/. \
+ && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
+ # Determine whether the default compiler is a.out or elf
+ cat >dummy.c <<EOF
+main(argc, argv)
+int argc;
+char *argv[];
+{
+#ifdef __ELF__
+ printf ("%s-pc-linux-gnu\n", argv[1]);
+#else
+ printf ("%s-pc-linux-gnuaout\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ fi ;;
+# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
+# are messed up and put the nodename in both sysname and nodename.
+ i?86:DYNIX/ptx:4*:*)
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ i?86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit 0 ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit 0 ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ M68*:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4 && exit 0 ;;
+ m68*:LynxOS:2.*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ i?86:LynxOS:2.*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit 0 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit 0 ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+cat >dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+ printf ("vax-dec-bsd\n"); exit (0);
+#else
+ printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
+rm -f dummy.c dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ c34*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ c38*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ c4*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ esac
+fi
+
+#echo '(Unable to guess system type)' 1>&2
+
+exit 1
diff --git a/contrib/nslint-2.1a3/config.sub b/contrib/nslint-2.1a3/config.sub
new file mode 100644
index 0000000..0432524
--- /dev/null
+++ b/contrib/nslint-2.1a3/config.sub
@@ -0,0 +1,927 @@
+#! /bin/sh
+# Configuration validation subroutine script, version 1.1.
+# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+if [ x$1 = x ]
+then
+ echo Configuration name missing. 1>&2
+ echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
+ echo "or $0 ALIAS" 1>&2
+ echo where ALIAS is a recognized configuration type. 1>&2
+ exit 1
+fi
+
+# First pass through any local machine types.
+case $1 in
+ *local*)
+ echo $1
+ exit 0
+ ;;
+ *)
+ ;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ linux-gnu*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple)
+ os=
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \
+ | arme[lb] | pyramid \
+ | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
+ | alpha | we32k | ns16k | clipper | i370 | sh \
+ | powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
+ | pdp11 | mips64el | mips64orion | mips64orionel \
+ | sparc | sparclet | sparclite | sparc64)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i[3456]86)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
+ | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
+ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
+ | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
+ | hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
+ | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
+ | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
+ | mips64el-* | mips64orion-* | mips64orionel-* | f301-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-cbm
+ ;;
+ amigados)
+ basic_machine=m68k-cbm
+ os=-amigados
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-cbm
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ cray2)
+ basic_machine=cray2-cray
+ os=-unicos
+ ;;
+ [ctj]90-cray)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i[3456]86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i[3456]86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i[3456]86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i[3456]86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5)
+ basic_machine=i586-intel
+ ;;
+ pentiumpro | p6)
+ basic_machine=i686-intel
+ ;;
+ pentium-* | p5-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ k5)
+ # We don't have specific support for AMD's K5 yet, so just call it a Pentium
+ basic_machine=i586-amd
+ ;;
+ nexen)
+ # We don't have specific support for Nexgen yet, so just call it a Pentium
+ basic_machine=i586-nexgen
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=rs6000-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ xmp)
+ basic_machine=xmp-cray
+ os=-unicos
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ mips)
+ basic_machine=mips-mips
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sparc)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -unixware* | svr4*)
+ os=-sysv4
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -linux-gnu* | -uxpv*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigados
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f301-fujitsu)
+ os=-uxpv
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -vxsim* | -vxworks*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
diff --git a/contrib/nslint-2.1a3/configure b/contrib/nslint-2.1a3/configure
new file mode 100644
index 0000000..db5c53e
--- /dev/null
+++ b/contrib/nslint-2.1a3/configure
@@ -0,0 +1,1905 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+ --without-gcc don't use gcc"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.13"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=nslint.c
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+# configure --host=HOST --target=TARGET --build=BUILD NONOPT
+#
+# The rules are:
+# 1. You are not allowed to specify --host, --target, and nonopt at the
+# same time.
+# 2. Host defaults to nonopt.
+# 3. If nonopt is not specified, then host defaults to the current host,
+# as determined by config.guess.
+# 4. Target and build default to nonopt.
+# 5. If nonopt is not specified, then target and build default to host.
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+case $host---$target---$nonopt in
+NONE---*---* | *---NONE---* | *---*---NONE) ;;
+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+esac
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:575: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:596: checking target system type" >&5
+
+target_alias=$target
+case "$target_alias" in
+NONE)
+ case $nonopt in
+ NONE) target_alias=$host_alias ;;
+ *) target_alias=$nonopt ;;
+ esac ;;
+esac
+
+target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$target" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:614: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+ case $nonopt in
+ NONE) build_alias=$host_alias ;;
+ *) build_alias=$nonopt ;;
+ esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+test "$host_alias" != "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+
+
+umask 002
+
+if test -z "$PWD" ; then
+ PWD=`pwd`
+fi
+
+
+
+
+
+ # Check whether --with-gcc or --without-gcc was given.
+if test "${with_gcc+set}" = set; then
+ withval="$with_gcc"
+ :
+fi
+
+ V_CCOPT="-O"
+ V_INCLS=""
+ if test "${srcdir}" != "." ; then
+ V_INCLS="-I\$\(srcdir\)"
+ fi
+ if test "${CFLAGS+set}" = set; then
+ LBL_CFLAGS="$CFLAGS"
+ fi
+ if test -z "$CC" ; then
+ case "$target_os" in
+
+ bsdi*)
+ # Extract the first word of "shlicc2", so it can be a program name with args.
+set dummy shlicc2; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:668: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_SHLICC2'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$SHLICC2"; then
+ ac_cv_prog_SHLICC2="$SHLICC2" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_SHLICC2="yes"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_SHLICC2" && ac_cv_prog_SHLICC2="no"
+fi
+fi
+SHLICC2="$ac_cv_prog_SHLICC2"
+if test -n "$SHLICC2"; then
+ echo "$ac_t""$SHLICC2" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test $SHLICC2 = yes ; then
+ CC=shlicc2
+ export CC
+ fi
+ ;;
+ esac
+ fi
+ if test -z "$CC" -a "$with_gcc" = no ; then
+ CC=cc
+ export CC
+ fi
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:709: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:739: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:790: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:822: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 833 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:864: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:869: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:878: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:897: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+ if test "$GCC" != yes ; then
+ echo $ac_n "checking that $CC handles ansi prototypes""... $ac_c" 1>&6
+echo "configure:930: checking that $CC handles ansi prototypes" >&5
+ if eval "test \"`echo '$''{'ac_cv_lbl_cc_ansi_prototypes'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 935 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int main() {
+int frob(int, char *)
+; return 0; }
+EOF
+if { (eval echo configure:942: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_lbl_cc_ansi_prototypes=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_lbl_cc_ansi_prototypes=no
+fi
+rm -f conftest*
+fi
+
+ echo "$ac_t""$ac_cv_lbl_cc_ansi_prototypes" 1>&6
+ if test $ac_cv_lbl_cc_ansi_prototypes = no ; then
+ case "$target_os" in
+
+ hpux*)
+ echo $ac_n "checking for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE)""... $ac_c" 1>&6
+echo "configure:960: checking for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE)" >&5
+ savedcflags="$CFLAGS"
+ CFLAGS="-Aa -D_HPUX_SOURCE $CFLAGS"
+ if eval "test \"`echo '$''{'ac_cv_lbl_cc_hpux_cc_aa'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 967 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int main() {
+int frob(int, char *)
+; return 0; }
+EOF
+if { (eval echo configure:974: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_lbl_cc_hpux_cc_aa=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_lbl_cc_hpux_cc_aa=no
+fi
+rm -f conftest*
+fi
+
+ echo "$ac_t""$ac_cv_lbl_cc_hpux_cc_aa" 1>&6
+ if test $ac_cv_lbl_cc_hpux_cc_aa = no ; then
+ { echo "configure: error: see the INSTALL doc for more info" 1>&2; exit 1; }
+ fi
+ CFLAGS="$savedcflags"
+ V_CCOPT="-Aa $V_CCOPT"
+ cat >> confdefs.h <<\EOF
+#define _HPUX_SOURCE 1
+EOF
+
+ ;;
+
+ *)
+ { echo "configure: error: see the INSTALL doc for more info" 1>&2; exit 1; }
+ ;;
+ esac
+ fi
+ V_INCLS="$V_INCLS -I/usr/local/include"
+ LDFLAGS="$LDFLAGS -L/usr/local/lib"
+
+ case "$target_os" in
+
+ irix*)
+ V_CCOPT="$V_CCOPT -xansi -signed -g3"
+ ;;
+
+ osf*)
+ V_CCOPT="$V_CCOPT -std1 -g3"
+ ;;
+
+ ultrix*)
+ echo $ac_n "checking that Ultrix $CC hacks const in prototypes""... $ac_c" 1>&6
+echo "configure:1018: checking that Ultrix $CC hacks const in prototypes" >&5
+ if eval "test \"`echo '$''{'ac_cv_lbl_cc_const_proto'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1023 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int main() {
+struct a { int b; };
+ void c(const struct a *)
+; return 0; }
+EOF
+if { (eval echo configure:1031: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_lbl_cc_const_proto=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_lbl_cc_const_proto=no
+fi
+rm -f conftest*
+fi
+
+ echo "$ac_t""$ac_cv_lbl_cc_const_proto" 1>&6
+ if test $ac_cv_lbl_cc_const_proto = no ; then
+ cat >> confdefs.h <<\EOF
+#define const
+EOF
+
+ fi
+ ;;
+ esac
+ fi
+
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1056: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 1071 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1077: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 1088 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1094: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 1105 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1111: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+for ac_hdr in fcntl.h malloc.h memory.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1139: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1144 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1149: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+for ac_func in strerror
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1179: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1184 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
+fi
+done
+
+
+echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
+echo "configure:1234: checking for main in -lnsl" >&5
+ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lnsl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1242 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:1249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lnsl $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
+echo "configure:1277: checking for main in -lsocket" >&5
+ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lsocket $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1285 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:1292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lsocket $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1321: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1326 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1334: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ ac_cv_header_stdc=yes
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1351 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1369 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+ :
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1390 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:1401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ :
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+ cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+echo $ac_n "checking for int32_t""... $ac_c" 1>&6
+echo "configure:1425: checking for int32_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_int32_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1430 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_int32_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_int32_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_int32_t" 1>&6
+if test $ac_cv_type_int32_t = no; then
+ cat >> confdefs.h <<\EOF
+#define int32_t int
+EOF
+
+fi
+
+echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6
+echo "configure:1458: checking for u_int32_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_u_int32_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1463 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])u_int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_u_int32_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_u_int32_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_u_int32_t" 1>&6
+if test $ac_cv_type_u_int32_t = no; then
+ cat >> confdefs.h <<\EOF
+#define u_int32_t u_int
+EOF
+
+fi
+
+
+rm -f os-proto.h
+ if test "${LBL_CFLAGS+set}" = set; then
+ V_CCOPT="$V_CCOPT ${LBL_CFLAGS}"
+ fi
+ if test -f .devel ; then
+ if test "$GCC" = yes ; then
+ if test "$SHLICC2" = yes ; then
+ ac_cv_lbl_gcc_vers=2
+ V_CCOPT="`echo $V_CCOPT | sed -e 's/-O/-O2/'`"
+ else
+ echo $ac_n "checking gcc version""... $ac_c" 1>&6
+echo "configure:1502: checking gcc version" >&5
+ if eval "test \"`echo '$''{'ac_cv_lbl_gcc_vers'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_lbl_gcc_vers=`$CC --version 2>&1 | \
+ sed -e 's/\..*//'`
+fi
+
+ echo "$ac_t""$ac_cv_lbl_gcc_vers" 1>&6
+ if test $ac_cv_lbl_gcc_vers -gt 1 ; then
+ V_CCOPT="`echo $V_CCOPT | sed -e 's/-O/-O2/'`"
+ fi
+ fi
+ if test "${LBL_CFLAGS+set}" != set; then
+ if test "$ac_cv_prog_cc_g" = yes ; then
+ V_CCOPT="-g $V_CCOPT"
+ fi
+ V_CCOPT="$V_CCOPT -Wall"
+ if test $ac_cv_lbl_gcc_vers -gt 1 ; then
+ V_CCOPT="$V_CCOPT -Wmissing-prototypes -Wstrict-prototypes"
+ fi
+ fi
+ else
+ case "$target_os" in
+
+ irix6*)
+ V_CCOPT="$V_CCOPT -fullwarn -n32"
+ ;;
+
+ *)
+ ;;
+ esac
+ fi
+ os=`echo $target_os | sed -e 's/\([0-9][0-9]*\)[^0-9].*$/\1/'`
+ name="lbl/os-$os.h"
+ if test -f $name ; then
+ ln -s $name os-proto.h
+ cat >> confdefs.h <<\EOF
+#define HAVE_OS_PROTO_H 1
+EOF
+
+ else
+ echo "configure: warning: can't find $name" 1>&2
+ fi
+ fi
+
+if test -r lbl/gnuc.h ; then
+ rm -f gnuc.h
+ ln -s lbl/gnuc.h gnuc.h
+fi
+
+
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:1568: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+cat > conftest.defs <<\EOF
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
+s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
+s%\[%\\&%g
+s%\]%\\&%g
+s%\$%$$%g
+EOF
+DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
+rm -f conftest.defs
+
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@target@%$target%g
+s%@target_alias@%$target_alias%g
+s%@target_cpu@%$target_cpu%g
+s%@target_vendor@%$target_vendor%g
+s%@target_os@%$target_os%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@SHLICC2@%$SHLICC2%g
+s%@CC@%$CC%g
+s%@CPP@%$CPP%g
+s%@LIBOBJS@%$LIBOBJS%g
+s%@V_CCOPT@%$V_CCOPT%g
+s%@V_INCLS@%$V_INCLS%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ [/$]*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
+
+if test -f .devel ; then
+ make depend
+fi
+exit 0
diff --git a/contrib/nslint-2.1a3/configure.in b/contrib/nslint-2.1a3/configure.in
new file mode 100644
index 0000000..5ba1e87
--- /dev/null
+++ b/contrib/nslint-2.1a3/configure.in
@@ -0,0 +1,47 @@
+dnl @(#) $Header: /proj/cvs/prod/bind9/contrib/nslint-2.1a3/configure.in,v 1.1 2001/12/21 04:12:03 marka Exp $ (LBL)
+dnl
+dnl Copyright (c) 1995, 1996, 1997
+dnl The Regents of the University of California. All rights reserved.
+dnl
+dnl Process this file with autoconf to produce a configure script.
+dnl
+
+AC_INIT(nslint.c)
+
+AC_CANONICAL_SYSTEM
+
+umask 002
+
+if test -z "$PWD" ; then
+ PWD=`pwd`
+fi
+
+AC_LBL_C_INIT(V_CCOPT, V_INCLS)
+
+AC_CHECK_HEADERS(fcntl.h malloc.h memory.h)
+
+AC_REPLACE_FUNCS(strerror)
+AC_CHECK_LIB(nsl, main)
+AC_CHECK_LIB(socket, main)
+
+AC_CHECK_TYPE(int32_t, int)
+AC_CHECK_TYPE(u_int32_t, u_int)
+
+AC_LBL_DEVEL(V_CCOPT)
+
+if test -r lbl/gnuc.h ; then
+ rm -f gnuc.h
+ ln -s lbl/gnuc.h gnuc.h
+fi
+
+AC_SUBST(V_CCOPT)
+AC_SUBST(V_INCLS)
+
+AC_PROG_INSTALL
+
+AC_OUTPUT(Makefile)
+
+if test -f .devel ; then
+ make depend
+fi
+exit 0
diff --git a/contrib/nslint-2.1a3/install-sh b/contrib/nslint-2.1a3/install-sh
new file mode 100644
index 0000000..ebc6691
--- /dev/null
+++ b/contrib/nslint-2.1a3/install-sh
@@ -0,0 +1,250 @@
+#! /bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/contrib/nslint-2.1a3/lbl/gnuc.h b/contrib/nslint-2.1a3/lbl/gnuc.h
new file mode 100644
index 0000000..7330227
--- /dev/null
+++ b/contrib/nslint-2.1a3/lbl/gnuc.h
@@ -0,0 +1,43 @@
+/* @(#) $Header: /proj/cvs/prod/bind9/contrib/nslint-2.1a3/lbl/gnuc.h,v 1.1 2001/12/21 04:12:05 marka Exp $ (LBL) */
+
+/* Define __P() macro, if necessary */
+#ifndef __P
+#if __STDC__
+#define __P(protos) protos
+#else
+#define __P(protos) ()
+#endif
+#endif
+
+/* inline foo */
+#ifdef __GNUC__
+#define inline __inline
+#else
+#define inline
+#endif
+
+/*
+ * Handle new and old "dead" routine prototypes
+ *
+ * For example:
+ *
+ * __dead void foo(void) __attribute__((volatile));
+ *
+ */
+#ifdef __GNUC__
+#ifndef __dead
+#define __dead volatile
+#endif
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
+#ifndef __attribute__
+#define __attribute__(args)
+#endif
+#endif
+#else
+#ifndef __dead
+#define __dead
+#endif
+#ifndef __attribute__
+#define __attribute__(args)
+#endif
+#endif
diff --git a/contrib/nslint-2.1a3/lbl/os-irix5.h b/contrib/nslint-2.1a3/lbl/os-irix5.h
new file mode 100644
index 0000000..71fdc7e
--- /dev/null
+++ b/contrib/nslint-2.1a3/lbl/os-irix5.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 1994, 1995, 1996
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @(#) $Header: /proj/cvs/prod/bind9/contrib/nslint-2.1a3/lbl/os-irix5.h,v 1.1 2001/12/21 04:12:05 marka Exp $ (LBL)
+ */
+
+/* Prototypes missing in IRIX 5 */
+#ifdef __STDC__
+struct ether_addr;
+#endif
+int ether_hostton(char *, struct ether_addr *);
+char *ether_ntoa(struct ether_addr *);
+#ifdef __STDC__
+struct utmp;
+#endif
+void login(struct utmp *);
+int setenv(const char *, const char *, int);
+int sigblock(int);
+int sigsetmask(int);
+int snprintf(char *, size_t, const char *, ...);
+time_t time(time_t *);
diff --git a/contrib/nslint-2.1a3/lbl/os-osf3.h b/contrib/nslint-2.1a3/lbl/os-osf3.h
new file mode 100644
index 0000000..f0e549e
--- /dev/null
+++ b/contrib/nslint-2.1a3/lbl/os-osf3.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 1995, 1996
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @(#) $Header: /proj/cvs/prod/bind9/contrib/nslint-2.1a3/lbl/os-osf3.h,v 1.1 2001/12/21 04:12:05 marka Exp $ (LBL)
+ */
+
+/* Prototypes missing in osf3 */
+int flock(int, int);
+int ioctl(int, int, caddr_t);
+int iruserok(u_int, int, char *, char *);
+int pfopen(char *, int);
+int rcmd(char **, u_short, const char *, const char *, const char *, int *);
+int rresvport(int *);
+int snprintf(char *, size_t, const char *, ...);
+void sync(void);
diff --git a/contrib/nslint-2.1a3/lbl/os-solaris2.h b/contrib/nslint-2.1a3/lbl/os-solaris2.h
new file mode 100644
index 0000000..ba91e71
--- /dev/null
+++ b/contrib/nslint-2.1a3/lbl/os-solaris2.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 1993, 1994, 1995, 1996, 1997, 2000
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @(#) $Id: os-solaris2.h,v 1.1 2001/12/21 04:12:05 marka Exp $ (LBL)
+ */
+
+/* Prototypes missing in SunOS 5 */
+int daemon(int, int);
+int dn_expand(const u_char *, const u_char *, const u_char *, char *, int);
+int dn_skipname(const u_char *, const u_char *);
+int flock(int, int);
+int getdtablesize(void);
+int gethostname(char *, int);
+int getpagesize(void);
+char *getusershell(void);
+char *getwd(char *);
+int iruserok(u_int, int, char *, char *);
+#ifdef __STDC__
+struct utmp;
+void login(struct utmp *);
+#endif
+int logout(const char *);
+int res_query(const char *, int, int, u_char *, int);
+int setenv(const char *, const char *, int);
+#if defined(_STDIO_H) && defined(HAVE_SETLINEBUF)
+int setlinebuf(FILE *);
+#endif
+int sigblock(int);
+int sigsetmask(int);
+char *strerror(int);
+int snprintf(char *, size_t, const char *, ...);
+int strcasecmp(const char *, const char *);
+void unsetenv(const char *);
diff --git a/contrib/nslint-2.1a3/lbl/os-sunos4.h b/contrib/nslint-2.1a3/lbl/os-sunos4.h
new file mode 100644
index 0000000..157ab67
--- /dev/null
+++ b/contrib/nslint-2.1a3/lbl/os-sunos4.h
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 1989, 1990, 1993, 1994, 1995, 1996
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @(#) $Header: /proj/cvs/prod/bind9/contrib/nslint-2.1a3/lbl/os-sunos4.h,v 1.1 2001/12/21 04:12:05 marka Exp $ (LBL)
+ */
+
+/* Prototypes missing in SunOS 4 */
+#ifdef FILE
+int _filbuf(FILE *);
+int _flsbuf(u_char, FILE *);
+int fclose(FILE *);
+int fflush(FILE *);
+int fgetc(FILE *);
+int fprintf(FILE *, const char *, ...);
+int fputc(int, FILE *);
+int fputs(const char *, FILE *);
+u_int fread(void *, u_int, u_int, FILE *);
+int fseek(FILE *, long, int);
+u_int fwrite(const void *, u_int, u_int, FILE *);
+int pclose(FILE *);
+void rewind(FILE *);
+void setbuf(FILE *, char *);
+int setlinebuf(FILE *);
+int ungetc(int, FILE *);
+int vfprintf(FILE *, const char *, ...);
+int vprintf(const char *, ...);
+#endif
+
+#if __GNUC__ <= 1
+int read(int, char *, u_int);
+int write(int, char *, u_int);
+#endif
+
+long a64l(const char *);
+#ifdef __STDC__
+struct sockaddr;
+#endif
+int accept(int, struct sockaddr *, int *);
+int bind(int, struct sockaddr *, int);
+int bcmp(const void *, const void *, u_int);
+void bcopy(const void *, void *, u_int);
+void bzero(void *, int);
+int chroot(const char *);
+int close(int);
+void closelog(void);
+int connect(int, struct sockaddr *, int);
+char *crypt(const char *, const char *);
+int daemon(int, int);
+int fchmod(int, int);
+int fchown(int, int, int);
+void endgrent(void);
+void endpwent(void);
+void endservent(void);
+#ifdef __STDC__
+struct ether_addr;
+#endif
+struct ether_addr *ether_aton(const char *);
+int flock(int, int);
+#ifdef __STDC__
+struct stat;
+#endif
+int fstat(int, struct stat *);
+#ifdef __STDC__
+struct statfs;
+#endif
+int fstatfs(int, struct statfs *);
+int fsync(int);
+#ifdef __STDC__
+struct timeb;
+#endif
+int ftime(struct timeb *);
+int ftruncate(int, off_t);
+int getdtablesize(void);
+long gethostid(void);
+int gethostname(char *, int);
+int getopt(int, char * const *, const char *);
+int getpagesize(void);
+char *getpass(char *);
+int getpeername(int, struct sockaddr *, int *);
+int getpriority(int, int);
+#ifdef __STDC__
+struct rlimit;
+#endif
+int getrlimit(int, struct rlimit *);
+int getsockname(int, struct sockaddr *, int *);
+int getsockopt(int, int, int, char *, int *);
+#ifdef __STDC__
+struct timeval;
+struct timezone;
+#endif
+int gettimeofday(struct timeval *, struct timezone *);
+char *getusershell(void);
+char *getwd(char *);
+int initgroups(const char *, int);
+int ioctl(int, int, caddr_t);
+int iruserok(u_long, int, char *, char *);
+int isatty(int);
+int killpg(int, int);
+int listen(int, int);
+#ifdef __STDC__
+struct utmp;
+#endif
+void login(struct utmp *);
+int logout(const char *);
+off_t lseek(int, off_t, int);
+int lstat(const char *, struct stat *);
+int mkstemp(char *);
+char *mktemp(char *);
+int munmap(caddr_t, int);
+void openlog(const char *, int, int);
+void perror(const char *);
+int printf(const char *, ...);
+int puts(const char *);
+long random(void);
+int readlink(const char *, char *, int);
+#ifdef __STDC__
+struct iovec;
+#endif
+int readv(int, struct iovec *, int);
+int recv(int, char *, u_int, int);
+int recvfrom(int, char *, u_int, int, struct sockaddr *, int *);
+int rename(const char *, const char *);
+int rcmd(char **, u_short, char *, char *, char *, int *);
+int rresvport(int *);
+int send(int, char *, u_int, int);
+int sendto(int, char *, u_int, int, struct sockaddr *, int);
+int setenv(const char *, const char *, int);
+int seteuid(int);
+int setpriority(int, int, int);
+int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
+int setpgrp(int, int);
+void setpwent(void);
+int setrlimit(int, struct rlimit *);
+void setservent(int);
+int setsockopt(int, int, int, char *, int);
+int shutdown(int, int);
+int sigblock(int);
+void (*signal (int, void (*) (int))) (int);
+int sigpause(int);
+int sigsetmask(int);
+#ifdef __STDC__
+struct sigvec;
+#endif
+int sigvec(int, struct sigvec *, struct sigvec*);
+int snprintf(char *, size_t, const char *, ...);
+int socket(int, int, int);
+int socketpair(int, int, int, int *);
+int symlink(const char *, const char *);
+void srandom(int);
+int sscanf(char *, const char *, ...);
+int stat(const char *, struct stat *);
+int statfs(char *, struct statfs *);
+char *strerror(int);
+int strcasecmp(const char *, const char *);
+#ifdef __STDC__
+struct tm;
+#endif
+int strftime(char *, int, char *, struct tm *);
+int strncasecmp(const char *, const char *, int);
+long strtol(const char *, char **, int);
+void sync(void);
+void syslog(int, const char *, ...);
+int system(const char *);
+long tell(int);
+time_t time(time_t *);
+char *timezone(int, int);
+int tolower(int);
+int toupper(int);
+int truncate(char *, off_t);
+void unsetenv(const char *);
+int vfork(void);
+int vsprintf(char *, const char *, ...);
+int writev(int, struct iovec *, int);
+#ifdef __STDC__
+struct rusage;
+#endif
+int utimes(const char *, struct timeval *);
+#if __GNUC__ <= 1
+int wait(int *);
+pid_t wait3(int *, int, struct rusage *);
+#endif
+
+/* Ugly signal hacking */
+#ifdef SIG_ERR
+#undef SIG_ERR
+#define SIG_ERR (void (*)(int))-1
+#undef SIG_DFL
+#define SIG_DFL (void (*)(int))0
+#undef SIG_IGN
+#define SIG_IGN (void (*)(int))1
+
+#ifdef KERNEL
+#undef SIG_CATCH
+#define SIG_CATCH (void (*)(int))2
+#endif
+#undef SIG_HOLD
+#define SIG_HOLD (void (*)(int))3
+#endif
diff --git a/contrib/nslint-2.1a3/lbl/os-ultrix4.h b/contrib/nslint-2.1a3/lbl/os-ultrix4.h
new file mode 100644
index 0000000..f8cedf4
--- /dev/null
+++ b/contrib/nslint-2.1a3/lbl/os-ultrix4.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1990, 1993, 1994, 1995, 1996
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @(#) $Header: /proj/cvs/prod/bind9/contrib/nslint-2.1a3/lbl/os-ultrix4.h,v 1.1 2001/12/21 04:12:05 marka Exp $ (LBL)
+ */
+
+/* Prototypes missing in Ultrix 4 */
+int bcmp(const char *, const char *, u_int);
+void bcopy(const void *, void *, u_int);
+void bzero(void *, u_int);
+void endservent(void);
+int getopt(int, char * const *, const char *);
+#ifdef __STDC__
+struct timeval;
+struct timezone;
+#endif
+int gettimeofday(struct timeval *, struct timezone *);
+int ioctl(int, int, caddr_t);
+int pfopen(char *, int);
+int setlinebuf(FILE *);
+int socket(int, int, int);
+int strcasecmp(const char *, const char *);
diff --git a/contrib/nslint-2.1a3/mkdep b/contrib/nslint-2.1a3/mkdep
new file mode 100644
index 0000000..2a9c221
--- /dev/null
+++ b/contrib/nslint-2.1a3/mkdep
@@ -0,0 +1,109 @@
+#!/bin/sh -
+#
+# Copyright (c) 1994, 1996
+# The Regents of the University of California. All rights reserved.
+#
+# Redistribution and use in source and binary forms are permitted
+# provided that this notice is preserved and that due credit is given
+# to the University of California at Berkeley. The name of the University
+# may not be used to endorse or promote products derived from this
+# software without specific prior written permission. This software
+# is provided ``as is'' without express or implied warranty.
+#
+# @(#)mkdep.sh 5.11 (Berkeley) 5/5/88
+#
+
+PATH=/bin:/usr/bin:/usr/ucb:/usr/local:/usr/local/bin
+export PATH
+
+MAKE=Makefile # default makefile name is "Makefile"
+CC=cc # default C compiler is "cc"
+
+while :
+ do case "$1" in
+ # -c allows you to specify the C compiler
+ -c)
+ CC=$2
+ shift; shift ;;
+
+ # -f allows you to select a makefile name
+ -f)
+ MAKE=$2
+ shift; shift ;;
+
+ # the -p flag produces "program: program.c" style dependencies
+ # so .o's don't get produced
+ -p)
+ SED='s;\.o;;'
+ shift ;;
+ *)
+ break ;;
+ esac
+done
+
+if [ $# = 0 ] ; then
+ echo 'usage: mkdep [-p] [-c cc] [-f makefile] [flags] file ...'
+ exit 1
+fi
+
+if [ ! -w $MAKE ]; then
+ echo "mkdep: no writeable file \"$MAKE\""
+ exit 1
+fi
+
+TMP=/tmp/mkdep$$
+
+trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
+
+cp $MAKE ${MAKE}.bak
+
+sed -e '/DO NOT DELETE THIS LINE/,$d' < $MAKE > $TMP
+
+cat << _EOF_ >> $TMP
+# DO NOT DELETE THIS LINE -- mkdep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+_EOF_
+
+# If your compiler doesn't have -M, add it. If you can't, the next two
+# lines will try and replace the "cc -M". The real problem is that this
+# hack can't deal with anything that requires a search path, and doesn't
+# even try for anything using bracket (<>) syntax.
+#
+# egrep '^#include[ ]*".*"' /dev/null $* |
+# sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' -e 's/\.c/.o/' |
+
+# XXX this doesn't work with things like "-DDECLWAITSTATUS=union\ wait"
+$CC -M $* |
+sed "
+ s; \./; ;g
+ $SED" |
+awk '{
+ if ($1 != prev) {
+ if (rec != "")
+ print rec;
+ rec = $0;
+ prev = $1;
+ }
+ else {
+ if (length(rec $2) > 78) {
+ print rec;
+ rec = $0;
+ }
+ else
+ rec = rec " " $2
+ }
+}
+END {
+ print rec
+}' >> $TMP
+
+cat << _EOF_ >> $TMP
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
+_EOF_
+
+# copy to preserve permissions
+cp $TMP $MAKE
+rm -f ${MAKE}.bak $TMP
+exit 0
diff --git a/contrib/nslint-2.1a3/nslint.8 b/contrib/nslint-2.1a3/nslint.8
new file mode 100644
index 0000000..98c1ebe
--- /dev/null
+++ b/contrib/nslint-2.1a3/nslint.8
@@ -0,0 +1,451 @@
+.\" @(#) $Id: nslint.8,v 1.1 2001/12/21 04:12:03 marka Exp $ (LBL)
+.\"
+.\" Copyright (c) 1994, 1996, 1997, 1999, 2001
+.\" The Regents of the University of California. All rights reserved.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that: (1) source code distributions
+.\" retain the above copyright notice and this paragraph in its entirety, (2)
+.\" distributions including binary code include the above copyright notice and
+.\" this paragraph in its entirety in the documentation or other materials
+.\" provided with the distribution, and (3) all advertising materials mentioning
+.\" features or use of this software display the following acknowledgement:
+.\" ``This product includes software developed by the University of California,
+.\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+.\" the University nor the names of its contributors may be used to endorse
+.\" or promote products derived from this software without specific prior
+.\" written permission.
+.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+.\"
+.TH nslint 8 "20 March 2001"
+.UC 4
+.SH NAME
+nslint - perform consistency checks on dns files
+.SH SYNOPSIS
+.B nslint
+[
+.B -d
+] [
+.B -b
+.I named.boot
+] [
+.B -B
+.I nslint.boot
+]
+.br
+.B nslint
+[
+.B -d
+] [
+.B -c
+.I named.conf
+] [
+.B -C
+.I nslint.conf
+]
+.SH DESCRIPTION
+.B Nslint
+reads the nameserver configuration files and performs a number of
+consistency checks on the dns records. If any problems are discovered,
+error messages are displayed on
+.I stderr
+and
+.B nslint
+exits with a non-zero status.
+.LP
+Here is a short list of errors
+.B nslint
+detects:
+.IP
+Records that are malformed.
+.IP
+Names that contain dots but are missing a trailing dot.
+.IP
+.B PTR
+records with names that are missing a trailing dot.
+.IP
+Names that contain illegal characters (rfc1034).
+.IP
+.B A
+records
+without matching
+.B PTR
+records
+.IP
+.B PTR
+records
+without matching
+.B A
+records
+.IP
+Names with more than one address on the same subnet.
+.IP
+Addresses in use by more than one name.
+.IP
+Names with
+.B CNAME
+and other records (rfc1033).
+.IP
+Unknown service and/or protocol keywords in
+.B WKS
+records.
+.IP
+Missing quotes.
+.LP
+.SH OPTIONS
+.TP
+.B -b
+Specify an alternate
+.I named.boot
+file. The default is
+.IR /etc/named.boot .
+.TP
+.TP
+.B -c
+Specify an alternate
+.I named.conf
+file. The default is
+.IR /etc/named.conf .
+.TP
+.B -B
+Specify an alternate
+.I nslint.boot
+file. The default is
+.I nslint.boot
+in the last
+.B directory
+line processed in
+.I named.boot
+(or the current working directory).
+This file is processed like a second
+.IR named.boot .
+The most common use is to tell
+.B nslint
+about
+.B A
+records that match
+.B PTR
+records that point outside the domains listed in
+.IR named.boot .
+.TP
+.B -C
+Specify an alternate
+.I nslint.conf
+file. The default is
+.I nslint.conf
+in the last
+.B directory
+line processed in
+.I named.conf
+(or the current working directory).
+This file is processed like a second
+.IR named.conf .
+.TP
+.B -d
+Raise the debugging level. Debugging information is
+displayed on
+.IR stdout .
+.LP
+.B Nslint
+knows how to read old style
+.I named.boot
+and BIND 8's new
+.I named.conf
+files. If both files exist,
+.B nslint
+will prefer
+.I named.conf
+(on the theory that you forgot to delete
+.I named.boot
+when you upgraded to BIND 8).
+.LP
+.SH "ADVANCED CONFIGURATION"
+There are some cases where it is necessary to use the
+advanced configuration features of
+.BR nslint .
+Advanced configuration is done with the
+.I nslint.boot
+file.
+.LP
+The most common is when a site has a demilitarized zone (DMZ).
+The problem here is that the DMZ network will have
+.B PTR
+records for hosts outside its domain. For example lets say
+we have
+.I 128.0.rev
+with:
+.LP
+.RS
+.nf
+.sp .5
+1.1 604800 in ptr gateway.lbl.gov.
+2.1 604800 in ptr gateway.es.net.
+.sp .5
+.fi
+.RE
+.LP
+Obviously we will define an
+.B A
+record for
+.I gateway.lbl.gov
+pointing to
+.I 128.0.1.1
+but we will get errors because there is no
+.B A
+record defined for
+.IR gateway.es.net .
+The solution is to create a
+.I nslint.boot
+file (in the same directory as the other dns files)
+with:
+.LP
+.RS
+.nf
+.sp .5
+primary es.net nslint.es.net
+.sp .5
+.fi
+.RE
+.LP
+And then create the file
+.I nslint.es.net
+with:
+.LP
+.RS
+.nf
+.sp .5
+gateway 1 in a 128.0.1.2
+.sp .5
+.fi
+.RE
+.LP
+Another problem occurs when there is a
+.B CNAME
+that points to a host outside the local domains. Let's say we have
+.I info.lbl.gov
+pointing to
+.IR larry.es.net :
+.LP
+.RS
+.nf
+.sp .5
+info 604800 in cname larry.es.net.
+.sp .5
+.fi
+.RE
+.LP
+In this case we would need:
+.LP
+.RS
+.nf
+.sp .5
+primary es.net nslint.es.net
+.sp .5
+.fi
+.RE
+.LP
+in
+.I nslint.boot
+and:
+.LP
+.RS
+.nf
+.sp .5
+larry 1 in txt "place holder"
+.sp .5
+.fi
+.RE
+.LP
+.IR nslint.es.net .
+.LP
+One last problem
+when a pseudo host is setup to allow two more
+more actual hosts provide a service. For, let's say that
+.I lbl.gov
+contains:
+.LP
+.RS
+.nf
+.sp .5
+server 604800 in a 128.0.6.6
+server 604800 in a 128.0.6.94
+;
+tom 604800 in a 128.0.6.6
+tom 604800 in mx 0 lbl.gov.
+;
+jerry 604800 in a 128.0.6.94
+jerry 604800 in mx 0 lbl.gov.
+.sp .5
+.fi
+.RE
+.LP
+In this case
+.B nslint
+would complain about missing
+.B PTR
+records and ip addresses in use by more than one host.
+To suppress these warnings, add you would the lines:
+.LP
+.RS
+.nf
+.sp .5
+primary lbl.gov nslint.lbl.gov
+primary 0.128.in-addr.arpa nslint.128.0.rev
+.sp .5
+.fi
+.RE
+.LP
+to
+.I nslint.boot
+and create
+.I nslint.lbl.gov
+with:
+.LP
+.RS
+.nf
+.sp .5
+server 1 in allowdupa 128.0.6.6
+server 1 in allowdupa 128.0.6.94
+.sp .5
+.fi
+.RE
+.LP
+and create
+.I nslint.128.0.rev
+with:
+.LP
+.RS
+.nf
+.sp .5
+6.6 604800 in ptr server.lbl.gov.
+94.6 604800 in ptr server.lbl.gov.
+.sp .5
+.fi
+.RE
+.LP
+In this example, the
+.B allowdupa
+keyword tells
+.B nslint
+that it's ok for
+.I 128.0.6.6
+and
+.I 128.0.6.94
+to be shared by
+.IR server.lbl.gov ,
+.IR tom.lbl.gov ,
+and
+.IR jerry.lbl.gov .
+.LP
+One last
+.B nslint
+feature helps detect hosts that have mistakenly had two ip addresses
+assigned on the same subnet. This can happen when two different
+people request an ip address for the same hostname or when someone
+forgets an address has been assigned and requests a new number.
+.LP
+To detect such
+.B A
+records, add a
+.B nslint
+section to your
+.I nslint.conf
+containing something similar to:
+.LP
+.RS
+.nf
+.sp .5
+nslint {
+.RS
+network "128.0.6/22";
+network "128.0.6 255.255.252.0";
+.RE
+};
+.sp .5
+.fi
+.RE
+.LP
+The two network lines in this example are equivalent ways of saying the same
+thing; that subnet
+.I 128.0.6
+has a 22 bit wide subnet mask.
+.LP
+If you are using
+.IR nslint.boot ,
+the syntax would be:
+.LP
+.RS
+.nf
+.sp .5
+network 128.0.6/22
+network 128.0.6 255.255.252.0
+.sp .5
+.fi
+.RE
+.LP
+Again this shows two ways of saying the same thing.
+.LP
+Using information from the above
+.B network
+statement,
+.B nslint
+would would flag the following
+.B A
+records as being in error:
+.LP
+.RS
+.nf
+.sp .5
+server 1 in a 128.0.6.48
+server 1 in a 128.0.7.16
+.sp .5
+.fi
+.RE
+.LP
+Note that if you specify any
+.B network
+lines in your
+.I nslint.conf
+or
+.I nslint.boot
+files,
+.B nslint
+requires you to include lines for all networks;
+otherwise you might forget to add
+.B network
+lines for new networks.
+.LP
+.SH FILES
+.na
+.nh
+.nf
+/etc/named.boot - default named configuration file
+nslint.boot - default nslint configuration file
+.ad
+.hy
+.fi
+.LP
+.SH "SEE ALSO"
+.na
+.nh
+.IR named (8),
+rfc1033,
+rfc1034
+.ad
+.hy
+.SH AUTHOR
+Craig Leres of the
+Lawrence Berkeley National Laboratory, University of California, Berkeley, CA.
+.LP
+The current version is available via anonymous ftp:
+.LP
+.RS
+.I ftp://ftp.ee.lbl.gov/nslint.tar.gz
+.RE
+.SH BUGS
+Please send bug reports to nslint@ee.lbl.gov.
+.LP
+Not everyone is guaranteed to agree with all the checks done.
diff --git a/contrib/nslint-2.1a3/nslint.c b/contrib/nslint-2.1a3/nslint.c
new file mode 100644
index 0000000..8ce9505
--- /dev/null
+++ b/contrib/nslint-2.1a3/nslint.c
@@ -0,0 +1,2382 @@
+/*
+ * Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+#ifndef lint
+static const char copyright[] =
+ "@(#) Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001\n\
+The Regents of the University of California. All rights reserved.\n";
+static const char rcsid[] =
+ "@(#) $Id: nslint.c,v 1.1 2001/12/21 04:12:04 marka Exp $ (LBL)";
+#endif
+/*
+ * nslint - perform consistency checks on dns files
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <netinet/in.h>
+
+#include <arpa/inet.h>
+
+#include <ctype.h>
+#include <errno.h>
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+#include <netdb.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "savestr.h"
+
+#include "gnuc.h"
+#ifdef HAVE_OS_PROTO_H
+#include "os-proto.h"
+#endif
+
+#define NSLINTBOOT "nslint.boot" /* default nslint.boot file */
+#define NSLINTCONF "nslint.conf" /* default nslint.conf file */
+
+/* item struct */
+struct item {
+ char *host; /* pointer to hostname */
+ u_int32_t addr; /* ip address */
+ u_int ttl; /* ttl of A records */
+ int records; /* resource records seen */
+ int flags; /* flags word */
+};
+
+/* Resource records seen */
+#define REC_A 0x0001
+#define REC_PTR 0x0002
+#define REC_WKS 0x0004
+#define REC_HINFO 0x0008
+#define REC_MX 0x0010
+#define REC_CNAME 0x0020
+#define REC_NS 0x0040
+#define REC_SOA 0x0080
+#define REC_RP 0x0100
+#define REC_TXT 0x0200
+#define REC_SRV 0x0400
+
+/* These aren't real records */
+#define REC_OTHER 0x0800
+#define REC_REF 0x1000
+#define REC_UNKNOWN 0x2000
+
+/* Test for records we want to map to REC_OTHER */
+#define MASK_TEST_REC (REC_WKS | REC_HINFO | \
+ REC_MX | REC_SOA | REC_RP | REC_TXT | REC_SRV | REC_UNKNOWN)
+
+/* Mask away records we don't care about in the final processing to REC_OTHER */
+#define MASK_CHECK_REC \
+ (REC_A | REC_PTR | REC_CNAME | REC_REF | REC_OTHER)
+
+/* Test for records we want to check for duplicate name detection */
+#define MASK_TEST_DUP \
+ (REC_A | REC_HINFO)
+
+/* Flags */
+#define FLG_SELFMX 0x001 /* mx record refers to self */
+#define FLG_MXREF 0x002 /* this record referred to by a mx record */
+#define FLG_SMTPWKS 0x004 /* saw wks with smtp/tcp */
+#define FLG_ALLOWDUPA 0x008 /* allow duplicate a records */
+
+/* Test for smtp problems */
+#define MASK_TEST_SMTP \
+ (FLG_SELFMX | FLG_SMTPWKS)
+
+
+#define ITEMSIZE (1 << 17) /* power of two */
+#define ITEMHASH(str, h, p) \
+ for (p = str, h = 0; *p != '.' && *p != '\0';) h = (h << 5) - h + *p++
+
+struct item items[ITEMSIZE];
+int itemcnt; /* count of items */
+
+/* Hostname string storage */
+#define STRSIZE 8192; /* size to malloc when more space is needed */
+char *strptr; /* pointer to string pool */
+int strsize; /* size of space left in pool */
+
+int debug;
+int errors;
+char *bootfile = "/etc/named.boot";
+char *conffile = "/etc/named.conf";
+char *nslintboot;
+char *nslintconf;
+char *prog;
+char *cwd = ".";
+
+char **protoserv; /* valid protocol/service names */
+int protoserv_init;
+int protoserv_last;
+int protoserv_len;
+
+static char inaddr[] = ".in-addr.arpa.";
+
+/* SOA record */
+#define SOA_SERIAL 0
+#define SOA_REFRESH 1
+#define SOA_RETRY 2
+#define SOA_EXPIRE 3
+#define SOA_MINIMUM 4
+
+static u_int soaval[5];
+static int nsoaval;
+#define NSOAVAL (sizeof(soaval) / sizeof(soaval[0]))
+
+/* Forwards */
+static inline void add_domain(char *, const char *);
+int checkdots(const char *);
+void checkdups(struct item *, int);
+int checkserv(const char *, char **p);
+int checkwks(FILE *, char *, int *, char **);
+int cmpaddr(const void *, const void *);
+int cmphost(const void *, const void *);
+int doboot(const char *, int);
+int doconf(const char *, int);
+void initprotoserv(void);
+char *intoa(u_int32_t);
+int main(int, char **);
+int nslint(void);
+int parseinaddr(const char *, u_int32_t *, u_int32_t *);
+int parsenetwork(const char *, char **);
+u_int32_t parseptr(const char *, u_int32_t, u_int32_t, char **);
+char *parsequoted(char *);
+int parsesoa(const char *, char **);
+void process(const char *, const char *, const char *);
+int rfc1034host(const char *, int);
+int updateitem(const char *, u_int32_t, int, u_int, int);
+__dead void usage(void) __attribute__((volatile));
+
+extern char *optarg;
+extern int optind, opterr;
+
+/* add domain if necessary */
+static inline void
+add_domain(register char *name, register const char *domain)
+{
+ register char *cp;
+
+ /* Kill trailing white space and convert to lowercase */
+ for (cp = name; *cp != '\0' && !isspace(*cp); ++cp)
+ if (isupper(*cp))
+ *cp = tolower(*cp);
+ *cp-- = '\0';
+ /* If necessary, append domain */
+ if (cp >= name && *cp++ != '.') {
+ if (*domain != '.')
+ *cp++ = '.';
+ (void)strcpy(cp, domain);
+ }
+ /* XXX should we insure a trailing dot? */
+}
+
+int
+main(int argc, char **argv)
+{
+ register char *cp;
+ register int op, status, i, donamedboot, donamedconf;
+
+ if ((cp = strrchr(argv[0], '/')) != NULL)
+ prog = cp + 1;
+ else
+ prog = argv[0];
+
+ donamedboot = 0;
+ donamedconf = 0;
+ while ((op = getopt(argc, argv, "b:c:B:C:d")) != -1)
+ switch (op) {
+
+ case 'b':
+ bootfile = optarg;
+ ++donamedboot;
+ break;
+
+ case 'c':
+ conffile = optarg;
+ ++donamedconf;
+ break;
+
+ case 'B':
+ nslintboot = optarg;
+ ++donamedboot;
+ break;
+
+ case 'C':
+ nslintconf = optarg;
+ ++donamedconf;
+ break;
+
+ case 'd':
+ ++debug;
+ break;
+
+ default:
+ usage();
+ }
+ if (optind != argc || (donamedboot && donamedconf))
+ usage();
+
+ if (donamedboot)
+ status = doboot(bootfile, 1);
+ else if (donamedconf)
+ status = doconf(conffile, 1);
+ else {
+ status = doconf(conffile, 0);
+ if (status < 0) {
+ status = doboot(bootfile, 1);
+ ++donamedboot;
+ } else
+ ++donamedconf;
+ }
+
+ if (donamedboot) {
+ if (nslintboot != NULL)
+ status |= doboot(nslintboot, 1);
+ else if ((i = doboot(NSLINTBOOT, 0)) > 0)
+ status |= i;
+ } else {
+ if (nslintconf != NULL)
+ status |= doconf(nslintconf, 1);
+ else if ((i = doconf(NSLINTCONF, 0)) > 0)
+ status |= i;
+ }
+ status |= nslint();
+ exit (status);
+}
+
+struct netlist {
+ u_int32_t net;
+ u_int32_t mask;
+};
+
+static struct netlist *netlist;
+static u_int netlistsize; /* size of array */
+static u_int netlistcnt; /* next free element */
+
+static u_int32_t
+findmask(u_int32_t addr)
+{
+ register int i;
+
+ for (i = 0; i < netlistcnt; ++i)
+ if ((addr & netlist[i].mask) == netlist[i].net)
+ return (netlist[i].mask);
+ return (0);
+}
+
+int
+parsenetwork(register const char *cp, register char **errstrp)
+{
+ register int i, w;
+ register u_int32_t net, mask;
+ register u_int32_t o;
+ register int shift;
+ static char errstr[132];
+
+ while (isspace(*cp))
+ ++cp;
+ net = 0;
+ mask = 0;
+ shift = 24;
+ while (isdigit(*cp) && shift >= 0) {
+ o = 0;
+ do {
+ o = o * 10 + (*cp++ - '0');
+ } while (isdigit(*cp));
+ net |= o << shift;
+ shift -= 8;
+ if (*cp != '.')
+ break;
+ ++cp;
+ }
+
+
+ if (isspace(*cp)) {
+ ++cp;
+ while (isspace(*cp))
+ ++cp;
+ mask = htonl(inet_addr(cp));
+ if ((int)mask == -1) {
+ *errstrp = errstr;
+ (void)sprintf(errstr, "bad mask \"%s\"", cp);
+ return (0);
+ }
+ i = 0;
+ while (isdigit(*cp))
+ ++cp;
+ for (i = 0; i < 3 && *cp == '.'; ++i) {
+ ++cp;
+ while (isdigit(*cp))
+ ++cp;
+ }
+ if (i != 3) {
+ *errstrp = "wrong number of dots in mask";
+ return (0);
+ }
+ } else if (*cp == '/') {
+ ++cp;
+ w = atoi(cp);
+ do {
+ ++cp;
+ } while (isdigit(*cp));
+ if (w < 1 || w > 32) {
+ *errstrp = "bad mask width";
+ return (0);
+ }
+ mask = 0xffffffff << (32 - w);
+ } else {
+ *errstrp = "garbage after net";
+ return (0);
+ }
+
+ while (isspace(*cp))
+ ++cp;
+
+ if (*cp != '\0') {
+ *errstrp = "trailing garbage";
+ return (0);
+ }
+
+ /* Finaly sanity checks */
+ if ((net & ~ mask) != 0) {
+ *errstrp = errstr;
+ (void)sprintf(errstr, "host bits set in net \"%s\"",
+ intoa(net));
+ return (0);
+ }
+
+ /* Make sure there's room */
+ if (netlistsize <= netlistcnt) {
+ if (netlistsize == 0) {
+ netlistsize = 32;
+ netlist = (struct netlist *)
+ malloc(netlistsize * sizeof(*netlist));
+ } else {
+ netlistsize <<= 1;
+ netlist = (struct netlist *)
+ realloc(netlist, netlistsize * sizeof(*netlist));
+ }
+ if (netlist == NULL) {
+ fprintf(stderr, "%s: nslint: malloc/realloc: %s\n",
+ prog, strerror(errno));
+ exit(1);
+ }
+ }
+
+ /* Add to list */
+ netlist[netlistcnt].net = net;
+ netlist[netlistcnt].mask = mask;
+ ++netlistcnt;
+
+ return (1);
+}
+
+int
+doboot(register const char *file, register int mustexist)
+{
+ register int n;
+ register char *cp, *cp2;
+ register FILE *f;
+ char *errstr;
+ char buf[1024], name[128];
+
+ errno = 0;
+ f = fopen(file, "r");
+ if (f == NULL) {
+ /* Not an error if it doesn't exist */
+ if (!mustexist && errno == ENOENT) {
+ if (debug > 1)
+ printf(
+ "%s: doit: %s doesn't exist (ignoring)\n",
+ prog, file);
+ return (-1);
+ }
+ fprintf(stderr, "%s: %s: %s\n", prog, file, strerror(errno));
+ exit(1);
+ }
+ if (debug > 1)
+ printf("%s: doit: opened %s\n", prog, file);
+
+ n = 0;
+ while (fgets(buf, sizeof(buf), f) != NULL) {
+ ++n;
+
+ /* Skip comments */
+ if (buf[0] == ';')
+ continue;
+ cp = strchr(buf, ';');
+ if (cp)
+ *cp = '\0';
+ cp = buf + strlen(buf) - 1;
+ if (cp >= buf && *cp == '\n')
+ *cp = '\0';
+ cp = buf;
+
+ /* Eat leading whitespace */
+ while (isspace(*cp))
+ ++cp;
+
+ /* Skip blank lines */
+ if (*cp == '\n' || *cp == '\0')
+ continue;
+
+ /* Get name */
+ cp2 = cp;
+ while (!isspace(*cp) && *cp != '\0')
+ ++cp;
+ *cp++ = '\0';
+
+ /* Find next keyword */
+ while (isspace(*cp))
+ ++cp;
+ if (strcasecmp(cp2, "directory") == 0) {
+ /* Terminate directory */
+ cp2 = cp;
+ while (!isspace(*cp) && *cp != '\0')
+ ++cp;
+ *cp = '\0';
+ if (chdir(cp2) < 0) {
+ ++errors;
+ fprintf(stderr, "%s: can't chdir %s: %s\n",
+ prog, cp2, strerror(errno));
+ exit(1);
+ }
+ cwd = savestr(cp2);
+ continue;
+ }
+ if (strcasecmp(cp2, "primary") == 0) {
+ /* Extract domain, converting to lowercase */
+ for (cp2 = name; !isspace(*cp) && *cp != '\0'; ++cp)
+ if (isupper(*cp))
+ *cp2++ = tolower(*cp);
+ else
+ *cp2++ = *cp;
+ /* Insure trailing dot */
+ if (cp2 > name && cp2[-1] != '.')
+ *cp2++ = '.';
+ *cp2 = '\0';
+
+ /* Find file */
+ while (isspace(*cp))
+ ++cp;
+
+ /* Terminate directory */
+ cp2 = cp;
+ while (!isspace(*cp) && *cp != '\0')
+ ++cp;
+ *cp = '\0';
+
+ /* Process it! (zone is the same as the domain) */
+ nsoaval = -1;
+ memset(soaval, 0, sizeof(soaval));
+ process(cp2, name, name);
+ continue;
+ }
+ if (strcasecmp(cp2, "network") == 0) {
+ if (!parsenetwork(cp, &errstr)) {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s:%d: bad network: %s\n",
+ prog, file, n, errstr);
+ }
+ continue;
+ }
+ if (strcasecmp(cp2, "include") == 0) {
+ /* Terminate include file */
+ cp2 = cp;
+ while (!isspace(*cp) && *cp != '\0')
+ ++cp;
+ *cp = '\0';
+ errors += doboot(cp2, 1);
+ continue;
+ }
+ /* Eat any other options */
+ }
+ (void)fclose(f);
+
+ return (errors != 0);
+}
+
+int
+doconf(register const char *file, register int mustexist)
+{
+ register int n, fd, cc, i, depth;
+ register char *cp, *cp2, *buf;
+ register char *name, *zonename, *filename, *typename;
+ register int namelen, zonenamelen, filenamelen, typenamelen;
+ char *errstr;
+ struct stat sbuf;
+ char zone[128], includefile[256];
+
+ errno = 0;
+ fd = open(file, O_RDONLY, 0);
+ if (fd < 0) {
+ /* Not an error if it doesn't exist */
+ if (!mustexist && errno == ENOENT) {
+ if (debug > 1)
+ printf(
+ "%s: doconf: %s doesn't exist (ignoring)\n",
+ prog, file);
+ return (-1);
+ }
+ fprintf(stderr, "%s: %s: %s\n", prog, file, strerror(errno));
+ exit(1);
+ }
+ if (debug > 1)
+ printf("%s: doconf: opened %s\n", prog, file);
+
+ if (fstat(fd, &sbuf) < 0) {
+ fprintf(stderr, "%s: fstat(%s) %s\n",
+ prog, file, strerror(errno));
+ exit(1);
+ }
+ buf = (char *)malloc(sbuf.st_size + 1);
+ if (buf == NULL) {
+ fprintf(stderr, "%s: malloc: %s\n", prog, strerror(errno));
+ exit(1);
+ }
+
+ /* Slurp entire config file */
+ n = sbuf.st_size;
+ cp = buf;
+ do {
+ cc = read(fd, cp, n);
+ if (cc < 0) {
+ fprintf(stderr, "%s: read(%s) %s\n",
+ prog, file, strerror(errno));
+ exit(1);
+ }
+ cp += cc;
+ n -= cc;
+ } while (cc != 0 && cc < n);
+ buf[cc] = '\0';
+
+#define EATWHITESPACE \
+ while (isspace(*cp)) { \
+ if (*cp == '\n') \
+ ++n; \
+ ++cp; \
+ }
+
+/* Handle both to-end-of-line and C style comments */
+#define EATCOMMENTS \
+ { \
+ int sawcomment; \
+ do { \
+ EATWHITESPACE \
+ sawcomment = 0; \
+ if (*cp == '#') { \
+ sawcomment = 1; \
+ ++cp; \
+ while (*cp != '\n' && *cp != '\0') \
+ ++cp; \
+ } \
+ else if (strncmp(cp, "//", 2) == 0) { \
+ sawcomment = 1; \
+ cp += 2; \
+ while (*cp != '\n' && *cp != '\0') \
+ ++cp; \
+ } \
+ else if (strncmp(cp, "/*", 2) == 0) { \
+ sawcomment = 1; \
+ for (cp += 2; *cp != '\0'; ++cp) { \
+ if (*cp == '\n') \
+ ++n; \
+ else if (strncmp(cp, "*/", 2) == 0) { \
+ cp += 2; \
+ break; \
+ } \
+ } \
+ } \
+ } while (sawcomment); \
+ }
+
+#define GETNAME(name, len) \
+ { \
+ (name) = cp; \
+ (len) = 0; \
+ while (!isspace(*cp) && *cp != ';' && *cp != '\0') { \
+ ++(len); \
+ ++cp; \
+ } \
+ }
+
+#define GETQUOTEDNAME(name, len) \
+ { \
+ if (*cp != '"') { \
+ ++errors; \
+ fprintf(stderr, "%s: %s:%d missing left quote\n", \
+ prog, file, n); \
+ } else \
+ ++cp; \
+ (name) = cp; \
+ (len) = 0; \
+ while (*cp != '"' && *cp != '\n' && *cp != '\0') { \
+ ++(len); \
+ ++cp; \
+ } \
+ if (*cp != '"') { \
+ ++errors; \
+ fprintf(stderr, "%s: %s:%d missing right quote\n", \
+ prog, file, n); \
+ } else \
+ ++cp; \
+ }
+
+/* Eat everything to the next semicolon, perhaps eating matching qbraces */
+#define EATSEMICOLON \
+ { \
+ register int depth = 0; \
+ while (*cp != '\0') { \
+ EATCOMMENTS \
+ if (*cp == ';') { \
+ ++cp; \
+ if (depth == 0) \
+ break; \
+ continue; \
+ } \
+ if (*cp == '{') { \
+ ++depth; \
+ ++cp; \
+ continue; \
+ } \
+ if (*cp == '}') { \
+ --depth; \
+ ++cp; \
+ continue; \
+ } \
+ ++cp; \
+ } \
+ }
+
+ n = 1;
+ zone[0] = '\0';
+ cp = buf;
+ while (*cp != '\0') {
+ EATCOMMENTS
+ if (*cp == '\0')
+ break;
+ GETNAME(name, namelen)
+ if (namelen == 0) {
+ ++errors;
+ fprintf(stderr, "%s: %s:%d garbage char '%c' (1)\n",
+ prog, file, n, *cp);
+ ++cp;
+ continue;
+ }
+ EATCOMMENTS
+ if (strncasecmp(name, "options", namelen) == 0) {
+ EATCOMMENTS
+ if (*cp != '{') {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s:%d missing left qbrace in options\n",
+ prog, file, n);
+ } else
+ ++cp;
+ EATCOMMENTS
+ while (*cp != '}' && *cp != '\0') {
+ EATCOMMENTS
+ GETNAME(name, namelen)
+ if (namelen == 0) {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s:%d garbage char '%c' (2)\n",
+ prog, file, n, *cp);
+ ++cp;
+ break;
+ }
+
+ /* If not the "directory" option, just eat it */
+ if (strncasecmp(name, "directory",
+ namelen) == 0) {
+ EATCOMMENTS
+ GETQUOTEDNAME(cp2, i)
+ cp2[i] = '\0';
+ if (chdir(cp2) < 0) {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s:.%d can't chdir %s: %s\n",
+ prog, file, n, cp2,
+ strerror(errno));
+ exit(1);
+ }
+ cwd = savestr(cp2);
+ }
+ EATSEMICOLON
+ EATCOMMENTS
+ }
+ ++cp;
+ EATCOMMENTS
+ if (*cp != ';') {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s:%d missing options semi\n",
+ prog, file, n);
+ } else
+ ++cp;
+ continue;
+ }
+ if (strncasecmp(name, "zone", namelen) == 0) {
+ EATCOMMENTS
+ GETQUOTEDNAME(zonename, zonenamelen)
+ typename = NULL;
+ filename = NULL;
+ typenamelen = 0;
+ filenamelen = 0;
+ EATCOMMENTS
+ if (strncasecmp(cp, "in", 2) == 0) {
+ cp += 2;
+ EATWHITESPACE
+ } else if (strncasecmp(cp, "chaos", 5) == 0) {
+ cp += 5;
+ EATWHITESPACE
+ }
+ if (*cp != '{') { /* } */
+ ++errors;
+ fprintf(stderr,
+ "%s: %s:%d missing left qbrace in zone\n",
+ prog, file, n);
+ continue;
+ }
+ depth = 0;
+ EATCOMMENTS
+ while (*cp != '\0') {
+ if (*cp == '{') {
+ ++cp;
+ ++depth;
+ } else if (*cp == '}') {
+ if (--depth <= 1)
+ break;
+ ++cp;
+ }
+ EATCOMMENTS
+ GETNAME(name, namelen)
+ if (namelen == 0) {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s:%d garbage char '%c' (3)\n",
+ prog, file, n, *cp);
+ ++cp;
+ break;
+ }
+ if (strncasecmp(name, "type",
+ namelen) == 0) {
+ EATCOMMENTS
+ GETNAME(typename, typenamelen)
+ if (namelen == 0) {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s:%d garbage char '%c' (4)\n",
+ prog, file, n, *cp);
+ ++cp;
+ break;
+ }
+ } else if (strncasecmp(name, "file",
+ namelen) == 0) {
+ EATCOMMENTS
+ GETQUOTEDNAME(filename, filenamelen)
+ }
+ /* Just ignore keywords we don't understand */
+ EATSEMICOLON
+ EATCOMMENTS
+ }
+ /* { */
+ if (*cp != '}') {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s:%d missing zone right qbrace\n",
+ prog, file, n);
+ } else
+ ++cp;
+ if (*cp != ';') {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s:%d missing zone semi\n",
+ prog, file, n);
+ } else
+ ++cp;
+ EATCOMMENTS
+ /* If we got something interesting, process it */
+ if (typenamelen == 0) {
+ ++errors;
+ fprintf(stderr, "%s: missing zone type!\n",
+ prog);
+ continue;
+ }
+ if (strncasecmp(typename, "master", typenamelen) == 0) {
+ if (filenamelen == 0) {
+ ++errors;
+ fprintf(stderr,
+ "%s: missing zone filename!\n",
+ prog);
+ continue;
+ }
+ strncpy(zone, zonename, zonenamelen);
+ zone[zonenamelen] = '\0';
+ for (cp2 = zone; *cp2 != '\0'; ++cp2)
+ if (isupper(*cp2))
+ *cp2 = tolower(*cp2);
+ /* Insure trailing dot */
+ if (cp2 > zone && cp2[-1] != '.') {
+ *cp2++ = '.';
+ *cp2 = '\0';
+ }
+ filename[filenamelen] = '\0';
+ nsoaval = -1;
+ memset(soaval, 0, sizeof(soaval));
+ process(filename, zone, zone);
+ }
+ continue;
+ }
+ if (strncasecmp(name, "nslint", namelen) == 0) {
+ EATCOMMENTS
+ if (*cp != '{') {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s:%d missing left qbrace in nslint\n",
+ prog, file, n);
+ } else
+ ++cp;
+ ++cp;
+ EATCOMMENTS
+ while (*cp != '}' && *cp != '\0') {
+ EATCOMMENTS
+ GETNAME(name, namelen)
+ if (strncasecmp(name, "network",
+ namelen) == 0) {
+ EATCOMMENTS
+ GETQUOTEDNAME(cp2, i)
+
+
+ cp2[i] = '\0';
+ if (!parsenetwork(cp2, &errstr)) {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s:%d: bad network: %s\n",
+ prog, file, n, errstr);
+ }
+ } else {
+ ++errors;
+ fprintf(stderr,
+ "%s: unknown nslint \"%.*s\"\n",
+ prog, namelen, name);
+ }
+ EATSEMICOLON
+ EATCOMMENTS
+ }
+ ++cp;
+ EATCOMMENTS
+ if (*cp != ';') {
+ ++errors;
+ fprintf(stderr, "missing options semi\n");
+ } else
+ ++cp;
+ continue;
+ }
+ if (strncasecmp(name, "include", namelen) == 0) {
+ EATCOMMENTS
+ GETQUOTEDNAME(filename, filenamelen)
+ strncpy(includefile, filename, filenamelen);
+ includefile[filenamelen] = '\0';
+ errors += doconf(includefile, 1);
+ EATSEMICOLON
+ continue;
+ }
+
+ /* Skip over statements we don't understand */
+ EATSEMICOLON
+ }
+
+ free(buf);
+ close(fd);
+ return (errors != 0);
+}
+
+/* Return true when done */
+int
+parsesoa(register const char *cp, register char **errstrp)
+{
+ register char ch, *garbage;
+ static char errstr[132];
+
+ /* Eat leading whitespace */
+ while (isspace(*cp))
+ ++cp;
+
+ /* Find opening paren */
+ if (nsoaval < 0) {
+ cp = strchr(cp, '(');
+ if (cp == NULL)
+ return (0);
+ ++cp;
+ while (isspace(*cp))
+ ++cp;
+ nsoaval = 0;
+ }
+
+ /* Grab any numbers we find */
+ garbage = "leading garbage";
+ while (isdigit(*cp) && nsoaval < NSOAVAL) {
+ soaval[nsoaval] = atoi(cp);
+ do {
+ ++cp;
+ } while (isdigit(*cp));
+ if (nsoaval == SOA_SERIAL && *cp == '.' && isdigit(cp[1])) {
+ do {
+ ++cp;
+ } while (isdigit(*cp));
+ } else {
+ ch = *cp;
+ if (isupper(ch))
+ ch = tolower(ch);
+ switch (ch) {
+
+ case 'w':
+ soaval[nsoaval] *= 7;
+ /* fall through */
+
+ case 'd':
+ soaval[nsoaval] *= 24;
+ /* fall through */
+
+ case 'h':
+ soaval[nsoaval] *= 60;
+ /* fall through */
+
+ case 'm':
+ soaval[nsoaval] *= 60;
+ /* fall through */
+
+ case 's':
+ ++cp;
+ break;
+
+ default:
+ ; /* none */
+ }
+ }
+ while (isspace(*cp))
+ ++cp;
+ garbage = "trailing garbage";
+ ++nsoaval;
+ }
+
+ /* If we're done, do some sanity checks */
+ if (nsoaval >= NSOAVAL && *cp == ')') {
+ ++cp;
+ if (*cp != '\0')
+ *errstrp = garbage;
+ else if (soaval[SOA_EXPIRE] <
+ soaval[SOA_REFRESH] + 10 * soaval[SOA_RETRY]) {
+ (void)sprintf(errstr,
+ "expire less than refresh + 10 * retry (%u < %u + 10 * %u)",
+ soaval[SOA_EXPIRE],
+ soaval[SOA_REFRESH],
+ soaval[SOA_RETRY]);
+ *errstrp = errstr;
+ } else if (soaval[SOA_REFRESH] < 2 * soaval[SOA_RETRY]) {
+ (void)sprintf(errstr,
+ "refresh less than 2 * retry (%u < 2 * %u)",
+ soaval[SOA_REFRESH],
+ soaval[SOA_RETRY]);
+ *errstrp = errstr;
+ }
+ return (1);
+ }
+
+ if (*cp != '\0') {
+ *errstrp = garbage;
+ return (1);
+ }
+
+ return (0);
+}
+
+void
+process(register const char *file, register const char *domain,
+ register const char *zone)
+{
+ register FILE *f;
+ register char ch, *cp, *cp2, *cp3, *rtype;
+ register const char *ccp;
+ register int n, sawsoa, flags, i;
+ register u_int ttl;
+ register u_int32_t addr;
+ u_int32_t net, mask;
+ int smtp;
+ char buf[1024], name[128], lastname[128], odomain[128];
+ char *errstr;
+ char *dotfmt = "%s: %s/%s:%d \"%s\" target missing trailing dot: %s\n";
+
+ f = fopen(file, "r");
+ if (f == NULL) {
+ fprintf(stderr, "%s: %s/%s: %s\n",
+ prog, cwd, file, strerror(errno));
+ ++errors;
+ return;
+ }
+ if (debug > 1)
+ printf("%s: process: opened %s/%s\n", prog, cwd, file);
+
+ /* Are we doing an in-addr.arpa domain? */
+ n = 0;
+ net = 0;
+ mask = 0;
+ ccp = domain + strlen(domain) - sizeof(inaddr) + 1;
+ if (ccp >= domain && strcasecmp(ccp, inaddr) == 0 &&
+ !parseinaddr(domain, &net, &mask)) {
+ ++errors;
+ fprintf(stderr, "%s: %s/%s:%d bad in-addr.arpa domain\n",
+ prog, cwd, file, n);
+ return;
+ }
+
+ lastname[0] = '\0';
+ sawsoa = 0;
+ while (fgets(buf, sizeof(buf), f) != NULL) {
+ ++n;
+ cp = buf;
+ while (*cp != '\0') {
+ /* Handle quoted strings (but don't report errors) */
+ if (*cp == '"') {
+ ++cp;
+ while (*cp != '"' && *cp != '\n' && *cp != '\0')
+ ++cp;
+ continue;
+ }
+ if (*cp == '\n' || *cp == ';')
+ break;
+ ++cp;
+ }
+ *cp-- = '\0';
+
+ /* Nuke trailing white space */
+ while (cp >= buf && isspace(*cp))
+ *cp-- = '\0';
+
+ cp = buf;
+ if (*cp == '\0')
+ continue;
+
+ /* Handle multi-line soa records */
+ if (sawsoa) {
+ errstr = NULL;
+ if (parsesoa(cp, &errstr))
+ sawsoa = 0;
+ if (errstr != NULL) {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d bad \"soa\" record (%s)\n",
+ prog, cwd, file, n, errstr);
+ }
+ continue;
+ }
+ if (debug > 3)
+ printf(">%s<\n", cp);
+
+ /* Look for name */
+ if (isspace(*cp)) {
+ /* Same name as last record */
+ if (lastname[0] == '\0') {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d no default name\n",
+ prog, cwd, file, n);
+ continue;
+ }
+ (void)strcpy(name, lastname);
+ } else {
+ /* Extract name, converting to lowercase */
+ for (cp2 = name; !isspace(*cp) && *cp != '\0'; ++cp)
+ if (isupper(*cp))
+ *cp2++ = tolower(*cp);
+ else
+ *cp2++ = *cp;
+ *cp2 = '\0';
+
+ /* Check for domain shorthand */
+ if (name[0] == '@' && name[1] == '\0')
+ (void)strcpy(name, domain);
+ }
+
+ /* Find next token */
+ while (isspace(*cp))
+ ++cp;
+
+ /* Handle includes (gag) */
+ if (name[0] == '$' && strcasecmp(name, "$include") == 0) {
+ /* Extract filename */
+ cp2 = name;
+ while (!isspace(*cp) && *cp != '\0')
+ *cp2++ = *cp++;
+ *cp2 = '\0';
+
+ /* Look for optional domain */
+ while (isspace(*cp))
+ ++cp;
+ if (*cp == '\0')
+ process(name, domain, zone);
+ else {
+ cp2 = cp;
+ /* Convert optional domain to lowercase */
+ for (; !isspace(*cp) && *cp != '\0'; ++cp)
+ if (isupper(*cp))
+ *cp = tolower(*cp);
+ *cp = '\0';
+ process(name, cp2, cp2);
+ }
+ continue;
+ }
+
+ /* Handle $origin */
+ if (name[0] == '$' && strcasecmp(name, "$origin") == 0) {
+ /* Extract domain, converting to lowercase */
+ for (cp2 = odomain; !isspace(*cp) && *cp != '\0'; ++cp)
+ if (isupper(*cp))
+ *cp2++ = tolower(*cp);
+ else
+ *cp2++ = *cp;
+ *cp2 = '\0';
+ domain = odomain;
+ lastname[0] = '\0';
+
+ /* Are we doing an in-addr.arpa domain? */
+ net = 0;
+ mask = 0;
+ ccp = domain + strlen(domain) - (sizeof(inaddr) - 1);
+ if (ccp >= domain && strcasecmp(ccp, inaddr) == 0 &&
+ !parseinaddr(domain, &net, &mask)) {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d bad in-addr.arpa domain\n",
+ prog, cwd, file, n);
+ return;
+ }
+ continue;
+ }
+
+ /* Handle ttl */
+ if (name[0] == '$' && strcasecmp(name, "$ttl") == 0) {
+ cp2 = cp;
+ while (isdigit(*cp))
+ ++cp;
+ ch = *cp;
+ if (isupper(ch))
+ ch = tolower(ch);
+ if (strchr("wdhms", ch) != NULL)
+ ++cp;
+ while (isspace(*cp))
+ ++cp;
+ if (*cp != '\0') {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d bad $ttl \"%s\"\n",
+ prog, cwd, file, n, cp2);
+ }
+ (void)strcpy(name, lastname);
+ continue;
+ }
+
+ /* Parse ttl or use default */
+ if (isdigit(*cp)) {
+ ttl = atoi(cp);
+ do {
+ ++cp;
+ } while (isdigit(*cp));
+
+ ch = *cp;
+ if (isupper(ch))
+ ch = tolower(ch);
+ switch (ch) {
+
+ case 'w':
+ ttl *= 7;
+ /* fall through */
+
+ case 'd':
+ ttl *= 24;
+ /* fall through */
+
+ case 'h':
+ ttl *= 60;
+ /* fall through */
+
+ case 'm':
+ ttl *= 60;
+ /* fall through */
+
+ case 's':
+ ++cp;
+ break;
+
+ default:
+ ; /* none */
+ }
+
+
+ if (!isspace(*cp)) {
+ ++errors;
+ fprintf(stderr, "%s: %s/%s:%d bad ttl\n",
+ prog, cwd, file, n);
+ continue;
+ }
+
+ /* Find next token */
+ ++cp;
+ while (isspace(*cp))
+ ++cp;
+ } else
+ ttl = soaval[SOA_MINIMUM];
+
+ /* Eat optional "in" */
+ if ((cp[0] == 'i' || cp[0] == 'I') &&
+ (cp[1] == 'n' || cp[1] == 'N') && isspace(cp[2])) {
+ /* Find next token */
+ cp += 3;
+ while (isspace(*cp))
+ ++cp;
+ } else if ((cp[0] == 'c' || cp[0] == 'C') &&
+ isspace(cp[5]) && strncasecmp(cp, "chaos", 5) == 0) {
+ /* Find next token */
+ cp += 5;
+ while (isspace(*cp))
+ ++cp;
+ }
+
+ /* Find end of record type, converting to lowercase */
+ rtype = cp;
+ for (rtype = cp; !isspace(*cp) && *cp != '\0'; ++cp)
+ if (isupper(*cp))
+ *cp = tolower(*cp);
+ *cp++ = '\0';
+
+ /* Find "the rest" */
+ while (isspace(*cp))
+ ++cp;
+
+ /* Check for non-ptr names with dots but no trailing dot */
+ if (!isdigit(*name) &&
+ checkdots(name) && strcmp(domain, ".") != 0) {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d \"%s\" name missing trailing dot: %s\n",
+ prog, cwd, file, n, rtype, name);
+ }
+
+ /* Check for FQDNs outside the zone */
+ cp2 = name + strlen(name) - 1;
+ if (cp2 >= name && *cp2 == '.' && strchr(name, '.') != NULL) {
+ cp2 = name + strlen(name) - strlen(zone);
+ if (cp2 >= name && strcasecmp(cp2, zone) != 0) {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d \"%s\" outside zone %s\n",
+ prog, cwd, file, n, name, zone);
+ }
+ }
+
+#define CHECK4(p, a, b, c, d) \
+ (p[0] == (a) && p[1] == (b) && p[2] == (c) && p[3] == (d) && p[4] == '\0')
+#define CHECK3(p, a, b, c) \
+ (p[0] == (a) && p[1] == (b) && p[2] == (c) && p[3] == '\0')
+#define CHECK2(p, a, b) \
+ (p[0] == (a) && p[1] == (b) && p[2] == '\0')
+#define CHECKDOT(p) \
+ (p[0] == '.' && p[1] == '\0')
+
+ if (rtype[0] == 'a' && rtype[1] == '\0') {
+ /* Handle "a" record */
+ add_domain(name, domain);
+ addr = htonl(inet_addr(cp));
+ if ((int)addr == -1) {
+ ++errors;
+ cp2 = cp + strlen(cp) - 1;
+ if (cp2 >= cp && *cp2 == '\n')
+ *cp2 = '\0';
+ fprintf(stderr,
+ "%s: %s/%s:%d bad \"a\" record ip addr \"%s\"\n",
+ prog, cwd, file, n, cp);
+ continue;
+ }
+ errors += updateitem(name, addr, REC_A, ttl, 0);
+ } else if (CHECK4(rtype, 'a', 'a', 'a', 'a')) {
+ /* Just eat for now */
+ continue;
+ } else if (CHECK3(rtype, 'p', 't', 'r')) {
+ /* Handle "ptr" record */
+ add_domain(name, domain);
+ if (strcmp(cp, "@") == 0)
+ (void)strcpy(cp, zone);
+ if (checkdots(cp)) {
+ ++errors;
+ fprintf(stderr, dotfmt,
+ prog, cwd, file, n, rtype, cp);
+ }
+ add_domain(cp, domain);
+ errstr = NULL;
+ addr = parseptr(name, net, mask, &errstr);
+ if (errstr != NULL) {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d bad \"ptr\" record (%s) ip addr \"%s\"\n",
+ prog, cwd, file, n, errstr, name);
+ continue;
+ }
+ errors += updateitem(cp, addr, REC_PTR, 0, 0);
+ } else if (CHECK3(rtype, 's', 'o', 'a')) {
+ /* Handle "soa" record */
+ if (!CHECKDOT(name)) {
+ add_domain(name, domain);
+ errors += updateitem(name, 0, REC_SOA, 0, 0);
+ }
+ errstr = NULL;
+ if (!parsesoa(cp, &errstr))
+ ++sawsoa;
+ if (errstr != NULL) {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d bad \"soa\" record (%s)\n",
+ prog, cwd, file, n, errstr);
+ continue;
+ }
+ } else if (CHECK3(rtype, 'w', 'k', 's')) {
+ /* Handle "wks" record */
+ addr = htonl(inet_addr(cp));
+ if ((int)addr == -1) {
+ ++errors;
+ cp2 = cp;
+ while (!isspace(*cp2) && *cp2 != '\0')
+ ++cp2;
+ *cp2 = '\0';
+ fprintf(stderr,
+ "%s: %s/%s:%d bad \"wks\" record ip addr \"%s\"\n",
+ prog, cwd, file, n, cp);
+ continue;
+ }
+ /* Step over ip address */
+ while (*cp == '.' || isdigit(*cp))
+ ++cp;
+ while (isspace(*cp))
+ *cp++ = '\0';
+ /* Make sure services are legit */
+ errstr = NULL;
+ n += checkwks(f, cp, &smtp, &errstr);
+ if (errstr != NULL) {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d bad \"wks\" record (%s)\n",
+ prog, cwd, file, n, errstr);
+ continue;
+ }
+ add_domain(name, domain);
+ errors += updateitem(name, addr, REC_WKS,
+ 0, smtp ? FLG_SMTPWKS : 0);
+ /* XXX check to see if ip address records exists? */
+ } else if (rtype[0] == 'h' && strcmp(rtype, "hinfo") == 0) {
+ /* Handle "hinfo" record */
+ add_domain(name, domain);
+ errors += updateitem(name, 0, REC_HINFO, 0, 0);
+ cp2 = cp;
+ cp = parsequoted(cp);
+ if (cp == NULL) {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d \"hinfo\" missing quote: %s\n",
+ prog, cwd, file, n, cp2);
+ continue;
+ }
+ if (!isspace(*cp)) {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d \"hinfo\" missing white space: %s\n",
+ prog, cwd, file, n, cp2);
+ continue;
+ }
+ ++cp;
+ while (isspace(*cp))
+ ++cp;
+ if (*cp == '\0') {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d \"hinfo\" missing keyword: %s\n",
+ prog, cwd, file, n, cp2);
+ continue;
+ }
+ cp = parsequoted(cp);
+ if (cp == NULL) {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d \"hinfo\" missing quote: %s\n",
+ prog, cwd, file, n, cp2);
+ continue;
+ }
+ if (*cp != '\0') {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d \"hinfo\" garbage after keywords: %s\n",
+ prog, cwd, file, n, cp2);
+ continue;
+ }
+ } else if (CHECK2(rtype, 'm', 'x')) {
+ /* Handle "mx" record */
+ add_domain(name, domain);
+ errors += updateitem(name, 0, REC_MX, ttl, 0);
+
+ /* Look for priority */
+ if (!isdigit(*cp)) {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d bad \"mx\" priority: %s\n",
+ prog, cwd, file, n, cp);
+ }
+
+ /* Skip over priority */
+ ++cp;
+ while (isdigit(*cp))
+ ++cp;
+ while (isspace(*cp))
+ ++cp;
+ if (*cp == '\0') {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d missing \"mx\" hostname\n",
+ prog, cwd, file, n);
+ }
+ if (strcmp(cp, "@") == 0)
+ (void)strcpy(cp, zone);
+ if (checkdots(cp)) {
+ ++errors;
+ fprintf(stderr, dotfmt,
+ prog, cwd, file, n, rtype, cp);
+ }
+
+ /* Check to see if mx host exists */
+ add_domain(cp, domain);
+ flags = FLG_MXREF;
+ if (*name == *cp && strcmp(name, cp) == 0)
+ flags |= FLG_SELFMX;
+ errors += updateitem(cp, 0, REC_REF, 0, flags);
+ } else if (rtype[0] == 'c' && strcmp(rtype, "cname") == 0) {
+ /* Handle "cname" record */
+ add_domain(name, domain);
+ errors += updateitem(name, 0, REC_CNAME, 0, 0);
+ if (checkdots(cp)) {
+ ++errors;
+ fprintf(stderr, dotfmt,
+ prog, cwd, file, n, rtype, cp);
+ }
+
+ /* Make sure cname points somewhere */
+ if (strcmp(cp, "@") == 0)
+ (void)strcpy(cp, zone);
+ add_domain(cp, domain);
+ errors += updateitem(cp, 0, REC_REF, 0, 0);
+ } else if (CHECK3(rtype, 's', 'r', 'v')) {
+ /* Handle "srv" record */
+ add_domain(name, domain);
+ errors += updateitem(name, 0, REC_SRV, 0, 0);
+ cp2 = cp;
+
+ /* Skip over three values */
+ for (i = 0; i < 3; ++i) {
+ if (!isdigit(*cp)) {
+ ++errors;
+ fprintf(stderr, "%s: %s/%s:%d"
+ " bad \"srv\" value: %s\n",
+ prog, cwd, file, n, cp);
+ }
+
+ /* Skip over value */
+ ++cp;
+ while (isdigit(*cp))
+ ++cp;
+ while (isspace(*cp))
+ ++cp;
+ }
+
+ /* Check to see if mx host exists */
+ add_domain(cp, domain);
+ errors += updateitem(cp, 0, REC_REF, 0, 0);
+ } else if (CHECK3(rtype, 't', 'x', 't')) {
+ /* Handle "txt" record */
+ add_domain(name, domain);
+ errors += updateitem(name, 0, REC_TXT, 0, 0);
+ cp2 = cp;
+ cp = parsequoted(cp);
+ if (cp == NULL) {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d \"txt\" missing quote: %s\n",
+ prog, cwd, file, n, cp2);
+ continue;
+ }
+ while (isspace(*cp))
+ ++cp;
+ if (*cp != '\0') {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d \"txt\" garbage after text: %s\n",
+ prog, cwd, file, n, cp2);
+ continue;
+ }
+ } else if (CHECK2(rtype, 'n', 's')) {
+ /* Handle "ns" record */
+ errors += updateitem(zone, 0, REC_NS, 0, 0);
+ if (strcmp(cp, "@") == 0)
+ (void)strcpy(cp, zone);
+ if (checkdots(cp)) {
+ ++errors;
+ fprintf(stderr, dotfmt,
+ prog, cwd, file, n, rtype, cp);
+ }
+ add_domain(cp, domain);
+ errors += updateitem(cp, 0, REC_REF, 0, 0);
+ } else if (CHECK2(rtype, 'r', 'p')) {
+ /* Handle "rp" record */
+ add_domain(name, domain);
+ errors += updateitem(name, 0, REC_RP, 0, 0);
+ cp2 = cp;
+
+ /* Step over mailbox name */
+ /* XXX could add_domain() and check further */
+ while (!isspace(*cp) && *cp != '\0')
+ ++cp;
+ if (*cp == '\0') {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d \"rp\" missing text name: %s\n",
+ prog, cwd, file, n, cp2);
+ continue;
+ }
+ ++cp;
+ cp3 = cp;
+
+ /* Step over text name */
+ while (!isspace(*cp) && *cp != '\0')
+ ++cp;
+
+ if (*cp != '\0') {
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d \"rp\" garbage after text name: %s\n",
+ prog, cwd, file, n, cp2);
+ continue;
+ }
+
+ /* Make sure text name points somewhere (if not ".") */
+ if (!CHECKDOT(cp3)) {
+ add_domain(cp3, domain);
+ errors += updateitem(cp3, 0, REC_REF, 0, 0);
+ }
+ } else if (rtype[0] == 'a' && strcmp(rtype, "allowdupa") == 0) {
+ /* Handle "allow duplicate a" record */
+ add_domain(name, domain);
+ addr = htonl(inet_addr(cp));
+ if ((int)addr == -1) {
+ ++errors;
+ cp2 = cp + strlen(cp) - 1;
+ if (cp2 >= cp && *cp2 == '\n')
+ *cp2 = '\0';
+ fprintf(stderr,
+ "%s: %s/%s:%d bad \"allowdupa\" record ip addr \"%s\"\n",
+ prog, cwd, file, n, cp);
+ continue;
+ }
+ errors += updateitem(name, addr, 0, 0, FLG_ALLOWDUPA);
+ } else {
+ /* Unknown record type */
+ ++errors;
+ fprintf(stderr,
+ "%s: %s/%s:%d unknown record type \"%s\"\n",
+ prog, cwd, file, n, rtype);
+ add_domain(name, domain);
+ errors += updateitem(name, 0, REC_UNKNOWN, 0, 0);
+ }
+ (void)strcpy(lastname, name);
+ }
+ (void)fclose(f);
+ return;
+}
+
+/* Records we use to detect duplicates */
+static struct duprec {
+ int record;
+ char *name;
+} duprec[] = {
+ { REC_A, "a" },
+ { REC_HINFO, "hinfo" },
+ { 0, NULL },
+};
+
+void
+checkdups(register struct item *ip, register int records)
+{
+ register struct duprec *dp;
+
+ records &= (ip->records & MASK_TEST_DUP);
+ if (records == 0)
+ return;
+ for (dp = duprec; dp->name != NULL; ++dp)
+ if ((records & dp->record) != 0) {
+ ++errors;
+ fprintf(stderr, "%s: multiple \"%s\" records for %s\n",
+ prog, dp->name, ip->host);
+ records &= ~dp->record;
+ }
+ if (records != 0)
+ fprintf(stderr, "%s: checkdups: records not zero (%d)\n",
+ prog, records);
+}
+
+int
+updateitem(register const char *host, register u_int32_t addr,
+ register int records, register u_int ttl, register int flags)
+{
+ register const char *ccp;
+ register int n, errs;
+ register u_int i;
+ register struct item *ip;
+ int foundsome;
+
+ n = 0;
+ foundsome = 0;
+ errs = 0;
+ ITEMHASH(host, i, ccp);
+ ip = &items[i & (ITEMSIZE - 1)];
+ while (n < ITEMSIZE && ip->host) {
+ if ((addr == 0 || addr == ip->addr || ip->addr == 0) &&
+ *host == *ip->host && strcmp(host, ip->host) == 0) {
+ ++foundsome;
+ if (ip->addr == 0)
+ ip->addr = addr;
+ if ((records & MASK_TEST_DUP) != 0)
+ checkdups(ip, records);
+ ip->records |= records;
+ /* Only check differing ttl's for A and MX records */
+ if (ip->ttl == 0)
+ ip->ttl = ttl;
+ else if (ttl != 0 && ip->ttl != ttl) {
+ fprintf(stderr,
+ "%s: differing ttls for %s (%u != %u)\n",
+ prog, ip->host, ttl, ip->ttl);
+ ++errs;
+ }
+ ip->flags |= flags;
+ /* Not done if we wildcard matched the name */
+ if (addr)
+ return (errs);
+ }
+ ++n;
+ ++ip;
+ if (ip >= &items[ITEMSIZE])
+ ip = items;
+ }
+
+ if (n >= ITEMSIZE) {
+ fprintf(stderr, "%s: out of item slots (max %d)\n",
+ prog, ITEMSIZE);
+ exit(1);
+ }
+
+ /* Done if we were wildcarding the name (and found entries for it) */
+ if (addr == 0 && foundsome)
+ return (errs);
+
+ /* Didn't find it, make new entry */
+ ++itemcnt;
+ if (ip->host) {
+ fprintf(stderr, "%s: reusing bucket!\n", prog);
+ exit(1);
+ }
+ ip->addr = addr;
+ ip->host = savestr(host);
+ if ((records & MASK_TEST_DUP) != 0)
+ checkdups(ip, records);
+ ip->records |= records;
+ if (ttl != 0)
+ ip->ttl = ttl;
+ ip->flags |= flags;
+ return (errs);
+}
+
+static const char *microlist[] = {
+ "_tcp",
+ "_udp",
+ "_msdcs",
+ "_sites",
+ NULL
+};
+
+int
+rfc1034host(register const char *host, register int recs)
+{
+ register const char *cp, **p;
+ register int underok;
+
+ underok = 0;
+ for (p = microlist; *p != NULL ;++p)
+ if ((cp = strstr(host, *p)) != NULL &&
+ cp > host &&
+ cp[-1] == '.' &&
+ cp[strlen(*p)] == '.') {
+ ++underok;
+ break;
+ }
+
+ cp = host;
+ if (!(isalpha(*cp) || isdigit(*cp) || (*cp == '_' && underok))) {
+ fprintf(stderr,
+ "%s: illegal hostname \"%s\" (starts with non-alpha/numeric)\n",
+ prog, host);
+ return (1);
+ }
+ for (++cp; *cp != '.' && *cp != '\0'; ++cp)
+ if (!(isalpha(*cp) || isdigit(*cp) || *cp == '-' ||
+ (*cp == '/' && (recs & REC_SOA) != 0))) {
+ fprintf(stderr,
+ "%s: illegal hostname \"%s\" ('%c' illegal character)\n",
+ prog, host, *cp);
+ return (1);
+ }
+ if (--cp >= host && *cp == '-') {
+ fprintf(stderr, "%s: illegal hostname \"%s\" (ends with '-')\n",
+ prog, host);
+ return (1);
+ }
+ return (0);
+}
+
+int
+nslint(void)
+{
+ register int n, records, flags;
+ register struct item *ip, *lastaip, **ipp, **itemlist;
+ register u_int32_t addr, lastaddr, mask;
+
+ itemlist = (struct item **)calloc(itemcnt, sizeof(*ipp));
+ if (itemlist == NULL) {
+ fprintf(stderr, "%s: nslint: calloc: %s\n",
+ prog, strerror(errno));
+ exit(1);
+ }
+ ipp = itemlist;
+ for (n = 0, ip = items; n < ITEMSIZE; ++n, ++ip) {
+ if (ip->host == NULL)
+ continue;
+
+ /* Save entries with addresses for later check */
+ if (ip->addr != 0)
+ *ipp++ = ip;
+
+ if (debug > 1) {
+ if (debug > 2)
+ printf("%d\t", n);
+ printf("%s\t%s\t0x%x\t0x%x\n",
+ ip->host, intoa(ip->addr), ip->records, ip->flags);
+ }
+
+ /* Check for illegal hostnames (rfc1034) */
+ if (rfc1034host(ip->host, ip->records))
+ ++errors;
+
+ /* Check for missing ptr records (ok if also an ns record) */
+ records = ip->records & MASK_CHECK_REC;
+ if ((ip->records & MASK_TEST_REC) != 0)
+ records |= REC_OTHER;
+ switch (records) {
+
+ case REC_A | REC_OTHER | REC_PTR | REC_REF:
+ case REC_A | REC_OTHER | REC_PTR:
+ case REC_A | REC_PTR | REC_REF:
+ case REC_A | REC_PTR:
+ case REC_CNAME:
+ /* These are O.K. */
+ break;
+
+ case REC_CNAME | REC_REF:
+ ++errors;
+ fprintf(stderr, "%s: \"cname\" referenced by other"
+ " \"cname\" or \"mx\": %s\n", prog, ip->host);
+ break;
+
+ case REC_OTHER | REC_REF:
+ case REC_OTHER:
+ /*
+ * This is only an error if there is an address
+ * associated with the hostname; this means
+ * there was a wks entry with bogus address.
+ * Otherwise, we have an mx or hinfo.
+ */
+ if (ip->addr != 0) {
+ ++errors;
+ fprintf(stderr,
+ "%s: \"wks\" without \"a\" and \"ptr\": %s -> %s\n",
+ prog, ip->host, intoa(ip->addr));
+ }
+ break;
+
+ case REC_REF:
+ ++errors;
+ fprintf(stderr,
+ "%s: name referenced without other records: %s\n",
+ prog, ip->host);
+ break;
+
+ case REC_A | REC_OTHER | REC_REF:
+ case REC_A | REC_OTHER:
+ case REC_A | REC_REF:
+ case REC_A:
+ ++errors;
+ fprintf(stderr, "%s: missing \"ptr\": %s -> %s\n",
+ prog, ip->host, intoa(ip->addr));
+ break;
+
+ case REC_OTHER | REC_PTR | REC_REF:
+ case REC_OTHER | REC_PTR:
+ case REC_PTR | REC_REF:
+ case REC_PTR:
+ ++errors;
+ fprintf(stderr, "%s: missing \"a\": %s -> %s\n",
+ prog, ip->host, intoa(ip->addr));
+ break;
+
+ case REC_A | REC_CNAME | REC_OTHER | REC_PTR | REC_REF:
+ case REC_A | REC_CNAME | REC_OTHER | REC_PTR:
+ case REC_A | REC_CNAME | REC_OTHER | REC_REF:
+ case REC_A | REC_CNAME | REC_OTHER:
+ case REC_A | REC_CNAME | REC_PTR | REC_REF:
+ case REC_A | REC_CNAME | REC_PTR:
+ case REC_A | REC_CNAME | REC_REF:
+ case REC_A | REC_CNAME:
+ case REC_CNAME | REC_OTHER | REC_PTR | REC_REF:
+ case REC_CNAME | REC_OTHER | REC_PTR:
+ case REC_CNAME | REC_OTHER | REC_REF:
+ case REC_CNAME | REC_OTHER:
+ case REC_CNAME | REC_PTR | REC_REF:
+ case REC_CNAME | REC_PTR:
+ ++errors;
+ fprintf(stderr, "%s: \"cname\" %s has other records\n",
+ prog, ip->host);
+ break;
+
+ case 0:
+ /* Second level test */
+ if ((ip->records & ~(REC_NS | REC_TXT)) == 0)
+ break;
+ /* Fall through... */
+
+ default:
+ ++errors;
+ fprintf(stderr,
+ "%s: records == 0x%x: can't happen (%s 0x%x)\n",
+ prog, records, ip->host, ip->records);
+ break;
+ }
+
+ /* Check for smtp problems */
+ flags = ip->flags & MASK_TEST_SMTP;
+
+ if ((flags & FLG_SELFMX) != 0 && (ip->records & REC_A) == 0) {
+ ++errors;
+ fprintf(stderr,
+ "%s: self \"mx\" for %s missing \"a\" record\n",
+ prog, ip->host);
+ }
+
+ switch (flags) {
+
+ case 0:
+ case FLG_SELFMX | FLG_SMTPWKS:
+ /* These are O.K. */
+ break;
+
+ case FLG_SELFMX:
+ if ((ip->records & REC_WKS) != 0) {
+ ++errors;
+ fprintf(stderr,
+ "%s: smtp/tcp missing from \"wks\": %s\n",
+ prog, ip->host);
+ }
+ break;
+
+ case FLG_SMTPWKS:
+ ++errors;
+ fprintf(stderr,
+ "%s: saw smtp/tcp without self \"mx\": %s\n",
+ prog, ip->host);
+ break;
+
+ default:
+ ++errors;
+ fprintf(stderr,
+ "%s: flags == 0x%x: can't happen (%s)\n",
+ prog, flags, ip->host);
+ }
+
+ /* Check for chained MX records */
+ if ((ip->flags & (FLG_SELFMX | FLG_MXREF)) == FLG_MXREF &&
+ (ip->records & REC_MX) != 0) {
+ ++errors;
+ fprintf(stderr, "%s: \"mx\" referenced by other"
+ " \"mx\" record: %s\n", prog, ip->host);
+ }
+ }
+
+ /* Check for doubly booked addresses */
+ n = ipp - itemlist;
+ qsort(itemlist, n, sizeof(itemlist[0]), cmpaddr);
+ lastaddr = 0;
+ ip = NULL;
+ for (ipp = itemlist; n > 0; ++ipp, --n) {
+ addr = (*ipp)->addr;
+ if (lastaddr == addr &&
+ ((*ipp)->flags & FLG_ALLOWDUPA) == 0 &&
+ (ip->flags & FLG_ALLOWDUPA) == 0) {
+ ++errors;
+ fprintf(stderr, "%s: %s in use by %s and %s\n",
+ prog, intoa(addr), (*ipp)->host, ip->host);
+ }
+ lastaddr = addr;
+ ip = *ipp;
+ }
+
+ /* Check for hosts with multiple addresses on the same subnet */
+ n = ipp - itemlist;
+ qsort(itemlist, n, sizeof(itemlist[0]), cmphost);
+ if (netlistcnt > 0) {
+ n = ipp - itemlist;
+ lastaip = NULL;
+ for (ipp = itemlist; n > 0; ++ipp, --n) {
+ ip = *ipp;
+ if ((ip->records & REC_A) == 0 ||
+ (ip->flags & FLG_ALLOWDUPA) != 0)
+ continue;
+ if (lastaip != NULL &&
+ strcasecmp(ip->host, lastaip->host) == 0) {
+ mask = findmask(ip->addr);
+ if (mask == 0) {
+ ++errors;
+ fprintf(stderr,
+ "%s: can't find mask for %s (%s)\n",
+ prog, ip->host, intoa(ip->addr));
+ } else if ((lastaip->addr & mask) ==
+ (ip->addr & mask) ) {
+ ++errors;
+ fprintf(stderr,
+ "%s: multiple \"a\" records for %s on subnet %s",
+ prog, ip->host,
+ intoa(ip->addr & mask));
+ fprintf(stderr, "\n\t(%s",
+ intoa(lastaip->addr));
+ fprintf(stderr, " and %s)\n",
+ intoa(ip->addr));
+ }
+ }
+ lastaip = ip;
+ }
+ }
+
+ if (debug)
+ printf("%s: %d/%d items used, %d error%s\n", prog, itemcnt,
+ ITEMSIZE, errors, errors == 1 ? "" : "s");
+ return (errors != 0);
+}
+
+/* Similar to inet_ntoa() */
+char *
+intoa(u_int32_t addr)
+{
+ register char *cp;
+ register u_int byte;
+ register int n;
+ static char buf[sizeof(".xxx.xxx.xxx.xxx")];
+
+ cp = &buf[sizeof buf];
+ *--cp = '\0';
+
+ n = 4;
+ do {
+ byte = addr & 0xff;
+ *--cp = byte % 10 + '0';
+ byte /= 10;
+ if (byte > 0) {
+ *--cp = byte % 10 + '0';
+ byte /= 10;
+ if (byte > 0)
+ *--cp = byte + '0';
+ }
+ *--cp = '.';
+ addr >>= 8;
+ } while (--n > 0);
+
+ return cp + 1;
+}
+
+int
+parseinaddr(register const char *cp, register u_int32_t *netp,
+ register u_int32_t *maskp)
+{
+ register int i, bits;
+ register u_int32_t o, net, mask;
+
+ if (!isdigit(*cp))
+ return (0);
+ net = 0;
+ mask = 0xff000000;
+ bits = 0;
+ o = 0;
+ do {
+ o = o * 10 + (*cp++ - '0');
+ } while (isdigit(*cp));
+ net = o << 24;
+
+ /* Check for classless delegation mask width */
+ if (*cp == '/') {
+ ++cp;
+ o = 0;
+ do {
+ o = o * 10 + (*cp++ - '0');
+ } while (isdigit(*cp));
+ bits = o;
+ if (bits <= 0 || bits > 32)
+ return (0);
+ }
+
+ if (*cp == '.' && isdigit(cp[1])) {
+ ++cp;
+ o = 0;
+ do {
+ o = o * 10 + (*cp++ - '0');
+ } while (isdigit(*cp));
+ net = (net >> 8) | (o << 24);
+ mask = 0xffff0000;
+ if (*cp == '.' && isdigit(cp[1])) {
+ ++cp;
+ o = 0;
+ do {
+ o = o * 10 + (*cp++ - '0');
+ } while (isdigit(*cp));
+ net = (net >> 8) | (o << 24);
+ mask = 0xffffff00;
+ if (*cp == '.' && isdigit(cp[1])) {
+ ++cp;
+ o = 0;
+ do {
+ o = o * 10 + (*cp++ - '0');
+ } while (isdigit(*cp));
+ net = (net >> 8) | (o << 24);
+ mask = 0xffffffff;
+ }
+ }
+ }
+ if (strcasecmp(cp, inaddr) != 0)
+ return (0);
+
+ /* Classless delegation */
+ /* XXX check that calculated mask isn't smaller than octet mask? */
+ if (bits != 0)
+ for (mask = 0, i = 31; bits > 0; --i, --bits)
+ mask |= (1 << i);
+
+ *netp = net;
+ *maskp = mask;
+ return (1);
+}
+
+u_int32_t
+parseptr(register const char *cp, u_int32_t net, u_int32_t mask,
+ register char **errstrp)
+{
+ register u_int32_t o, addr;
+ register int shift;
+
+ addr = 0;
+ shift = 0;
+ while (isdigit(*cp) && shift < 32) {
+ o = 0;
+ do {
+ o = o * 10 + (*cp++ - '0');
+ } while (isdigit(*cp));
+ addr |= o << shift;
+ shift += 8;
+ if (*cp != '.') {
+ if (*cp == '\0')
+ break;
+ *errstrp = "missing dot";
+ return (0);
+ }
+ ++cp;
+ }
+
+ if (shift > 32) {
+ *errstrp = "more than 4 octets";
+ return (0);
+ }
+
+ if (shift == 32 && strcasecmp(cp, inaddr + 1) == 0)
+ return (addr);
+
+#ifdef notdef
+ if (*cp != '\0') {
+ *errstrp = "trailing junk";
+ return (0);
+ }
+#endif
+#ifdef notdef
+ if ((~mask & net) != 0) {
+ *errstrp = "too many octets for net";
+ return (0);
+ }
+#endif
+ return (net | addr);
+}
+
+int
+checkwks(register FILE *f, register char *proto, register int *smtpp,
+ register char **errstrp)
+{
+ register int n, sawparen;
+ register char *cp, *serv, **p;
+ static char errstr[132];
+ char buf[1024];
+ char psbuf[512];
+
+ if (!protoserv_init) {
+ initprotoserv();
+ ++protoserv_init;
+ }
+
+ /* Line count */
+ n = 0;
+
+ /* Terminate protocol */
+ cp = proto;
+ while (!isspace(*cp) && *cp != '\0')
+ ++cp;
+ if (*cp != '\0')
+ *cp++ = '\0';
+
+ /* Find services */
+ *smtpp = 0;
+ sawparen = 0;
+ if (*cp == '(') {
+ ++sawparen;
+ ++cp;
+ while (isspace(*cp))
+ ++cp;
+ }
+ for (;;) {
+ if (*cp == '\0') {
+ if (!sawparen)
+ break;
+ if (fgets(buf, sizeof(buf), f) == NULL) {
+ *errstrp = "mismatched parens";
+ return (n);
+ }
+ ++n;
+ cp = buf;
+ while (isspace(*cp))
+ ++cp;
+ }
+ /* Find end of service, converting to lowercase */
+ for (serv = cp; !isspace(*cp) && *cp != '\0'; ++cp)
+ if (isupper(*cp))
+ *cp = tolower(*cp);
+ if (*cp != '\0')
+ *cp++ = '\0';
+ if (sawparen && *cp == ')') {
+ /* XXX should check for trailing junk */
+ break;
+ }
+
+ (void)sprintf(psbuf, "%s/%s", serv, proto);
+
+ if (*serv == 's' && strcmp(psbuf, "tcp/smtp") == 0)
+ ++*smtpp;
+
+ for (p = protoserv; *p != NULL; ++p)
+ if (*psbuf == **p && strcmp(psbuf, *p) == 0) {
+ break;
+ }
+ if (*p == NULL) {
+ sprintf(errstr, "%s unknown", psbuf);
+ *errstrp = errstr;
+ break;
+ }
+ }
+
+ return (n);
+}
+
+int
+checkserv(register const char *serv, register char **p)
+{
+ for (; *p != NULL; ++p)
+ if (*serv == **p && strcmp(serv, *p) == 0)
+ return (1);
+ return (0);
+}
+
+void
+initprotoserv(void)
+{
+ register char *cp;
+ register struct servent *sp;
+ char psbuf[512];
+
+ protoserv_len = 256;
+ protoserv = (char **)malloc(protoserv_len * sizeof(*protoserv));
+ if (protoserv == NULL) {
+ fprintf(stderr, "%s: nslint: malloc: %s\n",
+ prog, strerror(errno));
+ exit(1);
+ }
+
+ while ((sp = getservent()) != NULL) {
+ (void)sprintf(psbuf, "%s/%s", sp->s_name, sp->s_proto);
+
+ /* Convert to lowercase */
+ for (cp = psbuf; *cp != '\0'; ++cp)
+ if (isupper(*cp))
+ *cp = tolower(*cp);
+
+ if (protoserv_last + 1 >= protoserv_len) {
+ protoserv_len <<= 1;
+ protoserv = realloc(protoserv,
+ protoserv_len * sizeof(*protoserv));
+ if (protoserv == NULL) {
+ fprintf(stderr, "%s: nslint: realloc: %s\n",
+ prog, strerror(errno));
+ exit(1);
+ }
+ }
+ protoserv[protoserv_last] = savestr(psbuf);
+ ++protoserv_last;
+ }
+ protoserv[protoserv_last] = NULL;
+}
+
+/*
+ * Returns true if name contains a dot but not a trailing dot.
+ * Special case: allow a single dot if the second part is not one
+ * of the 3 or 4 letter top level domains or is any 2 letter TLD
+ */
+int
+checkdots(register const char *name)
+{
+ register const char *cp, *cp2;
+
+ if ((cp = strchr(name, '.')) == NULL)
+ return (0);
+ cp2 = name + strlen(name) - 1;
+ if (cp2 >= name && *cp2 == '.')
+ return (0);
+
+ /* Return true of more than one dot*/
+ ++cp;
+ if (strchr(cp, '.') != NULL)
+ return (1);
+
+ if (strlen(cp) == 2 ||
+ strcasecmp(cp, "gov") == 0 ||
+ strcasecmp(cp, "edu") == 0 ||
+ strcasecmp(cp, "com") == 0 ||
+ strcasecmp(cp, "net") == 0 ||
+ strcasecmp(cp, "org") == 0 ||
+ strcasecmp(cp, "mil") == 0 ||
+ strcasecmp(cp, "int") == 0 ||
+ strcasecmp(cp, "nato") == 0 ||
+ strcasecmp(cp, "arpa") == 0)
+ return (1);
+ return (0);
+}
+
+int
+cmpaddr(register const void *ip1, register const void *ip2)
+{
+ register u_int32_t a1, a2;
+
+ a1 = (*(struct item **)ip1)->addr;
+ a2 = (*(struct item **)ip2)->addr;
+
+ if (a1 < a2)
+ return (-1);
+ else if (a1 > a2)
+ return (1);
+ else
+ return (0);
+}
+
+int
+cmphost(register const void *ip1, register const void *ip2)
+{
+ register const char *s1, *s2;
+
+ s1 = (*(struct item **)ip1)->host;
+ s2 = (*(struct item **)ip2)->host;
+
+ return (strcasecmp(s1, s2));
+}
+
+/* Returns a pointer after the next token or quoted string, else NULL */
+char *
+parsequoted(register char *cp)
+{
+
+ if (*cp == '"') {
+ ++cp;
+ while (*cp != '"' && *cp != '\0')
+ ++cp;
+ if (*cp != '"')
+ return (NULL);
+ ++cp;
+ } else {
+ while (!isspace(*cp) && *cp != '\0')
+ ++cp;
+ }
+ return (cp);
+}
+
+__dead void
+usage(void)
+{
+ extern char version[];
+
+ fprintf(stderr, "Version %s\n", version);
+ fprintf(stderr, "usage: %s [-d] [-b named.boot] [-B nslint.boot]\n",
+ prog);
+ fprintf(stderr, " %s [-d] [-c named.conf] [-C nslint.conf]\n",
+ prog);
+ exit(1);
+}
diff --git a/contrib/nslint-2.1a3/savestr.c b/contrib/nslint-2.1a3/savestr.c
new file mode 100644
index 0000000..49b1a3b
--- /dev/null
+++ b/contrib/nslint-2.1a3/savestr.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 1997
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#ifndef lint
+static const char rcsid[] =
+ "@(#) $Header: /proj/cvs/prod/bind9/contrib/nslint-2.1a3/savestr.c,v 1.1 2001/12/21 04:12:04 marka Exp $ (LBL)";
+#endif
+
+#include <sys/types.h>
+
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gnuc.h"
+#ifdef HAVE_OS_PROTO_H
+#include "os-proto.h"
+#endif
+
+#include "savestr.h"
+
+/* A replacement for strdup() that cuts down on malloc() overhead */
+char *
+savestr(register const char *str)
+{
+ register u_int size;
+ register char *p;
+ static char *strptr = NULL;
+ static u_int strsize = 0;
+
+ size = strlen(str) + 1;
+ if (size > strsize) {
+ strsize = 1024;
+ if (strsize < size)
+ strsize = size;
+ strptr = (char *)malloc(strsize);
+ if (strptr == NULL) {
+ fprintf(stderr, "savestr: malloc\n");
+ exit(1);
+ }
+ }
+ (void)strcpy(strptr, str);
+ p = strptr;
+ strptr += size;
+ strsize -= size;
+ return (p);
+}
diff --git a/contrib/nslint-2.1a3/savestr.h b/contrib/nslint-2.1a3/savestr.h
new file mode 100644
index 0000000..020f698
--- /dev/null
+++ b/contrib/nslint-2.1a3/savestr.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 1997
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @(#) $Header: /proj/cvs/prod/bind9/contrib/nslint-2.1a3/savestr.h,v 1.1 2001/12/21 04:12:05 marka Exp $ (LBL)
+ */
+
+extern char *savestr(const char *);
diff --git a/contrib/nslint-2.1a3/strerror.c b/contrib/nslint-2.1a3/strerror.c
new file mode 100644
index 0000000..d330a65
--- /dev/null
+++ b/contrib/nslint-2.1a3/strerror.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)strerror.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/types.h>
+
+#include <string.h>
+
+#include "gnuc.h"
+#ifdef HAVE_OS_PROTO_H
+#include "os-proto.h"
+#endif
+
+char *
+strerror(num)
+ int num;
+{
+ extern int sys_nerr;
+ extern char *sys_errlist[];
+#define UPREFIX "Unknown error: "
+ static char ebuf[40] = UPREFIX; /* 64-bit number + slop */
+ register unsigned int errnum;
+ register char *p, *t;
+ char tmp[40];
+
+ errnum = num; /* convert to unsigned */
+ if (errnum < sys_nerr)
+ return(sys_errlist[errnum]);
+
+ /* Do this by hand, so we don't include stdio(3). */
+ t = tmp;
+ do {
+ *t++ = "0123456789"[errnum % 10];
+ } while (errnum /= 10);
+ for (p = ebuf + sizeof(UPREFIX) - 1;;) {
+ *p++ = *--t;
+ if (t <= tmp)
+ break;
+ }
+ *p = '\0';
+ return(ebuf);
+}
diff --git a/contrib/pkcs11-keygen/PEM_write_pubkey.c b/contrib/pkcs11-keygen/PEM_write_pubkey.c
new file mode 100644
index 0000000..65def63
--- /dev/null
+++ b/contrib/pkcs11-keygen/PEM_write_pubkey.c
@@ -0,0 +1,124 @@
+/* OpenSSL tool
+ *
+ * usage: PEM_write_pubkey -e engine -p pin -k keyname -f filename
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <openssl/engine.h>
+#include <openssl/conf.h>
+#include <unistd.h>
+#include <errno.h>
+
+extern int PEM_write_PUBKEY(FILE *fp, EVP_PKEY *x);
+
+int
+main(int argc, char *argv[])
+{
+ ENGINE *e;
+ EVP_PKEY *pub_key;
+ FILE *fp;
+ char *engine = NULL;
+ char *pin = NULL;
+ char *keyname = NULL;
+ char *filename = NULL;
+ int c, errflg = 0;
+ extern char *optarg;
+ extern int optopt;
+
+ while ((c = getopt(argc, argv, ":e:p:k:f:")) != -1) {
+ switch (c) {
+ case 'e':
+ engine = optarg;
+ break;
+ case 'p':
+ pin = optarg;
+ break;
+ case 'k':
+ keyname = optarg;
+ break;
+ case 'f':
+ filename = optarg;
+ break;
+ case ':':
+ fprintf(stderr, "Option -%c requires an operand\n", optopt);
+ errflg++;
+ break;
+ case '?':
+ default:
+ fprintf(stderr, "Unrecognised option: -%c\n", optopt);
+ errflg++;
+ }
+ }
+ if ((errflg) || (!engine) || (!filename) || (!keyname)) {
+ fprintf(stderr,
+ "usage: PEM_write_pubkey -e engine [-p pin] "
+ "-k keyname -f filename\n");
+ exit(1);
+ }
+
+ /* Load the config file */
+ OPENSSL_config(NULL);
+
+ /* Register engine */
+ e = ENGINE_by_id(engine);
+ if (!e) {
+ /* the engine isn't available */
+ printf("The engine isn't available\n");
+ ERR_print_errors_fp(stderr);
+ exit(1);
+ }
+
+ /* Send PIN to engine */
+ if (pin && !ENGINE_ctrl_cmd_string(e, "PIN", pin, 0)){
+ printf("Error sending PIN to engine\n");
+ ERR_print_errors_fp(stderr);
+ ENGINE_free(e);
+ exit(1);
+ }
+
+ if (!ENGINE_init(e)) {
+ /* the engine couldn't initialise, release 'e' */
+ printf("The engine couldn't initialise\n");
+ ERR_print_errors_fp(stderr);
+ ENGINE_free(e);
+ exit(1);
+ }
+
+ if (!ENGINE_register_RSA(e)){
+ /* This should only happen when 'e' can't initialise, but the previous
+ * statement suggests it did. */
+ printf("This should not happen\n");
+ ERR_print_errors_fp(stderr);
+ exit(1);
+ }
+
+ /* Load public key */
+ pub_key = ENGINE_load_public_key(e, keyname, NULL, NULL);
+ if (pub_key == NULL) {
+ /* No public key */
+ printf("Error loading public key\n");
+ ERR_print_errors_fp(stderr);
+ ENGINE_free(e);
+ exit(1);
+ }
+
+ /* write public key to file in PEM format */
+ fp = fopen(filename, "w");
+ if (fp == NULL) {
+ printf("Error opening output file.\n");
+ ENGINE_free(e);
+ exit(1);
+ }
+
+ if (!PEM_write_PUBKEY(fp, pub_key)) {
+ /* Error writing public key */
+ printf("Error writing public key");
+ ERR_print_errors_fp(stderr);
+ ENGINE_free(e);
+ exit(1);
+ }
+
+ fclose(fp);
+ exit(0);
+}
diff --git a/contrib/pkcs11-keygen/README b/contrib/pkcs11-keygen/README
new file mode 100644
index 0000000..4104e17
--- /dev/null
+++ b/contrib/pkcs11-keygen/README
@@ -0,0 +1,18 @@
+This is a set of utilities that when used together create rsa keys in
+a PKCS11 keystore. The keys will have a label of "zone,zsk|ksk,xxx" and
+an id of the keytag in hex.
+
+Run genkey.sh to generate a new key and call the other programs in turn.
+Run writekey.sh to load key to the key store from Kxxx.{key,private}.
+
+genkey[.c] uses PKCS11 calls to generate keys.
+PEM_write_pubkey[.c] uses OpenSSL to write a public key from the key store
+ into a file in PEM format.
+keyconv.pl uses Net::DNS::SEC to calculate the key tag and to write out
+ a DNSKEY RR into a file.
+set_key_id[.c] uses PKCS11 to set to the key id == keytag in the key store.
+readkey[.c] and writekey[.c] extracts and loads a key from/to the key store.
+keydump.pl uses Net::DNS::SEC to get the key from a Kxxx.private file and
+ write it into a file in PEM format.
+
+listobjs and destroyobjs browse the key store, prints or destroys objects.
diff --git a/contrib/pkcs11-keygen/destroyobj.c b/contrib/pkcs11-keygen/destroyobj.c
new file mode 100644
index 0000000..9c714d8
--- /dev/null
+++ b/contrib/pkcs11-keygen/destroyobj.c
@@ -0,0 +1,183 @@
+/* destroyobj [-s $slot] [-i $id | -l $label] [-p $pin] */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#ifndef OPENCRYPTOKI
+#include <security/cryptoki.h>
+#include <security/pkcs11.h>
+#else
+#include <opencryptoki/pkcs11.h>
+#endif
+
+int
+main(int argc, char *argv[])
+{
+ CK_RV rv;
+ CK_SLOT_ID slot = 0;
+ CK_SESSION_HANDLE hSession;
+ CK_UTF8CHAR *pin = NULL;
+ CK_BYTE attr_id[2];
+ CK_OBJECT_HANDLE akey[50];
+ char *label = NULL;
+ int error = 0;
+ int id = 0, i = 0;
+ int c, errflg = 0;
+ CK_ULONG ulObjectCount;
+ CK_ATTRIBUTE search_template[] = {
+ {CKA_ID, &attr_id, sizeof(attr_id)}
+ };
+ extern char *optarg;
+ extern int optopt;
+
+ while ((c = getopt(argc, argv, ":s:i:l:p:")) != -1) {
+ switch (c) {
+ case 's':
+ slot = atoi(optarg);
+ break;
+ case 'i':
+ id = atoi(optarg);
+ id &= 0xffff;
+ break;
+ case 'l':
+ label = optarg;
+ break;
+ case 'p':
+ pin = (CK_UTF8CHAR *)optarg;
+ break;
+ case ':':
+ fprintf(stderr, "Option -%c requires an operand\n", optopt);
+ errflg++;
+ break;
+ case '?':
+ default:
+ fprintf(stderr, "Unrecognised option: -%c\n", optopt);
+ errflg++;
+ }
+ }
+ if (errflg || ((!id) && (!label))) {
+ fprintf(stderr,
+ "usage: destroykey [-s slot] [-i id | -l label] [-p pin]\n");
+ exit(1);
+ }
+ if (id) {
+ printf("id %i\n", id);
+ attr_id[0] = (id >> 8) & 0xff;
+ attr_id[1] = id & 0xff;
+ } else if (label) {
+ printf("label %s\n", label);
+ search_template[0].type = CKA_LABEL;
+ search_template[0].pValue = label;
+ search_template[0].ulValueLen = strlen(label);
+ }
+
+ /* Initialize the CRYPTOKI library */
+ rv = C_Initialize(NULL_PTR);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_Initialize: Error = 0x%.8X\n", rv);
+ exit(1);
+ }
+
+ /* Open a session on the slot found */
+ rv = C_OpenSession(slot, CKF_RW_SESSION+CKF_SERIAL_SESSION,
+ NULL_PTR, NULL_PTR, &hSession);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_OpenSession: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_program;
+ }
+
+ /* Login to the Token (Keystore) */
+ if (!pin)
+#ifndef OPENCRYPTOKI
+ pin = (CK_UTF8CHAR *)getpassphrase("Enter Pin: ");
+#else
+ pin = (CK_UTF8CHAR *)getpass("Enter Pin: ");
+#endif
+ rv = C_Login(hSession, CKU_USER, pin, strlen((char *)pin));
+ memset(pin, 0, strlen((char *)pin));
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_Login: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_session;
+ }
+
+ rv = C_FindObjectsInit(hSession, search_template,
+ ((id != 0) || (label != NULL)) ? 1 : 0);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjectsInit: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_session;
+ }
+
+ rv = C_FindObjects(hSession, akey, 50, &ulObjectCount);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjects: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_search;
+ }
+
+ for (i = 0; i < ulObjectCount; i++) {
+ CK_OBJECT_CLASS oclass = 0;
+ CK_BYTE labelbuf[64 + 1];
+ CK_BYTE idbuf[64];
+ CK_ATTRIBUTE attr_template[] = {
+ {CKA_CLASS, &oclass, sizeof(oclass)},
+ {CKA_LABEL, labelbuf, sizeof(labelbuf) - 1},
+ {CKA_ID, idbuf, sizeof(idbuf)}
+ };
+ int j, len;
+
+ memset(labelbuf, 0, sizeof(labelbuf));
+ memset(idbuf, 0, sizeof(idbuf));
+
+ rv = C_GetAttributeValue(hSession, akey[i], attr_template, 3);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_GetAttributeValue[%d]: rv = 0x%.8X\n", i, rv);
+ error = 1;
+ goto exit_search;
+ }
+ len = attr_template[2].ulValueLen;
+ printf("object[%d]: class %d label '%s' id[%u] ",
+ i, oclass, labelbuf, attr_template[2].ulValueLen);
+ if (len > 4)
+ len = 4;
+ for (j = 0; j < len; j++)
+ printf("%02x", idbuf[j]);
+ if (attr_template[2].ulValueLen > len)
+ printf("...\n");
+ else
+ printf("\n");
+ }
+
+ /* give a chance to kill this */
+ printf("sleeping 5 seconds...\n");
+ sleep(5);
+
+ for (i = 0; i < ulObjectCount; i++) {
+ rv = C_DestroyObject(hSession, akey[i]);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_DestroyObject[%d]: rv = 0x%.8X\n", i, rv);
+ error = 1;
+ }
+ }
+
+ exit_search:
+ rv = C_FindObjectsFinal(hSession);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjectsFinal: Error = 0x%.8X\n", rv);
+ error = 1;
+ }
+
+ exit_session:
+ (void) C_CloseSession(hSession);
+
+ exit_program:
+ (void) C_Finalize(NULL_PTR);
+
+ exit(error);
+}
diff --git a/contrib/pkcs11-keygen/genkey.c b/contrib/pkcs11-keygen/genkey.c
new file mode 100644
index 0000000..fc70391
--- /dev/null
+++ b/contrib/pkcs11-keygen/genkey.c
@@ -0,0 +1,206 @@
+/* genkey - pkcs11 rsa key generator
+ *
+ * create RSASHA1 key in the keystore of an SCA6000
+ * The calculation of key tag is left to the script
+ * that converts the key into a DNSKEY RR and inserts
+ * it into a zone file.
+ *
+ * usage:
+ * genkey [-P] [-s slot] -b keysize -l label [-p pin]
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#ifndef OPENCRYPTOKI
+#include <security/cryptoki.h>
+#include <security/pkcs11.h>
+#else
+#include <opencryptoki/pkcs11.h>
+#endif
+
+/* Define static key template values */
+static CK_BBOOL truevalue = TRUE;
+static CK_BBOOL falsevalue = FALSE;
+
+int
+main(int argc, char *argv[])
+{
+ CK_RV rv;
+ CK_SLOT_ID slot = 0;
+ CK_MECHANISM genmech;
+ CK_SESSION_HANDLE hSession;
+ CK_UTF8CHAR *pin = NULL;
+ CK_ULONG modulusbits = 0;
+ CK_CHAR *label = NULL;
+ CK_OBJECT_HANDLE privatekey, publickey;
+ CK_BYTE public_exponent[3];
+ int error = 0;
+ int i = 0;
+ int c, errflg = 0;
+ int hide = 1;
+ CK_ULONG ulObjectCount;
+ /* Set search template */
+ CK_ATTRIBUTE search_template[] = {
+ {CKA_LABEL, NULL_PTR, 0}
+ };
+ CK_ATTRIBUTE publickey_template[] = {
+ {CKA_LABEL, NULL_PTR, 0},
+ {CKA_VERIFY, &truevalue, sizeof (truevalue)},
+ {CKA_TOKEN, &truevalue, sizeof (truevalue)},
+ {CKA_MODULUS_BITS, &modulusbits, sizeof (modulusbits)},
+ {CKA_PUBLIC_EXPONENT, &public_exponent, sizeof (public_exponent)}
+ };
+ CK_ATTRIBUTE privatekey_template[] = {
+ {CKA_LABEL, NULL_PTR, 0},
+ {CKA_SIGN, &truevalue, sizeof (truevalue)},
+ {CKA_TOKEN, &truevalue, sizeof (truevalue)},
+ {CKA_PRIVATE, &truevalue, sizeof (truevalue)},
+ {CKA_SENSITIVE, &truevalue, sizeof (truevalue)},
+ {CKA_EXTRACTABLE, &falsevalue, sizeof (falsevalue)}
+ };
+ extern char *optarg;
+ extern int optopt;
+
+ while ((c = getopt(argc, argv, ":Ps:b:i:l:p:")) != -1) {
+ switch (c) {
+ case 'P':
+ hide = 0;
+ break;
+ case 's':
+ slot = atoi(optarg);
+ break;
+ case 'b':
+ modulusbits = atoi(optarg);
+ break;
+ case 'l':
+ label = (CK_CHAR *)optarg;
+ break;
+ case 'p':
+ pin = (CK_UTF8CHAR *)optarg;
+ break;
+ case ':':
+ fprintf(stderr, "Option -%c requires an operand\n", optopt);
+ errflg++;
+ break;
+ case '?':
+ default:
+ fprintf(stderr, "Unrecognised option: -%c\n", optopt);
+ errflg++;
+ }
+ }
+ if ((errflg) || (!modulusbits) || (!label)) {
+ fprintf(stderr,
+ "usage: genkey [-P] [-s slot] -b keysize -l label [-p pin]\n");
+ exit(2);
+ }
+
+ search_template[0].pValue = label;
+ search_template[0].ulValueLen = strlen((char *)label);
+ publickey_template[0].pValue = label;
+ publickey_template[0].ulValueLen = strlen((char *)label);
+ privatekey_template[0].pValue = label;
+ privatekey_template[0].ulValueLen = strlen((char *)label);
+
+ /* Set public exponent to 65537 */
+ public_exponent[0] = 0x01;
+ public_exponent[1] = 0x00;
+ public_exponent[2] = 0x01;
+
+ /* Set up mechanism for generating key pair */
+ genmech.mechanism = CKM_RSA_PKCS_KEY_PAIR_GEN;
+ genmech.pParameter = NULL_PTR;
+ genmech.ulParameterLen = 0;
+
+ /* Initialize the CRYPTOKI library */
+ rv = C_Initialize(NULL_PTR);
+
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_Initialize: Error = 0x%.8X\n", rv);
+ exit(1);
+ }
+
+ /* Open a session on the slot found */
+ rv = C_OpenSession(slot, CKF_RW_SESSION+CKF_SERIAL_SESSION,
+ NULL_PTR, NULL_PTR, &hSession);
+
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_OpenSession: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_program;
+ }
+
+ /* Login to the Token (Keystore) */
+ if (!pin)
+#ifndef OPENCRYPTOKI
+ pin = (CK_UTF8CHAR *)getpassphrase("Enter Pin: ");
+#else
+ pin = (CK_UTF8CHAR *)getpass("Enter Pin: ");
+#endif
+ rv = C_Login(hSession, CKU_USER, pin, strlen((char *)pin));
+ memset(pin, 0, strlen((char *)pin));
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_Login: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_session;
+ }
+
+ /* check if a key with the same id already exists */
+ rv = C_FindObjectsInit(hSession, search_template, 1);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjectsInit: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_session;
+ }
+ rv = C_FindObjects(hSession, &privatekey, 1, &ulObjectCount);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjects: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_search;
+ }
+ if (ulObjectCount != 0) {
+ fprintf(stderr, "Key already exists.\n");
+ error = 1;
+ goto exit_search;
+ }
+
+ /* Set attributes if the key is not to be hidden */
+ if (!hide) {
+ privatekey_template[4].pValue = &falsevalue;
+ privatekey_template[5].pValue = &truevalue;
+ }
+
+ /* Generate Key pair for signing/verifying */
+ rv = C_GenerateKeyPair(hSession, &genmech, publickey_template,
+ (sizeof (publickey_template) /
+ sizeof (CK_ATTRIBUTE)),
+ privatekey_template,
+ (sizeof (privatekey_template) /
+ sizeof (CK_ATTRIBUTE)),
+ &publickey, &privatekey);
+
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_GenerateKeyPair: Error = 0x%.8X\n", rv);
+ error = 1;
+ }
+
+ exit_search:
+ rv = C_FindObjectsFinal(hSession);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjectsFinal: Error = 0x%.8X\n", rv);
+ error = 1;
+ }
+
+ exit_session:
+ (void) C_CloseSession(hSession);
+
+ exit_program:
+ (void) C_Finalize(NULL_PTR);
+
+ exit(error);
+}
diff --git a/contrib/pkcs11-keygen/genkey.sh b/contrib/pkcs11-keygen/genkey.sh
new file mode 100755
index 0000000..f5bf146
--- /dev/null
+++ b/contrib/pkcs11-keygen/genkey.sh
@@ -0,0 +1,55 @@
+#!/usr/bin/bash
+
+usage="Usage: $0 -z zone -x ext -p pin -b bits -e engine [-f] -k key_path"
+tmp_file=/tmp/cur_key.$$
+while getopts ":z:x:p:t:k:b:e:f" opt; do
+ case $opt in
+ z ) zone=$OPTARG ;;
+ x ) ext=$OPTARG ;;
+ p ) pin=$OPTARG ;;
+ t ) id=$OPTARG ;;
+ f ) flag="ksk" ;;
+ e ) engine=$OPTARG ;;
+ b ) bits=$OPTARG ;;
+ k ) key_path=$OPTARG ;;
+ \? ) echo $usage
+ exit 1 ;;
+ esac
+done
+shift $(($OPTIND -1))
+
+if [ ! "$zone" -o ! "$ext" -o ! "$pin" -o ! "$engine" -o ! "$bits" -o ! "$key_path" ] ; then
+ echo $usage
+ exit 1
+fi
+
+if [ "$flag" ] ; then
+ label="$zone,$flag,$ext"
+else
+ label="$zone,zsk,$ext"
+fi
+
+# for testing
+mypath=.
+
+echo "Generating key"
+$mypath/genkey -b $bits -l $label -p $pin
+if [ $? -ne 0 ] ; then exit 1 ; fi
+
+echo "Exporting public key"
+$mypath/PEM_write_pubkey -e $engine -p $pin -k pkcs11:$label -f $tmp_file
+if [ $? -ne 0 ] ; then exit 1 ; fi
+
+echo "Generating DNSKEY RR"
+if [ "$flag" ] ; then
+ keytag=`$mypath/keyconv.pl -a 5 -k -e $engine -l $label -p $key_path -i $tmp_file $zone`
+else
+ keytag=`$mypath/keyconv.pl -a 5 -e $engine -l $label -p $key_path -i $tmp_file $zone`
+fi
+
+if [ ! $keytag ] ; then rm $tmp_file; exit 1 ; fi
+
+echo "Set key id"
+$mypath/set_key_id -l $label -n $keytag -p $pin
+
+rm $tmp_file
diff --git a/contrib/pkcs11-keygen/keyconv.pl b/contrib/pkcs11-keygen/keyconv.pl
new file mode 100755
index 0000000..c68124c
--- /dev/null
+++ b/contrib/pkcs11-keygen/keyconv.pl
@@ -0,0 +1,61 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Crypt::OpenSSL::RSA;
+use Getopt::Std;
+use MIME::Base64;
+use Net::DNS;
+use Net::DNS::SEC;
+
+my %option;
+getopts('a:e:i:l:p:hk',\%option);
+
+die "usage: keyconv.pl [-a alg] [-k (to indicate KSK)] -e engine -l label [-p (path to store key)] -i filename domainname\n" if $option{h} || (not defined $option{i}) || (not defined $option{e}) || (not defined $option{l});
+
+# The default path is local.
+$option{p} || ($option{p}="./");
+
+# The default algorithm is 5.
+$option{a} || ($option{a}=5);
+
+$option{k} || ($option{k}=0);
+
+# The algorithm is either 5 or 133.
+$option{a}==5 || $option{a}==133 || die "algorithm must be 5 or 133\n";
+
+# standard flags (value is 256) plus optionally the KSK flag.
+my $flags=(256 + $option{k});
+
+open(PFILE, $option{i});
+ my @fc = <PFILE>;
+close(PFILE);
+
+my $rsa = Crypt::OpenSSL::RSA->new_public_key(join "", @fc);
+
+my ($m,$e)= $rsa->get_key_parameters;
+
+(my $l=pack("Cn",0,length($e->to_bin))) =~ s/^\000{2}//;
+
+my $rrkey=$l.$e->to_bin.$m->to_bin;
+my $keystr = $ARGV[0]. ". IN DNSKEY $flags 3 $option{a} ".encode_base64($rrkey,"");
+my $keyrr = Net::DNS::RR->new($keystr);
+
+open(PFILE, "> $option{p}/K".$ARGV[0].".+".sprintf("%03d",$option{a})."+".$keyrr->keytag.".key");
+print PFILE $ARGV[0], ". IN DNSKEY $flags 3 $option{a} ",encode_base64($rrkey,"")."\n";
+close(PFILE);
+
+open(PFILE, "> $option{p}/K".$ARGV[0].".+".sprintf("%03d",$option{a})."+".$keyrr->keytag.".private");
+print PFILE "Private-key-format: v1.2\n";
+print PFILE "Algorithm: ", $option{a}, " (RSASHA1)\n";
+print PFILE "Modulus: ".encode_base64($m->to_bin,"")."\n";
+print PFILE "PublicExponent: ".encode_base64($e->to_bin,"")."\n";
+my $engine="";
+$engine=encode_base64($option{e}."\0","");
+print PFILE "Engine: ", $engine, "\n";
+my $label="";
+$option{k}==0 && ($label=encode_base64($option{e}.":".$option{l}."\0",""));
+$option{k}!=0 && ($label=encode_base64($option{e}.":".$option{l}."\0",""));
+print PFILE "Label: ", $label, "\n";
+close(PFILE);
+
+print $keyrr->keytag;
diff --git a/contrib/pkcs11-keygen/keydump.pl b/contrib/pkcs11-keygen/keydump.pl
new file mode 100755
index 0000000..acbb00c
--- /dev/null
+++ b/contrib/pkcs11-keygen/keydump.pl
@@ -0,0 +1,26 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Getopt::Std;
+use Crypt::OpenSSL::RSA;
+use Net::DNS::SEC;
+
+my %option;
+getopts('k:p:o:h',\%option);
+
+$option{h} || (not defined $option{k}) || (not defined $option{p}) || (not defined $option{o}) && die "usage: keydump.pl -k Kxxx.key -p Kxxx.priv -o pem\n";
+
+my $rsa = Net::DNS::SEC::Private->new($option{p});
+
+open(PFILE, "> $option{o}");
+print PFILE $rsa->dump_rsa_private_der;
+close(PFILE);
+
+open(KFILE, "< $option{k}");
+my @fc = <KFILE>;
+close(KFILE);
+
+my $keyrr = Net::DNS::RR->new(join "", @fc);
+
+print $keyrr->flags;
+
diff --git a/contrib/pkcs11-keygen/listobjs.c b/contrib/pkcs11-keygen/listobjs.c
new file mode 100644
index 0000000..68e22ec
--- /dev/null
+++ b/contrib/pkcs11-keygen/listobjs.c
@@ -0,0 +1,197 @@
+/* listobjs [-P] [-s slot] [-i $id | -l $label] [-p $pin] */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#ifndef OPENCRYPTOKI
+#include <security/cryptoki.h>
+#include <security/pkcs11.h>
+#else
+#include <opencryptoki/pkcs11.h>
+#endif
+
+int
+main(int argc, char *argv[])
+{
+ CK_RV rv;
+ CK_SLOT_ID slot = 0;
+ CK_SESSION_HANDLE hSession;
+ CK_UTF8CHAR *pin = NULL;
+ CK_BYTE attr_id[2];
+ CK_OBJECT_HANDLE akey[50];
+ char *label = NULL;
+ int error = 0, public = 0, all = 0;
+ int i = 0, id = 0;
+ int c, errflg = 0;
+ CK_ULONG ulObjectCount;
+ CK_ATTRIBUTE search_template[] = {
+ {CKA_ID, &attr_id, sizeof(attr_id)}
+ };
+ extern char *optarg;
+ extern int optopt;
+
+ while ((c = getopt(argc, argv, ":s:i:l:p:P")) != -1) {
+ switch (c) {
+ case 'P':
+ public = 1;
+ break;
+ case 's':
+ slot = atoi(optarg);
+ break;
+ case 'i':
+ id = atoi(optarg);
+ id &= 0xffff;
+ break;
+ case 'l':
+ label = optarg;
+ break;
+ case 'p':
+ pin = (CK_UTF8CHAR *)optarg;
+ break;
+ case ':':
+ fprintf(stderr, "Option -%c requires an operand\n", optopt);
+ errflg++;
+ break;
+ case '?':
+ default:
+ fprintf(stderr, "Unrecognised option: -%c\n", optopt);
+ errflg++;
+ }
+ }
+ if (errflg) {
+ fprintf(stderr,
+ "usage: listobjs [-P] [-s slot] [-p pin] -i id | $label\n");
+ exit(1);
+ }
+ if ((!id) && (!label))
+ all = 1;
+ if (slot)
+ printf("slot %d\n", slot);
+ if (id) {
+ printf("id %i\n", id);
+ attr_id[0] = (id >> 8) & 0xff;
+ attr_id[1] = id & 0xff;
+ } else if (label) {
+ printf("label %s\n", label);
+ search_template[0].type = CKA_LABEL;
+ search_template[0].pValue = label;
+ search_template[0].ulValueLen = strlen(label);
+ }
+
+ /* Initialize the CRYPTOKI library */
+ rv = C_Initialize(NULL_PTR);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_Initialize: Error = 0x%.8X\n", rv);
+ exit(1);
+ }
+
+ /* Open a session on the slot found */
+ rv = C_OpenSession(slot, CKF_SERIAL_SESSION,
+ NULL_PTR, NULL_PTR, &hSession);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_OpenSession: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_program;
+ }
+
+ /* Login to the Token (Keystore) */
+ if (!public) {
+ if (!pin)
+#ifndef OPENCRYPTOKI
+ pin = (CK_UTF8CHAR *)getpassphrase("Enter Pin: ");
+#else
+ pin = (CK_UTF8CHAR *)getpass("Enter Pin: ");
+#endif
+ rv = C_Login(hSession, CKU_USER, pin, strlen((char *)pin));
+ memset(pin, 0, strlen((char *)pin));
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_Login: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_session;
+ }
+ }
+
+ rv = C_FindObjectsInit(hSession, search_template, all ? 0 : 1);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjectsInit: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_session;
+ }
+
+ ulObjectCount = 1;
+ while (ulObjectCount) {
+ rv = C_FindObjects(hSession, akey, 50, &ulObjectCount);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjects: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_search;
+ }
+
+ for (i = 0; i < ulObjectCount; i++) {
+ CK_OBJECT_CLASS oclass = 0;
+ CK_BYTE labelbuf[64 + 1];
+ CK_BYTE idbuf[64];
+ CK_ATTRIBUTE attr_template[] = {
+ {CKA_CLASS, &oclass, sizeof(oclass)},
+ {CKA_LABEL, labelbuf, sizeof(labelbuf) - 1},
+ {CKA_ID, idbuf, sizeof(idbuf)}
+ };
+ int j, len;
+
+ memset(labelbuf, 0, sizeof(labelbuf));
+ memset(idbuf, 0, sizeof(idbuf));
+
+ rv = C_GetAttributeValue(hSession, akey[i], attr_template, 3);
+ if (rv != CKR_OK) {
+ fprintf(stderr,
+ "C_GetAttributeValue[%d]: rv = 0x%.8X\n", i, rv);
+ if (rv = CKR_BUFFER_TOO_SMALL)
+ fprintf(stderr, "%d too small: %u %u %u\n", i,
+ attr_template[0].ulValueLen,
+ attr_template[1].ulValueLen,
+ attr_template[2].ulValueLen);
+ error = 1;
+ continue;
+ }
+
+ len = attr_template[2].ulValueLen;
+ printf("object[%d]: handle %u class %d label[%u] '%s' id[%u] ",
+ i, akey[i], oclass,
+ attr_template[1].ulValueLen, labelbuf,
+ attr_template[2].ulValueLen);
+ if (len == 2) {
+ id = (idbuf[0] << 8) & 0xff00;
+ id |= idbuf[1] & 0xff;
+ printf("%i\n", id);
+ } else {
+ if (len > 8)
+ len = 8;
+ for (j = 0; j < len; j++)
+ printf("%02x", idbuf[j]);
+ if (attr_template[2].ulValueLen > len)
+ printf("...\n");
+ else
+ printf("\n");
+ }
+ }
+ }
+
+ exit_search:
+ rv = C_FindObjectsFinal(hSession);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjectsFinal: Error = 0x%.8X\n", rv);
+ error = 1;
+ }
+
+ exit_session:
+ (void) C_CloseSession(hSession);
+
+ exit_program:
+ (void) C_Finalize(NULL_PTR);
+
+ exit(error);
+}
diff --git a/contrib/pkcs11-keygen/openssl-0.9.8g-patch b/contrib/pkcs11-keygen/openssl-0.9.8g-patch
new file mode 100644
index 0000000..6d93c68
--- /dev/null
+++ b/contrib/pkcs11-keygen/openssl-0.9.8g-patch
@@ -0,0 +1,8715 @@
+diff -r -u -N openssl-0.9.8g/Configure openssl/Configure
+--- openssl-0.9.8g/Configure 2007-09-16 14:24:17.000000000 +0200
++++ openssl/Configure 2007-10-25 01:27:08.000000000 +0200
+@@ -10,7 +10,7 @@
+
+ # see INSTALL for instructions.
+
+-my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]\n";
++my $usage="Usage: Configure --pk11-libname=PK11_LIB_LOCATION [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]\n";
+
+ # Options:
+ #
+@@ -19,6 +19,9 @@
+ # --prefix prefix for the OpenSSL include, lib and bin directories
+ # (Default: the OPENSSLDIR directory)
+ #
++# --pk11_libname PKCS#11 library name.
++# (Default: none)
++#
+ # --install_prefix Additional prefix for package builders (empty by
+ # default). This needn't be set in advance, you can
+ # just as well use "make INSTALL_PREFIX=/whatever install".
+@@ -560,6 +563,8 @@
+ my $idx_ranlib = $idx++;
+ my $idx_arflags = $idx++;
+
++my $pk11_libname="";
++
+ my $prefix="";
+ my $openssldir="";
+ my $exe_ext="";
+@@ -738,6 +743,10 @@
+ {
+ $flags.=$_." ";
+ }
++ elsif (/^--pk11-libname=(.*)$/)
++ {
++ $pk11_libname=$1;
++ }
+ elsif (/^--prefix=(.*)$/)
+ {
+ $prefix=$1;
+@@ -861,6 +870,13 @@
+ exit 0;
+ }
+
++if (! $pk11_libname)
++ {
++ print STDERR "You must set --pk11-libname for PKCS#11 library.\n";
++ print STDERR "See README.pkcs11 for more information.\n";
++ exit 1;
++ }
++
+ if ($target =~ m/^CygWin32(-.*)$/) {
+ $target = "Cygwin".$1;
+ }
+@@ -986,6 +1002,8 @@
+ if ($flags ne "") { $cflags="$flags$cflags"; }
+ else { $no_user_cflags=1; }
+
++$cflags="-DPK11_LIB_LOCATION=\"$pk11_libname\" $cflags";
++
+ # Kerberos settings. The flavor must be provided from outside, either through
+ # the script "config" or manually.
+ if (!$no_krb5)
+@@ -1319,6 +1337,7 @@
+ s/^VERSION=.*/VERSION=$version/;
+ s/^MAJOR=.*/MAJOR=$major/;
+ s/^MINOR=.*/MINOR=$minor/;
++ s/^PK11_LIB_LOCATION=.*/PK11_LIB_LOCATION=$pk11_libname/;
+ s/^SHLIB_VERSION_NUMBER=.*/SHLIB_VERSION_NUMBER=$shlib_version_number/;
+ s/^SHLIB_VERSION_HISTORY=.*/SHLIB_VERSION_HISTORY=$shlib_version_history/;
+ s/^SHLIB_MAJOR=.*/SHLIB_MAJOR=$shlib_major/;
+diff -r -u -N openssl-0.9.8g/crypto/engine/cryptoki.h openssl/crypto/engine/cryptoki.h
+--- openssl-0.9.8g/crypto/engine/cryptoki.h 1970-01-01 01:00:00.000000000 +0100
++++ openssl/crypto/engine/cryptoki.h 2007-10-25 01:27:09.000000000 +0200
+@@ -0,0 +1,103 @@
++/*
++ * CDDL HEADER START
++ *
++ * The contents of this file are subject to the terms of the
++ * Common Development and Distribution License, Version 1.0 only
++ * (the "License"). You may not use this file except in compliance
++ * with the License.
++ *
++ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
++ * or http://www.opensolaris.org/os/licensing.
++ * See the License for the specific language governing permissions
++ * and limitations under the License.
++ *
++ * When distributing Covered Code, include this CDDL HEADER in each
++ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
++ * If applicable, add the following below this CDDL HEADER, with the
++ * fields enclosed by brackets "[]" replaced with your own identifying
++ * information: Portions Copyright [yyyy] [name of copyright owner]
++ *
++ * CDDL HEADER END
++ */
++/*
++ * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
++ * Use is subject to license terms.
++ */
++
++#ifndef _CRYPTOKI_H
++#define _CRYPTOKI_H
++
++#pragma ident "@(#)cryptoki.h 1.2 05/06/08 SMI"
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++#ifndef CK_PTR
++#define CK_PTR *
++#endif
++
++#ifndef CK_DEFINE_FUNCTION
++#define CK_DEFINE_FUNCTION(returnType, name) returnType name
++#endif
++
++#ifndef CK_DECLARE_FUNCTION
++#define CK_DECLARE_FUNCTION(returnType, name) returnType name
++#endif
++
++#ifndef CK_DECLARE_FUNCTION_POINTER
++#define CK_DECLARE_FUNCTION_POINTER(returnType, name) returnType (* name)
++#endif
++
++#ifndef CK_CALLBACK_FUNCTION
++#define CK_CALLBACK_FUNCTION(returnType, name) returnType (* name)
++#endif
++
++#ifndef NULL_PTR
++#include <unistd.h> /* For NULL */
++#define NULL_PTR NULL
++#endif
++
++/*
++ * pkcs11t.h defines TRUE and FALSE in a way that upsets lint
++ */
++#ifndef CK_DISABLE_TRUE_FALSE
++#define CK_DISABLE_TRUE_FALSE
++#ifndef TRUE
++#define TRUE 1
++#endif /* TRUE */
++#ifndef FALSE
++#define FALSE 0
++#endif /* FALSE */
++#endif /* CK_DISABLE_TRUE_FALSE */
++
++#undef CK_PKCS11_FUNCTION_INFO
++
++#include "pkcs11.h"
++
++/* Solaris specific functions */
++
++#include <stdlib.h>
++
++/*
++ * SUNW_C_GetMechSession will initialize the framework and do all
++ * the necessary PKCS#11 calls to create a session capable of
++ * providing operations on the requested mechanism
++ */
++CK_RV SUNW_C_GetMechSession(CK_MECHANISM_TYPE mech,
++ CK_SESSION_HANDLE_PTR hSession);
++
++/*
++ * SUNW_C_KeyToObject will create a secret key object for the given
++ * mechanism from the rawkey data.
++ */
++CK_RV SUNW_C_KeyToObject(CK_SESSION_HANDLE hSession,
++ CK_MECHANISM_TYPE mech, const void *rawkey, size_t rawkey_len,
++ CK_OBJECT_HANDLE_PTR obj);
++
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif /* _CRYPTOKI_H */
+diff -r -u -N openssl-0.9.8g/crypto/engine/eng_all.c openssl/crypto/engine/eng_all.c
+--- openssl-0.9.8g/crypto/engine/eng_all.c 2007-01-04 23:55:25.000000000 +0100
++++ openssl/crypto/engine/eng_all.c 2007-10-25 01:27:09.000000000 +0200
+@@ -107,6 +107,9 @@
+ #if defined(__OpenBSD__) || defined(__FreeBSD__)
+ ENGINE_load_cryptodev();
+ #endif
++#ifndef OPENSSL_NO_HW_PKCS11
++ ENGINE_load_pk11();
++#endif
+ #endif
+ }
+
+diff -r -u -N openssl-0.9.8g/crypto/engine/engine.h openssl/crypto/engine/engine.h
+--- openssl-0.9.8g/crypto/engine/engine.h 2005-11-06 18:48:59.000000000 +0100
++++ openssl/crypto/engine/engine.h 2007-10-25 01:27:09.000000000 +0200
+@@ -332,6 +332,7 @@
+ void ENGINE_load_ubsec(void);
+ #endif
+ void ENGINE_load_cryptodev(void);
++void ENGINE_load_pk11(void);
+ void ENGINE_load_padlock(void);
+ void ENGINE_load_builtin_engines(void);
+
+diff -r -u -N openssl-0.9.8g/crypto/engine/hw_pk11.c openssl/crypto/engine/hw_pk11.c
+--- openssl-0.9.8g/crypto/engine/hw_pk11.c 1970-01-01 01:00:00.000000000 +0100
++++ openssl/crypto/engine/hw_pk11.c 2007-10-29 23:31:11.000000000 +0100
+@@ -0,0 +1,2153 @@
++/*
++ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
++ * Use is subject to license terms.
++ */
++
++#pragma ident "@(#)hw_pk11.c 1.12 07/07/05 SMI"
++
++/* crypto/engine/hw_pk11.c */
++/* This product includes software developed by the OpenSSL Project for
++ * use in the OpenSSL Toolkit (http://www.openssl.org/).
++ *
++ * This project also referenced hw_pkcs11-0.9.7b.patch written by
++ * Afchine Madjlessi.
++ */
++/* ====================================================================
++ * Copyright (c) 2000-2001 The OpenSSL Project. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ *
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ *
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in
++ * the documentation and/or other materials provided with the
++ * distribution.
++ *
++ * 3. All advertising materials mentioning features or use of this
++ * software must display the following acknowledgment:
++ * "This product includes software developed by the OpenSSL Project
++ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
++ *
++ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
++ * endorse or promote products derived from this software without
++ * prior written permission. For written permission, please contact
++ * licensing@OpenSSL.org.
++ *
++ * 5. Products derived from this software may not be called "OpenSSL"
++ * nor may "OpenSSL" appear in their names without prior written
++ * permission of the OpenSSL Project.
++ *
++ * 6. Redistributions of any form whatsoever must retain the following
++ * acknowledgment:
++ * "This product includes software developed by the OpenSSL Project
++ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
++ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
++ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
++ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
++ * OF THE POSSIBILITY OF SUCH DAMAGE.
++ * ====================================================================
++ *
++ * This product includes cryptographic software written by Eric Young
++ * (eay@cryptsoft.com). This product includes software written by Tim
++ * Hudson (tjh@cryptsoft.com).
++ *
++ */
++
++#include <stdio.h>
++#include <assert.h>
++#include <stdlib.h>
++#include <string.h>
++#include <sys/types.h>
++#include <unistd.h>
++
++#include <openssl/e_os2.h>
++#include <openssl/engine.h>
++#include <openssl/dso.h>
++#include <openssl/err.h>
++#include <openssl/bn.h>
++#include <openssl/md5.h>
++#include <openssl/pem.h>
++#include <openssl/rsa.h>
++#include <openssl/rand.h>
++#include <openssl/objects.h>
++#include <openssl/x509.h>
++#include <cryptlib.h>
++
++#ifndef OPENSSL_NO_HW
++#ifndef OPENSSL_NO_HW_PK11
++
++#undef DEBUG_SLOT_SELECTION
++
++#include "cryptoki.h"
++#include "pkcs11.h"
++#include "hw_pk11_err.c"
++
++
++/* The head of the free PK11 session list */
++static struct PK11_SESSION_st *free_session = NULL;
++
++/* Create all secret key objects in a global session so that they are available
++ * to use for other sessions. These other sessions may be opened or closed
++ * without losing the secret key objects */
++static CK_SESSION_HANDLE global_session = CK_INVALID_HANDLE;
++
++/* ENGINE level stuff */
++static int pk11_init(ENGINE *e);
++static int pk11_library_init(ENGINE *e);
++static int pk11_finish(ENGINE *e);
++static int pk11_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
++static int pk11_destroy(ENGINE *e);
++
++/* RAND stuff */
++static void pk11_rand_seed(const void *buf, int num);
++static void pk11_rand_add(const void *buf, int num, double add_entropy);
++static void pk11_rand_cleanup(void);
++static int pk11_rand_bytes(unsigned char *buf, int num);
++static int pk11_rand_status(void);
++
++/* These functions are also used in other files */
++PK11_SESSION *pk11_get_session();
++void pk11_return_session(PK11_SESSION *sp);
++int pk11_destroy_rsa_key_objects(PK11_SESSION *session);
++int pk11_destroy_dsa_key_objects(PK11_SESSION *session);
++int pk11_destroy_dh_key_objects(PK11_SESSION *session);
++
++/* Local helper functions */
++static int pk11_free_all_sessions();
++static int pk11_setup_session(PK11_SESSION *sp);
++static int pk11_destroy_cipher_key_objects(PK11_SESSION *session);
++static int pk11_destroy_object(CK_SESSION_HANDLE session,
++ CK_OBJECT_HANDLE oh);
++static const char *get_PK11_LIBNAME(void);
++static void free_PK11_LIBNAME(void);
++static long set_PK11_LIBNAME(const char *name);
++
++/* Symmetric cipher and digest support functions */
++static int cipher_nid_to_pk11(int nid);
++static int pk11_usable_ciphers(const int **nids);
++static int pk11_usable_digests(const int **nids);
++static int pk11_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
++ const unsigned char *iv, int enc);
++static int pk11_cipher_final(PK11_SESSION *sp);
++static int pk11_cipher_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
++ const unsigned char *in, unsigned int inl);
++static int pk11_cipher_cleanup(EVP_CIPHER_CTX *ctx);
++static int pk11_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
++ const int **nids, int nid);
++static int pk11_engine_digests(ENGINE *e, const EVP_MD **digest,
++ const int **nids, int nid);
++static CK_OBJECT_HANDLE pk11_get_cipher_key(EVP_CIPHER_CTX *ctx,
++ const unsigned char *key, CK_KEY_TYPE key_type, PK11_SESSION *sp);
++static void check_new_cipher_key(PK11_SESSION *sp, const unsigned char *key);
++static int md_nid_to_pk11(int nid);
++static int pk11_digest_init(EVP_MD_CTX *ctx);
++static int pk11_digest_update(EVP_MD_CTX *ctx,const void *data,
++ size_t count);
++static int pk11_digest_final(EVP_MD_CTX *ctx,unsigned char *md);
++static int pk11_digest_copy(EVP_MD_CTX *to,const EVP_MD_CTX *from);
++static int pk11_digest_cleanup(EVP_MD_CTX *ctx);
++
++static int pk11_choose_slot();
++static int pk11_count_symmetric_cipher(int slot_id, CK_MECHANISM_TYPE mech,
++ int *current_slot_n_cipher, int *local_cipher_nids, int id);
++static int pk11_count_digest(int slot_id, CK_MECHANISM_TYPE mech,
++ int *current_slot_n_digest, int *local_digest_nids, int id);
++
++/* Index for the supported ciphers */
++#define PK11_DES_CBC 0
++#define PK11_DES3_CBC 1
++#define PK11_AES_CBC 2
++#define PK11_RC4 3
++
++/* Index for the supported digests */
++#define PK11_MD5 0
++#define PK11_SHA1 1
++
++#define PK11_CIPHER_MAX 4 /* Max num of ciphers supported */
++#define PK11_DIGEST_MAX 2 /* Max num of digests supported */
++
++#define PK11_KEY_LEN_MAX 24
++
++static int cipher_nids[PK11_CIPHER_MAX];
++static int digest_nids[PK11_DIGEST_MAX];
++static int cipher_count = 0;
++static int digest_count = 0;
++static CK_BBOOL pk11_have_rsa = CK_FALSE;
++static CK_BBOOL pk11_have_dsa = CK_FALSE;
++static CK_BBOOL pk11_have_dh = CK_FALSE;
++static CK_BBOOL pk11_have_random = CK_FALSE;
++
++typedef struct PK11_CIPHER_st
++ {
++ int id;
++ int nid;
++ int ivmax;
++ int key_len;
++ CK_KEY_TYPE key_type;
++ CK_MECHANISM_TYPE mech_type;
++ } PK11_CIPHER;
++
++static PK11_CIPHER ciphers[] =
++ {
++ {PK11_DES_CBC, NID_des_cbc, 8, 8, CKK_DES, CKM_DES_CBC, },
++ {PK11_DES3_CBC, NID_des_ede3_cbc, 8, 24, CKK_DES3, CKM_DES3_CBC, },
++ {PK11_AES_CBC, NID_aes_128_cbc, 16, 16, CKK_AES, CKM_AES_CBC, },
++ {PK11_RC4, NID_rc4, 0, 16, CKK_RC4, CKM_RC4, },
++ };
++
++typedef struct PK11_DIGEST_st
++ {
++ int id;
++ int nid;
++ CK_MECHANISM_TYPE mech_type;
++ } PK11_DIGEST;
++
++static PK11_DIGEST digests[] =
++ {
++ {PK11_MD5, NID_md5, CKM_MD5, },
++ {PK11_SHA1, NID_sha1, CKM_SHA_1, },
++ {0, NID_undef, 0xFFFF, },
++ };
++
++/* Structure to be used for the cipher_data/md_data in
++ * EVP_CIPHER_CTX/EVP_MD_CTX structures in order to use the same
++ * pk11 session in multiple cipher_update calls
++ */
++typedef struct PK11_CIPHER_STATE_st
++ {
++ PK11_SESSION *sp;
++ } PK11_CIPHER_STATE;
++
++
++/* libcrypto EVP stuff - this is how we get wired to EVP so the engine
++ * gets called when libcrypto requests a cipher NID.
++ * Note how the PK11_CIPHER_STATE is used here.
++ */
++
++/* DES CBC EVP */
++static const EVP_CIPHER pk11_des_cbc =
++ {
++ NID_des_cbc,
++ 8, 8, 8,
++ EVP_CIPH_CBC_MODE,
++ pk11_cipher_init,
++ pk11_cipher_do_cipher,
++ pk11_cipher_cleanup,
++ sizeof(PK11_CIPHER_STATE),
++ EVP_CIPHER_set_asn1_iv,
++ EVP_CIPHER_get_asn1_iv,
++ NULL
++ };
++
++/* 3DES CBC EVP */
++static const EVP_CIPHER pk11_3des_cbc =
++ {
++ NID_des_ede3_cbc,
++ 8, 24, 8,
++ EVP_CIPH_CBC_MODE,
++ pk11_cipher_init,
++ pk11_cipher_do_cipher,
++ pk11_cipher_cleanup,
++ sizeof(PK11_CIPHER_STATE),
++ EVP_CIPHER_set_asn1_iv,
++ EVP_CIPHER_get_asn1_iv,
++ NULL
++ };
++
++static const EVP_CIPHER pk11_aes_cbc =
++ {
++ NID_aes_128_cbc,
++ 16, 16, 16,
++ EVP_CIPH_CBC_MODE,
++ pk11_cipher_init,
++ pk11_cipher_do_cipher,
++ pk11_cipher_cleanup,
++ sizeof(PK11_CIPHER_STATE),
++ EVP_CIPHER_set_asn1_iv,
++ EVP_CIPHER_get_asn1_iv,
++ NULL
++ };
++
++static const EVP_CIPHER pk11_rc4 =
++ {
++ NID_rc4,
++ 1,16,0,
++ EVP_CIPH_VARIABLE_LENGTH,
++ pk11_cipher_init,
++ pk11_cipher_do_cipher,
++ pk11_cipher_cleanup,
++ sizeof(PK11_CIPHER_STATE),
++ NULL,
++ NULL,
++ NULL
++ };
++
++static const EVP_MD pk11_md5 =
++ {
++ NID_md5,
++ NID_md5WithRSAEncryption,
++ MD5_DIGEST_LENGTH,
++ 0,
++ pk11_digest_init,
++ pk11_digest_update,
++ pk11_digest_final,
++ pk11_digest_copy,
++ pk11_digest_cleanup,
++ EVP_PKEY_RSA_method,
++ MD5_CBLOCK,
++ sizeof(PK11_CIPHER_STATE),
++ };
++
++static const EVP_MD pk11_sha1 =
++ {
++ NID_sha1,
++ NID_sha1WithRSAEncryption,
++ SHA_DIGEST_LENGTH,
++ 0,
++ pk11_digest_init,
++ pk11_digest_update,
++ pk11_digest_final,
++ pk11_digest_copy,
++ pk11_digest_cleanup,
++ EVP_PKEY_RSA_method,
++ SHA_CBLOCK,
++ sizeof(PK11_CIPHER_STATE),
++ };
++
++/* Initialization function. Sets up various pk11 library components.
++ */
++/* The definitions for control commands specific to this engine
++ */
++#define PK11_CMD_SO_PATH ENGINE_CMD_BASE
++#define PK11_CMD_PIN (ENGINE_CMD_BASE+1)
++#define PK11_CMD_SLOT (ENGINE_CMD_BASE+2)
++static const ENGINE_CMD_DEFN pk11_cmd_defns[] =
++ {
++ {
++ PK11_CMD_SO_PATH,
++ "SO_PATH",
++ "Specifies the path to the 'pkcs#11' shared library",
++ ENGINE_CMD_FLAG_STRING
++ },
++ {
++ PK11_CMD_PIN,
++ "PIN",
++ "Specifies the pin code",
++ ENGINE_CMD_FLAG_STRING
++ },
++ {
++ PK11_CMD_SLOT,
++ "SLOT",
++ "Specifies the slot (default is auto select)",
++ ENGINE_CMD_FLAG_NUMERIC,
++ },
++ {0, NULL, NULL, 0}
++ };
++
++
++static RAND_METHOD pk11_random =
++ {
++ pk11_rand_seed,
++ pk11_rand_bytes,
++ pk11_rand_cleanup,
++ pk11_rand_add,
++ pk11_rand_bytes,
++ pk11_rand_status
++ };
++
++
++/* Constants used when creating the ENGINE
++ */
++static const char *engine_pk11_id = "pkcs11";
++static const char *engine_pk11_name = "PKCS #11 engine support";
++
++CK_FUNCTION_LIST_PTR pFuncList = NULL;
++static const char PK11_GET_FUNCTION_LIST[] = "C_GetFunctionList";
++
++/* Cryptoki library
++ */
++static const char def_PK11_LIBNAME[] = PK11_LIB_LOCATION;
++
++static CK_BBOOL true = TRUE;
++static CK_BBOOL false = FALSE;
++static CK_SLOT_ID SLOTID = 0;
++static int pk11_auto_slot = 1;
++char *pk11_pin;
++static int pk11_library_initialized = 0;
++
++static DSO *pk11_dso = NULL;
++
++/*
++ * This internal function is used by ENGINE_pk11() and "dynamic" ENGINE support.
++ */
++static int bind_pk11(ENGINE *e)
++ {
++ const RSA_METHOD *rsa = NULL;
++ RSA_METHOD *pk11_rsa = PK11_RSA();
++
++ if (!pk11_library_initialized)
++ pk11_library_init(e);
++
++ if(!ENGINE_set_id(e, engine_pk11_id) ||
++ !ENGINE_set_name(e, engine_pk11_name) ||
++ !ENGINE_set_ciphers(e, pk11_engine_ciphers) ||
++ !ENGINE_set_digests(e, pk11_engine_digests))
++ return 0;
++#ifndef OPENSSL_NO_RSA
++ if(pk11_have_rsa == CK_TRUE)
++ {
++ if(!ENGINE_set_RSA(e, PK11_RSA()) ||
++ !ENGINE_set_load_privkey_function(e, pk11_load_privkey) ||
++ !ENGINE_set_load_pubkey_function(e, pk11_load_pubkey))
++ return 0;
++#ifdef DEBUG_SLOT_SELECTION
++ fprintf(stderr, "OPENSSL_PKCS#11_ENGINE: registered RSA\n");
++#endif /* DEBUG_SLOT_SELECTION */
++ }
++#endif
++#ifndef OPENSSL_NO_DSA
++ if(pk11_have_dsa == CK_TRUE)
++ {
++ if (!ENGINE_set_DSA(e, PK11_DSA()))
++ return 0;
++#ifdef DEBUG_SLOT_SELECTION
++ fprintf(stderr, "OPENSSL_PKCS#11_ENGINE: registered DSA\n");
++#endif /* DEBUG_SLOT_SELECTION */
++ }
++#endif
++#ifndef OPENSSL_NO_DH
++ if(pk11_have_dh == CK_TRUE)
++ {
++ if (!ENGINE_set_DH(e, PK11_DH()))
++ return 0;
++#ifdef DEBUG_SLOT_SELECTION
++ fprintf(stderr, "OPENSSL_PKCS#11_ENGINE: registered DH\n");
++#endif /* DEBUG_SLOT_SELECTION */
++ }
++#endif
++ if(pk11_have_random)
++ {
++ if(!ENGINE_set_RAND(e, &pk11_random))
++ return 0;
++#ifdef DEBUG_SLOT_SELECTION
++ fprintf(stderr, "OPENSSL_PKCS#11_ENGINE: registered random\n");
++#endif /* DEBUG_SLOT_SELECTION */
++ }
++ if(!ENGINE_set_init_function(e, pk11_init) ||
++ !ENGINE_set_destroy_function(e, pk11_destroy) ||
++ !ENGINE_set_finish_function(e, pk11_finish) ||
++ !ENGINE_set_ctrl_function(e, pk11_ctrl) ||
++ !ENGINE_set_cmd_defns(e, pk11_cmd_defns))
++ return 0;
++
++/* Apache calls OpenSSL function RSA_blinding_on() once during startup
++ * which in turn calls bn_mod_exp. Since we do not implement bn_mod_exp
++ * here, we wire it back to the OpenSSL software implementation.
++ * Since it is used only once, performance is not a concern. */
++#ifndef OPENSSL_NO_RSA
++ rsa = RSA_PKCS1_SSLeay();
++ pk11_rsa->rsa_mod_exp = rsa->rsa_mod_exp;
++ pk11_rsa->bn_mod_exp = rsa->bn_mod_exp;
++#endif
++
++ /* Ensure the pk11 error handling is set up */
++ ERR_load_pk11_strings();
++
++ return 1;
++ }
++
++/* Dynamic engine support is disabled at a higher level for Solaris
++ */
++#ifdef ENGINE_DYNAMIC_SUPPORT
++static int bind_helper(ENGINE *e, const char *id)
++ {
++ if (id && (strcmp(id, engine_pk11_id) != 0))
++ return 0;
++
++ if (!bind_pk11(e))
++ return 0;
++
++ return 1;
++ }
++
++IMPLEMENT_DYNAMIC_CHECK_FN()
++IMPLEMENT_DYNAMIC_BIND_FN(bind_helper)
++
++#else
++static ENGINE *engine_pk11(void)
++ {
++ ENGINE *ret = ENGINE_new();
++
++ if (!ret)
++ return NULL;
++
++ if (!bind_pk11(ret))
++ {
++ ENGINE_free(ret);
++ return NULL;
++ }
++
++ return ret;
++ }
++
++void ENGINE_load_pk11(void)
++ {
++ ENGINE *e_pk11 = NULL;
++
++ /* Do not use dynamic PKCS#11 library on Solaris due to
++ * security reasons. We will link it in statically
++ */
++ /* Attempt to load PKCS#11 library
++ */
++ if (!pk11_dso)
++ pk11_dso = DSO_load(NULL, get_PK11_LIBNAME(), NULL, 0);
++
++ if (pk11_dso == NULL)
++ {
++ PK11err(PK11_F_LOAD, PK11_R_DSO_FAILURE);
++ return;
++ }
++
++ e_pk11 = engine_pk11();
++ if (!e_pk11)
++ {
++ DSO_free(pk11_dso);
++ pk11_dso = NULL;
++ return;
++ }
++
++ /* At this point, the pk11 shared library is either dynamically
++ * loaded or statically linked in. So, initialize the pk11
++ * library before calling ENGINE_set_default since the latter
++ * needs cipher and digest algorithm information
++ */
++ if (!pk11_library_init(e_pk11))
++ {
++ DSO_free(pk11_dso);
++ pk11_dso = NULL;
++ ENGINE_free(e_pk11);
++ return;
++ }
++
++ ENGINE_add(e_pk11);
++
++ ENGINE_free(e_pk11);
++ ERR_clear_error();
++ }
++#endif
++
++/* These are the static string constants for the DSO file name and
++ * the function symbol names to bind to.
++ */
++static const char *PK11_LIBNAME = NULL;
++
++static const char *get_PK11_LIBNAME(void)
++ {
++ if (PK11_LIBNAME)
++ return PK11_LIBNAME;
++
++ return def_PK11_LIBNAME;
++ }
++
++static void free_PK11_LIBNAME(void)
++ {
++ if (PK11_LIBNAME)
++ OPENSSL_free((void*)PK11_LIBNAME);
++
++ PK11_LIBNAME = NULL;
++ }
++
++static long set_PK11_LIBNAME(const char *name)
++ {
++ free_PK11_LIBNAME();
++
++ return ((PK11_LIBNAME = BUF_strdup(name)) != NULL ? 1 : 0);
++ }
++
++/* Initialization function for the pk11 engine */
++static int pk11_init(ENGINE *e)
++{
++ return pk11_library_init(e);
++}
++
++/* Initialization function. Sets up various pk11 library components.
++ * It selects a slot based on predefined critiera. In the process, it also
++ * count how many ciphers and digests to support. Since the cipher and
++ * digest information is needed when setting default engine, this function
++ * needs to be called before calling ENGINE_set_default.
++ */
++static int pk11_library_init(ENGINE *e)
++ {
++ CK_C_GetFunctionList p;
++ CK_RV rv = CKR_OK;
++ CK_INFO info;
++ CK_ULONG ul_state_len;
++ char tmp_buf[20];
++
++ if (pk11_library_initialized)
++ return 1;
++
++ if (pk11_dso == NULL)
++ {
++ PK11err(PK11_F_LIBRARY_INIT, PK11_R_DSO_FAILURE);
++ goto err;
++ }
++
++ /* get the C_GetFunctionList function from the loaded library
++ */
++ p = (CK_C_GetFunctionList)DSO_bind_func(pk11_dso,
++ PK11_GET_FUNCTION_LIST);
++ if ( !p )
++ {
++ PK11err(PK11_F_LIBRARY_INIT, PK11_R_DSO_FAILURE);
++ goto err;
++ }
++
++ /* get the full function list from the loaded library
++ */
++ rv = p(&pFuncList);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_LIBRARY_INIT, PK11_R_DSO_FAILURE);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ rv = pFuncList->C_Initialize(NULL_PTR);
++ if ((rv != CKR_OK) && (rv != CKR_CRYPTOKI_ALREADY_INITIALIZED))
++ {
++ PK11err(PK11_F_LIBRARY_INIT, PK11_R_INITIALIZE);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ rv = pFuncList->C_GetInfo(&info);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_LIBRARY_INIT, PK11_R_GETINFO);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ if (pk11_choose_slot() == 0)
++ goto err;
++
++ if (global_session == CK_INVALID_HANDLE)
++ {
++ /* Open the global_session for the new process */
++ rv = pFuncList->C_OpenSession(SLOTID, CKF_SERIAL_SESSION,
++ NULL_PTR, NULL_PTR, &global_session);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_LIBRARY_INIT, PK11_R_OPENSESSION);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++ }
++
++ /* Disable digest if C_GetOperationState is not supported since
++ * this function is required by OpenSSL digest copy function */
++ if (pFuncList->C_GetOperationState(global_session, NULL, &ul_state_len)
++ == CKR_FUNCTION_NOT_SUPPORTED)
++ digest_count = 0;
++
++ pk11_library_initialized = 1;
++ return 1;
++
++err:
++
++ return 0;
++ }
++
++/* Destructor (complements the "ENGINE_pk11()" constructor)
++ */
++static int pk11_destroy(ENGINE *e)
++ {
++ free_PK11_LIBNAME();
++ ERR_unload_pk11_strings();
++ if (pk11_pin) {
++ memset(pk11_pin, 0, strlen(pk11_pin));
++ OPENSSL_free((void*)pk11_pin);
++ }
++ pk11_pin = NULL;
++ return 1;
++ }
++
++/* Termination function to clean up the session, the token, and
++ * the pk11 library.
++ */
++static int pk11_finish(ENGINE *e)
++ {
++
++ if (pk11_pin) {
++ memset(pk11_pin, 0, strlen(pk11_pin));
++ OPENSSL_free((void*)pk11_pin);
++ }
++ pk11_pin = NULL;
++
++ if (pk11_dso == NULL)
++ {
++ PK11err(PK11_F_FINISH, PK11_R_NOT_LOADED);
++ goto err;
++ }
++
++ assert(pFuncList != NULL);
++
++ if (pk11_free_all_sessions() == 0)
++ goto err;
++
++ pFuncList->C_CloseSession(global_session);
++
++ /* Since we are part of a library (libcrypto.so), calling this
++ * function may have side-effects.
++ pFuncList->C_Finalize(NULL);
++ */
++
++ if (!DSO_free(pk11_dso))
++ {
++ PK11err(PK11_F_FINISH, PK11_R_DSO_FAILURE);
++ goto err;
++ }
++ pk11_dso = NULL;
++ pFuncList = NULL;
++ pk11_library_initialized = 0;
++
++ return 1;
++
++err:
++ return 0;
++ }
++
++/* Standard engine interface function to set the dynamic library path */
++static int pk11_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
++ {
++ int initialized = ((pk11_dso == NULL) ? 0 : 1);
++
++ switch(cmd)
++ {
++ case PK11_CMD_SO_PATH:
++ if (p == NULL)
++ {
++ PK11err(PK11_F_CTRL, ERR_R_PASSED_NULL_PARAMETER);
++ return 0;
++ }
++
++ if (initialized)
++ {
++ PK11err(PK11_F_CTRL, PK11_R_ALREADY_LOADED);
++ return 0;
++ }
++
++ return set_PK11_LIBNAME((const char*)p);
++ case PK11_CMD_PIN:
++ if (pk11_pin) {
++ memset(pk11_pin, 0, strlen(pk11_pin));
++ OPENSSL_free((void*)pk11_pin);
++ }
++ pk11_pin = NULL;
++
++ if (p == NULL)
++ {
++ PK11err(PK11_F_CTRL, ERR_R_PASSED_NULL_PARAMETER);
++ return 0;
++ }
++
++ pk11_pin = BUF_strdup(p);
++ if (pk11_pin == NULL)
++ {
++ PK11err(PK11_F_GET_SESSION, PK11_R_MALLOC_FAILURE);
++ return 0;
++ }
++ return 1;
++ case PK11_CMD_SLOT:
++ SLOTID = (CK_SLOT_ID)i;
++#ifdef DEBUG_SLOT_SELECTION
++ fprintf(stderr, "OPENSSL_PKCS#11_ENGINE: slot set\n");
++#endif
++ return 1;
++ default:
++ break;
++ }
++
++ PK11err(PK11_F_CTRL,PK11_R_CTRL_COMMAND_NOT_IMPLEMENTED);
++
++ return 0;
++ }
++
++
++/* Required function by the engine random interface. It does nothing here
++ */
++static void pk11_rand_cleanup(void)
++ {
++ return;
++ }
++
++static void pk11_rand_add(const void *buf, int num, double add)
++ {
++ PK11_SESSION *sp;
++
++ if ((sp = pk11_get_session()) == NULL)
++ return;
++
++ /* Ignore any errors (e.g. CKR_RANDOM_SEED_NOT_SUPPORTED) since
++ * the calling functions do not care anyway
++ */
++ pFuncList->C_SeedRandom(sp->session, (unsigned char *) buf, num);
++ pk11_return_session(sp);
++
++ return;
++ }
++
++static void pk11_rand_seed(const void *buf, int num)
++ {
++ pk11_rand_add(buf, num, 0);
++ }
++
++static int pk11_rand_bytes(unsigned char *buf, int num)
++ {
++ CK_RV rv;
++ PK11_SESSION *sp;
++
++ if ((sp = pk11_get_session()) == NULL)
++ return 0;
++
++ rv = pFuncList->C_GenerateRandom(sp->session, buf, num);
++ if (rv != CKR_OK)
++ {
++ char tmp_buf[20];
++ PK11err(PK11_F_RAND_BYTES, PK11_R_GENERATERANDOM);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ pk11_return_session(sp);
++ return 0;
++ }
++
++ pk11_return_session(sp);
++ return 1;
++ }
++
++
++/* Required function by the engine random interface. It does nothing here
++ */
++static int pk11_rand_status(void)
++ {
++ return 1;
++ }
++
++
++PK11_SESSION *pk11_get_session()
++ {
++ PK11_SESSION *sp, *sp1;
++ CK_RV rv;
++ char tmp_buf[20];
++
++ CRYPTO_w_lock(CRYPTO_LOCK_PK11_ENGINE);
++ if ((sp = free_session) == NULL)
++ {
++ if ((sp = OPENSSL_malloc(sizeof(PK11_SESSION))) == NULL)
++ {
++ PK11err(PK11_F_GET_SESSION,
++ PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++ memset(sp, 0, sizeof(PK11_SESSION));
++ }
++ else
++ {
++ free_session = sp->next;
++ }
++
++ if (sp->pid != 0 && sp->pid != getpid())
++ {
++ /* We are a new process and thus need to free any inherated
++ * PK11_SESSION objects.
++ */
++ while ((sp1 = free_session) != NULL)
++ {
++ free_session = sp1->next;
++ OPENSSL_free(sp1);
++ }
++
++ /* Initialize the process */
++ rv = pFuncList->C_Initialize(NULL_PTR);
++ if ((rv != CKR_OK) && (rv != CKR_CRYPTOKI_ALREADY_INITIALIZED))
++ {
++ PK11err(PK11_F_GET_SESSION, PK11_R_INITIALIZE);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ OPENSSL_free(sp);
++ sp = NULL;
++ goto err;
++ }
++
++ /* Choose slot here since the slot table is different on
++ * this process.
++ */
++ if (pk11_choose_slot() == 0)
++ goto err;
++
++ /* Open the global_session for the new process */
++ rv = pFuncList->C_OpenSession(SLOTID, CKF_SERIAL_SESSION,
++ NULL_PTR, NULL_PTR, &global_session);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_SESSION, PK11_R_OPENSESSION);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ OPENSSL_free(sp);
++ sp = NULL;
++ goto err;
++ }
++
++ /* It is an inherited session and needs re-initialization.
++ */
++ if (pk11_setup_session(sp) == 0)
++ {
++ OPENSSL_free(sp);
++ sp = NULL;
++ }
++ }
++ else if (sp->pid == 0)
++ {
++ /* It is a new session and needs initialization.
++ */
++ if (pk11_setup_session(sp) == 0)
++ {
++ OPENSSL_free(sp);
++ sp = NULL;
++ }
++ }
++
++err:
++ if (sp)
++ sp->next = NULL;
++
++ CRYPTO_w_unlock(CRYPTO_LOCK_PK11_ENGINE);
++
++ return sp;
++ }
++
++
++void pk11_return_session(PK11_SESSION *sp)
++ {
++ if (sp == NULL || sp->pid != getpid())
++ return;
++
++
++ CRYPTO_w_lock(CRYPTO_LOCK_PK11_ENGINE);
++
++ sp->next = free_session;
++ free_session = sp;
++
++ CRYPTO_w_unlock(CRYPTO_LOCK_PK11_ENGINE);
++ }
++
++
++/* Destroy all objects. This function is called when the engine is finished
++ */
++static int pk11_free_all_sessions()
++ {
++ CK_RV rv;
++ PK11_SESSION *sp = NULL;
++ pid_t mypid = getpid();
++ int ret = 0;
++
++ pk11_destroy_rsa_key_objects(NULL);
++ pk11_destroy_dsa_key_objects(NULL);
++ pk11_destroy_dh_key_objects(NULL);
++ pk11_destroy_cipher_key_objects(NULL);
++
++ CRYPTO_w_lock(CRYPTO_LOCK_PK11_ENGINE);
++ while ((sp = free_session) != NULL)
++ {
++ if (sp->session != CK_INVALID_HANDLE && sp->pid == mypid)
++ {
++ rv = pFuncList->C_CloseSession(sp->session);
++ if (rv != CKR_OK)
++ {
++ char tmp_buf[20];
++ PK11err(PK11_F_FREE_ALL_SESSIONS,
++ PK11_R_CLOSESESSION);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ }
++ }
++ if (sp->session_cipher != CK_INVALID_HANDLE && sp->pid == mypid)
++ {
++ rv = pFuncList->C_CloseSession(sp->session_cipher);
++ if (rv != CKR_OK)
++ {
++ char tmp_buf[20];
++ PK11err(PK11_F_FREE_ALL_SESSIONS,
++ PK11_R_CLOSESESSION);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ }
++ }
++ free_session = sp->next;
++ OPENSSL_free(sp);
++ }
++ ret = 1;
++err:
++ CRYPTO_w_unlock(CRYPTO_LOCK_PK11_ENGINE);
++
++ return ret;
++ }
++
++
++static int pk11_setup_session(PK11_SESSION *sp)
++ {
++ CK_RV rv;
++ sp->session = CK_INVALID_HANDLE;
++ rv = pFuncList->C_OpenSession(SLOTID, CKF_SERIAL_SESSION,
++ NULL_PTR, NULL_PTR, &sp->session);
++ if (rv == CKR_CRYPTOKI_NOT_INITIALIZED)
++ {
++ /*
++ * We are probably a child process so force the
++ * reinitialize of the session
++ */
++ pk11_library_initialized = 0;
++ (void) pk11_library_init(NULL);
++ rv = pFuncList->C_OpenSession(SLOTID, CKF_SERIAL_SESSION,
++ NULL_PTR, NULL_PTR, &sp->session);
++ }
++ if (rv != CKR_OK)
++ {
++ char tmp_buf[20];
++ PK11err(PK11_F_SETUP_SESSION, PK11_R_OPENSESSION);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ return 0;
++ }
++
++ sp->session_cipher = CK_INVALID_HANDLE;
++ rv = pFuncList->C_OpenSession(SLOTID, CKF_SERIAL_SESSION,
++ NULL_PTR, NULL_PTR, &sp->session_cipher);
++ if (rv != CKR_OK)
++ {
++ char tmp_buf[20];
++
++ (void) pFuncList->C_CloseSession(sp->session);
++ sp->session = CK_INVALID_HANDLE;
++
++ PK11err(PK11_F_SETUP_SESSION, PK11_R_OPENSESSION);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ return 0;
++ }
++
++ sp->pid = getpid();
++ sp->rsa_pub_key = CK_INVALID_HANDLE;
++ sp->rsa_priv_key = CK_INVALID_HANDLE;
++ sp->dsa_pub_key = CK_INVALID_HANDLE;
++ sp->dsa_priv_key = CK_INVALID_HANDLE;
++ sp->dh_key = CK_INVALID_HANDLE;
++ sp->cipher_key = CK_INVALID_HANDLE;
++ sp->rsa = NULL;
++ sp->dsa = NULL;
++ sp->dh = NULL;
++ sp->encrypt = -1;
++
++ return 1;
++ }
++
++int pk11_destroy_rsa_key_objects(PK11_SESSION *session)
++ {
++ int ret = 0;
++ PK11_SESSION *sp = NULL;
++ PK11_SESSION *local_free_session;
++
++ CRYPTO_w_lock(CRYPTO_LOCK_PK11_ENGINE);
++ if (session)
++ local_free_session = session;
++ else
++ local_free_session = free_session;
++ while ((sp = local_free_session) != NULL)
++ {
++ local_free_session = sp->next;
++
++ if (sp->rsa_pub_key != CK_INVALID_HANDLE)
++ {
++ if (pk11_destroy_object(sp->session,
++ sp->rsa_pub_key) == 0)
++ goto err;
++ sp->rsa_pub_key = CK_INVALID_HANDLE;
++ }
++
++ if (sp->rsa_priv_key != CK_INVALID_HANDLE)
++ {
++ if ((sp->rsa->flags & RSA_FLAG_EXT_PKEY) == 0 &&
++ pk11_destroy_object(sp->session,
++ sp->rsa_priv_key) == 0)
++ goto err;
++ sp->rsa_priv_key = CK_INVALID_HANDLE;
++ }
++
++ sp->rsa = NULL;
++ }
++ ret = 1;
++err:
++ CRYPTO_w_unlock(CRYPTO_LOCK_PK11_ENGINE);
++
++ return ret;
++ }
++
++int pk11_destroy_dsa_key_objects(PK11_SESSION *session)
++ {
++ int ret = 0;
++ PK11_SESSION *sp = NULL;
++ PK11_SESSION *local_free_session;
++
++ CRYPTO_w_lock(CRYPTO_LOCK_PK11_ENGINE);
++ if (session)
++ local_free_session = session;
++ else
++ local_free_session = free_session;
++ while ((sp = local_free_session) != NULL)
++ {
++ local_free_session = sp->next;
++
++ if (sp->dsa_pub_key != CK_INVALID_HANDLE)
++ {
++ if (pk11_destroy_object(sp->session,
++ sp->dsa_pub_key) == 0)
++ goto err;
++ sp->dsa_pub_key = CK_INVALID_HANDLE;
++ }
++
++ if (sp->dsa_priv_key != CK_INVALID_HANDLE)
++ {
++ if (pk11_destroy_object(sp->session,
++ sp->dsa_priv_key) == 0)
++ goto err;
++ sp->dsa_priv_key = CK_INVALID_HANDLE;
++ }
++
++ sp->dsa = NULL;
++ }
++ ret = 1;
++err:
++ CRYPTO_w_unlock(CRYPTO_LOCK_PK11_ENGINE);
++
++ return ret;
++ }
++
++int pk11_destroy_dh_key_objects(PK11_SESSION *session)
++ {
++ int ret = 0;
++ PK11_SESSION *sp = NULL;
++ PK11_SESSION *local_free_session;
++
++ CRYPTO_w_lock(CRYPTO_LOCK_PK11_ENGINE);
++ if (session)
++ local_free_session = session;
++ else
++ local_free_session = free_session;
++ while ((sp = local_free_session) != NULL)
++ {
++ local_free_session = sp->next;
++
++ if (sp->dh_key != CK_INVALID_HANDLE)
++ {
++ if (pk11_destroy_object(sp->session,
++ sp->dh_key) == 0)
++ goto err;
++ sp->dh_key = CK_INVALID_HANDLE;
++ }
++
++ sp->dh = NULL;
++ }
++ ret = 1;
++err:
++ CRYPTO_w_unlock(CRYPTO_LOCK_PK11_ENGINE);
++
++ return ret;
++ }
++
++static int pk11_destroy_object(CK_SESSION_HANDLE session, CK_OBJECT_HANDLE oh)
++ {
++ CK_RV rv;
++ rv = pFuncList->C_DestroyObject(session, oh);
++ if (rv != CKR_OK)
++ {
++ char tmp_buf[20];
++ PK11err(PK11_F_DESTROY_OBJECT, PK11_R_DESTROYOBJECT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X",
++ tmp_buf);
++ return 0;
++ }
++
++ return 1;
++ }
++
++
++/* Symmetric ciphers and digests support functions
++ */
++
++static int
++cipher_nid_to_pk11(int nid)
++ {
++ int i;
++
++ for (i = 0; i < PK11_CIPHER_MAX; i++)
++ if (ciphers[i].nid == nid)
++ return (ciphers[i].id);
++ return (-1);
++ }
++
++static int
++pk11_usable_ciphers(const int **nids)
++ {
++ if (cipher_count > 0)
++ *nids = cipher_nids;
++ else
++ *nids = NULL;
++ return (cipher_count);
++ }
++
++static int
++pk11_usable_digests(const int **nids)
++ {
++ if (digest_count > 0)
++ *nids = digest_nids;
++ else
++ *nids = NULL;
++ return (digest_count);
++ }
++
++static int
++pk11_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
++ const unsigned char *iv, int enc)
++ {
++ CK_RV rv;
++ CK_MECHANISM mech;
++ int index;
++ PK11_CIPHER_STATE *state = (PK11_CIPHER_STATE *) ctx->cipher_data;
++ PK11_SESSION *sp;
++ PK11_CIPHER *pcp;
++ char tmp_buf[20];
++
++ state->sp = NULL;
++
++ index = cipher_nid_to_pk11(ctx->cipher->nid);
++ if (index < 0 || index >= PK11_CIPHER_MAX)
++ return 0;
++
++ pcp = &ciphers[index];
++ if (ctx->cipher->iv_len > pcp->ivmax || ctx->key_len != pcp->key_len)
++ return 0;
++
++ if ((sp = pk11_get_session()) == NULL)
++ return 0;
++
++ /* if applicable, the mechanism parameter is used for IV */
++ mech.mechanism = pcp->mech_type;
++ mech.pParameter = NULL;
++ mech.ulParameterLen = 0;
++
++ /* The key object is destroyed here if it is not the current key
++ */
++ check_new_cipher_key(sp, key);
++
++ /* If the key is the same and the encryption is also the same,
++ * then just reuse it
++ */
++ if (sp->cipher_key != CK_INVALID_HANDLE && sp->encrypt == ctx->encrypt)
++ {
++ state->sp = sp;
++ return 1;
++ }
++
++ /* Check if the key has been invalidated. If so, a new key object
++ * needs to be created.
++ */
++ if (sp->cipher_key == CK_INVALID_HANDLE)
++ {
++ sp->cipher_key = pk11_get_cipher_key(
++ ctx, key, pcp->key_type, sp);
++ }
++
++ if (sp->encrypt != ctx->encrypt && sp->encrypt != -1)
++ {
++ /* The previous encryption/decryption
++ * is different. Need to terminate the previous
++ * active encryption/decryption here
++ */
++ if (!pk11_cipher_final(sp))
++ {
++ pk11_return_session(sp);
++ return 0;
++ }
++ }
++
++ if (sp->cipher_key == CK_INVALID_HANDLE)
++ {
++ pk11_return_session(sp);
++ return 0;
++ }
++
++ if (ctx->cipher->iv_len > 0)
++ {
++ mech.pParameter = (void *) ctx->iv;
++ mech.ulParameterLen = ctx->cipher->iv_len;
++ }
++
++ /* If we get here, the encryption needs to be reinitialized */
++ if (ctx->encrypt)
++ {
++ rv = pFuncList->C_EncryptInit(sp->session_cipher, &mech,
++ sp->cipher_key);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_CIPHER_INIT, PK11_R_ENCRYPTINIT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ pk11_return_session(sp);
++ return 0;
++ }
++ }
++ else
++ {
++ rv = pFuncList->C_DecryptInit(sp->session_cipher, &mech,
++ sp->cipher_key);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_CIPHER_INIT, PK11_R_DECRYPTINIT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ pk11_return_session(sp);
++ return 0;
++ }
++ }
++
++ sp->encrypt = ctx->encrypt;
++ state->sp = sp;
++
++ return 1;
++ }
++
++/* When reusing the same key in an encryption/decryption session for a
++ * decryption/encryption session, we need to close the active session
++ * and recreate a new one. Note that the key is in the global session so
++ * that it needs not be recreated.
++ *
++ * It is more appropriate to use C_En/DecryptFinish here. At the time of this
++ * development, these two functions in the PKCS#11 libraries used return
++ * unexpected errors when passing in 0 length output. It may be a good
++ * idea to try them again if performance is a problem here and fix
++ * C_En/DecryptFinial if there are bugs there causing the problem.
++ */
++static int
++pk11_cipher_final(PK11_SESSION *sp)
++ {
++ CK_RV rv;
++ char tmp_buf[20];
++
++ rv = pFuncList->C_CloseSession(sp->session_cipher);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_CIPHER_FINAL, PK11_R_CLOSESESSION);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ return 0;
++ }
++
++ rv = pFuncList->C_OpenSession(SLOTID, CKF_SERIAL_SESSION,
++ NULL_PTR, NULL_PTR, &sp->session_cipher);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_CIPHER_FINAL, PK11_R_OPENSESSION);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ return 0;
++ }
++
++ return 1;
++ }
++
++/* An engine interface function. The calling function allocates sufficient
++ * memory for the output buffer "out" to hold the results */
++static int
++pk11_cipher_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
++ const unsigned char *in, unsigned int inl)
++ {
++ PK11_CIPHER_STATE *state = (PK11_CIPHER_STATE *) ctx->cipher_data;
++ PK11_SESSION *sp;
++ CK_RV rv;
++ unsigned long outl = inl;
++ char tmp_buf[20];
++
++ if (state == NULL || state->sp == NULL)
++ return 0;
++
++ sp = (PK11_SESSION *) state->sp;
++
++ if (!inl)
++ return 1;
++
++ /* RC4 is the only stream cipher we support */
++ if (ctx->cipher->nid != NID_rc4 && (inl % ctx->cipher->block_size) != 0)
++ return 0;
++
++ if (ctx->encrypt)
++ {
++ rv = pFuncList->C_EncryptUpdate(sp->session_cipher,
++ (unsigned char *)in, inl, out, &outl);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_CIPHER_DO_CIPHER,
++ PK11_R_ENCRYPTUPDATE);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ return 0;
++ }
++ }
++ else
++ {
++ rv = pFuncList->C_DecryptUpdate(sp->session_cipher,
++ (unsigned char *)in, inl, out, &outl);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_CIPHER_DO_CIPHER,
++ PK11_R_DECRYPTUPDATE);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ return 0;
++ }
++ }
++
++ /* for DES_CBC, DES3_CBC, AES_CBC, and RC4, the output size is always
++ * the same size of input
++ * The application has guaranteed to call the block ciphers with
++ * correctly aligned buffers.
++ */
++ if (inl != outl)
++ return 0;
++
++ return 1;
++ }
++
++/* Return the session to the pool. The C_EncryptFinal and C_DecryptFinal are
++ * not used. Once a secret key is initialized, it is used until destroyed.
++ */
++static int
++pk11_cipher_cleanup(EVP_CIPHER_CTX *ctx)
++ {
++ PK11_CIPHER_STATE *state = ctx->cipher_data;
++
++ if (state != NULL && state->sp != NULL)
++ {
++ pk11_return_session(state->sp);
++ state->sp = NULL;
++ }
++
++ return 1;
++ }
++
++/* Registered by the ENGINE when used to find out how to deal with
++ * a particular NID in the ENGINE. This says what we'll do at the
++ * top level - note, that list is restricted by what we answer with
++ */
++static int
++pk11_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
++ const int **nids, int nid)
++ {
++ if (!cipher)
++ return (pk11_usable_ciphers(nids));
++
++ switch (nid)
++ {
++ case NID_des_ede3_cbc:
++ *cipher = &pk11_3des_cbc;
++ break;
++ case NID_des_cbc:
++ *cipher = &pk11_des_cbc;
++ break;
++ case NID_aes_128_cbc:
++ *cipher = &pk11_aes_cbc;
++ break;
++ case NID_rc4:
++ *cipher = &pk11_rc4;
++ break;
++ default:
++ *cipher = NULL;
++ break;
++ }
++ return (*cipher != NULL);
++ }
++
++static int
++pk11_engine_digests(ENGINE *e, const EVP_MD **digest,
++ const int **nids, int nid)
++ {
++ if (!digest)
++ return (pk11_usable_digests(nids));
++
++ switch (nid)
++ {
++ case NID_md5:
++ *digest = &pk11_md5;
++ break;
++ case NID_sha1:
++ *digest = &pk11_sha1;
++ break;
++ default:
++ *digest = NULL;
++ break;
++ }
++ return (*digest != NULL);
++ }
++
++
++/* Create a secret key object in a PKCS#11 session
++ */
++static CK_OBJECT_HANDLE pk11_get_cipher_key(EVP_CIPHER_CTX *ctx,
++ const unsigned char *key, CK_KEY_TYPE key_type, PK11_SESSION *sp)
++ {
++ CK_RV rv;
++ CK_OBJECT_HANDLE h_key = CK_INVALID_HANDLE;
++ CK_OBJECT_CLASS obj_key = CKO_SECRET_KEY;
++ CK_ULONG ul_key_attr_count = 6;
++ char tmp_buf[20];
++
++ CK_ATTRIBUTE a_key_template[] =
++ {
++ {CKA_CLASS, (void*) NULL, sizeof(CK_OBJECT_CLASS)},
++ {CKA_KEY_TYPE, (void*) NULL, sizeof(CK_KEY_TYPE)},
++ {CKA_TOKEN, &false, sizeof(false)},
++ {CKA_ENCRYPT, &true, sizeof(true)},
++ {CKA_DECRYPT, &true, sizeof(true)},
++ {CKA_VALUE, (void*) NULL, 0},
++ };
++
++ /* Create secret key object in global_session. All other sessions
++ * can use the key handles. Here is why:
++ * OpenSSL will call EncryptInit and EncryptUpdate using a secret key.
++ * It may then call DecryptInit and DecryptUpdate using the same key.
++ * To use the same key object, we need to call EncryptFinal with
++ * a 0 length message. Currently, this does not work for 3DES
++ * mechanism. To get around this problem, we close the session and
++ * then create a new session to use the same key object. When a session
++ * is closed, all the object handles will be invalid. Thus, create key
++ * objects in a global session, an individual session may be closed to
++ * terminate the active operation.
++ */
++ CK_SESSION_HANDLE session = global_session;
++ a_key_template[0].pValue = &obj_key;
++ a_key_template[1].pValue = &key_type;
++ a_key_template[5].pValue = (void *) key;
++ a_key_template[5].ulValueLen = (unsigned long) ctx->key_len;
++
++ rv = pFuncList->C_CreateObject(session,
++ a_key_template, ul_key_attr_count, &h_key);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_CIPHER_KEY, PK11_R_CREATEOBJECT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ /* Save the key information used in this session.
++ * The max can be saved is PK11_KEY_LEN_MAX.
++ */
++ sp->key_len = ctx->key_len > PK11_KEY_LEN_MAX ?
++ PK11_KEY_LEN_MAX : ctx->key_len;
++ memcpy(sp->key, key, sp->key_len);
++err:
++
++ return h_key;
++ }
++
++static int
++md_nid_to_pk11(int nid)
++ {
++ int i;
++
++ for (i = 0; i < PK11_DIGEST_MAX; i++)
++ if (digests[i].nid == nid)
++ return (digests[i].id);
++ return (-1);
++ }
++
++static int
++pk11_digest_init(EVP_MD_CTX *ctx)
++ {
++ CK_RV rv;
++ CK_MECHANISM mech;
++ int index;
++ PK11_SESSION *sp;
++ PK11_DIGEST *pdp;
++ PK11_CIPHER_STATE *state = (PK11_CIPHER_STATE *) ctx->md_data;
++
++ state->sp = NULL;
++
++ index = md_nid_to_pk11(ctx->digest->type);
++ if (index < 0 || index >= PK11_DIGEST_MAX)
++ return 0;
++
++ pdp = &digests[index];
++ if ((sp = pk11_get_session()) == NULL)
++ return 0;
++
++ /* at present, no parameter is needed for supported digests */
++ mech.mechanism = pdp->mech_type;
++ mech.pParameter = NULL;
++ mech.ulParameterLen = 0;
++
++ rv = pFuncList->C_DigestInit(sp->session, &mech);
++
++ if (rv != CKR_OK)
++ {
++ char tmp_buf[20];
++ PK11err(PK11_F_DIGEST_INIT, PK11_R_DIGESTINIT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ pk11_return_session(sp);
++ return 0;
++ }
++
++ state->sp = sp;
++
++ return 1;
++ }
++
++static int
++pk11_digest_update(EVP_MD_CTX *ctx,const void *data,size_t count)
++ {
++ CK_RV rv;
++ PK11_CIPHER_STATE *state = (PK11_CIPHER_STATE *) ctx->md_data;
++
++ /* 0 length message will cause a failure in C_DigestFinal */
++ if (count == 0)
++ return 1;
++
++ if (state == NULL || state->sp == NULL)
++ return 0;
++
++ rv = pFuncList->C_DigestUpdate(state->sp->session, (CK_BYTE *) data,
++ count);
++
++ if (rv != CKR_OK)
++ {
++ char tmp_buf[20];
++ PK11err(PK11_F_DIGEST_UPDATE, PK11_R_DIGESTUPDATE);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ pk11_return_session(state->sp);
++ state->sp = NULL;
++ return 0;
++ }
++
++ return 1;
++ }
++
++static int
++pk11_digest_final(EVP_MD_CTX *ctx,unsigned char *md)
++ {
++ CK_RV rv;
++ unsigned long len;
++ PK11_CIPHER_STATE *state = (PK11_CIPHER_STATE *) ctx->md_data;
++ len = ctx->digest->md_size;
++
++ if (state == NULL || state->sp == NULL)
++ return 0;
++
++ rv = pFuncList->C_DigestFinal(state->sp->session, md, &len);
++
++ if (rv != CKR_OK)
++ {
++ char tmp_buf[20];
++ PK11err(PK11_F_DIGEST_FINAL, PK11_R_DIGESTFINAL);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ pk11_return_session(state->sp);
++ state->sp = NULL;
++ return 0;
++ }
++
++ if (ctx->digest->md_size != len)
++ return 0;
++
++ /* Final is called and digest is returned, so return the session
++ * to the pool
++ */
++ pk11_return_session(state->sp);
++ state->sp = NULL;
++
++ return 1;
++ }
++
++static int
++pk11_digest_copy(EVP_MD_CTX *to,const EVP_MD_CTX *from)
++ {
++ CK_RV rv;
++ int ret = 0;
++ PK11_CIPHER_STATE *state, *state_to;
++ CK_BYTE_PTR pstate = NULL;
++ CK_ULONG ul_state_len;
++ char tmp_buf[20];
++
++ /* The copy-from state */
++ state = (PK11_CIPHER_STATE *) from->md_data;
++ if (state == NULL || state->sp == NULL)
++ goto err;
++
++ /* Initialize the copy-to state */
++ if (!pk11_digest_init(to))
++ goto err;
++ state_to = (PK11_CIPHER_STATE *) to->md_data;
++
++ /* Get the size of the operation state of the copy-from session */
++ rv = pFuncList->C_GetOperationState(state->sp->session, NULL,
++ &ul_state_len);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_DIGEST_COPY, PK11_R_GET_OPERATION_STATE);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++ if (ul_state_len == 0)
++ {
++ goto err;
++ }
++
++ pstate = OPENSSL_malloc(ul_state_len);
++ if (pstate == NULL)
++ {
++ RSAerr(PK11_F_DIGEST_COPY, PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++
++ /* Get the operation state of the copy-from session */
++ rv = pFuncList->C_GetOperationState(state->sp->session, pstate,
++ &ul_state_len);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_DIGEST_COPY, PK11_R_GET_OPERATION_STATE);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ /* Set the operation state of the copy-to session */
++ rv = pFuncList->C_SetOperationState(state_to->sp->session, pstate,
++ ul_state_len, 0, 0);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_DIGEST_COPY, PK11_R_SET_OPERATION_STATE);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ ret = 1;
++err:
++ if (pstate != NULL)
++ OPENSSL_free(pstate);
++
++ return ret;
++ }
++
++/* Return any pending session state to the pool */
++static int
++pk11_digest_cleanup(EVP_MD_CTX *ctx)
++ {
++ PK11_CIPHER_STATE *state = ctx->md_data;
++ unsigned char buf[EVP_MAX_MD_SIZE];
++
++ if (state != NULL && state->sp != NULL)
++ {
++ /*
++ * If state->sp is not NULL then pk11_digest_final() has not
++ * been called yet. We must call it now to free any memory
++ * that might have been allocated in the token when
++ * pk11_digest_init() was called.
++ */
++ pk11_digest_final(ctx,buf);
++ pk11_return_session(state->sp);
++ state->sp = NULL;
++ }
++
++ return 1;
++ }
++
++/* Check if the new key is the same as the key object in the session.
++ * If the key is the same, no need to create a new key object. Otherwise,
++ * the old key object needs to be destroyed and a new one will be created
++ */
++static void check_new_cipher_key(PK11_SESSION *sp, const unsigned char *key)
++ {
++ if (memcmp(sp->key, key, sp->key_len) != 0)
++ pk11_destroy_cipher_key_objects(sp);
++ }
++
++/* Destroy one or more secret key objects.
++ */
++static int pk11_destroy_cipher_key_objects(PK11_SESSION *session)
++ {
++ int ret = 0;
++ PK11_SESSION *sp = NULL;
++ PK11_SESSION *local_free_session;
++
++ CRYPTO_w_lock(CRYPTO_LOCK_PK11_ENGINE);
++ if (session)
++ local_free_session = session;
++ else
++ local_free_session = free_session;
++ while ((sp = local_free_session) != NULL)
++ {
++ local_free_session = sp->next;
++
++ if (sp->cipher_key != CK_INVALID_HANDLE)
++ {
++ /* The secret key object is created in the
++ * global_session. See pk11_get_cipher_key
++ */
++ if (pk11_destroy_object(global_session,
++ sp->cipher_key) == 0)
++ goto err;
++ sp->cipher_key = CK_INVALID_HANDLE;
++ }
++ }
++ ret = 1;
++err:
++ CRYPTO_w_unlock(CRYPTO_LOCK_PK11_ENGINE);
++
++ return ret;
++ }
++
++
++/*
++ * Required mechanisms
++ *
++ * CKM_RSA_X_509
++ * CKM_RSA_PKCS
++ * CKM_DSA
++ *
++ * As long as these required mechanisms are met, it will return success.
++ * Otherwise, it will return failure and the engine initialization will fail.
++ * The application will then decide whether to use another engine or
++ * no engine.
++ *
++ * Symmetric ciphers optionally supported
++ *
++ * CKM_DES3_CBC
++ * CKM_DES_CBC
++ * CKM_AES_CBC
++ * CKM_RC4
++ *
++ * Digests optionally supported
++ *
++ * CKM_MD5
++ * CKM_SHA_1
++ */
++
++static int
++pk11_choose_slot()
++ {
++ CK_SLOT_ID_PTR pSlotList = NULL_PTR;
++ CK_ULONG ulSlotCount = 0;
++ CK_MECHANISM_INFO mech_info;
++ CK_TOKEN_INFO token_info;
++ int i;
++ CK_RV rv;
++ CK_SLOT_ID best_slot_sofar;
++ CK_BBOOL found_candidate_slot = CK_FALSE;
++ int slot_n_cipher = 0;
++ int slot_n_digest = 0;
++ CK_SLOT_ID current_slot = 0;
++ int current_slot_n_cipher = 0;
++ int current_slot_n_digest = 0;
++
++ int local_cipher_nids[PK11_CIPHER_MAX];
++ int local_digest_nids[PK11_DIGEST_MAX];
++ char tmp_buf[20];
++ int retval = 0;
++
++ if (!pk11_auto_slot)
++ return 1;
++
++ /* Get slot list for memory alloction */
++ rv = pFuncList->C_GetSlotList(0, NULL_PTR, &ulSlotCount);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_CHOOSE_SLOT, PK11_R_GETSLOTLIST);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ return retval;
++ }
++
++ if (ulSlotCount == 0)
++ {
++ PK11err(PK11_F_CHOOSE_SLOT, PK11_R_GETSLOTLIST);
++ return retval;
++ }
++
++ pSlotList = OPENSSL_malloc(ulSlotCount * sizeof (CK_SLOT_ID));
++
++ if (pSlotList == NULL)
++ {
++ RSAerr(PK11_F_CHOOSE_SLOT,PK11_R_MALLOC_FAILURE);
++ return retval;
++ }
++
++ /* Get the slot list for processing */
++ rv = pFuncList->C_GetSlotList(0, pSlotList, &ulSlotCount);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_CHOOSE_SLOT, PK11_R_GETSLOTLIST);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ OPENSSL_free(pSlotList);
++ return retval;
++ }
++
++ for (i = 0; i < ulSlotCount; i++)
++ {
++ CK_BBOOL slot_has_rsa = CK_FALSE;
++ CK_BBOOL slot_has_dsa = CK_FALSE;
++ CK_BBOOL slot_has_dh = CK_FALSE;
++ current_slot = pSlotList[i];
++ current_slot_n_cipher = 0;
++ current_slot_n_digest = 0;
++ memset(local_cipher_nids, 0, sizeof(local_cipher_nids));
++ memset(local_digest_nids, 0, sizeof(local_digest_nids));
++
++#ifdef DEBUG_SLOT_SELECTION
++ fprintf(stderr, "OPENSSL_PKCS#11_ENGINE: checking slot: %d\n",
++ current_slot);
++#endif
++ /* Check if slot has random support. */
++ rv = pFuncList->C_GetTokenInfo(current_slot, &token_info);
++ if (rv != CKR_OK)
++ continue;
++
++ if (token_info.flags & CKF_RNG)
++ pk11_have_random = CK_TRUE;
++
++ /*
++ * Check if this slot is capable of signing and
++ * verifying with CKM_RSA_PKCS.
++ */
++ rv = pFuncList->C_GetMechanismInfo(current_slot, CKM_RSA_PKCS,
++ &mech_info);
++
++ if (rv == CKR_OK && ((mech_info.flags & CKF_SIGN) &&
++ (mech_info.flags & CKF_VERIFY)))
++ {
++ /*
++ * Check if this slot is capable of encryption,
++ * decryption, sign, and verify with CKM_RSA_X_509.
++ */
++ rv = pFuncList->C_GetMechanismInfo(current_slot,
++ CKM_RSA_X_509, &mech_info);
++
++ if (rv == CKR_OK && ((mech_info.flags & CKF_SIGN) &&
++ (mech_info.flags & CKF_VERIFY) &&
++ (mech_info.flags & CKF_ENCRYPT) &&
++ (mech_info.flags & CKF_VERIFY_RECOVER) &&
++ (mech_info.flags & CKF_DECRYPT)))
++ slot_has_rsa = CK_TRUE;
++ }
++
++ /*
++ * Check if this slot is capable of signing and
++ * verifying with CKM_DSA.
++ */
++ rv = pFuncList->C_GetMechanismInfo(current_slot, CKM_DSA,
++ &mech_info);
++ if (rv == CKR_OK && ((mech_info.flags & CKF_SIGN) &&
++ (mech_info.flags & CKF_VERIFY)))
++ slot_has_dsa = CK_TRUE;
++
++ /*
++ * Check if this slot is capable of DH key generataion and
++ * derivation.
++ */
++ rv = pFuncList->C_GetMechanismInfo(current_slot,
++ CKM_DH_PKCS_KEY_PAIR_GEN, &mech_info);
++
++ if (rv == CKR_OK && (mech_info.flags & CKF_GENERATE_KEY_PAIR))
++ {
++ rv = pFuncList->C_GetMechanismInfo(current_slot,
++ CKM_DH_PKCS_DERIVE, &mech_info);
++ if (rv == CKR_OK && (mech_info.flags & CKF_DERIVE))
++ slot_has_dh = CK_TRUE;
++ }
++
++ if (!found_candidate_slot &&
++ (slot_has_rsa || slot_has_dsa || slot_has_dh))
++ {
++#ifdef DEBUG_SLOT_SELECTION
++ fprintf(stderr,
++ "OPENSSL_PKCS#11_ENGINE: potential slot: %d\n",
++ current_slot);
++#endif
++ best_slot_sofar = current_slot;
++ pk11_have_rsa = slot_has_rsa;
++ pk11_have_dsa = slot_has_dsa;
++ pk11_have_dh = slot_has_dh;
++ found_candidate_slot = CK_TRUE;
++#ifdef DEBUG_SLOT_SELECTION
++ fprintf(stderr,
++ "OPENSSL_PKCS#11_ENGINE: best so far slot: %d\n",
++ best_slot_sofar);
++#endif
++ }
++
++ /* Count symmetric cipher support. */
++ if (!pk11_count_symmetric_cipher(current_slot, CKM_DES_CBC,
++ &current_slot_n_cipher, local_cipher_nids,
++ PK11_DES_CBC))
++ continue;
++ if (!pk11_count_symmetric_cipher(current_slot, CKM_DES3_CBC,
++ &current_slot_n_cipher, local_cipher_nids,
++ PK11_DES3_CBC))
++ continue;
++ if (!pk11_count_symmetric_cipher(current_slot, CKM_AES_CBC,
++ &current_slot_n_cipher, local_cipher_nids,
++ PK11_AES_CBC))
++ continue;
++ if (!pk11_count_symmetric_cipher(current_slot, CKM_RC4,
++ &current_slot_n_cipher, local_cipher_nids,
++ PK11_RC4))
++ continue;
++
++ /* Count digest support */
++ if (!pk11_count_digest(current_slot, CKM_MD5,
++ &current_slot_n_digest, local_digest_nids,
++ PK11_MD5))
++ continue;
++ if (!pk11_count_digest(current_slot, CKM_SHA_1,
++ &current_slot_n_digest, local_digest_nids,
++ PK11_SHA1))
++ continue;
++
++ /*
++ * If the current slot supports more ciphers/digests than
++ * the previous best one we change the current best to this one.
++ * otherwise leave it where it is.
++ */
++ if (((current_slot_n_cipher > slot_n_cipher) &&
++ (current_slot_n_digest > slot_n_digest)) &&
++ ((slot_has_rsa == pk11_have_rsa) &&
++ (slot_has_dsa == pk11_have_dsa) &&
++ (slot_has_dh == pk11_have_dh)))
++ {
++ best_slot_sofar = current_slot;
++ slot_n_cipher = current_slot_n_cipher;
++ slot_n_digest = current_slot_n_digest;
++
++ memcpy(cipher_nids, local_cipher_nids,
++ sizeof(local_cipher_nids));
++ memcpy(digest_nids, local_digest_nids,
++ sizeof(local_digest_nids));
++ }
++
++ }
++
++ if (found_candidate_slot)
++ {
++ cipher_count = slot_n_cipher;
++ digest_count = slot_n_digest;
++ SLOTID = best_slot_sofar;
++ retval = 1;
++ }
++ else
++ {
++ cipher_count = 0;
++ digest_count = 0;
++ }
++
++#ifdef DEBUG_SLOT_SELECTION
++ fprintf(stderr,
++ "OPENSSL_PKCS#11_ENGINE: choose slot: %d\n", SLOTID);
++ fprintf(stderr,
++ "OPENSSL_PKCS#11_ENGINE: pk11_have_rsa %d\n", pk11_have_rsa);
++ fprintf(stderr,
++ "OPENSSL_PKCS#11_ENGINE: pk11_have_dsa %d\n", pk11_have_dsa);
++ fprintf(stderr,
++ "OPENSSL_PKCS#11_ENGINE: pk11_have_dh %d\n", pk11_have_dh);
++ fprintf(stderr,
++ "OPENSSL_PKCS#11_ENGINE: pk11_have_random %d\n", pk11_have_random);
++#endif /* DEBUG_SLOT_SELECTION */
++
++ if (pSlotList)
++ OPENSSL_free(pSlotList);
++
++ return retval;
++ }
++
++static int pk11_count_symmetric_cipher(int slot_id, CK_MECHANISM_TYPE mech,
++ int *current_slot_n_cipher, int *local_cipher_nids, int id)
++ {
++ CK_MECHANISM_INFO mech_info;
++ CK_RV rv;
++
++ rv = pFuncList->C_GetMechanismInfo(slot_id, mech, &mech_info);
++
++ if (rv != CKR_OK)
++ return 0;
++
++ if ((mech_info.flags & CKF_ENCRYPT) &&
++ (mech_info.flags & CKF_DECRYPT))
++ {
++ local_cipher_nids[(*current_slot_n_cipher)++] = ciphers[id].nid;
++ }
++
++ return 1;
++ }
++
++
++static int pk11_count_digest(int slot_id, CK_MECHANISM_TYPE mech,
++ int *current_slot_n_digest, int *local_digest_nids, int id)
++ {
++ CK_MECHANISM_INFO mech_info;
++ CK_RV rv;
++
++ rv = pFuncList->C_GetMechanismInfo(slot_id, mech, &mech_info);
++
++ if (rv != CKR_OK)
++ return 0;
++
++ if (mech_info.flags & CKF_DIGEST)
++ {
++ local_digest_nids[(*current_slot_n_digest)++] = digests[id].nid;
++ }
++
++ return 1;
++ }
++
++
++#endif
++#endif
++
+diff -r -u -N openssl-0.9.8g/crypto/engine/hw_pk11_err.c openssl/crypto/engine/hw_pk11_err.c
+--- openssl-0.9.8g/crypto/engine/hw_pk11_err.c 1970-01-01 01:00:00.000000000 +0100
++++ openssl/crypto/engine/hw_pk11_err.c 2007-10-25 01:27:09.000000000 +0200
+@@ -0,0 +1,233 @@
++/*
++ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
++ * Use is subject to license terms.
++ */
++#pragma ident "@(#)hw_pk11_err.c 1.2 04/06/22 SMI"
++
++/* crypto/engine/hw_pk11_err.c */
++/* This product includes software developed by the OpenSSL Project for
++ * use in the OpenSSL Toolkit (http://www.openssl.org/).
++ *
++ * This project also referenced hw_pkcs11-0.9.7b.patch written by
++ * Afchine Madjlessi.
++ */
++/* ====================================================================
++ * Copyright (c) 2000-2001 The OpenSSL Project. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ *
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ *
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in
++ * the documentation and/or other materials provided with the
++ * distribution.
++ *
++ * 3. All advertising materials mentioning features or use of this
++ * software must display the following acknowledgment:
++ * "This product includes software developed by the OpenSSL Project
++ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
++ *
++ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
++ * endorse or promote products derived from this software without
++ * prior written permission. For written permission, please contact
++ * licensing@OpenSSL.org.
++ *
++ * 5. Products derived from this software may not be called "OpenSSL"
++ * nor may "OpenSSL" appear in their names without prior written
++ * permission of the OpenSSL Project.
++ *
++ * 6. Redistributions of any form whatsoever must retain the following
++ * acknowledgment:
++ * "This product includes software developed by the OpenSSL Project
++ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
++ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
++ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
++ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
++ * OF THE POSSIBILITY OF SUCH DAMAGE.
++ * ====================================================================
++ *
++ * This product includes cryptographic software written by Eric Young
++ * (eay@cryptsoft.com). This product includes software written by Tim
++ * Hudson (tjh@cryptsoft.com).
++ *
++ */
++
++#include <stdio.h>
++#include <openssl/err.h>
++#include "hw_pk11_err.h"
++
++/* BEGIN ERROR CODES */
++#ifndef OPENSSL_NO_ERR
++static ERR_STRING_DATA pk11_str_functs[]=
++{
++ {ERR_PACK(0,PK11_F_INIT,0), "PK11_INIT"},
++ {ERR_PACK(0,PK11_F_FINISH,0), "PK11_FINISH"},
++ {ERR_PACK(0,PK11_F_DESTROY,0), "PK11_DESTROY"},
++ {ERR_PACK(0,PK11_F_CTRL,0), "PK11_CTRL"},
++ {ERR_PACK(0,PK11_F_RSA_INIT,0), "PK11_RSA_INIT"},
++ {ERR_PACK(0,PK11_F_RSA_FINISH,0), "PK11_RSA_FINISH"},
++ {ERR_PACK(0,PK11_F_GET_PUB_RSA_KEY,0), "PK11_GET_PUB_RSA_KEY"},
++ {ERR_PACK(0,PK11_F_GET_PRIV_RSA_KEY,0), "PK11_GET_PRIV_RSA_KEY"},
++ {ERR_PACK(0,PK11_F_RSA_GEN_KEY,0), "PK11_RSA_GEN_KEY"},
++ {ERR_PACK(0,PK11_F_RSA_PUB_ENC,0), "PK11_RSA_PUB_ENC"},
++ {ERR_PACK(0,PK11_F_RSA_PRIV_ENC,0), "PK11_RSA_PRIV_ENC"},
++ {ERR_PACK(0,PK11_F_RSA_PUB_DEC,0), "PK11_RSA_PUB_DEC"},
++ {ERR_PACK(0,PK11_F_RSA_PRIV_DEC,0), "PK11_RSA_PRIV_DEC"},
++ {ERR_PACK(0,PK11_F_RSA_SIGN,0), "PK11_RSA_SIGN"},
++ {ERR_PACK(0,PK11_F_RSA_VERIFY,0), "PK11_RSA_VERIFY"},
++ {ERR_PACK(0,PK11_F_RAND_ADD,0), "PK11_RAND_ADD"},
++ {ERR_PACK(0,PK11_F_RAND_BYTES,0), "PK11_RAND_BYTES"},
++ {ERR_PACK(0,PK11_F_GET_SESSION,0), "PK11_GET_SESSION"},
++ {ERR_PACK(0,PK11_F_FREE_SESSION,0), "PK11_FREE_SESSION"},
++ {ERR_PACK(0,PK11_F_LOAD_PUBKEY,0), "PK11_LOAD_PUBKEY"},
++ {ERR_PACK(0,PK11_F_LOAD_PRIVKEY,0), "PK11_LOAD_PRIV_KEY"},
++ {ERR_PACK(0,PK11_F_RSA_PUB_ENC_LOW,0), "PK11_RSA_PUB_ENC_LOW"},
++ {ERR_PACK(0,PK11_F_RSA_PRIV_ENC_LOW,0), "PK11_RSA_PRIV_ENC_LOW"},
++ {ERR_PACK(0,PK11_F_RSA_PUB_DEC_LOW,0), "PK11_RSA_PUB_DEC_LOW"},
++ {ERR_PACK(0,PK11_F_RSA_PRIV_DEC_LOW,0), "PK11_RSA_PRIV_DEC_LOW"},
++ {ERR_PACK(0,PK11_F_DSA_SIGN,0), "PK11_DSA_SIGN"},
++ {ERR_PACK(0,PK11_F_DSA_VERIFY,0), "PK11_DSA_VERIFY"},
++ {ERR_PACK(0,PK11_F_DSA_INIT,0), "PK11_DSA_INIT"},
++ {ERR_PACK(0,PK11_F_DSA_FINISH,0), "PK11_DSA_FINISH"},
++ {ERR_PACK(0,PK11_F_GET_PUB_DSA_KEY,0), "PK11_GET_PUB_DSA_KEY"},
++ {ERR_PACK(0,PK11_F_GET_PRIV_DSA_KEY,0), "PK11_GET_PRIV_DSA_KEY"},
++ {ERR_PACK(0,PK11_F_DH_INIT,0), "PK11_DH_INIT"},
++ {ERR_PACK(0,PK11_F_DH_FINISH,0), "PK11_DH_FINISH"},
++ {ERR_PACK(0,PK11_F_MOD_EXP_DH,0), "PK11_MOD_EXP_DH"},
++ {ERR_PACK(0,PK11_F_GET_DH_KEY,0), "PK11_GET_DH_KEY"},
++ {ERR_PACK(0,PK11_F_FREE_ALL_SESSIONS,0),"PK11_FREE_ALL_SESSIONS"},
++ {ERR_PACK(0,PK11_F_SETUP_SESSION,0), "PK11_SETUP_SESSION"},
++ {ERR_PACK(0,PK11_F_DESTROY_OBJECT,0), "PK11_DESTROY_OBJECT"},
++ {ERR_PACK(0,PK11_F_CIPHER_INIT,0), "PK11_CIPHER_INIT"},
++ {ERR_PACK(0,PK11_F_CIPHER_DO_CIPHER,0), "PK11_CIPHER_DO_CIPHER"},
++ {ERR_PACK(0,PK11_F_GET_CIPHER_KEY,0), "PK11_GET_CIPHER_KEY"},
++ {ERR_PACK(0,PK11_F_DIGEST_INIT,0), "PK11_DIGEST_INIT"},
++ {ERR_PACK(0,PK11_F_DIGEST_UPDATE,0), "PK11_DIGEST_UPDATE"},
++ {ERR_PACK(0,PK11_F_DIGEST_FINAL,0), "PK11_DIGEST_FINAL"},
++ {ERR_PACK(0,PK11_F_CHOOSE_SLOT,0), "PK11_CHOOSE_SLOT"},
++ {ERR_PACK(0,PK11_F_CIPHER_FINAL,0), "PK11_CIPHER_FINAL"},
++ {ERR_PACK(0,PK11_F_LIBRARY_INIT,0), "PK11_LIBRARY_INIT"},
++ {ERR_PACK(0,PK11_F_LOAD,0), "ENGINE_LOAD_PK11"},
++ {ERR_PACK(0,PK11_F_DH_GEN_KEY,0), "PK11_DH_GEN_KEY"},
++ {ERR_PACK(0,PK11_F_DH_COMP_KEY,0), "PK11_DH_COMP_KEY"},
++ {ERR_PACK(0,PK11_F_DIGEST_COPY,0), "PK11_DIGEST_COPY"},
++ {0,NULL}
++};
++
++static ERR_STRING_DATA pk11_str_reasons[]=
++{
++ {PK11_R_ALREADY_LOADED ,"PKCS#11 DSO already loaded"},
++ {PK11_R_DSO_FAILURE ,"unable to load PKCS#11 DSO"},
++ {PK11_R_NOT_LOADED ,"PKCS#11 DSO not loaded"},
++ {PK11_R_PASSED_NULL_PARAMETER ,"null parameter passed"},
++ {PK11_R_COMMAND_NOT_IMPLEMENTED ,"command not implemented"},
++ {PK11_R_INITIALIZE ,"C_Initialize failed"},
++ {PK11_R_FINALIZE ,"C_Finalize failed"},
++ {PK11_R_GETINFO ,"C_GetInfo faile"},
++ {PK11_R_GETSLOTLIST ,"C_GetSlotList failed"},
++ {PK11_R_NO_MODULUS_OR_NO_EXPONENT ,"no modulus or no exponent"},
++ {PK11_R_ATTRIBUT_SENSITIVE_OR_INVALID ,"attr sensitive or invalid"},
++ {PK11_R_GETATTRIBUTVALUE ,"C_GetAttributeValue failed"},
++ {PK11_R_NO_MODULUS ,"no modulus"},
++ {PK11_R_NO_EXPONENT ,"no exponent"},
++ {PK11_R_FINDOBJECTSINIT ,"C_FindObjectsInit failed"},
++ {PK11_R_FINDOBJECTS ,"C_FindObjects failed"},
++ {PK11_R_FINDOBJECTSFINAL ,"C_FindObjectsFinal failed"},
++ {PK11_R_CREATEOBJECT ,"C_CreateObject failed"},
++ {PK11_R_DESTROYOBJECT ,"C_DestroyObject failed"},
++ {PK11_R_OPENSESSION ,"C_OpenSession failed"},
++ {PK11_R_CLOSESESSION ,"C_CloseSession failed"},
++ {PK11_R_ENCRYPTINIT ,"C_EncryptInit failed"},
++ {PK11_R_ENCRYPT ,"C_Encrypt failed"},
++ {PK11_R_SIGNINIT ,"C_SignInit failed"},
++ {PK11_R_SIGN ,"C_Sign failed"},
++ {PK11_R_DECRYPTINIT ,"C_DecryptInit failed"},
++ {PK11_R_DECRYPT ,"C_Decrypt failed"},
++ {PK11_R_VERIFYINIT ,"C_VerifyRecover failed"},
++ {PK11_R_VERIFY ,"C_Verify failed "},
++ {PK11_R_VERIFYRECOVERINIT ,"C_VerifyRecoverInit failed"},
++ {PK11_R_VERIFYRECOVER ,"C_VerifyRecover failed"},
++ {PK11_R_GEN_KEY ,"C_GenerateKeyPair failed"},
++ {PK11_R_SEEDRANDOM ,"C_SeedRandom failed"},
++ {PK11_R_GENERATERANDOM ,"C_GenerateRandom failed"},
++ {PK11_R_INVALID_MESSAGE_LENGTH ,"invalid message length"},
++ {PK11_R_UNKNOWN_ALGORITHM_TYPE ,"unknown algorithm type"},
++ {PK11_R_UNKNOWN_ASN1_OBJECT_ID ,"unknown asn1 onject id"},
++ {PK11_R_UNKNOWN_PADDING_TYPE ,"unknown padding type"},
++ {PK11_R_PADDING_CHECK_FAILED ,"padding check failed"},
++ {PK11_R_DIGEST_TOO_BIG ,"digest too big"},
++ {PK11_R_MALLOC_FAILURE ,"malloc failure"},
++ {PK11_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctl command not implemented"},
++ {PK11_R_DATA_GREATER_THAN_MOD_LEN ,"data is bigger than mod"},
++ {PK11_R_DATA_TOO_LARGE_FOR_MODULUS ,"data is too larger for mod"},
++ {PK11_R_MISSING_KEY_COMPONENT ,"a dsa component is missing"},
++ {PK11_R_INVALID_SIGNATURE_LENGTH ,"invalid signature length"},
++ {PK11_R_INVALID_DSA_SIGNATURE_R ,"missing r in dsa verify"},
++ {PK11_R_INVALID_DSA_SIGNATURE_S ,"missing s in dsa verify"},
++ {PK11_R_INCONSISTENT_KEY ,"inconsistent key type"},
++ {PK11_R_ENCRYPTUPDATE ,"C_EncryptUpdate failed"},
++ {PK11_R_DECRYPTUPDATE ,"C_DecryptUpdate failed"},
++ {PK11_R_DIGESTINIT ,"C_DigestInit failed"},
++ {PK11_R_DIGESTUPDATE ,"C_DigestUpdate failed"},
++ {PK11_R_DIGESTFINAL ,"C_DigestFinal failed"},
++ {PK11_R_ENCRYPTFINAL ,"C_EncryptFinal failed"},
++ {PK11_R_DECRYPTFINAL ,"C_DecryptFinal failed"},
++ {PK11_R_NO_PRNG_SUPPORT ,"Slot does not support PRNG"},
++ {PK11_R_GETTOKENINFO ,"C_GetTokenInfo failed"},
++ {PK11_R_DERIVEKEY ,"C_DeriveKey failed"},
++ {PK11_R_GET_OPERATION_STATE ,"C_GetOperationState failed"},
++ {PK11_R_SET_OPERATION_STATE ,"C_SetOperationState failed"},
++ {0,NULL}
++};
++
++#endif
++
++static int pk11_lib_error_code=0;
++static int pk11_error_init=1;
++
++static void ERR_load_pk11_strings(void)
++{
++ if (pk11_lib_error_code == 0)
++ pk11_lib_error_code = ERR_get_next_error_library();
++
++ if (pk11_error_init)
++ {
++ pk11_error_init=0;
++#ifndef OPENSSL_NO_ERR
++ ERR_load_strings(pk11_lib_error_code,pk11_str_functs);
++ ERR_load_strings(pk11_lib_error_code,pk11_str_reasons);
++#endif
++ }
++}
++
++static void ERR_unload_pk11_strings(void)
++{
++ if (pk11_error_init == 0)
++ {
++#ifndef OPENSSL_NO_ERR
++ ERR_unload_strings(pk11_lib_error_code,pk11_str_functs);
++ ERR_unload_strings(pk11_lib_error_code,pk11_str_reasons);
++#endif
++ pk11_error_init = 1;
++ }
++}
++
++static void ERR_pk11_error(int function, int reason, char *file, int line)
++{
++ if (pk11_lib_error_code == 0)
++ pk11_lib_error_code=ERR_get_next_error_library();
++ ERR_PUT_error(pk11_lib_error_code,function,reason,file,line);
++}
+diff -r -u -N openssl-0.9.8g/crypto/engine/hw_pk11_err.h openssl/crypto/engine/hw_pk11_err.h
+--- openssl-0.9.8g/crypto/engine/hw_pk11_err.h 1970-01-01 01:00:00.000000000 +0100
++++ openssl/crypto/engine/hw_pk11_err.h 2008-01-31 16:14:07.000000000 +0100
+@@ -0,0 +1,247 @@
++/*
++ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
++ * Use is subject to license terms.
++ */
++#pragma ident "@(#)hw_pk11_err.h 1.2 04/06/22 SMI"
++
++/* crypto/engine/hw_pk11_err.h */
++/* This product includes software developed by the OpenSSL Project for
++ * use in the OpenSSL Toolkit (http://www.openssl.org/).
++ *
++ * This project also referenced hw_pkcs11-0.9.7b.patch written by
++ * Afchine Madjlessi.
++ */
++/* ====================================================================
++ * Copyright (c) 2000-2001 The OpenSSL Project. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ *
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ *
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in
++ * the documentation and/or other materials provided with the
++ * distribution.
++ *
++ * 3. All advertising materials mentioning features or use of this
++ * software must display the following acknowledgment:
++ * "This product includes software developed by the OpenSSL Project
++ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
++ *
++ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
++ * endorse or promote products derived from this software without
++ * prior written permission. For written permission, please contact
++ * licensing@OpenSSL.org.
++ *
++ * 5. Products derived from this software may not be called "OpenSSL"
++ * nor may "OpenSSL" appear in their names without prior written
++ * permission of the OpenSSL Project.
++ *
++ * 6. Redistributions of any form whatsoever must retain the following
++ * acknowledgment:
++ * "This product includes software developed by the OpenSSL Project
++ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
++ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
++ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
++ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
++ * OF THE POSSIBILITY OF SUCH DAMAGE.
++ * ====================================================================
++ *
++ * This product includes cryptographic software written by Eric Young
++ * (eay@cryptsoft.com). This product includes software written by Tim
++ * Hudson (tjh@cryptsoft.com).
++ *
++ */
++
++#ifndef HW_PK11_ERR_H
++#define HW_PK11_ERR_H
++
++/* CRYPTO_LOCK_RSA is defined in OpenSSL for RSA method. Since this pk11
++ * engine replaces RSA method, we may reuse this lock here.
++ */
++#define CRYPTO_LOCK_PK11_ENGINE CRYPTO_LOCK_RSA
++
++static void ERR_load_pk11_strings(void);
++static void ERR_pk11_error(int function, int reason, char *file, int line);
++#define PK11err(f,r) ERR_pk11_error((f),(r),__FILE__,__LINE__)
++
++/* Error codes for the PK11 functions. */
++
++/* Function codes. */
++
++#define PK11_F_INIT 100
++#define PK11_F_FINISH 101
++#define PK11_F_DESTROY 102
++#define PK11_F_CTRL 103
++#define PK11_F_RSA_INIT 104
++#define PK11_F_RSA_FINISH 105
++#define PK11_F_GET_PUB_RSA_KEY 106
++#define PK11_F_GET_PRIV_RSA_KEY 107
++#define PK11_F_RSA_GEN_KEY 108
++#define PK11_F_RSA_PUB_ENC 109
++#define PK11_F_RSA_PRIV_ENC 110
++#define PK11_F_RSA_PUB_DEC 111
++#define PK11_F_RSA_PRIV_DEC 112
++#define PK11_F_RSA_SIGN 113
++#define PK11_F_RSA_VERIFY 114
++#define PK11_F_RAND_ADD 115
++#define PK11_F_RAND_BYTES 116
++#define PK11_F_GET_SESSION 117
++#define PK11_F_FREE_SESSION 118
++#define PK11_F_LOAD_PUBKEY 119
++#define PK11_F_LOAD_PRIVKEY 120
++#define PK11_F_RSA_PUB_ENC_LOW 121
++#define PK11_F_RSA_PRIV_ENC_LOW 122
++#define PK11_F_RSA_PUB_DEC_LOW 123
++#define PK11_F_RSA_PRIV_DEC_LOW 124
++#define PK11_F_DSA_SIGN 125
++#define PK11_F_DSA_VERIFY 126
++#define PK11_F_DSA_INIT 127
++#define PK11_F_DSA_FINISH 128
++#define PK11_F_GET_PUB_DSA_KEY 129
++#define PK11_F_GET_PRIV_DSA_KEY 130
++#define PK11_F_DH_INIT 131
++#define PK11_F_DH_FINISH 132
++#define PK11_F_MOD_EXP_DH 133
++#define PK11_F_GET_DH_KEY 134
++#define PK11_F_FREE_ALL_SESSIONS 135
++#define PK11_F_SETUP_SESSION 136
++#define PK11_F_DESTROY_OBJECT 137
++#define PK11_F_CIPHER_INIT 138
++#define PK11_F_CIPHER_DO_CIPHER 139
++#define PK11_F_GET_CIPHER_KEY 140
++#define PK11_F_DIGEST_INIT 141
++#define PK11_F_DIGEST_UPDATE 142
++#define PK11_F_DIGEST_FINAL 143
++#define PK11_F_CHOOSE_SLOT 144
++#define PK11_F_CIPHER_FINAL 145
++#define PK11_F_LIBRARY_INIT 146
++#define PK11_F_LOAD 147
++#define PK11_F_DH_GEN_KEY 148
++#define PK11_F_DH_COMP_KEY 149
++#define PK11_F_DIGEST_COPY 150
++
++/* Reason codes. */
++#define PK11_R_ALREADY_LOADED 100
++#define PK11_R_DSO_FAILURE 101
++#define PK11_R_NOT_LOADED 102
++#define PK11_R_PASSED_NULL_PARAMETER 103
++#define PK11_R_COMMAND_NOT_IMPLEMENTED 104
++#define PK11_R_INITIALIZE 105
++#define PK11_R_FINALIZE 106
++#define PK11_R_GETINFO 107
++#define PK11_R_GETSLOTLIST 108
++#define PK11_R_NO_MODULUS_OR_NO_EXPONENT 109
++#define PK11_R_ATTRIBUT_SENSITIVE_OR_INVALID 110
++#define PK11_R_GETATTRIBUTVALUE 111
++#define PK11_R_NO_MODULUS 112
++#define PK11_R_NO_EXPONENT 113
++#define PK11_R_FINDOBJECTSINIT 114
++#define PK11_R_FINDOBJECTS 115
++#define PK11_R_FINDOBJECTSFINAL 116
++#define PK11_R_CREATEOBJECT 118
++#define PK11_R_DESTROYOBJECT 119
++#define PK11_R_OPENSESSION 120
++#define PK11_R_CLOSESESSION 121
++#define PK11_R_ENCRYPTINIT 122
++#define PK11_R_ENCRYPT 123
++#define PK11_R_SIGNINIT 124
++#define PK11_R_SIGN 125
++#define PK11_R_DECRYPTINIT 126
++#define PK11_R_DECRYPT 127
++#define PK11_R_VERIFYINIT 128
++#define PK11_R_VERIFY 129
++#define PK11_R_VERIFYRECOVERINIT 130
++#define PK11_R_VERIFYRECOVER 131
++#define PK11_R_GEN_KEY 132
++#define PK11_R_SEEDRANDOM 133
++#define PK11_R_GENERATERANDOM 134
++#define PK11_R_INVALID_MESSAGE_LENGTH 135
++#define PK11_R_UNKNOWN_ALGORITHM_TYPE 136
++#define PK11_R_UNKNOWN_ASN1_OBJECT_ID 137
++#define PK11_R_UNKNOWN_PADDING_TYPE 138
++#define PK11_R_PADDING_CHECK_FAILED 139
++#define PK11_R_DIGEST_TOO_BIG 140
++#define PK11_R_MALLOC_FAILURE 141
++#define PK11_R_CTRL_COMMAND_NOT_IMPLEMENTED 142
++#define PK11_R_DATA_GREATER_THAN_MOD_LEN 143
++#define PK11_R_DATA_TOO_LARGE_FOR_MODULUS 144
++#define PK11_R_MISSING_KEY_COMPONENT 145
++#define PK11_R_INVALID_SIGNATURE_LENGTH 146
++#define PK11_R_INVALID_DSA_SIGNATURE_R 147
++#define PK11_R_INVALID_DSA_SIGNATURE_S 148
++#define PK11_R_INCONSISTENT_KEY 149
++#define PK11_R_ENCRYPTUPDATE 150
++#define PK11_R_DECRYPTUPDATE 151
++#define PK11_R_DIGESTINIT 152
++#define PK11_R_DIGESTUPDATE 153
++#define PK11_R_DIGESTFINAL 154
++#define PK11_R_ENCRYPTFINAL 155
++#define PK11_R_DECRYPTFINAL 156
++#define PK11_R_NO_PRNG_SUPPORT 157
++#define PK11_R_GETTOKENINFO 158
++#define PK11_R_DERIVEKEY 159
++#define PK11_R_GET_OPERATION_STATE 160
++#define PK11_R_SET_OPERATION_STATE 161
++#define PK11_R_INVALID_PIN 162
++#define PK11_R_TOO_MANY_OBJECTS 163
++#define PK11_R_OBJECT_NOT_FOUND 164
++
++/* This structure encapsulates all reusable information for a PKCS#11
++ * session. A list of this object is created on behalf of the
++ * calling application using an on-demand method. When a new request
++ * comes in, an object will be taken from the list (if there is one)
++ * or a new one is created to handle the request. Note that not all
++ * fields are used for every application. For example, an RSA-only
++ * application only uses the RSA related fields */
++typedef struct PK11_SESSION_st
++ {
++ struct PK11_SESSION_st *next;
++ CK_SESSION_HANDLE session; /* PK11 session handle */
++ CK_SESSION_HANDLE session_cipher; /* PK11 sess handle for ciph */
++ pid_t pid; /* Current process ID */
++ CK_OBJECT_HANDLE rsa_pub_key; /* RSA key handle in the sess */
++ CK_OBJECT_HANDLE rsa_priv_key; /* RSA private key handle */
++ CK_OBJECT_HANDLE dsa_pub_key; /* DSA pub key handle */
++ CK_OBJECT_HANDLE dsa_priv_key; /* DSA priv key handle */
++ CK_OBJECT_HANDLE dh_key; /* RSA pub key handle for DH */
++ CK_OBJECT_HANDLE cipher_key; /* Cipher key handle */
++ RSA *rsa; /* Address of the RSA struct */
++ void *dsa; /* Address of the DSA structure */
++ void *dh; /* Address of the DH */
++ unsigned char key[24];/* Save the private key here */
++ int key_len;/* Saved private key length */
++ int encrypt;/* 1/0 for encrypt/decrypt */
++ } PK11_SESSION;
++
++extern PK11_SESSION *pk11_get_session();
++extern void pk11_return_session(PK11_SESSION *sp);
++
++extern int pk11_destroy_rsa_key_objects(PK11_SESSION *session);
++extern int pk11_destroy_dsa_key_objects(PK11_SESSION *session);
++extern int pk11_destroy_dh_key_objects(PK11_SESSION *session);
++
++extern RSA_METHOD *PK11_RSA(void);
++extern DSA_METHOD *PK11_DSA(void);
++extern DH_METHOD *PK11_DH(void);
++
++extern EVP_PKEY *pk11_load_privkey(ENGINE*, const char* pubkey_file,
++ UI_METHOD *ui_method, void *callback_data);
++extern EVP_PKEY *pk11_load_pubkey(ENGINE*, const char* pubkey_file,
++ UI_METHOD *ui_method, void *callback_data);
++
++extern CK_FUNCTION_LIST_PTR pFuncList;
++
++#endif /* HW_PK11_ERR_H */
+diff -r -u -N openssl-0.9.8g/crypto/engine/hw_pk11_pub.c openssl/crypto/engine/hw_pk11_pub.c
+--- openssl-0.9.8g/crypto/engine/hw_pk11_pub.c 1970-01-01 01:00:00.000000000 +0100
++++ openssl/crypto/engine/hw_pk11_pub.c 2008-03-17 15:15:49.000000000 +0100
+@@ -0,0 +1,2616 @@
++/*
++ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
++ * Use is subject to license terms.
++ */
++#pragma ident "@(#)hw_pk11_pub.c 1.4 07/05/10 SMI"
++
++/* crypto/engine/hw_pk11_pub.c */
++/* This product includes software developed by the OpenSSL Project for
++ * use in the OpenSSL Toolkit (http://www.openssl.org/).
++ *
++ * This project also referenced hw_pkcs11-0.9.7b.patch written by
++ * Afchine Madjlessi.
++ */
++/* ====================================================================
++ * Copyright (c) 2000-2001 The OpenSSL Project. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ *
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ *
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in
++ * the documentation and/or other materials provided with the
++ * distribution.
++ *
++ * 3. All advertising materials mentioning features or use of this
++ * software must display the following acknowledgment:
++ * "This product includes software developed by the OpenSSL Project
++ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
++ *
++ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
++ * endorse or promote products derived from this software without
++ * prior written permission. For written permission, please contact
++ * licensing@OpenSSL.org.
++ *
++ * 5. Products derived from this software may not be called "OpenSSL"
++ * nor may "OpenSSL" appear in their names without prior written
++ * permission of the OpenSSL Project.
++ *
++ * 6. Redistributions of any form whatsoever must retain the following
++ * acknowledgment:
++ * "This product includes software developed by the OpenSSL Project
++ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
++ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
++ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
++ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
++ * OF THE POSSIBILITY OF SUCH DAMAGE.
++ * ====================================================================
++ *
++ * This product includes cryptographic software written by Eric Young
++ * (eay@cryptsoft.com). This product includes software written by Tim
++ * Hudson (tjh@cryptsoft.com).
++ *
++ */
++
++#include <stdio.h>
++#include <assert.h>
++#include <stdlib.h>
++#include <string.h>
++#include <sys/types.h>
++#include <unistd.h>
++
++#include <openssl/e_os2.h>
++#include <openssl/engine.h>
++#include <openssl/dso.h>
++#include <openssl/err.h>
++#include <openssl/bn.h>
++#include <openssl/pem.h>
++#include <openssl/rsa.h>
++#include <openssl/rand.h>
++#include <openssl/objects.h>
++#include <openssl/x509.h>
++#include <cryptlib.h>
++
++#ifndef OPENSSL_NO_HW
++#ifndef OPENSSL_NO_HW_PK11
++
++#include "cryptoki.h"
++#include "pkcs11.h"
++#include "hw_pk11_err.c"
++
++#ifndef OPENSSL_NO_RSA
++/* RSA stuff */
++static int pk11_RSA_public_encrypt(int flen, const unsigned char *from,
++ unsigned char *to, RSA *rsa, int padding);
++static int pk11_RSA_private_encrypt(int flen, const unsigned char *from,
++ unsigned char *to, RSA *rsa, int padding);
++static int pk11_RSA_public_decrypt(int flen, const unsigned char *from,
++ unsigned char *to, RSA *rsa, int padding);
++static int pk11_RSA_private_decrypt(int flen, const unsigned char *from,
++ unsigned char *to, RSA *rsa, int padding);
++static int pk11_RSA_init(RSA *rsa);
++static int pk11_RSA_finish(RSA *rsa);
++static int pk11_RSA_sign(int type, const unsigned char *m, unsigned int m_len,
++ unsigned char *sigret, unsigned int *siglen, const RSA *rsa);
++static int pk11_RSA_verify(int dtype, const unsigned char *m,
++ unsigned int m_len, unsigned char *sigbuf, unsigned int siglen,
++ const RSA *rsa);
++EVP_PKEY *pk11_load_privkey(ENGINE*, const char* pubkey_file,
++ UI_METHOD *ui_method, void *callback_data);
++EVP_PKEY *pk11_load_pubkey(ENGINE*, const char* pubkey_file,
++ UI_METHOD *ui_method, void *callback_data);
++
++static int pk11_RSA_public_encrypt_low(int flen, const unsigned char *from,
++ unsigned char *to, RSA *rsa);
++static int pk11_RSA_private_encrypt_low(int flen, const unsigned char *from,
++ unsigned char *to, RSA *rsa);
++static int pk11_RSA_public_decrypt_low(int flen, const unsigned char *from,
++ unsigned char *to, RSA *rsa);
++static int pk11_RSA_private_decrypt_low(int flen, const unsigned char *from,
++ unsigned char *to, RSA *rsa);
++
++static CK_OBJECT_HANDLE pk11_get_public_rsa_key(RSA* rsa, PK11_SESSION *sp);
++static CK_OBJECT_HANDLE pk11_get_private_rsa_key(RSA* rsa,
++ PK11_SESSION *sp);
++#endif
++
++/* DSA stuff */
++#ifndef OPENSSL_NO_DSA
++static int pk11_DSA_init(DSA *dsa);
++static int pk11_DSA_finish(DSA *dsa);
++static DSA_SIG *pk11_dsa_do_sign(const unsigned char *dgst, int dlen,
++ DSA *dsa);
++static int pk11_dsa_do_verify(const unsigned char *dgst, int dgst_len,
++ DSA_SIG *sig, DSA *dsa);
++
++static CK_OBJECT_HANDLE pk11_get_public_dsa_key(DSA* dsa,
++ PK11_SESSION *sp);
++static CK_OBJECT_HANDLE pk11_get_private_dsa_key(DSA* dsa,
++ PK11_SESSION *sp);
++#endif
++
++/* DH stuff */
++#ifndef OPENSSL_NO_DH
++static int pk11_DH_init(DH *dh);
++static int pk11_DH_finish(DH *dh);
++static int pk11_DH_generate_key(DH *dh);
++static int pk11_DH_compute_key(unsigned char *key,
++ const BIGNUM *pub_key,DH *dh);
++
++static CK_OBJECT_HANDLE pk11_get_dh_key(DH* dh, PK11_SESSION *sp);
++#endif
++
++static int init_template_value(BIGNUM *bn, CK_VOID_PTR *pValue,
++ CK_ULONG *ulValueLen);
++static void check_new_rsa_key(PK11_SESSION *sp, void *rsa);
++static void check_new_dsa_key(PK11_SESSION *sp, void *dsa);
++static void check_new_dh_key(PK11_SESSION *sp, void *dh);
++static void attr_to_BN(CK_ATTRIBUTE_PTR attr, CK_BYTE attr_data[], BIGNUM **bn);
++
++
++#ifndef OPENSSL_NO_RSA
++/* Our internal RSA_METHOD that we provide pointers to */
++static RSA_METHOD pk11_rsa =
++ {
++ "PKCS#11 RSA method",
++ pk11_RSA_public_encrypt, /* rsa_pub_encrypt */
++ pk11_RSA_public_decrypt, /* rsa_pub_decrypt */
++ pk11_RSA_private_encrypt, /* rsa_priv_encrypt */
++ pk11_RSA_private_decrypt, /* rsa_priv_decrypt */
++ NULL, /* rsa_mod_exp */
++ NULL, /* bn_mod_exp */
++ pk11_RSA_init, /* init */
++ pk11_RSA_finish, /* finish */
++ RSA_FLAG_SIGN_VER, /* flags */
++ NULL, /* app_data */
++ pk11_RSA_sign, /* rsa_sign */
++ pk11_RSA_verify/*,*/ /* rsa_verify */
++ };
++
++RSA_METHOD *PK11_RSA(void)
++ {
++ return(&pk11_rsa);
++ }
++#endif
++
++#ifndef OPENSSL_NO_DSA
++/* Our internal DSA_METHOD that we provide pointers to */
++static DSA_METHOD pk11_dsa =
++ {
++ "PKCS#11 DSA method",
++ pk11_dsa_do_sign, /* dsa_do_sign */
++ NULL, /* dsa_sign_setup */
++ pk11_dsa_do_verify, /* dsa_do_verify */
++ NULL, /* dsa_mod_exp */
++ NULL, /* bn_mod_exp */
++ pk11_DSA_init, /* init */
++ pk11_DSA_finish, /* finish */
++ 0, /* flags */
++ NULL /* app_data */
++ };
++
++DSA_METHOD *PK11_DSA(void)
++ {
++ return(&pk11_dsa);
++ }
++
++#endif
++
++
++#ifndef OPENSSL_NO_DH
++/* Our internal DH_METHOD that we provide pointers to */
++static DH_METHOD pk11_dh =
++ {
++ "PKCS#11 DH method",
++ pk11_DH_generate_key, /* generate_key */
++ pk11_DH_compute_key, /* compute_key */
++ NULL, /* bn_mod_exp */
++ pk11_DH_init, /* init */
++ pk11_DH_finish, /* finish */
++ 0, /* flags */
++ NULL /* app_data */
++ };
++
++DH_METHOD *PK11_DH(void)
++ {
++ return(&pk11_dh);
++ }
++#endif
++
++/* Size of an SSL signature: MD5+SHA1
++ */
++#define SSL_SIG_LENGTH 36
++
++/* Lengths of DSA data and signature
++ */
++#define DSA_DATA_LEN 20
++#define DSA_SIGNATURE_LEN 40
++
++static CK_BBOOL true = TRUE;
++static CK_BBOOL false = FALSE;
++
++#ifndef OPENSSL_NO_RSA
++
++/* Similiar to Openssl to take advantage of the paddings. The goal is to
++ * support all paddings in this engine although PK11 library does not
++ * support all the paddings used in OpenSSL.
++ * The input errors should have been checked in the padding functions
++ */
++static int pk11_RSA_public_encrypt(int flen, const unsigned char *from,
++ unsigned char *to, RSA *rsa, int padding)
++ {
++ int i,num=0,r= -1;
++ unsigned char *buf=NULL;
++
++ num=BN_num_bytes(rsa->n);
++ if ((buf=(unsigned char *)OPENSSL_malloc(num)) == NULL)
++ {
++ RSAerr(PK11_F_RSA_PUB_ENC,PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++
++ switch (padding)
++ {
++ case RSA_PKCS1_PADDING:
++ i=RSA_padding_add_PKCS1_type_2(buf,num,from,flen);
++ break;
++#ifndef OPENSSL_NO_SHA
++ case RSA_PKCS1_OAEP_PADDING:
++ i=RSA_padding_add_PKCS1_OAEP(buf,num,from,flen,NULL,0);
++ break;
++#endif
++ case RSA_SSLV23_PADDING:
++ i=RSA_padding_add_SSLv23(buf,num,from,flen);
++ break;
++ case RSA_NO_PADDING:
++ i=RSA_padding_add_none(buf,num,from,flen);
++ break;
++ default:
++ RSAerr(PK11_F_RSA_PUB_ENC,PK11_R_UNKNOWN_PADDING_TYPE);
++ goto err;
++ }
++ if (i <= 0) goto err;
++
++ /* PK11 functions are called here */
++ r = pk11_RSA_public_encrypt_low(num, buf, to, rsa);
++err:
++ if (buf != NULL)
++ {
++ OPENSSL_cleanse(buf,num);
++ OPENSSL_free(buf);
++ }
++ return(r);
++ }
++
++
++/* Similar to Openssl to take advantage of the paddings. The input errors
++ * should be catched in the padding functions
++ */
++static int pk11_RSA_private_encrypt(int flen, const unsigned char *from,
++ unsigned char *to, RSA *rsa, int padding)
++ {
++ int i,num=0,r= -1;
++ unsigned char *buf=NULL;
++
++ num=BN_num_bytes(rsa->n);
++ if ((buf=(unsigned char *)OPENSSL_malloc(num)) == NULL)
++ {
++ RSAerr(PK11_F_RSA_PRIV_ENC,PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++
++ switch (padding)
++ {
++ case RSA_PKCS1_PADDING:
++ i=RSA_padding_add_PKCS1_type_1(buf,num,from,flen);
++ break;
++ case RSA_NO_PADDING:
++ i=RSA_padding_add_none(buf,num,from,flen);
++ break;
++ case RSA_SSLV23_PADDING:
++ default:
++ RSAerr(PK11_F_RSA_PRIV_ENC,PK11_R_UNKNOWN_PADDING_TYPE);
++ goto err;
++ }
++ if (i <= 0) goto err;
++
++ /* PK11 functions are called here */
++ r=pk11_RSA_private_encrypt_low(num, buf, to, rsa);
++err:
++ if (buf != NULL)
++ {
++ OPENSSL_cleanse(buf,num);
++ OPENSSL_free(buf);
++ }
++ return(r);
++ }
++
++/* Similar to Openssl. Input errors are also checked here
++ */
++static int pk11_RSA_private_decrypt(int flen, const unsigned char *from,
++ unsigned char *to, RSA *rsa, int padding)
++ {
++ BIGNUM f;
++ int j,num=0,r= -1;
++ unsigned char *p;
++ unsigned char *buf=NULL;
++
++ BN_init(&f);
++
++ num=BN_num_bytes(rsa->n);
++
++ if ((buf=(unsigned char *)OPENSSL_malloc(num)) == NULL)
++ {
++ RSAerr(PK11_F_RSA_PRIV_DEC,PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++
++ /* This check was for equality but PGP does evil things
++ * and chops off the top '0' bytes */
++ if (flen > num)
++ {
++ RSAerr(PK11_F_RSA_PRIV_DEC,
++ PK11_R_DATA_GREATER_THAN_MOD_LEN);
++ goto err;
++ }
++
++ /* make data into a big number */
++ if (BN_bin2bn(from,(int)flen,&f) == NULL) goto err;
++
++ if (BN_ucmp(&f, rsa->n) >= 0)
++ {
++ RSAerr(PK11_F_RSA_PRIV_DEC,
++ PK11_R_DATA_TOO_LARGE_FOR_MODULUS);
++ goto err;
++ }
++
++ /* PK11 functions are called here */
++ r = pk11_RSA_private_decrypt_low(flen, from, buf, rsa);
++
++ /* PK11 CKM_RSA_X_509 mechanism pads 0's at the beginning.
++ * Needs to skip these 0's paddings here */
++ for (j = 0; j < r; j++)
++ if (buf[j] != 0)
++ break;
++
++ p = buf + j;
++ j = r - j; /* j is only used with no-padding mode */
++
++ switch (padding)
++ {
++ case RSA_PKCS1_PADDING:
++ r=RSA_padding_check_PKCS1_type_2(to,num,p,j,num);
++ break;
++#ifndef OPENSSL_NO_SHA
++ case RSA_PKCS1_OAEP_PADDING:
++ r=RSA_padding_check_PKCS1_OAEP(to,num,p,j,num,NULL,0);
++ break;
++#endif
++ case RSA_SSLV23_PADDING:
++ r=RSA_padding_check_SSLv23(to,num,p,j,num);
++ break;
++ case RSA_NO_PADDING:
++ r=RSA_padding_check_none(to,num,p,j,num);
++ break;
++ default:
++ RSAerr(PK11_F_RSA_PRIV_DEC,PK11_R_UNKNOWN_PADDING_TYPE);
++ goto err;
++ }
++ if (r < 0)
++ RSAerr(PK11_F_RSA_PRIV_DEC,PK11_R_PADDING_CHECK_FAILED);
++
++err:
++ BN_clear_free(&f);
++ if (buf != NULL)
++ {
++ OPENSSL_cleanse(buf,num);
++ OPENSSL_free(buf);
++ }
++ return(r);
++ }
++
++/* Similar to Openssl. Input errors are also checked here
++ */
++static int pk11_RSA_public_decrypt(int flen, const unsigned char *from,
++ unsigned char *to, RSA *rsa, int padding)
++ {
++ BIGNUM f;
++ int i,num=0,r= -1;
++ unsigned char *p;
++ unsigned char *buf=NULL;
++
++ BN_init(&f);
++ num=BN_num_bytes(rsa->n);
++ buf=(unsigned char *)OPENSSL_malloc(num);
++ if (buf == NULL)
++ {
++ RSAerr(PK11_F_RSA_PUB_DEC,PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++
++ /* This check was for equality but PGP does evil things
++ * and chops off the top '0' bytes */
++ if (flen > num)
++ {
++ RSAerr(PK11_F_RSA_PUB_DEC,PK11_R_DATA_GREATER_THAN_MOD_LEN);
++ goto err;
++ }
++
++ if (BN_bin2bn(from,flen,&f) == NULL) goto err;
++
++ if (BN_ucmp(&f, rsa->n) >= 0)
++ {
++ RSAerr(PK11_F_RSA_PUB_DEC,
++ PK11_R_DATA_TOO_LARGE_FOR_MODULUS);
++ goto err;
++ }
++
++ /* PK11 functions are called here */
++ r = pk11_RSA_public_decrypt_low(flen, from, buf, rsa);
++
++ /* PK11 CKM_RSA_X_509 mechanism pads 0's at the beginning.
++ * Needs to skip these 0's here */
++ for (i = 0; i < r; i++)
++ if (buf[i] != 0)
++ break;
++
++ p = buf + i;
++ i = r - i; /* i is only used with no-padding mode */
++
++ switch (padding)
++ {
++ case RSA_PKCS1_PADDING:
++ r=RSA_padding_check_PKCS1_type_1(to,num,p,i,num);
++ break;
++ case RSA_NO_PADDING:
++ r=RSA_padding_check_none(to,num,p,i,num);
++ break;
++ default:
++ RSAerr(PK11_F_RSA_PUB_DEC,PK11_R_UNKNOWN_PADDING_TYPE);
++ goto err;
++ }
++ if (r < 0)
++ RSAerr(PK11_F_RSA_PUB_DEC,PK11_R_PADDING_CHECK_FAILED);
++
++err:
++ BN_clear_free(&f);
++ if (buf != NULL)
++ {
++ OPENSSL_cleanse(buf,num);
++ OPENSSL_free(buf);
++ }
++ return(r);
++ }
++
++/* This function implements RSA public encryption using C_EncryptInit and
++ * C_Encrypt pk11 interfaces. Note that the CKM_RSA_X_509 is used here.
++ * The calling function allocated sufficient memory in "to" to store results.
++ */
++static int pk11_RSA_public_encrypt_low(int flen,
++ const unsigned char *from, unsigned char *to, RSA *rsa)
++ {
++ CK_ULONG bytes_encrypted=flen;
++ int retval = -1;
++ CK_RV rv;
++ CK_MECHANISM mech_rsa = {CKM_RSA_X_509, NULL, 0};
++ CK_MECHANISM *p_mech = &mech_rsa;
++ CK_OBJECT_HANDLE h_pub_key = CK_INVALID_HANDLE;
++ PK11_SESSION *sp;
++ char tmp_buf[20];
++
++ if ((sp = pk11_get_session()) == NULL)
++ return -1;
++
++ check_new_rsa_key(sp, (void *) rsa);
++
++ h_pub_key = sp->rsa_pub_key;
++ if (h_pub_key == CK_INVALID_HANDLE)
++ h_pub_key = sp->rsa_pub_key =
++ pk11_get_public_rsa_key(rsa, sp);
++
++ if (h_pub_key != CK_INVALID_HANDLE)
++ {
++ rv = pFuncList->C_EncryptInit(sp->session, p_mech,
++ h_pub_key);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_RSA_PUB_ENC_LOW,
++ PK11_R_ENCRYPTINIT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ pk11_return_session(sp);
++ return -1;
++ }
++
++ rv = pFuncList->C_Encrypt(sp->session,
++ (unsigned char *)from, flen, to, &bytes_encrypted);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_RSA_PUB_ENC_LOW, PK11_R_ENCRYPT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ pk11_return_session(sp);
++ return -1;
++ }
++ retval = bytes_encrypted;
++ }
++
++ pk11_return_session(sp);
++ return retval;
++ }
++
++
++/* This function implements RSA private encryption using C_SignInit and
++ * C_Sign pk11 APIs. Note that CKM_RSA_X_509 is used here.
++ * The calling function allocated sufficient memory in "to" to store results.
++ */
++static int pk11_RSA_private_encrypt_low(int flen,
++ const unsigned char *from, unsigned char *to, RSA *rsa)
++ {
++ CK_ULONG ul_sig_len=flen;
++ int retval = -1;
++ CK_RV rv;
++ CK_MECHANISM mech_rsa = {CKM_RSA_X_509, NULL, 0};
++ CK_MECHANISM *p_mech = &mech_rsa;
++ CK_OBJECT_HANDLE h_priv_key= CK_INVALID_HANDLE;
++ PK11_SESSION *sp;
++ char tmp_buf[20];
++
++ if ((sp = pk11_get_session()) == NULL)
++ return -1;
++
++ check_new_rsa_key(sp, (void *) rsa);
++
++ h_priv_key = sp->rsa_priv_key;
++ if (h_priv_key == CK_INVALID_HANDLE)
++ h_priv_key = sp->rsa_priv_key =
++ pk11_get_private_rsa_key(rsa, sp);
++
++ if (h_priv_key != CK_INVALID_HANDLE)
++ {
++ rv = pFuncList->C_SignInit(sp->session, p_mech,
++ h_priv_key);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_RSA_PRIV_ENC_LOW, PK11_R_SIGNINIT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ pk11_return_session(sp);
++ return -1;
++ }
++
++ rv = pFuncList->C_Sign(sp->session,
++ (unsigned char *)from, flen, to, &ul_sig_len);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_RSA_PRIV_ENC_LOW, PK11_R_SIGN);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ pk11_return_session(sp);
++ return -1;
++ }
++
++ retval = ul_sig_len;
++ }
++
++ pk11_return_session(sp);
++ return retval;
++ }
++
++
++/* This function implements RSA private decryption using C_DecryptInit and
++ * C_Decrypt pk11 APIs. Note that CKM_RSA_X_509 mechanism is used here.
++ * The calling function allocated sufficient memory in "to" to store results.
++ */
++static int pk11_RSA_private_decrypt_low(int flen,
++ const unsigned char *from, unsigned char *to, RSA *rsa)
++ {
++ CK_ULONG bytes_decrypted = flen;
++ int retval = -1;
++ CK_RV rv;
++ CK_MECHANISM mech_rsa = {CKM_RSA_X_509, NULL, 0};
++ CK_MECHANISM *p_mech = &mech_rsa;
++ CK_OBJECT_HANDLE h_priv_key;
++ PK11_SESSION *sp;
++ char tmp_buf[20];
++
++ if ((sp = pk11_get_session()) == NULL)
++ return -1;
++
++ check_new_rsa_key(sp, (void *) rsa);
++
++ h_priv_key = sp->rsa_priv_key;
++ if (h_priv_key == CK_INVALID_HANDLE)
++ h_priv_key = sp->rsa_priv_key =
++ pk11_get_private_rsa_key(rsa, sp);
++
++ if (h_priv_key != CK_INVALID_HANDLE)
++ {
++ rv = pFuncList->C_DecryptInit(sp->session, p_mech,
++ h_priv_key);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_RSA_PRIV_DEC_LOW,
++ PK11_R_DECRYPTINIT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ pk11_return_session(sp);
++ return -1;
++ }
++
++ rv = pFuncList->C_Decrypt(sp->session,
++ (unsigned char *)from, flen, to, &bytes_decrypted);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_RSA_PRIV_DEC_LOW, PK11_R_DECRYPT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ pk11_return_session(sp);
++ return -1;
++ }
++ retval = bytes_decrypted;
++ }
++
++ pk11_return_session(sp);
++ return retval;
++ }
++
++
++/* This function implements RSA public decryption using C_VerifyRecoverInit
++ * and C_VerifyRecover pk11 APIs. Note that CKM_RSA_X_509 is used here.
++ * The calling function allocated sufficient memory in "to" to store results.
++ */
++static int pk11_RSA_public_decrypt_low(int flen,
++ const unsigned char *from, unsigned char *to, RSA *rsa)
++ {
++ CK_ULONG bytes_decrypted = flen;
++ int retval = -1;
++ CK_RV rv;
++ CK_MECHANISM mech_rsa = {CKM_RSA_X_509, NULL, 0};
++ CK_MECHANISM *p_mech = &mech_rsa;
++ CK_OBJECT_HANDLE h_pub_key = CK_INVALID_HANDLE;
++ PK11_SESSION *sp;
++ char tmp_buf[20];
++
++ if ((sp = pk11_get_session()) == NULL)
++ return -1;
++
++ check_new_rsa_key(sp, (void *) rsa);
++
++ h_pub_key = sp->rsa_pub_key;
++ if (h_pub_key == CK_INVALID_HANDLE)
++ h_pub_key = sp->rsa_pub_key =
++ pk11_get_public_rsa_key(rsa, sp);
++
++ if (h_pub_key != CK_INVALID_HANDLE)
++ {
++ rv = pFuncList->C_VerifyRecoverInit(sp->session,
++ p_mech, h_pub_key);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_RSA_PUB_DEC_LOW,
++ PK11_R_VERIFYRECOVERINIT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ pk11_return_session(sp);
++ return -1;
++ }
++
++ rv = pFuncList->C_VerifyRecover(sp->session,
++ (unsigned char *)from, flen, to, &bytes_decrypted);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_RSA_PUB_DEC_LOW,
++ PK11_R_VERIFYRECOVER);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ pk11_return_session(sp);
++ return -1;
++ }
++ retval = bytes_decrypted;
++ }
++
++ pk11_return_session(sp);
++ return retval;
++ }
++
++
++static int pk11_RSA_init(RSA *rsa)
++ {
++ /* This flag in the RSA_METHOD enables the new rsa_sign,
++ * rsa_verify functions. See rsa.h for details. */
++ rsa->flags |= RSA_FLAG_SIGN_VER;
++
++ return 1;
++ }
++
++
++static int pk11_RSA_finish(RSA *rsa)
++ {
++ if (rsa->_method_mod_n != NULL)
++ BN_MONT_CTX_free(rsa->_method_mod_n);
++ if (rsa->_method_mod_p != NULL)
++ BN_MONT_CTX_free(rsa->_method_mod_p);
++ if (rsa->_method_mod_q != NULL)
++ BN_MONT_CTX_free(rsa->_method_mod_q);
++
++ return pk11_destroy_rsa_key_objects(NULL);
++ }
++
++
++/* Standard engine interface function. Majority codes here are from
++ * rsa/rsa_sign.c. We replaced the decrypt function call by C_Sign of PKCS#11.
++ * See more details in rsa/rsa_sign.c */
++static int pk11_RSA_sign(int type, const unsigned char *m, unsigned int m_len,
++ unsigned char *sigret, unsigned int *siglen, const RSA *rsa)
++ {
++ X509_SIG sig;
++ ASN1_TYPE parameter;
++ int i,j;
++ unsigned char *p,*s = NULL;
++ X509_ALGOR algor;
++ ASN1_OCTET_STRING digest;
++ CK_RV rv;
++ CK_MECHANISM mech_rsa = {CKM_RSA_PKCS, NULL, 0};
++ CK_MECHANISM *p_mech = &mech_rsa;
++ CK_OBJECT_HANDLE h_priv_key;
++ PK11_SESSION *sp = NULL;
++ int ret = 0;
++ char tmp_buf[20];
++ unsigned long ulsiglen;
++
++ /* Encode the digest */
++ /* Special case: SSL signature, just check the length */
++ if (type == NID_md5_sha1)
++ {
++ if (m_len != SSL_SIG_LENGTH)
++ {
++ PK11err(PK11_F_RSA_SIGN,
++ PK11_R_INVALID_MESSAGE_LENGTH);
++ goto err;
++ }
++ i = SSL_SIG_LENGTH;
++ s = (unsigned char *)m;
++ }
++ else
++ {
++ sig.algor= &algor;
++ sig.algor->algorithm=OBJ_nid2obj(type);
++ if (sig.algor->algorithm == NULL)
++ {
++ PK11err(PK11_F_RSA_SIGN,
++ PK11_R_UNKNOWN_ALGORITHM_TYPE);
++ goto err;
++ }
++ if (sig.algor->algorithm->length == 0)
++ {
++ PK11err(PK11_F_RSA_SIGN,
++ PK11_R_UNKNOWN_ASN1_OBJECT_ID);
++ goto err;
++ }
++ parameter.type=V_ASN1_NULL;
++ parameter.value.ptr=NULL;
++ sig.algor->parameter= &parameter;
++
++ sig.digest= &digest;
++ sig.digest->data=(unsigned char *)m;
++ sig.digest->length=m_len;
++
++ i=i2d_X509_SIG(&sig,NULL);
++ }
++
++ j=RSA_size(rsa);
++ if ((i-RSA_PKCS1_PADDING) > j)
++ {
++ PK11err(PK11_F_RSA_SIGN, PK11_R_DIGEST_TOO_BIG);
++ goto err;
++ }
++
++ if (type != NID_md5_sha1)
++ {
++ s=(unsigned char *)OPENSSL_malloc((unsigned int)j+1);
++ if (s == NULL)
++ {
++ PK11err(PK11_F_RSA_SIGN, PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++ p=s;
++ i2d_X509_SIG(&sig,&p);
++ }
++
++ if ((sp = pk11_get_session()) == NULL)
++ goto err;
++
++ check_new_rsa_key(sp, (void *) rsa);
++
++ h_priv_key = sp->rsa_priv_key;
++ if (h_priv_key == CK_INVALID_HANDLE)
++ h_priv_key = sp->rsa_priv_key =
++ pk11_get_private_rsa_key((RSA *)rsa, sp);
++
++ if (h_priv_key != CK_INVALID_HANDLE)
++ {
++ rv = pFuncList->C_SignInit(sp->session, p_mech, h_priv_key);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_RSA_SIGN, PK11_R_SIGNINIT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ ulsiglen = j;
++ rv = pFuncList->C_Sign(sp->session, s, i, sigret,
++ (CK_ULONG_PTR) &ulsiglen);
++ *siglen = ulsiglen;
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_RSA_SIGN, PK11_R_SIGN);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++ ret = 1;
++ }
++
++err:
++ if (type != NID_md5_sha1)
++ {
++ memset(s,0,(unsigned int)j+1);
++ OPENSSL_free(s);
++ }
++
++ pk11_return_session(sp);
++ return ret;
++ }
++
++static int pk11_RSA_verify(int type, const unsigned char *m,
++ unsigned int m_len, unsigned char *sigbuf, unsigned int siglen,
++ const RSA *rsa)
++ {
++ X509_SIG sig;
++ ASN1_TYPE parameter;
++ int i,j;
++ unsigned char *p,*s = NULL;
++ X509_ALGOR algor;
++ ASN1_OCTET_STRING digest;
++ CK_RV rv;
++ CK_MECHANISM mech_rsa = {CKM_RSA_PKCS, NULL, 0};
++ CK_MECHANISM *p_mech = &mech_rsa;
++ CK_OBJECT_HANDLE h_pub_key;
++ PK11_SESSION *sp = NULL;
++ int ret = 0;
++ char tmp_buf[20];
++
++ /* Encode the digest */
++ /* Special case: SSL signature, just check the length */
++ if (type == NID_md5_sha1)
++ {
++ if (m_len != SSL_SIG_LENGTH)
++ {
++ PK11err(PK11_F_RSA_VERIFY,
++ PK11_R_INVALID_MESSAGE_LENGTH);
++ goto err;
++ }
++ i = SSL_SIG_LENGTH;
++ s = (unsigned char *)m;
++ }
++ else
++ {
++ sig.algor= &algor;
++ sig.algor->algorithm=OBJ_nid2obj(type);
++ if (sig.algor->algorithm == NULL)
++ {
++ PK11err(PK11_F_RSA_VERIFY,
++ PK11_R_UNKNOWN_ALGORITHM_TYPE);
++ goto err;
++ }
++ if (sig.algor->algorithm->length == 0)
++ {
++ PK11err(PK11_F_RSA_VERIFY,
++ PK11_R_UNKNOWN_ASN1_OBJECT_ID);
++ goto err;
++ }
++ parameter.type=V_ASN1_NULL;
++ parameter.value.ptr=NULL;
++ sig.algor->parameter= &parameter;
++ sig.digest= &digest;
++ sig.digest->data=(unsigned char *)m;
++ sig.digest->length=m_len;
++ i=i2d_X509_SIG(&sig,NULL);
++ }
++
++ j=RSA_size(rsa);
++ if ((i-RSA_PKCS1_PADDING) > j)
++ {
++ PK11err(PK11_F_RSA_VERIFY, PK11_R_DIGEST_TOO_BIG);
++ goto err;
++ }
++
++ if (type != NID_md5_sha1)
++ {
++ s=(unsigned char *)OPENSSL_malloc((unsigned int)j+1);
++ if (s == NULL)
++ {
++ PK11err(PK11_F_RSA_VERIFY, PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++ p=s;
++ i2d_X509_SIG(&sig,&p);
++ }
++
++ if ((sp = pk11_get_session()) == NULL)
++ goto err;
++
++ check_new_rsa_key(sp, (void *) rsa);
++
++ h_pub_key = sp->rsa_pub_key;
++ if (h_pub_key == CK_INVALID_HANDLE)
++ h_pub_key = sp->rsa_pub_key =
++ pk11_get_public_rsa_key((RSA *)rsa, sp);
++
++ if (h_pub_key != CK_INVALID_HANDLE)
++ {
++ rv = pFuncList->C_VerifyInit(sp->session, p_mech,
++ h_pub_key);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_RSA_VERIFY, PK11_R_VERIFYINIT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++ rv = pFuncList->C_Verify(sp->session, s, i, sigbuf,
++ (CK_ULONG)siglen);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_RSA_VERIFY, PK11_R_VERIFY);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++ ret = 1;
++ }
++
++err:
++ if (type != NID_md5_sha1)
++ {
++ memset(s,0,(unsigned int)siglen);
++ OPENSSL_free(s);
++ }
++
++ pk11_return_session(sp);
++ return ret;
++ }
++
++static int hndidx_rsa = -1;
++
++struct key_info {
++ CK_OBJECT_HANDLE handle;
++ CK_SESSION_HANDLE session;
++};
++
++/* Destroy the object when the last reference to it has gone.
++ */
++static void hndidx_free(void *obj, void *item, CRYPTO_EX_DATA *ad,
++ int ind, long argl, void *argp)
++{
++ struct key_info *key_info = item;
++ CK_RV rv;
++ char tmp_buf[20];
++
++ if (key_info != NULL)
++ {
++ rv = pFuncList->C_DestroyObject(key_info->session,
++ key_info->handle);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_DESTROY_OBJECT, PK11_R_DESTROYOBJECT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ }
++ free(item);
++ }
++}
++
++EVP_PKEY *pk11_load_privkey(ENGINE* e, const char* privkey_file,
++ UI_METHOD *ui_method, void *callback_data)
++ {
++ EVP_PKEY *pkey=NULL;
++ FILE *privkey;
++ CK_OBJECT_HANDLE h_priv_key = CK_INVALID_HANDLE;
++ RSA *rsa;
++ PK11_SESSION *sp;
++ /* everything else below needed for key by reference extension */
++ char tmp_buf[20];
++ CK_RV rv;
++ CK_ULONG objcnt = 0;
++ CK_BBOOL is_token = TRUE;
++ CK_BYTE attr_data[2][1024];
++ CK_OBJECT_CLASS key_class = CKO_PRIVATE_KEY;
++ CK_OBJECT_HANDLE ks_key = CK_INVALID_HANDLE; /* key in keystore */
++ struct key_info *key_info = NULL;
++ extern char *pk11_pin;
++
++ /* we look for private keys only */
++ CK_ATTRIBUTE search_templ[] =
++ {
++ {CKA_TOKEN, &is_token, sizeof(is_token)},
++ {CKA_CLASS, &key_class, sizeof(key_class)},
++ {CKA_LABEL, NULL, 0}
++ };
++
++ /* these attributes are needed to initialize OpenSSL RSA structure */
++ CK_ATTRIBUTE get_templ[] =
++ {
++ {CKA_MODULUS, (void *)attr_data[0], 1024}, /* n */
++ {CKA_PUBLIC_EXPONENT, (void *)attr_data[1], 1024}, /* e */
++ };
++
++ if ((sp = pk11_get_session()) == NULL)
++ return NULL;
++
++ /*
++ * Use simple scheme "pkcs11:<KEY_LABEL>" for now.
++ */
++ if (strstr(privkey_file, "pkcs11:") == privkey_file)
++ {
++ search_templ[2].pValue = strstr(privkey_file, ":") + 1;
++ search_templ[2].ulValueLen = strlen(search_templ[2].pValue);
++
++ if (pk11_pin == NULL)
++#ifndef OPENCRYPTOKI
++ pk11_pin = getpassphrase("Enter PIN: ");
++#else
++ pk11_pin = getpass("Enter PIN: ");
++#endif
++ if ((rv = pFuncList->C_Login(sp->session, CKU_USER, (CK_UTF8CHAR*)pk11_pin,
++ strlen(pk11_pin))) != CKR_OK && rv != CKR_USER_ALREADY_LOGGED_IN)
++ {
++ fprintf(stderr, "C_Login -> %lx\n", rv);
++ PK11err(PK11_F_LOAD_PRIVKEY, PK11_R_INVALID_PIN);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ CRYPTO_w_lock(CRYPTO_LOCK_PK11_ENGINE);
++ if ((rv = pFuncList->C_FindObjectsInit(sp->session,
++ search_templ, 3)) != CKR_OK)
++ {
++ CRYPTO_w_unlock(CRYPTO_LOCK_PK11_ENGINE);
++ PK11err(PK11_F_LOAD_PRIVKEY, PK11_R_FINDOBJECTSINIT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ rv = pFuncList->C_FindObjects(sp->session, &ks_key, 1, &objcnt);
++ if (rv != CKR_OK)
++ {
++ CRYPTO_w_unlock(CRYPTO_LOCK_PK11_ENGINE);
++ PK11err(PK11_F_LOAD_PRIVKEY, PK11_R_FINDOBJECTS);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ if (objcnt > 1)
++ {
++ CRYPTO_w_unlock(CRYPTO_LOCK_PK11_ENGINE);
++ PK11err(PK11_F_LOAD_PRIVKEY, PK11_R_TOO_MANY_OBJECTS);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lu", objcnt);
++ ERR_add_error_data(2,
++ "PK11 too many objects:", tmp_buf);
++ goto err;
++ }
++
++ if (objcnt != 1)
++ {
++ CRYPTO_w_unlock(CRYPTO_LOCK_PK11_ENGINE);
++ PK11err(PK11_F_LOAD_PRIVKEY, PK11_R_OBJECT_NOT_FOUND);
++ ERR_add_error_data(1, "PK11 object not found");
++ goto err;
++ }
++
++ (void) pFuncList->C_FindObjectsFinal(sp->session);
++ CRYPTO_w_unlock(CRYPTO_LOCK_PK11_ENGINE);
++
++ if (hndidx_rsa == -1)
++ hndidx_rsa = RSA_get_ex_new_index(0,
++ "pkcs11 RSA HSM key handle",
++ NULL, NULL, hndidx_free);
++
++ key_info = malloc(sizeof(struct key_info));
++ if (key_info == NULL)
++ goto err;
++
++ pkey = EVP_PKEY_new();
++ if (pkey == NULL)
++ goto err;
++
++ rsa = RSA_new();
++ if (rsa == NULL) {
++ EVP_PKEY_free(pkey);
++ pkey = NULL;
++ goto err;
++ }
++ EVP_PKEY_set1_RSA(pkey, rsa);
++
++ if ((rv = pFuncList->C_GetAttributeValue(sp->session, ks_key,
++ get_templ, 2)) != CKR_OK)
++ {
++ PK11err(PK11_F_LOAD_PRIVKEY, PK11_R_GETATTRIBUTVALUE);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ EVP_PKEY_free(pkey);
++ pkey = NULL;
++ goto err;
++ }
++
++ /*
++ * Now we have to initialize an OpenSSL RSA structure,
++ * everything else is 0 or NULL.
++ */
++ rsa->meth = &pk11_rsa;
++ rsa->engine = e;
++ rsa->references = 2;
++ rsa->flags = RSA_FLAG_SIGN_VER | RSA_FLAG_EXT_PKEY;
++ key_info->handle = ks_key;
++ key_info->session = sp->session;
++ RSA_set_ex_data(rsa, hndidx_rsa, key_info);
++ key_info = NULL;
++ sp->rsa = rsa;
++ sp->rsa_priv_key = ks_key;
++
++ attr_to_BN(&get_templ[0], attr_data[0], &rsa->n);
++#ifdef OPENCRYPTOKI
++ /* openCryptoki bug workaround */
++ if (get_templ[1].ulValueLen == 0) {
++ get_templ[1].ulValueLen = 1;
++ attr_data[1][0] = 3;
++ }
++#endif
++ attr_to_BN(&get_templ[1], attr_data[1], &rsa->e);
++ }
++ else if ((privkey=fopen(privkey_file,"r")) != NULL)
++ {
++ pkey = PEM_read_PrivateKey(privkey, NULL, NULL, NULL);
++ fclose(privkey);
++ if (pkey)
++ {
++ rsa = EVP_PKEY_get1_RSA(pkey);
++
++ if (rsa)
++ {
++ check_new_rsa_key(sp, (void *) rsa);
++
++ h_priv_key = pk11_get_private_rsa_key(rsa,
++ sp);
++ if (h_priv_key == CK_INVALID_HANDLE)
++ {
++ EVP_PKEY_free(pkey);
++ pkey = NULL;
++ }
++ }
++ else
++ {
++ EVP_PKEY_free(pkey);
++ pkey = NULL;
++ }
++ }
++ }
++
++err:
++ if (key_info != NULL)
++ free(key_info);
++ pk11_return_session(sp);
++ return(pkey);
++ }
++
++EVP_PKEY *pk11_load_pubkey(ENGINE* e, const char* pubkey_file,
++ UI_METHOD *ui_method, void *callback_data)
++ {
++ EVP_PKEY *pkey=NULL;
++ FILE *pubkey;
++ CK_OBJECT_HANDLE h_pub_key = CK_INVALID_HANDLE;
++ RSA *rsa;
++ PK11_SESSION *sp;
++ /* everything else below needed for key by reference extension */
++ char tmp_buf[20];
++ CK_RV rv;
++ CK_ULONG objcnt = 0;
++ CK_BBOOL is_token = TRUE;
++ CK_BYTE attr_data[2][1024];
++ CK_OBJECT_CLASS key_class = CKO_PUBLIC_KEY;
++ CK_OBJECT_HANDLE ks_key = CK_INVALID_HANDLE; /* key in keystore */
++ extern char *pk11_pin;
++
++ /* we look for private keys only */
++ CK_ATTRIBUTE search_templ[] =
++ {
++ {CKA_TOKEN, &is_token, sizeof(is_token)},
++ {CKA_CLASS, &key_class, sizeof(key_class)},
++ {CKA_LABEL, NULL, 0}
++ };
++
++ /* these attributes are needed to initialize OpenSSL RSA structure */
++ CK_ATTRIBUTE get_templ[] =
++ {
++ {CKA_MODULUS, (void *)attr_data[0], 1024}, /* n */
++ {CKA_PUBLIC_EXPONENT, (void *)attr_data[1], 1024}, /* e */
++ };
++
++ if ((sp = pk11_get_session()) == NULL)
++ return NULL;
++
++ /*
++ * Use simple scheme "pkcs11:<KEY_LABEL>" for now.
++ */
++ if (strstr(pubkey_file, "pkcs11:") == pubkey_file)
++ {
++ search_templ[2].pValue = strstr(pubkey_file, ":") + 1;
++ search_templ[2].ulValueLen = strlen(search_templ[2].pValue);
++
++#define ALLWAYS_LOGIN
++#ifdef ALLWAYS_LOGIN
++ if (pk11_pin == NULL)
++#ifndef OPENCRYPTOKI
++ pk11_pin = getpassphrase("Enter PIN: ");
++#else
++ pk11_pin = getpass("Enter PIN: ");
++#endif
++ if ((rv = pFuncList->C_Login(sp->session, CKU_USER, (CK_UTF8CHAR*)pk11_pin,
++ strlen(pk11_pin))) != CKR_OK && rv != CKR_USER_ALREADY_LOGGED_IN)
++ {
++ fprintf(stderr, "C_Login -> %lx\n", rv);
++ PK11err(PK11_F_LOAD_PUBKEY, PK11_R_INVALID_PIN);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++#endif
++
++ CRYPTO_w_lock(CRYPTO_LOCK_PK11_ENGINE);
++ if (pFuncList->C_FindObjectsInit(sp->session, search_templ, 3) != CKR_OK)
++ {
++ CRYPTO_w_unlock(CRYPTO_LOCK_PK11_ENGINE);
++ PK11err(PK11_F_LOAD_PUBKEY, PK11_R_FINDOBJECTSINIT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++ rv = pFuncList->C_FindObjects(sp->session, &ks_key, 1, &objcnt);
++ if (rv != CKR_OK)
++ {
++ CRYPTO_w_unlock(CRYPTO_LOCK_PK11_ENGINE);
++ PK11err(PK11_F_LOAD_PUBKEY, PK11_R_FINDOBJECTS);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ if (objcnt > 1)
++ {
++ CRYPTO_w_unlock(CRYPTO_LOCK_PK11_ENGINE);
++ PK11err(PK11_F_LOAD_PUBKEY, PK11_R_TOO_MANY_OBJECTS);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lu", objcnt);
++ ERR_add_error_data(2,
++ "PK11 too many objects:", tmp_buf);
++ goto err;
++ }
++
++ if (objcnt != 1)
++ {
++ CRYPTO_w_unlock(CRYPTO_LOCK_PK11_ENGINE);
++ PK11err(PK11_F_LOAD_PUBKEY, PK11_R_OBJECT_NOT_FOUND);
++ ERR_add_error_data(1, "PK11 object not found");
++ goto err;
++ }
++
++ (void) pFuncList->C_FindObjectsFinal(sp->session);
++ CRYPTO_w_unlock(CRYPTO_LOCK_PK11_ENGINE);
++
++ sp->rsa_pub_key = ks_key;
++ pkey = malloc(sizeof(EVP_PKEY));
++ bzero(pkey, sizeof(EVP_PKEY));
++ pkey->type = EVP_PKEY_RSA;
++ pkey->references = 1;
++
++ rsa = pkey->pkey.rsa = sp->rsa = malloc(sizeof(RSA));
++ bzero(rsa, sizeof(RSA));
++
++ if (pFuncList->C_GetAttributeValue(sp->session, ks_key,
++ get_templ, 3) != CKR_OK)
++ {
++ PK11err(PK11_F_LOAD_PUBKEY, PK11_R_GETATTRIBUTVALUE);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ /*
++ * Now we have to initialize an OpenSSL RSA structure,
++ * everything else is 0 or NULL.
++ */
++ rsa->meth = &pk11_rsa;
++ rsa->engine = e;
++ rsa->references = 2;
++ rsa->flags = RSA_FLAG_SIGN_VER;
++
++ attr_to_BN(&get_templ[0], attr_data[0], &rsa->n);
++ attr_to_BN(&get_templ[1], attr_data[1], &rsa->e);
++ }
++ else if ((pubkey=fopen(pubkey_file,"r")) != NULL)
++ {
++ pkey = PEM_read_PUBKEY(pubkey, NULL, NULL, NULL);
++ fclose(pubkey);
++ if (pkey)
++ {
++ rsa = EVP_PKEY_get1_RSA(pkey);
++ if (rsa)
++ {
++ check_new_rsa_key(sp, (void *) rsa);
++
++ h_pub_key = pk11_get_public_rsa_key(rsa, sp);
++ if (h_pub_key == CK_INVALID_HANDLE)
++ {
++ EVP_PKEY_free(pkey);
++ pkey = NULL;
++ }
++ }
++ else
++ {
++ EVP_PKEY_free(pkey);
++ pkey = NULL;
++ }
++ }
++ }
++
++err:
++ pk11_return_session(sp);
++ return(pkey);
++ }
++
++/* Create a public key object in a session from a given rsa structure.
++ */
++static CK_OBJECT_HANDLE pk11_get_public_rsa_key(RSA* rsa, PK11_SESSION *sp)
++ {
++ CK_RV rv;
++ CK_OBJECT_HANDLE h_key = CK_INVALID_HANDLE;
++ CK_ULONG found;
++ CK_OBJECT_CLASS o_key = CKO_PUBLIC_KEY;
++ CK_KEY_TYPE k_type = CKK_RSA;
++ CK_ULONG ul_key_attr_count = 7;
++ char tmp_buf[20];
++
++ CK_ATTRIBUTE a_key_template[] =
++ {
++ {CKA_CLASS, (void *) NULL, sizeof(CK_OBJECT_CLASS)},
++ {CKA_KEY_TYPE, (void *) NULL, sizeof(CK_KEY_TYPE)},
++ {CKA_TOKEN, &false, sizeof(true)},
++ {CKA_ENCRYPT, &true, sizeof(true)},
++ {CKA_VERIFY_RECOVER, &true, sizeof(true)},
++ {CKA_MODULUS, (void *)NULL, 0},
++ {CKA_PUBLIC_EXPONENT, (void *)NULL, 0}
++ };
++
++ int i;
++ CK_SESSION_HANDLE session = sp->session;
++
++ a_key_template[0].pValue = &o_key;
++ a_key_template[1].pValue = &k_type;
++
++ a_key_template[5].ulValueLen = BN_num_bytes(rsa->n);
++ a_key_template[5].pValue = (CK_VOID_PTR)OPENSSL_malloc(
++ (size_t)a_key_template[5].ulValueLen);
++ if (a_key_template[5].pValue == NULL)
++ {
++ PK11err(PK11_F_GET_PUB_RSA_KEY, PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++
++ BN_bn2bin(rsa->n, a_key_template[5].pValue);
++
++ a_key_template[6].ulValueLen = BN_num_bytes(rsa->e);
++ a_key_template[6].pValue = (CK_VOID_PTR)OPENSSL_malloc(
++ (size_t)a_key_template[6].ulValueLen);
++ if (a_key_template[6].pValue == NULL)
++ {
++ PK11err(PK11_F_GET_PUB_RSA_KEY, PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++
++ BN_bn2bin(rsa->e, a_key_template[6].pValue);
++
++ rv = pFuncList->C_FindObjectsInit(session, a_key_template,
++ ul_key_attr_count);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_PUB_RSA_KEY, PK11_R_FINDOBJECTSINIT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ rv = pFuncList->C_FindObjects(session, &h_key, 1, &found);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_PUB_RSA_KEY, PK11_R_FINDOBJECTS);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ rv = pFuncList->C_FindObjectsFinal(session);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_PUB_RSA_KEY, PK11_R_FINDOBJECTSFINAL);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ if (found == 0)
++ {
++ rv = pFuncList->C_CreateObject(session,
++ a_key_template, ul_key_attr_count, &h_key);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_PUB_RSA_KEY,
++ PK11_R_CREATEOBJECT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++ }
++
++ sp->rsa = rsa;
++
++ err:
++ for (i = 5; i <= 6; i++)
++ {
++ if (a_key_template[i].pValue != NULL)
++ {
++ OPENSSL_free(a_key_template[i].pValue);
++ a_key_template[i].pValue = NULL;
++ }
++ }
++
++ return h_key;
++
++ }
++
++/* Create a private key object in the session from a given rsa structure
++ */
++static CK_OBJECT_HANDLE pk11_get_private_rsa_key(RSA* rsa, PK11_SESSION *sp)
++ {
++ CK_RV rv;
++ CK_OBJECT_HANDLE h_key = CK_INVALID_HANDLE;
++ int i;
++ CK_ULONG found;
++ CK_OBJECT_CLASS o_key = CKO_PRIVATE_KEY;
++ CK_KEY_TYPE k_type = CKK_RSA;
++ CK_ULONG ul_key_attr_count = 14;
++ char tmp_buf[20];
++
++ /* Both CKA_TOKEN and CKA_SENSITIVE have to be FALSE for session keys
++ */
++ CK_ATTRIBUTE a_key_template[] =
++ {
++ {CKA_CLASS, (void *) NULL, sizeof(CK_OBJECT_CLASS)},
++ {CKA_KEY_TYPE, (void *) NULL, sizeof(CK_KEY_TYPE)},
++ {CKA_TOKEN, &false, sizeof(true)},
++ {CKA_SENSITIVE, &false, sizeof(true)},
++ {CKA_DECRYPT, &true, sizeof(true)},
++ {CKA_SIGN, &true, sizeof(true)},
++ {CKA_MODULUS, (void *)NULL, 0},
++ {CKA_PUBLIC_EXPONENT, (void *)NULL, 0},
++ {CKA_PRIVATE_EXPONENT, (void *)NULL, 0},
++ {CKA_PRIME_1, (void *)NULL, 0},
++ {CKA_PRIME_2, (void *)NULL, 0},
++ {CKA_EXPONENT_1, (void *)NULL, 0},
++ {CKA_EXPONENT_2, (void *)NULL, 0},
++ {CKA_COEFFICIENT, (void *)NULL, 0}
++ };
++ CK_SESSION_HANDLE session = sp->session;
++
++ if ((rsa->flags & RSA_FLAG_EXT_PKEY) != 0) {
++ sp->rsa = rsa;
++ return (*(CK_OBJECT_HANDLE_PTR)RSA_get_ex_data(rsa, hndidx_rsa));
++ }
++
++ a_key_template[0].pValue = &o_key;
++ a_key_template[1].pValue = &k_type;
++
++ /* Put the private key components into the template */
++ if (init_template_value(rsa->n, &a_key_template[6].pValue,
++ &a_key_template[6].ulValueLen) == 0 ||
++ init_template_value(rsa->e, &a_key_template[7].pValue,
++ &a_key_template[7].ulValueLen) == 0 ||
++ init_template_value(rsa->d, &a_key_template[8].pValue,
++ &a_key_template[8].ulValueLen) == 0 ||
++ init_template_value(rsa->p, &a_key_template[9].pValue,
++ &a_key_template[9].ulValueLen) == 0 ||
++ init_template_value(rsa->q, &a_key_template[10].pValue,
++ &a_key_template[10].ulValueLen) == 0 ||
++ init_template_value(rsa->dmp1, &a_key_template[11].pValue,
++ &a_key_template[11].ulValueLen) == 0 ||
++ init_template_value(rsa->dmq1, &a_key_template[12].pValue,
++ &a_key_template[12].ulValueLen) == 0 ||
++ init_template_value(rsa->iqmp, &a_key_template[13].pValue,
++ &a_key_template[13].ulValueLen) == 0)
++ {
++ PK11err(PK11_F_GET_PRIV_RSA_KEY, PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++
++ rv = pFuncList->C_FindObjectsInit(session, a_key_template,
++ ul_key_attr_count);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_PRIV_RSA_KEY, PK11_R_FINDOBJECTSINIT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ rv = pFuncList->C_FindObjects(session, &h_key, 1, &found);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_PRIV_RSA_KEY, PK11_R_FINDOBJECTS);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ rv = pFuncList->C_FindObjectsFinal(session);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_PRIV_RSA_KEY, PK11_R_FINDOBJECTSFINAL);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ if (found == 0)
++ {
++ rv = pFuncList->C_CreateObject(session,
++ a_key_template, ul_key_attr_count, &h_key);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_PRIV_RSA_KEY,
++ PK11_R_CREATEOBJECT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++ }
++
++ sp->rsa = rsa;
++
++ err:
++ /* 6 to 13 entries in the key template are key components
++ * They need to be freed apon exit or error.
++ */
++ for (i = 6; i <= 13; i++)
++ {
++ if (a_key_template[i].pValue != NULL)
++ {
++ memset(a_key_template[i].pValue, 0,
++ a_key_template[i].ulValueLen);
++ OPENSSL_free(a_key_template[i].pValue);
++ a_key_template[i].pValue = NULL;
++ }
++ }
++
++ return h_key;
++ }
++
++#endif
++
++
++#ifndef OPENSSL_NO_DSA
++/* The DSA function implementation
++ */
++static int pk11_DSA_init(DSA *dsa)
++ {
++ return 1;
++ }
++
++
++static int pk11_DSA_finish(DSA *dsa)
++ {
++ return pk11_destroy_dsa_key_objects(NULL);
++ }
++
++
++static DSA_SIG *
++pk11_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
++ {
++ BIGNUM *r = NULL, *s = NULL;
++ int i;
++ DSA_SIG *dsa_sig = NULL;
++
++ CK_RV rv;
++ CK_MECHANISM Mechanism_dsa = {CKM_DSA, NULL, 0};
++ CK_MECHANISM *p_mech = &Mechanism_dsa;
++ CK_OBJECT_HANDLE h_priv_key;
++
++ /* The signature is the concatenation of r and s,
++ * each is 20 bytes long
++ */
++ unsigned char sigret[DSA_SIGNATURE_LEN];
++ unsigned long siglen = DSA_SIGNATURE_LEN;
++ unsigned int siglen2 = DSA_SIGNATURE_LEN / 2;
++
++ PK11_SESSION *sp = NULL;
++ char tmp_buf[20];
++
++ if ((dsa->p == NULL) || (dsa->q == NULL) || (dsa->g == NULL))
++ {
++ PK11err(PK11_F_DSA_SIGN, PK11_R_MISSING_KEY_COMPONENT);
++ goto ret;
++ }
++
++ i=BN_num_bytes(dsa->q); /* should be 20 */
++ if (dlen > i)
++ {
++ PK11err(PK11_F_DSA_SIGN, PK11_R_INVALID_SIGNATURE_LENGTH);
++ goto ret;
++ }
++
++ if ((sp = pk11_get_session()) == NULL)
++ goto ret;
++
++ check_new_dsa_key(sp, (void *) dsa);
++
++ h_priv_key = sp->dsa_priv_key;
++ if (h_priv_key == CK_INVALID_HANDLE)
++ h_priv_key = sp->dsa_priv_key =
++ pk11_get_private_dsa_key((DSA *)dsa, sp);
++
++ if (h_priv_key != CK_INVALID_HANDLE)
++ {
++ rv = pFuncList->C_SignInit(sp->session, p_mech, h_priv_key);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_DSA_SIGN, PK11_R_SIGNINIT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto ret;
++ }
++
++ memset(sigret, 0, siglen);
++ rv = pFuncList->C_Sign(sp->session,
++ (unsigned char*) dgst, dlen, sigret,
++ (CK_ULONG_PTR) &siglen);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_DSA_SIGN, PK11_R_SIGN);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto ret;
++ }
++ }
++
++
++ if ((s = BN_new()) == NULL)
++ {
++ PK11err(PK11_F_DSA_SIGN, PK11_R_MALLOC_FAILURE);
++ goto ret;
++ }
++
++ if ((r = BN_new()) == NULL)
++ {
++ PK11err(PK11_F_DSA_SIGN, PK11_R_MALLOC_FAILURE);
++ goto ret;
++ }
++
++ if ((dsa_sig = DSA_SIG_new()) == NULL)
++ {
++ PK11err(PK11_F_DSA_SIGN, PK11_R_MALLOC_FAILURE);
++ goto ret;
++ }
++
++ BN_bin2bn(sigret, siglen2, r);
++ BN_bin2bn(&sigret[siglen2], siglen2, s);
++
++ dsa_sig->r = r;
++ dsa_sig->s = s;
++
++ret:
++ if (dsa_sig == NULL)
++ {
++ if (r != NULL)
++ BN_free(r);
++ if (s != NULL)
++ BN_free(s);
++ }
++
++ pk11_return_session(sp);
++ return (dsa_sig);
++ }
++
++static int
++pk11_dsa_do_verify(const unsigned char *dgst, int dlen, DSA_SIG *sig,
++ DSA *dsa)
++ {
++ int i;
++ CK_RV rv;
++ int retval = 0;
++ CK_MECHANISM Mechanism_dsa = {CKM_DSA, NULL, 0};
++ CK_MECHANISM *p_mech = &Mechanism_dsa;
++ CK_OBJECT_HANDLE h_pub_key;
++
++ unsigned char sigbuf[DSA_SIGNATURE_LEN];
++ unsigned long siglen = DSA_SIGNATURE_LEN;
++ unsigned long siglen2 = DSA_SIGNATURE_LEN/2;
++
++ PK11_SESSION *sp = NULL;
++ char tmp_buf[20];
++
++ if (BN_is_zero(sig->r) || sig->r->neg || BN_ucmp(sig->r, dsa->q) >= 0)
++ {
++ PK11err(PK11_F_DSA_VERIFY,
++ PK11_R_INVALID_DSA_SIGNATURE_R);
++ goto ret;
++ }
++
++ if (BN_is_zero(sig->s) || sig->s->neg || BN_ucmp(sig->s, dsa->q) >= 0)
++ {
++ PK11err(PK11_F_DSA_VERIFY,
++ PK11_R_INVALID_DSA_SIGNATURE_S);
++ goto ret;
++ }
++
++ i = BN_num_bytes(dsa->q); /* should be 20 */
++
++ if (dlen > i)
++ {
++ PK11err(PK11_F_DSA_VERIFY,
++ PK11_R_INVALID_SIGNATURE_LENGTH);
++ goto ret;
++ }
++
++ if ((sp = pk11_get_session()) == NULL)
++ goto ret;
++
++ check_new_dsa_key(sp, (void *) dsa);
++
++ h_pub_key = sp->dsa_pub_key;
++ if (h_pub_key == CK_INVALID_HANDLE)
++ h_pub_key = sp->dsa_pub_key =
++ pk11_get_public_dsa_key((DSA *)dsa, sp);
++
++ if (h_pub_key != CK_INVALID_HANDLE)
++ {
++ rv = pFuncList->C_VerifyInit(sp->session, p_mech,
++ h_pub_key);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_DSA_VERIFY, PK11_R_VERIFYINIT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto ret;
++ }
++
++ memset(sigbuf, 0, siglen);
++ BN_bn2bin(sig->r, sigbuf);
++ BN_bn2bin(sig->s, &sigbuf[siglen2]);
++
++ rv = pFuncList->C_Verify(sp->session,
++ (unsigned char *) dgst, dlen, sigbuf, (CK_ULONG)siglen);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_DSA_VERIFY, PK11_R_VERIFY);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto ret;
++ }
++ }
++
++ retval = 1;
++ret:
++
++ pk11_return_session(sp);
++ return retval;
++ }
++
++
++/* Create a public key object in a session from a given dsa structure.
++ */
++static CK_OBJECT_HANDLE pk11_get_public_dsa_key(DSA* dsa, PK11_SESSION *sp)
++ {
++ CK_RV rv;
++ CK_OBJECT_CLASS o_key = CKO_PUBLIC_KEY;
++ CK_OBJECT_HANDLE h_key = CK_INVALID_HANDLE;
++ CK_ULONG found;
++ CK_KEY_TYPE k_type = CKK_DSA;
++ CK_ULONG ul_key_attr_count = 8;
++ int i;
++ char tmp_buf[20];
++
++ CK_ATTRIBUTE a_key_template[] =
++ {
++ {CKA_CLASS, (void *) NULL, sizeof(CK_OBJECT_CLASS)},
++ {CKA_KEY_TYPE, (void *) NULL, sizeof(CK_KEY_TYPE)},
++ {CKA_TOKEN, &false, sizeof(true)},
++ {CKA_VERIFY, &true, sizeof(true)},
++ {CKA_PRIME, (void *)NULL, 0}, /* p */
++ {CKA_SUBPRIME, (void *)NULL, 0}, /* q */
++ {CKA_BASE, (void *)NULL, 0}, /* g */
++ {CKA_VALUE, (void *)NULL, 0} /* pub_key - y */
++ };
++ CK_SESSION_HANDLE session = sp->session;
++
++ a_key_template[0].pValue = &o_key;
++ a_key_template[1].pValue = &k_type;
++
++ if (init_template_value(dsa->p, &a_key_template[4].pValue,
++ &a_key_template[4].ulValueLen) == 0 ||
++ init_template_value(dsa->q, &a_key_template[5].pValue,
++ &a_key_template[5].ulValueLen) == 0 ||
++ init_template_value(dsa->g, &a_key_template[6].pValue,
++ &a_key_template[6].ulValueLen) == 0 ||
++ init_template_value(dsa->pub_key, &a_key_template[7].pValue,
++ &a_key_template[7].ulValueLen) == 0)
++ {
++ PK11err(PK11_F_GET_PUB_DSA_KEY, PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++
++ rv = pFuncList->C_FindObjectsInit(session, a_key_template,
++ ul_key_attr_count);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_PUB_DSA_KEY, PK11_R_FINDOBJECTSINIT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ rv = pFuncList->C_FindObjects(session, &h_key, 1, &found);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_PUB_DSA_KEY, PK11_R_FINDOBJECTS);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ rv = pFuncList->C_FindObjectsFinal(session);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_PUB_DSA_KEY, PK11_R_FINDOBJECTSFINAL);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ if (found == 0)
++ {
++ rv = pFuncList->C_CreateObject(session,
++ a_key_template, ul_key_attr_count, &h_key);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_PUB_DSA_KEY,
++ PK11_R_CREATEOBJECT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++ }
++
++ sp->dsa = dsa;
++
++ err:
++ for (i = 4; i <= 7; i++)
++ {
++ if (a_key_template[i].pValue != NULL)
++ {
++ OPENSSL_free(a_key_template[i].pValue);
++ a_key_template[i].pValue = NULL;
++ }
++ }
++
++ return h_key;
++
++ }
++
++/* Create a private key object in the session from a given dsa structure
++ */
++static CK_OBJECT_HANDLE pk11_get_private_dsa_key(DSA* dsa, PK11_SESSION *sp)
++ {
++ CK_RV rv;
++ CK_OBJECT_HANDLE h_key = CK_INVALID_HANDLE;
++ CK_OBJECT_CLASS o_key = CKO_PRIVATE_KEY;
++ int i;
++ char tmp_buf[20];
++ CK_ULONG found;
++ CK_KEY_TYPE k_type = CKK_DSA;
++ CK_ULONG ul_key_attr_count = 9;
++
++ /* Both CKA_TOKEN and CKA_SENSITIVE have to be FALSE for session keys
++ */
++ CK_ATTRIBUTE a_key_template[] =
++ {
++ {CKA_CLASS, (void *) NULL, sizeof(CK_OBJECT_CLASS)},
++ {CKA_KEY_TYPE, (void *) NULL, sizeof(CK_KEY_TYPE)},
++ {CKA_TOKEN, &false, sizeof(true)},
++ {CKA_SENSITIVE, &false, sizeof(true)},
++ {CKA_SIGN, &true, sizeof(true)},
++ {CKA_PRIME, (void *)NULL, 0}, /* p */
++ {CKA_SUBPRIME, (void *)NULL, 0}, /* q */
++ {CKA_BASE, (void *)NULL, 0}, /* g */
++ {CKA_VALUE, (void *)NULL, 0} /* priv_key - x */
++ };
++ CK_SESSION_HANDLE session = sp->session;
++
++ a_key_template[0].pValue = &o_key;
++ a_key_template[1].pValue = &k_type;
++
++ /* Put the private key components into the template
++ */
++ if (init_template_value(dsa->p, &a_key_template[5].pValue,
++ &a_key_template[5].ulValueLen) == 0 ||
++ init_template_value(dsa->q, &a_key_template[6].pValue,
++ &a_key_template[6].ulValueLen) == 0 ||
++ init_template_value(dsa->g, &a_key_template[7].pValue,
++ &a_key_template[7].ulValueLen) == 0 ||
++ init_template_value(dsa->priv_key, &a_key_template[8].pValue,
++ &a_key_template[8].ulValueLen) == 0)
++ {
++ PK11err(PK11_F_GET_PRIV_DSA_KEY, PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++
++ rv = pFuncList->C_FindObjectsInit(session, a_key_template,
++ ul_key_attr_count);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_PRIV_DSA_KEY, PK11_R_FINDOBJECTSINIT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ rv = pFuncList->C_FindObjects(session, &h_key, 1, &found);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_PRIV_DSA_KEY, PK11_R_FINDOBJECTS);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ rv = pFuncList->C_FindObjectsFinal(session);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_PRIV_DSA_KEY, PK11_R_FINDOBJECTSFINAL);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ if (found == 0)
++ {
++ rv = pFuncList->C_CreateObject(session,
++ a_key_template, ul_key_attr_count, &h_key);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_PRIV_DSA_KEY,
++ PK11_R_CREATEOBJECT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++ }
++
++ sp->dsa = dsa;
++
++err:
++ /* 5 to 8 entries in the key template are key components
++ * They need to be freed apon exit or error.
++ */
++ for (i = 5; i <= 8; i++)
++ {
++ if (a_key_template[i].pValue != NULL)
++ {
++ memset(a_key_template[i].pValue, 0,
++ a_key_template[i].ulValueLen);
++ OPENSSL_free(a_key_template[i].pValue);
++ a_key_template[i].pValue = NULL;
++ }
++ }
++
++ return h_key;
++
++ }
++#endif
++
++
++#ifndef OPENSSL_NO_DH
++
++/* The DH function implementation
++ */
++static int pk11_DH_init(DH *dh)
++ {
++ return 1;
++ }
++
++
++static int pk11_DH_finish(DH *dh)
++ {
++ return pk11_destroy_dh_key_objects(NULL);
++ }
++
++static int pk11_DH_generate_key(DH *dh)
++ {
++ CK_ULONG i;
++ CK_RV rv, rv1;
++ int ret = 0;
++ PK11_SESSION *sp = NULL;
++ char tmp_buf[20];
++ CK_BYTE_PTR reuse_mem;
++
++ CK_MECHANISM mechanism = {CKM_DH_PKCS_KEY_PAIR_GEN, NULL_PTR, 0};
++ CK_OBJECT_HANDLE h_pub_key = CK_INVALID_HANDLE;
++ CK_OBJECT_HANDLE h_priv_key = CK_INVALID_HANDLE;
++
++ CK_ULONG ul_pub_key_attr_count = 3;
++ CK_ATTRIBUTE pub_key_template[] =
++ {
++ {CKA_PRIVATE, &false, sizeof(false)},
++ {CKA_PRIME, (void *)NULL, 0},
++ {CKA_BASE, (void *)NULL, 0}
++ };
++
++ CK_ULONG ul_priv_key_attr_count = 3;
++ CK_ATTRIBUTE priv_key_template[] =
++ {
++ {CKA_PRIVATE, &false, sizeof(false)},
++ {CKA_SENSITIVE, &false, sizeof(false)},
++ {CKA_DERIVE, &true, sizeof(true)}
++ };
++
++ CK_ULONG pub_key_attr_result_count = 1;
++ CK_ATTRIBUTE pub_key_result[] =
++ {
++ {CKA_VALUE, (void *)NULL, 0}
++ };
++
++ CK_ULONG priv_key_attr_result_count = 1;
++ CK_ATTRIBUTE priv_key_result[] =
++ {
++ {CKA_VALUE, (void *)NULL, 0}
++ };
++
++ pub_key_template[1].ulValueLen = BN_num_bytes(dh->p);
++ if (pub_key_template[1].ulValueLen > 0)
++ {
++ pub_key_template[1].pValue =
++ OPENSSL_malloc(pub_key_template[1].ulValueLen);
++ if (pub_key_template[1].pValue == NULL)
++ {
++ PK11err(PK11_F_DH_GEN_KEY, PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++
++ i = BN_bn2bin(dh->p, pub_key_template[1].pValue);
++ }
++ else
++ goto err;
++
++ pub_key_template[2].ulValueLen = BN_num_bytes(dh->g);
++ if (pub_key_template[2].ulValueLen > 0)
++ {
++ pub_key_template[2].pValue =
++ OPENSSL_malloc(pub_key_template[2].ulValueLen);
++ if (pub_key_template[2].pValue == NULL)
++ {
++ PK11err(PK11_F_DH_GEN_KEY, PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++
++ i = BN_bn2bin(dh->g, pub_key_template[2].pValue);
++ }
++ else
++ goto err;
++
++ if ((sp = pk11_get_session()) == NULL)
++ goto err;
++
++ rv = pFuncList->C_GenerateKeyPair(sp->session,
++ &mechanism,
++ pub_key_template,
++ ul_pub_key_attr_count,
++ priv_key_template,
++ ul_priv_key_attr_count,
++ &h_pub_key,
++ &h_priv_key);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_DH_GEN_KEY, PK11_R_GEN_KEY);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ /* Reuse the larger memory allocated. We know the larger memory
++ * is sufficient for reuse */
++ if (pub_key_template[1].ulValueLen > pub_key_template[2].ulValueLen)
++ reuse_mem = pub_key_template[1].pValue;
++ else
++ reuse_mem = pub_key_template[2].pValue;
++
++ rv = pFuncList->C_GetAttributeValue(sp->session, h_pub_key,
++ pub_key_result, pub_key_attr_result_count);
++ rv1 = pFuncList->C_GetAttributeValue(sp->session, h_priv_key,
++ priv_key_result, priv_key_attr_result_count);
++
++ if (rv != CKR_OK || rv1 != CKR_OK)
++ {
++ rv = (rv != CKR_OK) ? rv : rv1;
++ PK11err(PK11_F_DH_GEN_KEY, PK11_R_GETATTRIBUTVALUE);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ if (((CK_LONG) pub_key_result[0].ulValueLen) <= 0 ||
++ ((CK_LONG) priv_key_result[0].ulValueLen) <= 0)
++ {
++ PK11err(PK11_F_DH_GEN_KEY, PK11_R_GETATTRIBUTVALUE);
++ goto err;
++ }
++
++ /* Reuse the memory allocated */
++ pub_key_result[0].pValue = reuse_mem;
++
++ rv = pFuncList->C_GetAttributeValue(sp->session, h_pub_key,
++ pub_key_result, pub_key_attr_result_count);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_DH_GEN_KEY, PK11_R_GETATTRIBUTVALUE);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ if (pub_key_result[0].type == CKA_VALUE)
++ {
++ if (dh->pub_key == NULL)
++ dh->pub_key = BN_new();
++ dh->pub_key = BN_bin2bn(pub_key_result[0].pValue,
++ pub_key_result[0].ulValueLen, dh->pub_key);
++ }
++
++ /* Reuse the memory allocated */
++ priv_key_result[0].pValue = reuse_mem;
++
++ rv = pFuncList->C_GetAttributeValue(sp->session, h_priv_key,
++ priv_key_result, priv_key_attr_result_count);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_DH_GEN_KEY, PK11_R_GETATTRIBUTVALUE);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ if (priv_key_result[0].type == CKA_VALUE)
++ {
++ if (dh->priv_key == NULL)
++ dh->priv_key = BN_new();
++ dh->priv_key = BN_bin2bn(priv_key_result[0].pValue,
++ priv_key_result[0].ulValueLen, dh->priv_key);
++ }
++
++ ret = 1;
++
++err:
++
++ if (h_pub_key != CK_INVALID_HANDLE)
++ {
++ rv = pFuncList->C_DestroyObject(sp->session, h_pub_key);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_DH_GEN_KEY, PK11_R_DESTROYOBJECT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ }
++ }
++
++ if (h_priv_key != CK_INVALID_HANDLE)
++ {
++ rv = pFuncList->C_DestroyObject(sp->session, h_priv_key);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_DH_GEN_KEY, PK11_R_DESTROYOBJECT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ }
++ }
++
++ for (i = 1; i <= 2; i++)
++ {
++ if (pub_key_template[i].pValue != NULL)
++ {
++ OPENSSL_free(pub_key_template[i].pValue);
++ pub_key_template[i].pValue = NULL;
++ }
++ }
++
++ pk11_return_session(sp);
++ return ret;
++ }
++
++static int pk11_DH_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh)
++ {
++ int i;
++ CK_MECHANISM mechanism = {CKM_DH_PKCS_DERIVE, NULL_PTR, 0};
++ CK_OBJECT_CLASS key_class = CKO_SECRET_KEY;
++ CK_KEY_TYPE key_type = CKK_GENERIC_SECRET;
++ CK_OBJECT_HANDLE h_derived_key = CK_INVALID_HANDLE;
++ CK_OBJECT_HANDLE h_key = CK_INVALID_HANDLE;
++
++ CK_ULONG ul_priv_key_attr_count = 2;
++ CK_ATTRIBUTE priv_key_template[] =
++ {
++ {CKA_CLASS, (void*) NULL, sizeof(key_class)},
++ {CKA_KEY_TYPE, (void*) NULL, sizeof(key_type)},
++ };
++
++ CK_ULONG priv_key_attr_result_count = 1;
++ CK_ATTRIBUTE priv_key_result[] =
++ {
++ {CKA_VALUE, (void *)NULL, 0}
++ };
++
++ CK_RV rv;
++ int ret = 0;
++ PK11_SESSION *sp = NULL;
++ char tmp_buf[20];
++
++ priv_key_template[0].pValue = &key_class;
++ priv_key_template[1].pValue = &key_type;
++
++ if ((sp = pk11_get_session()) == NULL)
++ goto err;
++
++ mechanism.ulParameterLen = BN_num_bytes(pub_key);
++ mechanism.pParameter = OPENSSL_malloc(mechanism.ulParameterLen);
++ if (mechanism.pParameter == NULL)
++ {
++ PK11err(PK11_F_DH_COMP_KEY, PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++ BN_bn2bin(pub_key, mechanism.pParameter);
++
++ check_new_dh_key(sp, dh);
++
++ h_key = sp->dh_key;
++ if (h_key == CK_INVALID_HANDLE)
++ h_key = sp->dh_key = pk11_get_dh_key((DH*) dh, sp);
++
++ if (h_key == CK_INVALID_HANDLE)
++ {
++ PK11err(PK11_F_DH_COMP_KEY, PK11_R_CREATEOBJECT);
++ goto err;
++ }
++
++ rv = pFuncList->C_DeriveKey(sp->session,
++ &mechanism,
++ h_key,
++ priv_key_template,
++ ul_priv_key_attr_count,
++ &h_derived_key);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_DH_COMP_KEY, PK11_R_DERIVEKEY);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ rv = pFuncList->C_GetAttributeValue(sp->session, h_derived_key,
++ priv_key_result, priv_key_attr_result_count);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_DH_COMP_KEY, PK11_R_GETATTRIBUTVALUE);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ if (((CK_LONG) priv_key_result[0].ulValueLen) <= 0)
++ {
++ PK11err(PK11_F_DH_COMP_KEY, PK11_R_GETATTRIBUTVALUE);
++ goto err;
++ }
++ priv_key_result[0].pValue =
++ OPENSSL_malloc(priv_key_result[0].ulValueLen);
++ if (!priv_key_result[0].pValue)
++ {
++ PK11err(PK11_F_DH_COMP_KEY, PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++
++ rv = pFuncList->C_GetAttributeValue(sp->session, h_derived_key,
++ priv_key_result, priv_key_attr_result_count);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_DH_COMP_KEY, PK11_R_GETATTRIBUTVALUE);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ /* OpenSSL allocates the output buffer 'key' which is the same
++ * length of the public key. It is long enough for the derived key */
++ if (priv_key_result[0].type == CKA_VALUE)
++ {
++ /* CKM_DH_PKCS_DERIVE mechanism is not supposed to strip
++ * leading zeros from a computed shared secret. However,
++ * OpenSSL always did it so we must do the same here. The
++ * vagueness of the spec regarding leading zero bytes was
++ * finally cleared with TLS 1.1 (RFC 4346) saying that leading
++ * zeros are stripped before the computed data is used as the
++ * pre-master secret.
++ */
++ for (i = 0; i < priv_key_result[0].ulValueLen; ++i)
++ {
++ if (((char *) priv_key_result[0].pValue)[i] != 0)
++ break;
++ }
++
++ memcpy(key, ((char *) priv_key_result[0].pValue) + i,
++ priv_key_result[0].ulValueLen - i);
++ ret = priv_key_result[0].ulValueLen - i;
++ }
++
++err:
++
++ if (h_derived_key != CK_INVALID_HANDLE)
++ {
++ rv = pFuncList->C_DestroyObject(sp->session, h_derived_key);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_DH_COMP_KEY, PK11_R_DESTROYOBJECT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ }
++ }
++ if (priv_key_result[0].pValue)
++ {
++ OPENSSL_free(priv_key_result[0].pValue);
++ priv_key_result[0].pValue = NULL;
++ }
++
++ if (mechanism.pParameter)
++ {
++ OPENSSL_free(mechanism.pParameter);
++ mechanism.pParameter = NULL;
++ }
++
++ pk11_return_session(sp);
++ return ret;
++ }
++
++
++static CK_OBJECT_HANDLE pk11_get_dh_key(DH* dh, PK11_SESSION *sp)
++ {
++ CK_RV rv;
++ CK_OBJECT_HANDLE h_key = CK_INVALID_HANDLE;
++ CK_OBJECT_CLASS class = CKO_PRIVATE_KEY;
++ CK_KEY_TYPE key_type = CKK_DH;
++ CK_ULONG found;
++ int i;
++ char tmp_buf[20];
++
++ CK_ULONG ul_key_attr_count = 7;
++ CK_ATTRIBUTE key_template[] =
++ {
++ {CKA_CLASS, (void*) NULL, sizeof(class)},
++ {CKA_KEY_TYPE, (void*) NULL, sizeof(key_type)},
++ {CKA_DERIVE, &true, sizeof(true)},
++ {CKA_PRIVATE, &false, sizeof(false)},
++ {CKA_PRIME, (void *) NULL, 0},
++ {CKA_BASE, (void *) NULL, 0},
++ {CKA_VALUE, (void *) NULL, 0},
++ };
++
++ CK_SESSION_HANDLE session = sp->session;
++
++ key_template[0].pValue = &class;
++ key_template[1].pValue = &key_type;
++
++ key_template[4].ulValueLen = BN_num_bytes(dh->p);
++ key_template[4].pValue = (CK_VOID_PTR)OPENSSL_malloc(
++ (size_t)key_template[4].ulValueLen);
++ if (key_template[4].pValue == NULL)
++ {
++ PK11err(PK11_F_GET_DH_KEY, PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++
++ BN_bn2bin(dh->p, key_template[4].pValue);
++
++ key_template[5].ulValueLen = BN_num_bytes(dh->g);
++ key_template[5].pValue = (CK_VOID_PTR)OPENSSL_malloc(
++ (size_t)key_template[5].ulValueLen);
++ if (key_template[5].pValue == NULL)
++ {
++ PK11err(PK11_F_GET_DH_KEY, PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++
++ BN_bn2bin(dh->g, key_template[5].pValue);
++
++ key_template[6].ulValueLen = BN_num_bytes(dh->priv_key);
++ key_template[6].pValue = (CK_VOID_PTR)OPENSSL_malloc(
++ (size_t)key_template[6].ulValueLen);
++ if (key_template[6].pValue == NULL)
++ {
++ PK11err(PK11_F_GET_DH_KEY, PK11_R_MALLOC_FAILURE);
++ goto err;
++ }
++
++ BN_bn2bin(dh->priv_key, key_template[6].pValue);
++
++ rv = pFuncList->C_FindObjectsInit(session, key_template,
++ ul_key_attr_count);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_DH_KEY, PK11_R_FINDOBJECTSINIT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ rv = pFuncList->C_FindObjects(session, &h_key, 1, &found);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_DH_KEY, PK11_R_FINDOBJECTS);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ rv = pFuncList->C_FindObjectsFinal(session);
++
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_DH_KEY, PK11_R_FINDOBJECTSFINAL);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++
++ if (found == 0)
++ {
++ rv = pFuncList->C_CreateObject(session,
++ key_template, ul_key_attr_count, &h_key);
++ if (rv != CKR_OK)
++ {
++ PK11err(PK11_F_GET_DH_KEY, PK11_R_CREATEOBJECT);
++ snprintf(tmp_buf, sizeof (tmp_buf), "%lx", rv);
++ ERR_add_error_data(2, "PK11 CK_RV=0X", tmp_buf);
++ goto err;
++ }
++ }
++
++ sp->dh = dh;
++
++ err:
++ for (i = 4; i <= 6; i++)
++ {
++ if (key_template[i].pValue != NULL)
++ {
++ OPENSSL_free(key_template[i].pValue);
++ key_template[i].pValue = NULL;
++ }
++ }
++
++ return h_key;
++ }
++
++#endif
++
++/* Local function to simplify key template population
++ * Return 0 -- error, 1 -- no error
++ */
++static int init_template_value(BIGNUM *bn, CK_VOID_PTR *p_value,
++ CK_ULONG *ul_value_len)
++ {
++ CK_ULONG len = BN_num_bytes(bn);
++ if (len == 0)
++ return 1;
++
++ *ul_value_len = len;
++ *p_value = (CK_VOID_PTR)OPENSSL_malloc((size_t) *ul_value_len);
++ if (*p_value == NULL)
++ return 0;
++
++ BN_bn2bin(bn, *p_value);
++
++ return 1;
++ }
++
++static void attr_to_BN(CK_ATTRIBUTE_PTR attr, CK_BYTE attr_data[], BIGNUM **bn)
++ {
++ if (attr->ulValueLen > 0)
++ {
++ *bn = BN_bin2bn(attr_data, attr->ulValueLen, NULL);
++ }
++ }
++
++static void check_new_rsa_key(PK11_SESSION *sp, void *rsa)
++ {
++ if (sp->rsa != rsa)
++ pk11_destroy_rsa_key_objects(sp);
++ }
++
++static void check_new_dsa_key(PK11_SESSION *sp, void *dsa)
++ {
++ if (sp->dsa != dsa)
++ pk11_destroy_dsa_key_objects(sp);
++ }
++
++static void check_new_dh_key(PK11_SESSION *sp, void *dh)
++ {
++ if (sp->dh != dh)
++ pk11_destroy_dh_key_objects(sp);
++ }
++
++
++#endif
++#endif
+diff -r -u -N openssl-0.9.8g/crypto/engine/Makefile openssl/crypto/engine/Makefile
+--- openssl-0.9.8g/crypto/engine/Makefile 2005-07-16 13:13:05.000000000 +0200
++++ openssl/crypto/engine/Makefile 2007-10-25 01:27:09.000000000 +0200
+@@ -21,12 +21,14 @@
+ eng_table.c eng_pkey.c eng_fat.c eng_all.c \
+ tb_rsa.c tb_dsa.c tb_ecdsa.c tb_dh.c tb_ecdh.c tb_rand.c tb_store.c \
+ tb_cipher.c tb_digest.c \
+- eng_openssl.c eng_cnf.c eng_dyn.c eng_cryptodev.c eng_padlock.c
++ eng_openssl.c eng_cnf.c eng_dyn.c eng_cryptodev.c eng_padlock.c \
++ hw_pk11.c hw_pk11_pub.c
+ LIBOBJ= eng_err.o eng_lib.o eng_list.o eng_init.o eng_ctrl.o \
+ eng_table.o eng_pkey.o eng_fat.o eng_all.o \
+ tb_rsa.o tb_dsa.o tb_ecdsa.o tb_dh.o tb_ecdh.o tb_rand.o tb_store.o \
+ tb_cipher.o tb_digest.o \
+- eng_openssl.o eng_cnf.o eng_dyn.o eng_cryptodev.o eng_padlock.o
++ eng_openssl.o eng_cnf.o eng_dyn.o eng_cryptodev.o eng_padlock.o \
++ hw_pk11.o hw_pk11_pub.o
+
+ SRC= $(LIBSRC)
+
+@@ -212,6 +214,54 @@
+ eng_table.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+ eng_table.o: ../../include/openssl/symhacks.h ../cryptlib.h eng_int.h
+ eng_table.o: eng_table.c
++hw_pk11.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
++hw_pk11.o: ../../include/openssl/engine.h ../../include/openssl/ossl_typ.h
++hw_pk11.o: ../../include/openssl/bn.h ../../include/openssl/rsa.h
++hw_pk11.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
++hw_pk11.o: ../../include/openssl/crypto.h ../../include/openssl/stack.h
++hw_pk11.o: ../../include/openssl/safestack.h ../../include/openssl/opensslv.h
++hw_pk11.o: ../../include/openssl/symhacks.h ../../include/openssl/dsa.h
++hw_pk11.o: ../../include/openssl/dh.h ../../include/openssl/rand.h
++hw_pk11.o: ../../include/openssl/ui.h ../../include/openssl/err.h
++hw_pk11.o: ../../include/openssl/lhash.h ../../include/openssl/dso.h
++hw_pk11.o: ../../include/openssl/pem.h ../../include/openssl/evp.h
++hw_pk11.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
++hw_pk11.o: ../../include/openssl/md5.h ../../include/openssl/sha.h
++hw_pk11.o: ../../include/openssl/ripemd.h ../../include/openssl/des.h
++hw_pk11.o: ../../include/openssl/des_old.h ../../include/openssl/ui_compat.h
++hw_pk11.o: ../../include/openssl/rc4.h ../../include/openssl/rc2.h
++hw_pk11.o: ../../crypto/rc5/rc5.h ../../include/openssl/blowfish.h
++hw_pk11.o: ../../include/openssl/cast.h ../../include/openssl/idea.h
++hw_pk11.o: ../../crypto/mdc2/mdc2.h ../../include/openssl/aes.h
++hw_pk11.o: ../../include/openssl/objects.h ../../include/openssl/obj_mac.h
++hw_pk11.o: ../../include/openssl/x509.h ../../include/openssl/buffer.h
++hw_pk11.o: ../../include/openssl/x509_vfy.h ../../include/openssl/pkcs7.h
++hw_pk11.o: ../../include/openssl/pem2.h ../cryptlib.h
++hw_pk11.o: ../../e_os.h hw_pk11_err.c hw_pk11_err.h hw_pk11.c
++hw_pk11_pub.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
++hw_pk11_pub.o: ../../include/openssl/engine.h ../../include/openssl/ossl_typ.h
++hw_pk11_pub.o: ../../include/openssl/bn.h ../../include/openssl/rsa.h
++hw_pk11_pub.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
++hw_pk11_pub.o: ../../include/openssl/crypto.h ../../include/openssl/stack.h
++hw_pk11_pub.o: ../../include/openssl/safestack.h ../../include/openssl/opensslv.h
++hw_pk11_pub.o: ../../include/openssl/symhacks.h ../../include/openssl/dsa.h
++hw_pk11_pub.o: ../../include/openssl/dh.h ../../include/openssl/rand.h
++hw_pk11_pub.o: ../../include/openssl/ui.h ../../include/openssl/err.h
++hw_pk11_pub.o: ../../include/openssl/lhash.h ../../include/openssl/dso.h
++hw_pk11_pub.o: ../../include/openssl/pem.h ../../include/openssl/evp.h
++hw_pk11_pub.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
++hw_pk11_pub.o: ../../include/openssl/md5.h ../../include/openssl/sha.h
++hw_pk11_pub.o: ../../include/openssl/ripemd.h ../../include/openssl/des.h
++hw_pk11_pub.o: ../../include/openssl/des_old.h ../../include/openssl/ui_compat.h
++hw_pk11_pub.o: ../../include/openssl/rc4.h ../../include/openssl/rc2.h
++hw_pk11_pub.o: ../../crypto/rc5/rc5.h ../../include/openssl/blowfish.h
++hw_pk11_pub.o: ../../include/openssl/cast.h ../../include/openssl/idea.h
++hw_pk11_pub.o: ../../crypto/mdc2/mdc2.h ../../include/openssl/aes.h
++hw_pk11_pub.o: ../../include/openssl/objects.h ../../include/openssl/obj_mac.h
++hw_pk11_pub.o: ../../include/openssl/x509.h ../../include/openssl/buffer.h
++hw_pk11_pub.o: ../../include/openssl/x509_vfy.h ../../include/openssl/pkcs7.h
++hw_pk11_pub.o: ../../include/openssl/pem2.h ../cryptlib.h
++hw_pk11_pub.o: ../../e_os.h hw_pk11_err.c hw_pk11_err.h hw_pk11_pub.c
+ tb_cipher.o: ../../e_os.h ../../include/openssl/bio.h
+ tb_cipher.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+ tb_cipher.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
+diff -r -u -N openssl-0.9.8g/crypto/engine/pkcs11f.h openssl/crypto/engine/pkcs11f.h
+--- openssl-0.9.8g/crypto/engine/pkcs11f.h 1970-01-01 01:00:00.000000000 +0100
++++ openssl/crypto/engine/pkcs11f.h 2007-10-25 01:27:09.000000000 +0200
+@@ -0,0 +1,912 @@
++/* pkcs11f.h include file for PKCS #11. */
++/* $Revision: 1.2 $ */
++
++/* License to copy and use this software is granted provided that it is
++ * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface
++ * (Cryptoki)" in all material mentioning or referencing this software.
++
++ * License is also granted to make and use derivative works provided that
++ * such works are identified as "derived from the RSA Security Inc. PKCS #11
++ * Cryptographic Token Interface (Cryptoki)" in all material mentioning or
++ * referencing the derived work.
++
++ * RSA Security Inc. makes no representations concerning either the
++ * merchantability of this software or the suitability of this software for
++ * any particular purpose. It is provided "as is" without express or implied
++ * warranty of any kind.
++ */
++
++/* This header file contains pretty much everything about all the */
++/* Cryptoki function prototypes. Because this information is */
++/* used for more than just declaring function prototypes, the */
++/* order of the functions appearing herein is important, and */
++/* should not be altered. */
++
++/* General-purpose */
++
++/* C_Initialize initializes the Cryptoki library. */
++CK_PKCS11_FUNCTION_INFO(C_Initialize)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_VOID_PTR pInitArgs /* if this is not NULL_PTR, it gets
++ * cast to CK_C_INITIALIZE_ARGS_PTR
++ * and dereferenced */
++);
++#endif
++
++
++/* C_Finalize indicates that an application is done with the
++ * Cryptoki library. */
++CK_PKCS11_FUNCTION_INFO(C_Finalize)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_VOID_PTR pReserved /* reserved. Should be NULL_PTR */
++);
++#endif
++
++
++/* C_GetInfo returns general information about Cryptoki. */
++CK_PKCS11_FUNCTION_INFO(C_GetInfo)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_INFO_PTR pInfo /* location that receives information */
++);
++#endif
++
++
++/* C_GetFunctionList returns the function list. */
++CK_PKCS11_FUNCTION_INFO(C_GetFunctionList)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_FUNCTION_LIST_PTR_PTR ppFunctionList /* receives pointer to
++ * function list */
++);
++#endif
++
++
++
++/* Slot and token management */
++
++/* C_GetSlotList obtains a list of slots in the system. */
++CK_PKCS11_FUNCTION_INFO(C_GetSlotList)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_BBOOL tokenPresent, /* only slots with tokens? */
++ CK_SLOT_ID_PTR pSlotList, /* receives array of slot IDs */
++ CK_ULONG_PTR pulCount /* receives number of slots */
++);
++#endif
++
++
++/* C_GetSlotInfo obtains information about a particular slot in
++ * the system. */
++CK_PKCS11_FUNCTION_INFO(C_GetSlotInfo)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SLOT_ID slotID, /* the ID of the slot */
++ CK_SLOT_INFO_PTR pInfo /* receives the slot information */
++);
++#endif
++
++
++/* C_GetTokenInfo obtains information about a particular token
++ * in the system. */
++CK_PKCS11_FUNCTION_INFO(C_GetTokenInfo)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SLOT_ID slotID, /* ID of the token's slot */
++ CK_TOKEN_INFO_PTR pInfo /* receives the token information */
++);
++#endif
++
++
++/* C_GetMechanismList obtains a list of mechanism types
++ * supported by a token. */
++CK_PKCS11_FUNCTION_INFO(C_GetMechanismList)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SLOT_ID slotID, /* ID of token's slot */
++ CK_MECHANISM_TYPE_PTR pMechanismList, /* gets mech. array */
++ CK_ULONG_PTR pulCount /* gets # of mechs. */
++);
++#endif
++
++
++/* C_GetMechanismInfo obtains information about a particular
++ * mechanism possibly supported by a token. */
++CK_PKCS11_FUNCTION_INFO(C_GetMechanismInfo)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SLOT_ID slotID, /* ID of the token's slot */
++ CK_MECHANISM_TYPE type, /* type of mechanism */
++ CK_MECHANISM_INFO_PTR pInfo /* receives mechanism info */
++);
++#endif
++
++
++/* C_InitToken initializes a token. */
++CK_PKCS11_FUNCTION_INFO(C_InitToken)
++#ifdef CK_NEED_ARG_LIST
++/* pLabel changed from CK_CHAR_PTR to CK_UTF8CHAR_PTR for v2.10 */
++(
++ CK_SLOT_ID slotID, /* ID of the token's slot */
++ CK_UTF8CHAR_PTR pPin, /* the SO's initial PIN */
++ CK_ULONG ulPinLen, /* length in bytes of the PIN */
++ CK_UTF8CHAR_PTR pLabel /* 32-byte token label (blank padded) */
++);
++#endif
++
++
++/* C_InitPIN initializes the normal user's PIN. */
++CK_PKCS11_FUNCTION_INFO(C_InitPIN)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_UTF8CHAR_PTR pPin, /* the normal user's PIN */
++ CK_ULONG ulPinLen /* length in bytes of the PIN */
++);
++#endif
++
++
++/* C_SetPIN modifies the PIN of the user who is logged in. */
++CK_PKCS11_FUNCTION_INFO(C_SetPIN)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_UTF8CHAR_PTR pOldPin, /* the old PIN */
++ CK_ULONG ulOldLen, /* length of the old PIN */
++ CK_UTF8CHAR_PTR pNewPin, /* the new PIN */
++ CK_ULONG ulNewLen /* length of the new PIN */
++);
++#endif
++
++
++
++/* Session management */
++
++/* C_OpenSession opens a session between an application and a
++ * token. */
++CK_PKCS11_FUNCTION_INFO(C_OpenSession)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SLOT_ID slotID, /* the slot's ID */
++ CK_FLAGS flags, /* from CK_SESSION_INFO */
++ CK_VOID_PTR pApplication, /* passed to callback */
++ CK_NOTIFY Notify, /* callback function */
++ CK_SESSION_HANDLE_PTR phSession /* gets session handle */
++);
++#endif
++
++
++/* C_CloseSession closes a session between an application and a
++ * token. */
++CK_PKCS11_FUNCTION_INFO(C_CloseSession)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession /* the session's handle */
++);
++#endif
++
++
++/* C_CloseAllSessions closes all sessions with a token. */
++CK_PKCS11_FUNCTION_INFO(C_CloseAllSessions)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SLOT_ID slotID /* the token's slot */
++);
++#endif
++
++
++/* C_GetSessionInfo obtains information about the session. */
++CK_PKCS11_FUNCTION_INFO(C_GetSessionInfo)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_SESSION_INFO_PTR pInfo /* receives session info */
++);
++#endif
++
++
++/* C_GetOperationState obtains the state of the cryptographic operation
++ * in a session. */
++CK_PKCS11_FUNCTION_INFO(C_GetOperationState)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* session's handle */
++ CK_BYTE_PTR pOperationState, /* gets state */
++ CK_ULONG_PTR pulOperationStateLen /* gets state length */
++);
++#endif
++
++
++/* C_SetOperationState restores the state of the cryptographic
++ * operation in a session. */
++CK_PKCS11_FUNCTION_INFO(C_SetOperationState)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* session's handle */
++ CK_BYTE_PTR pOperationState, /* holds state */
++ CK_ULONG ulOperationStateLen, /* holds state length */
++ CK_OBJECT_HANDLE hEncryptionKey, /* en/decryption key */
++ CK_OBJECT_HANDLE hAuthenticationKey /* sign/verify key */
++);
++#endif
++
++
++/* C_Login logs a user into a token. */
++CK_PKCS11_FUNCTION_INFO(C_Login)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_USER_TYPE userType, /* the user type */
++ CK_UTF8CHAR_PTR pPin, /* the user's PIN */
++ CK_ULONG ulPinLen /* the length of the PIN */
++);
++#endif
++
++
++/* C_Logout logs a user out from a token. */
++CK_PKCS11_FUNCTION_INFO(C_Logout)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession /* the session's handle */
++);
++#endif
++
++
++
++/* Object management */
++
++/* C_CreateObject creates a new object. */
++CK_PKCS11_FUNCTION_INFO(C_CreateObject)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_ATTRIBUTE_PTR pTemplate, /* the object's template */
++ CK_ULONG ulCount, /* attributes in template */
++ CK_OBJECT_HANDLE_PTR phObject /* gets new object's handle. */
++);
++#endif
++
++
++/* C_CopyObject copies an object, creating a new object for the
++ * copy. */
++CK_PKCS11_FUNCTION_INFO(C_CopyObject)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_OBJECT_HANDLE hObject, /* the object's handle */
++ CK_ATTRIBUTE_PTR pTemplate, /* template for new object */
++ CK_ULONG ulCount, /* attributes in template */
++ CK_OBJECT_HANDLE_PTR phNewObject /* receives handle of copy */
++);
++#endif
++
++
++/* C_DestroyObject destroys an object. */
++CK_PKCS11_FUNCTION_INFO(C_DestroyObject)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_OBJECT_HANDLE hObject /* the object's handle */
++);
++#endif
++
++
++/* C_GetObjectSize gets the size of an object in bytes. */
++CK_PKCS11_FUNCTION_INFO(C_GetObjectSize)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_OBJECT_HANDLE hObject, /* the object's handle */
++ CK_ULONG_PTR pulSize /* receives size of object */
++);
++#endif
++
++
++/* C_GetAttributeValue obtains the value of one or more object
++ * attributes. */
++CK_PKCS11_FUNCTION_INFO(C_GetAttributeValue)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_OBJECT_HANDLE hObject, /* the object's handle */
++ CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs; gets vals */
++ CK_ULONG ulCount /* attributes in template */
++);
++#endif
++
++
++/* C_SetAttributeValue modifies the value of one or more object
++ * attributes */
++CK_PKCS11_FUNCTION_INFO(C_SetAttributeValue)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_OBJECT_HANDLE hObject, /* the object's handle */
++ CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs and values */
++ CK_ULONG ulCount /* attributes in template */
++);
++#endif
++
++
++/* C_FindObjectsInit initializes a search for token and session
++ * objects that match a template. */
++CK_PKCS11_FUNCTION_INFO(C_FindObjectsInit)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_ATTRIBUTE_PTR pTemplate, /* attribute values to match */
++ CK_ULONG ulCount /* attrs in search template */
++);
++#endif
++
++
++/* C_FindObjects continues a search for token and session
++ * objects that match a template, obtaining additional object
++ * handles. */
++CK_PKCS11_FUNCTION_INFO(C_FindObjects)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* session's handle */
++ CK_OBJECT_HANDLE_PTR phObject, /* gets obj. handles */
++ CK_ULONG ulMaxObjectCount, /* max handles to get */
++ CK_ULONG_PTR pulObjectCount /* actual # returned */
++);
++#endif
++
++
++/* C_FindObjectsFinal finishes a search for token and session
++ * objects. */
++CK_PKCS11_FUNCTION_INFO(C_FindObjectsFinal)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession /* the session's handle */
++);
++#endif
++
++
++
++/* Encryption and decryption */
++
++/* C_EncryptInit initializes an encryption operation. */
++CK_PKCS11_FUNCTION_INFO(C_EncryptInit)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_MECHANISM_PTR pMechanism, /* the encryption mechanism */
++ CK_OBJECT_HANDLE hKey /* handle of encryption key */
++);
++#endif
++
++
++/* C_Encrypt encrypts single-part data. */
++CK_PKCS11_FUNCTION_INFO(C_Encrypt)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* session's handle */
++ CK_BYTE_PTR pData, /* the plaintext data */
++ CK_ULONG ulDataLen, /* bytes of plaintext */
++ CK_BYTE_PTR pEncryptedData, /* gets ciphertext */
++ CK_ULONG_PTR pulEncryptedDataLen /* gets c-text size */
++);
++#endif
++
++
++/* C_EncryptUpdate continues a multiple-part encryption
++ * operation. */
++CK_PKCS11_FUNCTION_INFO(C_EncryptUpdate)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* session's handle */
++ CK_BYTE_PTR pPart, /* the plaintext data */
++ CK_ULONG ulPartLen, /* plaintext data len */
++ CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
++ CK_ULONG_PTR pulEncryptedPartLen /* gets c-text size */
++);
++#endif
++
++
++/* C_EncryptFinal finishes a multiple-part encryption
++ * operation. */
++CK_PKCS11_FUNCTION_INFO(C_EncryptFinal)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* session handle */
++ CK_BYTE_PTR pLastEncryptedPart, /* last c-text */
++ CK_ULONG_PTR pulLastEncryptedPartLen /* gets last size */
++);
++#endif
++
++
++/* C_DecryptInit initializes a decryption operation. */
++CK_PKCS11_FUNCTION_INFO(C_DecryptInit)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_MECHANISM_PTR pMechanism, /* the decryption mechanism */
++ CK_OBJECT_HANDLE hKey /* handle of decryption key */
++);
++#endif
++
++
++/* C_Decrypt decrypts encrypted data in a single part. */
++CK_PKCS11_FUNCTION_INFO(C_Decrypt)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* session's handle */
++ CK_BYTE_PTR pEncryptedData, /* ciphertext */
++ CK_ULONG ulEncryptedDataLen, /* ciphertext length */
++ CK_BYTE_PTR pData, /* gets plaintext */
++ CK_ULONG_PTR pulDataLen /* gets p-text size */
++);
++#endif
++
++
++/* C_DecryptUpdate continues a multiple-part decryption
++ * operation. */
++CK_PKCS11_FUNCTION_INFO(C_DecryptUpdate)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* session's handle */
++ CK_BYTE_PTR pEncryptedPart, /* encrypted data */
++ CK_ULONG ulEncryptedPartLen, /* input length */
++ CK_BYTE_PTR pPart, /* gets plaintext */
++ CK_ULONG_PTR pulPartLen /* p-text size */
++);
++#endif
++
++
++/* C_DecryptFinal finishes a multiple-part decryption
++ * operation. */
++CK_PKCS11_FUNCTION_INFO(C_DecryptFinal)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_BYTE_PTR pLastPart, /* gets plaintext */
++ CK_ULONG_PTR pulLastPartLen /* p-text size */
++);
++#endif
++
++
++
++/* Message digesting */
++
++/* C_DigestInit initializes a message-digesting operation. */
++CK_PKCS11_FUNCTION_INFO(C_DigestInit)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_MECHANISM_PTR pMechanism /* the digesting mechanism */
++);
++#endif
++
++
++/* C_Digest digests data in a single part. */
++CK_PKCS11_FUNCTION_INFO(C_Digest)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_BYTE_PTR pData, /* data to be digested */
++ CK_ULONG ulDataLen, /* bytes of data to digest */
++ CK_BYTE_PTR pDigest, /* gets the message digest */
++ CK_ULONG_PTR pulDigestLen /* gets digest length */
++);
++#endif
++
++
++/* C_DigestUpdate continues a multiple-part message-digesting
++ * operation. */
++CK_PKCS11_FUNCTION_INFO(C_DigestUpdate)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_BYTE_PTR pPart, /* data to be digested */
++ CK_ULONG ulPartLen /* bytes of data to be digested */
++);
++#endif
++
++
++/* C_DigestKey continues a multi-part message-digesting
++ * operation, by digesting the value of a secret key as part of
++ * the data already digested. */
++CK_PKCS11_FUNCTION_INFO(C_DigestKey)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_OBJECT_HANDLE hKey /* secret key to digest */
++);
++#endif
++
++
++/* C_DigestFinal finishes a multiple-part message-digesting
++ * operation. */
++CK_PKCS11_FUNCTION_INFO(C_DigestFinal)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_BYTE_PTR pDigest, /* gets the message digest */
++ CK_ULONG_PTR pulDigestLen /* gets byte count of digest */
++);
++#endif
++
++
++
++/* Signing and MACing */
++
++/* C_SignInit initializes a signature (private key encryption)
++ * operation, where the signature is (will be) an appendix to
++ * the data, and plaintext cannot be recovered from the
++ *signature. */
++CK_PKCS11_FUNCTION_INFO(C_SignInit)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_MECHANISM_PTR pMechanism, /* the signature mechanism */
++ CK_OBJECT_HANDLE hKey /* handle of signature key */
++);
++#endif
++
++
++/* C_Sign signs (encrypts with private key) data in a single
++ * part, where the signature is (will be) an appendix to the
++ * data, and plaintext cannot be recovered from the signature. */
++CK_PKCS11_FUNCTION_INFO(C_Sign)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_BYTE_PTR pData, /* the data to sign */
++ CK_ULONG ulDataLen, /* count of bytes to sign */
++ CK_BYTE_PTR pSignature, /* gets the signature */
++ CK_ULONG_PTR pulSignatureLen /* gets signature length */
++);
++#endif
++
++
++/* C_SignUpdate continues a multiple-part signature operation,
++ * where the signature is (will be) an appendix to the data,
++ * and plaintext cannot be recovered from the signature. */
++CK_PKCS11_FUNCTION_INFO(C_SignUpdate)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_BYTE_PTR pPart, /* the data to sign */
++ CK_ULONG ulPartLen /* count of bytes to sign */
++);
++#endif
++
++
++/* C_SignFinal finishes a multiple-part signature operation,
++ * returning the signature. */
++CK_PKCS11_FUNCTION_INFO(C_SignFinal)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_BYTE_PTR pSignature, /* gets the signature */
++ CK_ULONG_PTR pulSignatureLen /* gets signature length */
++);
++#endif
++
++
++/* C_SignRecoverInit initializes a signature operation, where
++ * the data can be recovered from the signature. */
++CK_PKCS11_FUNCTION_INFO(C_SignRecoverInit)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_MECHANISM_PTR pMechanism, /* the signature mechanism */
++ CK_OBJECT_HANDLE hKey /* handle of the signature key */
++);
++#endif
++
++
++/* C_SignRecover signs data in a single operation, where the
++ * data can be recovered from the signature. */
++CK_PKCS11_FUNCTION_INFO(C_SignRecover)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_BYTE_PTR pData, /* the data to sign */
++ CK_ULONG ulDataLen, /* count of bytes to sign */
++ CK_BYTE_PTR pSignature, /* gets the signature */
++ CK_ULONG_PTR pulSignatureLen /* gets signature length */
++);
++#endif
++
++
++
++/* Verifying signatures and MACs */
++
++/* C_VerifyInit initializes a verification operation, where the
++ * signature is an appendix to the data, and plaintext cannot
++ * cannot be recovered from the signature (e.g. DSA). */
++CK_PKCS11_FUNCTION_INFO(C_VerifyInit)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_MECHANISM_PTR pMechanism, /* the verification mechanism */
++ CK_OBJECT_HANDLE hKey /* verification key */
++);
++#endif
++
++
++/* C_Verify verifies a signature in a single-part operation,
++ * where the signature is an appendix to the data, and plaintext
++ * cannot be recovered from the signature. */
++CK_PKCS11_FUNCTION_INFO(C_Verify)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_BYTE_PTR pData, /* signed data */
++ CK_ULONG ulDataLen, /* length of signed data */
++ CK_BYTE_PTR pSignature, /* signature */
++ CK_ULONG ulSignatureLen /* signature length*/
++);
++#endif
++
++
++/* C_VerifyUpdate continues a multiple-part verification
++ * operation, where the signature is an appendix to the data,
++ * and plaintext cannot be recovered from the signature. */
++CK_PKCS11_FUNCTION_INFO(C_VerifyUpdate)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_BYTE_PTR pPart, /* signed data */
++ CK_ULONG ulPartLen /* length of signed data */
++);
++#endif
++
++
++/* C_VerifyFinal finishes a multiple-part verification
++ * operation, checking the signature. */
++CK_PKCS11_FUNCTION_INFO(C_VerifyFinal)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_BYTE_PTR pSignature, /* signature to verify */
++ CK_ULONG ulSignatureLen /* signature length */
++);
++#endif
++
++
++/* C_VerifyRecoverInit initializes a signature verification
++ * operation, where the data is recovered from the signature. */
++CK_PKCS11_FUNCTION_INFO(C_VerifyRecoverInit)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_MECHANISM_PTR pMechanism, /* the verification mechanism */
++ CK_OBJECT_HANDLE hKey /* verification key */
++);
++#endif
++
++
++/* C_VerifyRecover verifies a signature in a single-part
++ * operation, where the data is recovered from the signature. */
++CK_PKCS11_FUNCTION_INFO(C_VerifyRecover)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_BYTE_PTR pSignature, /* signature to verify */
++ CK_ULONG ulSignatureLen, /* signature length */
++ CK_BYTE_PTR pData, /* gets signed data */
++ CK_ULONG_PTR pulDataLen /* gets signed data len */
++);
++#endif
++
++
++
++/* Dual-function cryptographic operations */
++
++/* C_DigestEncryptUpdate continues a multiple-part digesting
++ * and encryption operation. */
++CK_PKCS11_FUNCTION_INFO(C_DigestEncryptUpdate)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* session's handle */
++ CK_BYTE_PTR pPart, /* the plaintext data */
++ CK_ULONG ulPartLen, /* plaintext length */
++ CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
++ CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */
++);
++#endif
++
++
++/* C_DecryptDigestUpdate continues a multiple-part decryption and
++ * digesting operation. */
++CK_PKCS11_FUNCTION_INFO(C_DecryptDigestUpdate)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* session's handle */
++ CK_BYTE_PTR pEncryptedPart, /* ciphertext */
++ CK_ULONG ulEncryptedPartLen, /* ciphertext length */
++ CK_BYTE_PTR pPart, /* gets plaintext */
++ CK_ULONG_PTR pulPartLen /* gets plaintext len */
++);
++#endif
++
++
++/* C_SignEncryptUpdate continues a multiple-part signing and
++ * encryption operation. */
++CK_PKCS11_FUNCTION_INFO(C_SignEncryptUpdate)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* session's handle */
++ CK_BYTE_PTR pPart, /* the plaintext data */
++ CK_ULONG ulPartLen, /* plaintext length */
++ CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
++ CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */
++);
++#endif
++
++
++/* C_DecryptVerifyUpdate continues a multiple-part decryption and
++ * verify operation. */
++CK_PKCS11_FUNCTION_INFO(C_DecryptVerifyUpdate)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* session's handle */
++ CK_BYTE_PTR pEncryptedPart, /* ciphertext */
++ CK_ULONG ulEncryptedPartLen, /* ciphertext length */
++ CK_BYTE_PTR pPart, /* gets plaintext */
++ CK_ULONG_PTR pulPartLen /* gets p-text length */
++);
++#endif
++
++
++
++/* Key management */
++
++/* C_GenerateKey generates a secret key, creating a new key
++ * object. */
++CK_PKCS11_FUNCTION_INFO(C_GenerateKey)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_MECHANISM_PTR pMechanism, /* key generation mech. */
++ CK_ATTRIBUTE_PTR pTemplate, /* template for new key */
++ CK_ULONG ulCount, /* # of attrs in template */
++ CK_OBJECT_HANDLE_PTR phKey /* gets handle of new key */
++);
++#endif
++
++
++/* C_GenerateKeyPair generates a public-key/private-key pair,
++ * creating new key objects. */
++CK_PKCS11_FUNCTION_INFO(C_GenerateKeyPair)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* session
++ * handle */
++ CK_MECHANISM_PTR pMechanism, /* key-gen
++ * mech. */
++ CK_ATTRIBUTE_PTR pPublicKeyTemplate, /* template
++ * for pub.
++ * key */
++ CK_ULONG ulPublicKeyAttributeCount, /* # pub.
++ * attrs. */
++ CK_ATTRIBUTE_PTR pPrivateKeyTemplate, /* template
++ * for priv.
++ * key */
++ CK_ULONG ulPrivateKeyAttributeCount, /* # priv.
++ * attrs. */
++ CK_OBJECT_HANDLE_PTR phPublicKey, /* gets pub.
++ * key
++ * handle */
++ CK_OBJECT_HANDLE_PTR phPrivateKey /* gets
++ * priv. key
++ * handle */
++);
++#endif
++
++
++/* C_WrapKey wraps (i.e., encrypts) a key. */
++CK_PKCS11_FUNCTION_INFO(C_WrapKey)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_MECHANISM_PTR pMechanism, /* the wrapping mechanism */
++ CK_OBJECT_HANDLE hWrappingKey, /* wrapping key */
++ CK_OBJECT_HANDLE hKey, /* key to be wrapped */
++ CK_BYTE_PTR pWrappedKey, /* gets wrapped key */
++ CK_ULONG_PTR pulWrappedKeyLen /* gets wrapped key size */
++);
++#endif
++
++
++/* C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new
++ * key object. */
++CK_PKCS11_FUNCTION_INFO(C_UnwrapKey)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* session's handle */
++ CK_MECHANISM_PTR pMechanism, /* unwrapping mech. */
++ CK_OBJECT_HANDLE hUnwrappingKey, /* unwrapping key */
++ CK_BYTE_PTR pWrappedKey, /* the wrapped key */
++ CK_ULONG ulWrappedKeyLen, /* wrapped key len */
++ CK_ATTRIBUTE_PTR pTemplate, /* new key template */
++ CK_ULONG ulAttributeCount, /* template length */
++ CK_OBJECT_HANDLE_PTR phKey /* gets new handle */
++);
++#endif
++
++
++/* C_DeriveKey derives a key from a base key, creating a new key
++ * object. */
++CK_PKCS11_FUNCTION_INFO(C_DeriveKey)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* session's handle */
++ CK_MECHANISM_PTR pMechanism, /* key deriv. mech. */
++ CK_OBJECT_HANDLE hBaseKey, /* base key */
++ CK_ATTRIBUTE_PTR pTemplate, /* new key template */
++ CK_ULONG ulAttributeCount, /* template length */
++ CK_OBJECT_HANDLE_PTR phKey /* gets new handle */
++);
++#endif
++
++
++
++/* Random number generation */
++
++/* C_SeedRandom mixes additional seed material into the token's
++ * random number generator. */
++CK_PKCS11_FUNCTION_INFO(C_SeedRandom)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_BYTE_PTR pSeed, /* the seed material */
++ CK_ULONG ulSeedLen /* length of seed material */
++);
++#endif
++
++
++/* C_GenerateRandom generates random data. */
++CK_PKCS11_FUNCTION_INFO(C_GenerateRandom)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_BYTE_PTR RandomData, /* receives the random data */
++ CK_ULONG ulRandomLen /* # of bytes to generate */
++);
++#endif
++
++
++
++/* Parallel function management */
++
++/* C_GetFunctionStatus is a legacy function; it obtains an
++ * updated status of a function running in parallel with an
++ * application. */
++CK_PKCS11_FUNCTION_INFO(C_GetFunctionStatus)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession /* the session's handle */
++);
++#endif
++
++
++/* C_CancelFunction is a legacy function; it cancels a function
++ * running in parallel. */
++CK_PKCS11_FUNCTION_INFO(C_CancelFunction)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_SESSION_HANDLE hSession /* the session's handle */
++);
++#endif
++
++
++
++/* Functions added in for Cryptoki Version 2.01 or later */
++
++/* C_WaitForSlotEvent waits for a slot event (token insertion,
++ * removal, etc.) to occur. */
++CK_PKCS11_FUNCTION_INFO(C_WaitForSlotEvent)
++#ifdef CK_NEED_ARG_LIST
++(
++ CK_FLAGS flags, /* blocking/nonblocking flag */
++ CK_SLOT_ID_PTR pSlot, /* location that receives the slot ID */
++ CK_VOID_PTR pRserved /* reserved. Should be NULL_PTR */
++);
++#endif
+diff -r -u -N openssl-0.9.8g/crypto/engine/pkcs11.h openssl/crypto/engine/pkcs11.h
+--- openssl-0.9.8g/crypto/engine/pkcs11.h 1970-01-01 01:00:00.000000000 +0100
++++ openssl/crypto/engine/pkcs11.h 2007-10-25 01:27:09.000000000 +0200
+@@ -0,0 +1,299 @@
++/* pkcs11.h include file for PKCS #11. */
++/* $Revision: 1.2 $ */
++
++/* License to copy and use this software is granted provided that it is
++ * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface
++ * (Cryptoki)" in all material mentioning or referencing this software.
++
++ * License is also granted to make and use derivative works provided that
++ * such works are identified as "derived from the RSA Security Inc. PKCS #11
++ * Cryptographic Token Interface (Cryptoki)" in all material mentioning or
++ * referencing the derived work.
++
++ * RSA Security Inc. makes no representations concerning either the
++ * merchantability of this software or the suitability of this software for
++ * any particular purpose. It is provided "as is" without express or implied
++ * warranty of any kind.
++ */
++
++#ifndef _PKCS11_H_
++#define _PKCS11_H_ 1
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++/* Before including this file (pkcs11.h) (or pkcs11t.h by
++ * itself), 6 platform-specific macros must be defined. These
++ * macros are described below, and typical definitions for them
++ * are also given. Be advised that these definitions can depend
++ * on both the platform and the compiler used (and possibly also
++ * on whether a Cryptoki library is linked statically or
++ * dynamically).
++ *
++ * In addition to defining these 6 macros, the packing convention
++ * for Cryptoki structures should be set. The Cryptoki
++ * convention on packing is that structures should be 1-byte
++ * aligned.
++ *
++ * If you're using Microsoft Developer Studio 5.0 to produce
++ * Win32 stuff, this might be done by using the following
++ * preprocessor directive before including pkcs11.h or pkcs11t.h:
++ *
++ * #pragma pack(push, cryptoki, 1)
++ *
++ * and using the following preprocessor directive after including
++ * pkcs11.h or pkcs11t.h:
++ *
++ * #pragma pack(pop, cryptoki)
++ *
++ * If you're using an earlier version of Microsoft Developer
++ * Studio to produce Win16 stuff, this might be done by using
++ * the following preprocessor directive before including
++ * pkcs11.h or pkcs11t.h:
++ *
++ * #pragma pack(1)
++ *
++ * In a UNIX environment, you're on your own for this. You might
++ * not need to do (or be able to do!) anything.
++ *
++ *
++ * Now for the macros:
++ *
++ *
++ * 1. CK_PTR: The indirection string for making a pointer to an
++ * object. It can be used like this:
++ *
++ * typedef CK_BYTE CK_PTR CK_BYTE_PTR;
++ *
++ * If you're using Microsoft Developer Studio 5.0 to produce
++ * Win32 stuff, it might be defined by:
++ *
++ * #define CK_PTR *
++ *
++ * If you're using an earlier version of Microsoft Developer
++ * Studio to produce Win16 stuff, it might be defined by:
++ *
++ * #define CK_PTR far *
++ *
++ * In a typical UNIX environment, it might be defined by:
++ *
++ * #define CK_PTR *
++ *
++ *
++ * 2. CK_DEFINE_FUNCTION(returnType, name): A macro which makes
++ * an exportable Cryptoki library function definition out of a
++ * return type and a function name. It should be used in the
++ * following fashion to define the exposed Cryptoki functions in
++ * a Cryptoki library:
++ *
++ * CK_DEFINE_FUNCTION(CK_RV, C_Initialize)(
++ * CK_VOID_PTR pReserved
++ * )
++ * {
++ * ...
++ * }
++ *
++ * If you're using Microsoft Developer Studio 5.0 to define a
++ * function in a Win32 Cryptoki .dll, it might be defined by:
++ *
++ * #define CK_DEFINE_FUNCTION(returnType, name) \
++ * returnType __declspec(dllexport) name
++ *
++ * If you're using an earlier version of Microsoft Developer
++ * Studio to define a function in a Win16 Cryptoki .dll, it
++ * might be defined by:
++ *
++ * #define CK_DEFINE_FUNCTION(returnType, name) \
++ * returnType __export _far _pascal name
++ *
++ * In a UNIX environment, it might be defined by:
++ *
++ * #define CK_DEFINE_FUNCTION(returnType, name) \
++ * returnType name
++ *
++ *
++ * 3. CK_DECLARE_FUNCTION(returnType, name): A macro which makes
++ * an importable Cryptoki library function declaration out of a
++ * return type and a function name. It should be used in the
++ * following fashion:
++ *
++ * extern CK_DECLARE_FUNCTION(CK_RV, C_Initialize)(
++ * CK_VOID_PTR pReserved
++ * );
++ *
++ * If you're using Microsoft Developer Studio 5.0 to declare a
++ * function in a Win32 Cryptoki .dll, it might be defined by:
++ *
++ * #define CK_DECLARE_FUNCTION(returnType, name) \
++ * returnType __declspec(dllimport) name
++ *
++ * If you're using an earlier version of Microsoft Developer
++ * Studio to declare a function in a Win16 Cryptoki .dll, it
++ * might be defined by:
++ *
++ * #define CK_DECLARE_FUNCTION(returnType, name) \
++ * returnType __export _far _pascal name
++ *
++ * In a UNIX environment, it might be defined by:
++ *
++ * #define CK_DECLARE_FUNCTION(returnType, name) \
++ * returnType name
++ *
++ *
++ * 4. CK_DECLARE_FUNCTION_POINTER(returnType, name): A macro
++ * which makes a Cryptoki API function pointer declaration or
++ * function pointer type declaration out of a return type and a
++ * function name. It should be used in the following fashion:
++ *
++ * // Define funcPtr to be a pointer to a Cryptoki API function
++ * // taking arguments args and returning CK_RV.
++ * CK_DECLARE_FUNCTION_POINTER(CK_RV, funcPtr)(args);
++ *
++ * or
++ *
++ * // Define funcPtrType to be the type of a pointer to a
++ * // Cryptoki API function taking arguments args and returning
++ * // CK_RV, and then define funcPtr to be a variable of type
++ * // funcPtrType.
++ * typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, funcPtrType)(args);
++ * funcPtrType funcPtr;
++ *
++ * If you're using Microsoft Developer Studio 5.0 to access
++ * functions in a Win32 Cryptoki .dll, in might be defined by:
++ *
++ * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
++ * returnType __declspec(dllimport) (* name)
++ *
++ * If you're using an earlier version of Microsoft Developer
++ * Studio to access functions in a Win16 Cryptoki .dll, it might
++ * be defined by:
++ *
++ * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
++ * returnType __export _far _pascal (* name)
++ *
++ * In a UNIX environment, it might be defined by:
++ *
++ * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
++ * returnType (* name)
++ *
++ *
++ * 5. CK_CALLBACK_FUNCTION(returnType, name): A macro which makes
++ * a function pointer type for an application callback out of
++ * a return type for the callback and a name for the callback.
++ * It should be used in the following fashion:
++ *
++ * CK_CALLBACK_FUNCTION(CK_RV, myCallback)(args);
++ *
++ * to declare a function pointer, myCallback, to a callback
++ * which takes arguments args and returns a CK_RV. It can also
++ * be used like this:
++ *
++ * typedef CK_CALLBACK_FUNCTION(CK_RV, myCallbackType)(args);
++ * myCallbackType myCallback;
++ *
++ * If you're using Microsoft Developer Studio 5.0 to do Win32
++ * Cryptoki development, it might be defined by:
++ *
++ * #define CK_CALLBACK_FUNCTION(returnType, name) \
++ * returnType (* name)
++ *
++ * If you're using an earlier version of Microsoft Developer
++ * Studio to do Win16 development, it might be defined by:
++ *
++ * #define CK_CALLBACK_FUNCTION(returnType, name) \
++ * returnType _far _pascal (* name)
++ *
++ * In a UNIX environment, it might be defined by:
++ *
++ * #define CK_CALLBACK_FUNCTION(returnType, name) \
++ * returnType (* name)
++ *
++ *
++ * 6. NULL_PTR: This macro is the value of a NULL pointer.
++ *
++ * In any ANSI/ISO C environment (and in many others as well),
++ * this should best be defined by
++ *
++ * #ifndef NULL_PTR
++ * #define NULL_PTR 0
++ * #endif
++ */
++
++
++/* All the various Cryptoki types and #define'd values are in the
++ * file pkcs11t.h. */
++#include "pkcs11t.h"
++
++#define __PASTE(x,y) x##y
++
++
++/* ==============================================================
++ * Define the "extern" form of all the entry points.
++ * ==============================================================
++ */
++
++#define CK_NEED_ARG_LIST 1
++#define CK_PKCS11_FUNCTION_INFO(name) \
++ extern CK_DECLARE_FUNCTION(CK_RV, name)
++
++/* pkcs11f.h has all the information about the Cryptoki
++ * function prototypes. */
++#include "pkcs11f.h"
++
++#undef CK_NEED_ARG_LIST
++#undef CK_PKCS11_FUNCTION_INFO
++
++
++/* ==============================================================
++ * Define the typedef form of all the entry points. That is, for
++ * each Cryptoki function C_XXX, define a type CK_C_XXX which is
++ * a pointer to that kind of function.
++ * ==============================================================
++ */
++
++#define CK_NEED_ARG_LIST 1
++#define CK_PKCS11_FUNCTION_INFO(name) \
++ typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, __PASTE(CK_,name))
++
++/* pkcs11f.h has all the information about the Cryptoki
++ * function prototypes. */
++#include "pkcs11f.h"
++
++#undef CK_NEED_ARG_LIST
++#undef CK_PKCS11_FUNCTION_INFO
++
++
++/* ==============================================================
++ * Define structed vector of entry points. A CK_FUNCTION_LIST
++ * contains a CK_VERSION indicating a library's Cryptoki version
++ * and then a whole slew of function pointers to the routines in
++ * the library. This type was declared, but not defined, in
++ * pkcs11t.h.
++ * ==============================================================
++ */
++
++#define CK_PKCS11_FUNCTION_INFO(name) \
++ __PASTE(CK_,name) name;
++
++struct CK_FUNCTION_LIST {
++
++ CK_VERSION version; /* Cryptoki version */
++
++/* Pile all the function pointers into the CK_FUNCTION_LIST. */
++/* pkcs11f.h has all the information about the Cryptoki
++ * function prototypes. */
++#include "pkcs11f.h"
++
++};
++
++#undef CK_PKCS11_FUNCTION_INFO
++
++
++#undef __PASTE
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif
+diff -r -u -N openssl-0.9.8g/crypto/engine/pkcs11t.h openssl/crypto/engine/pkcs11t.h
+--- openssl-0.9.8g/crypto/engine/pkcs11t.h 1970-01-01 01:00:00.000000000 +0100
++++ openssl/crypto/engine/pkcs11t.h 2007-10-25 01:27:09.000000000 +0200
+@@ -0,0 +1,1685 @@
++/* pkcs11t.h include file for PKCS #11. */
++/* $Revision: 1.2 $ */
++
++/* License to copy and use this software is granted provided that it is
++ * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface
++ * (Cryptoki)" in all material mentioning or referencing this software.
++
++ * License is also granted to make and use derivative works provided that
++ * such works are identified as "derived from the RSA Security Inc. PKCS #11
++ * Cryptographic Token Interface (Cryptoki)" in all material mentioning or
++ * referencing the derived work.
++
++ * RSA Security Inc. makes no representations concerning either the
++ * merchantability of this software or the suitability of this software for
++ * any particular purpose. It is provided "as is" without express or implied
++ * warranty of any kind.
++ */
++
++/* See top of pkcs11.h for information about the macros that
++ * must be defined and the structure-packing conventions that
++ * must be set before including this file. */
++
++#ifndef _PKCS11T_H_
++#define _PKCS11T_H_ 1
++
++#define CK_TRUE 1
++#define CK_FALSE 0
++
++#ifndef CK_DISABLE_TRUE_FALSE
++#ifndef FALSE
++#define FALSE CK_FALSE
++#endif
++
++#ifndef TRUE
++#define TRUE CK_TRUE
++#endif
++#endif
++
++/* an unsigned 8-bit value */
++typedef unsigned char CK_BYTE;
++
++/* an unsigned 8-bit character */
++typedef CK_BYTE CK_CHAR;
++
++/* an 8-bit UTF-8 character */
++typedef CK_BYTE CK_UTF8CHAR;
++
++/* a BYTE-sized Boolean flag */
++typedef CK_BYTE CK_BBOOL;
++
++/* an unsigned value, at least 32 bits long */
++typedef unsigned long int CK_ULONG;
++
++/* a signed value, the same size as a CK_ULONG */
++/* CK_LONG is new for v2.0 */
++typedef long int CK_LONG;
++
++/* at least 32 bits; each bit is a Boolean flag */
++typedef CK_ULONG CK_FLAGS;
++
++
++/* some special values for certain CK_ULONG variables */
++#define CK_UNAVAILABLE_INFORMATION (~0UL)
++#define CK_EFFECTIVELY_INFINITE 0
++
++
++typedef CK_BYTE CK_PTR CK_BYTE_PTR;
++typedef CK_CHAR CK_PTR CK_CHAR_PTR;
++typedef CK_UTF8CHAR CK_PTR CK_UTF8CHAR_PTR;
++typedef CK_ULONG CK_PTR CK_ULONG_PTR;
++typedef void CK_PTR CK_VOID_PTR;
++
++/* Pointer to a CK_VOID_PTR-- i.e., pointer to pointer to void */
++typedef CK_VOID_PTR CK_PTR CK_VOID_PTR_PTR;
++
++
++/* The following value is always invalid if used as a session */
++/* handle or object handle */
++#define CK_INVALID_HANDLE 0
++
++
++typedef struct CK_VERSION {
++ CK_BYTE major; /* integer portion of version number */
++ CK_BYTE minor; /* 1/100ths portion of version number */
++} CK_VERSION;
++
++typedef CK_VERSION CK_PTR CK_VERSION_PTR;
++
++
++typedef struct CK_INFO {
++ /* manufacturerID and libraryDecription have been changed from
++ * CK_CHAR to CK_UTF8CHAR for v2.10 */
++ CK_VERSION cryptokiVersion; /* Cryptoki interface ver */
++ CK_UTF8CHAR manufacturerID[32]; /* blank padded */
++ CK_FLAGS flags; /* must be zero */
++
++ /* libraryDescription and libraryVersion are new for v2.0 */
++ CK_UTF8CHAR libraryDescription[32]; /* blank padded */
++ CK_VERSION libraryVersion; /* version of library */
++} CK_INFO;
++
++typedef CK_INFO CK_PTR CK_INFO_PTR;
++
++
++/* CK_NOTIFICATION enumerates the types of notifications that
++ * Cryptoki provides to an application */
++/* CK_NOTIFICATION has been changed from an enum to a CK_ULONG
++ * for v2.0 */
++typedef CK_ULONG CK_NOTIFICATION;
++#define CKN_SURRENDER 0
++
++
++typedef CK_ULONG CK_SLOT_ID;
++
++typedef CK_SLOT_ID CK_PTR CK_SLOT_ID_PTR;
++
++
++/* CK_SLOT_INFO provides information about a slot */
++typedef struct CK_SLOT_INFO {
++ /* slotDescription and manufacturerID have been changed from
++ * CK_CHAR to CK_UTF8CHAR for v2.10 */
++ CK_UTF8CHAR slotDescription[64]; /* blank padded */
++ CK_UTF8CHAR manufacturerID[32]; /* blank padded */
++ CK_FLAGS flags;
++
++ /* hardwareVersion and firmwareVersion are new for v2.0 */
++ CK_VERSION hardwareVersion; /* version of hardware */
++ CK_VERSION firmwareVersion; /* version of firmware */
++} CK_SLOT_INFO;
++
++/* flags: bit flags that provide capabilities of the slot
++ * Bit Flag Mask Meaning
++ */
++#define CKF_TOKEN_PRESENT 0x00000001 /* a token is there */
++#define CKF_REMOVABLE_DEVICE 0x00000002 /* removable devices*/
++#define CKF_HW_SLOT 0x00000004 /* hardware slot */
++
++typedef CK_SLOT_INFO CK_PTR CK_SLOT_INFO_PTR;
++
++
++/* CK_TOKEN_INFO provides information about a token */
++typedef struct CK_TOKEN_INFO {
++ /* label, manufacturerID, and model have been changed from
++ * CK_CHAR to CK_UTF8CHAR for v2.10 */
++ CK_UTF8CHAR label[32]; /* blank padded */
++ CK_UTF8CHAR manufacturerID[32]; /* blank padded */
++ CK_UTF8CHAR model[16]; /* blank padded */
++ CK_CHAR serialNumber[16]; /* blank padded */
++ CK_FLAGS flags; /* see below */
++
++ /* ulMaxSessionCount, ulSessionCount, ulMaxRwSessionCount,
++ * ulRwSessionCount, ulMaxPinLen, and ulMinPinLen have all been
++ * changed from CK_USHORT to CK_ULONG for v2.0 */
++ CK_ULONG ulMaxSessionCount; /* max open sessions */
++ CK_ULONG ulSessionCount; /* sess. now open */
++ CK_ULONG ulMaxRwSessionCount; /* max R/W sessions */
++ CK_ULONG ulRwSessionCount; /* R/W sess. now open */
++ CK_ULONG ulMaxPinLen; /* in bytes */
++ CK_ULONG ulMinPinLen; /* in bytes */
++ CK_ULONG ulTotalPublicMemory; /* in bytes */
++ CK_ULONG ulFreePublicMemory; /* in bytes */
++ CK_ULONG ulTotalPrivateMemory; /* in bytes */
++ CK_ULONG ulFreePrivateMemory; /* in bytes */
++
++ /* hardwareVersion, firmwareVersion, and time are new for
++ * v2.0 */
++ CK_VERSION hardwareVersion; /* version of hardware */
++ CK_VERSION firmwareVersion; /* version of firmware */
++ CK_CHAR utcTime[16]; /* time */
++} CK_TOKEN_INFO;
++
++/* The flags parameter is defined as follows:
++ * Bit Flag Mask Meaning
++ */
++#define CKF_RNG 0x00000001 /* has random #
++ * generator */
++#define CKF_WRITE_PROTECTED 0x00000002 /* token is
++ * write-
++ * protected */
++#define CKF_LOGIN_REQUIRED 0x00000004 /* user must
++ * login */
++#define CKF_USER_PIN_INITIALIZED 0x00000008 /* normal user's
++ * PIN is set */
++
++/* CKF_RESTORE_KEY_NOT_NEEDED is new for v2.0. If it is set,
++ * that means that *every* time the state of cryptographic
++ * operations of a session is successfully saved, all keys
++ * needed to continue those operations are stored in the state */
++#define CKF_RESTORE_KEY_NOT_NEEDED 0x00000020
++
++/* CKF_CLOCK_ON_TOKEN is new for v2.0. If it is set, that means
++ * that the token has some sort of clock. The time on that
++ * clock is returned in the token info structure */
++#define CKF_CLOCK_ON_TOKEN 0x00000040
++
++/* CKF_PROTECTED_AUTHENTICATION_PATH is new for v2.0. If it is
++ * set, that means that there is some way for the user to login
++ * without sending a PIN through the Cryptoki library itself */
++#define CKF_PROTECTED_AUTHENTICATION_PATH 0x00000100
++
++/* CKF_DUAL_CRYPTO_OPERATIONS is new for v2.0. If it is true,
++ * that means that a single session with the token can perform
++ * dual simultaneous cryptographic operations (digest and
++ * encrypt; decrypt and digest; sign and encrypt; and decrypt
++ * and sign) */
++#define CKF_DUAL_CRYPTO_OPERATIONS 0x00000200
++
++/* CKF_TOKEN_INITIALIZED if new for v2.10. If it is true, the
++ * token has been initialized using C_InitializeToken or an
++ * equivalent mechanism outside the scope of PKCS #11.
++ * Calling C_InitializeToken when this flag is set will cause
++ * the token to be reinitialized. */
++#define CKF_TOKEN_INITIALIZED 0x00000400
++
++/* CKF_SECONDARY_AUTHENTICATION if new for v2.10. If it is
++ * true, the token supports secondary authentication for
++ * private key objects. This flag is deprecated in v2.11 and
++ onwards. */
++#define CKF_SECONDARY_AUTHENTICATION 0x00000800
++
++/* CKF_USER_PIN_COUNT_LOW if new for v2.10. If it is true, an
++ * incorrect user login PIN has been entered at least once
++ * since the last successful authentication. */
++#define CKF_USER_PIN_COUNT_LOW 0x00010000
++
++/* CKF_USER_PIN_FINAL_TRY if new for v2.10. If it is true,
++ * supplying an incorrect user PIN will it to become locked. */
++#define CKF_USER_PIN_FINAL_TRY 0x00020000
++
++/* CKF_USER_PIN_LOCKED if new for v2.10. If it is true, the
++ * user PIN has been locked. User login to the token is not
++ * possible. */
++#define CKF_USER_PIN_LOCKED 0x00040000
++
++/* CKF_USER_PIN_TO_BE_CHANGED if new for v2.10. If it is true,
++ * the user PIN value is the default value set by token
++ * initialization or manufacturing, or the PIN has been
++ * expired by the card. */
++#define CKF_USER_PIN_TO_BE_CHANGED 0x00080000
++
++/* CKF_SO_PIN_COUNT_LOW if new for v2.10. If it is true, an
++ * incorrect SO login PIN has been entered at least once since
++ * the last successful authentication. */
++#define CKF_SO_PIN_COUNT_LOW 0x00100000
++
++/* CKF_SO_PIN_FINAL_TRY if new for v2.10. If it is true,
++ * supplying an incorrect SO PIN will it to become locked. */
++#define CKF_SO_PIN_FINAL_TRY 0x00200000
++
++/* CKF_SO_PIN_LOCKED if new for v2.10. If it is true, the SO
++ * PIN has been locked. SO login to the token is not possible.
++ */
++#define CKF_SO_PIN_LOCKED 0x00400000
++
++/* CKF_SO_PIN_TO_BE_CHANGED if new for v2.10. If it is true,
++ * the SO PIN value is the default value set by token
++ * initialization or manufacturing, or the PIN has been
++ * expired by the card. */
++#define CKF_SO_PIN_TO_BE_CHANGED 0x00800000
++
++typedef CK_TOKEN_INFO CK_PTR CK_TOKEN_INFO_PTR;
++
++
++/* CK_SESSION_HANDLE is a Cryptoki-assigned value that
++ * identifies a session */
++typedef CK_ULONG CK_SESSION_HANDLE;
++
++typedef CK_SESSION_HANDLE CK_PTR CK_SESSION_HANDLE_PTR;
++
++
++/* CK_USER_TYPE enumerates the types of Cryptoki users */
++/* CK_USER_TYPE has been changed from an enum to a CK_ULONG for
++ * v2.0 */
++typedef CK_ULONG CK_USER_TYPE;
++/* Security Officer */
++#define CKU_SO 0
++/* Normal user */
++#define CKU_USER 1
++/* Context specific (added in v2.20) */
++#define CKU_CONTEXT_SPECIFIC 2
++
++/* CK_STATE enumerates the session states */
++/* CK_STATE has been changed from an enum to a CK_ULONG for
++ * v2.0 */
++typedef CK_ULONG CK_STATE;
++#define CKS_RO_PUBLIC_SESSION 0
++#define CKS_RO_USER_FUNCTIONS 1
++#define CKS_RW_PUBLIC_SESSION 2
++#define CKS_RW_USER_FUNCTIONS 3
++#define CKS_RW_SO_FUNCTIONS 4
++
++
++/* CK_SESSION_INFO provides information about a session */
++typedef struct CK_SESSION_INFO {
++ CK_SLOT_ID slotID;
++ CK_STATE state;
++ CK_FLAGS flags; /* see below */
++
++ /* ulDeviceError was changed from CK_USHORT to CK_ULONG for
++ * v2.0 */
++ CK_ULONG ulDeviceError; /* device-dependent error code */
++} CK_SESSION_INFO;
++
++/* The flags are defined in the following table:
++ * Bit Flag Mask Meaning
++ */
++#define CKF_RW_SESSION 0x00000002 /* session is r/w */
++#define CKF_SERIAL_SESSION 0x00000004 /* no parallel */
++
++typedef CK_SESSION_INFO CK_PTR CK_SESSION_INFO_PTR;
++
++
++/* CK_OBJECT_HANDLE is a token-specific identifier for an
++ * object */
++typedef CK_ULONG CK_OBJECT_HANDLE;
++
++typedef CK_OBJECT_HANDLE CK_PTR CK_OBJECT_HANDLE_PTR;
++
++
++/* CK_OBJECT_CLASS is a value that identifies the classes (or
++ * types) of objects that Cryptoki recognizes. It is defined
++ * as follows: */
++/* CK_OBJECT_CLASS was changed from CK_USHORT to CK_ULONG for
++ * v2.0 */
++typedef CK_ULONG CK_OBJECT_CLASS;
++
++/* The following classes of objects are defined: */
++/* CKO_HW_FEATURE is new for v2.10 */
++/* CKO_DOMAIN_PARAMETERS is new for v2.11 */
++/* CKO_MECHANISM is new for v2.20 */
++#define CKO_DATA 0x00000000
++#define CKO_CERTIFICATE 0x00000001
++#define CKO_PUBLIC_KEY 0x00000002
++#define CKO_PRIVATE_KEY 0x00000003
++#define CKO_SECRET_KEY 0x00000004
++#define CKO_HW_FEATURE 0x00000005
++#define CKO_DOMAIN_PARAMETERS 0x00000006
++#define CKO_MECHANISM 0x00000007
++#define CKO_VENDOR_DEFINED 0x80000000
++
++typedef CK_OBJECT_CLASS CK_PTR CK_OBJECT_CLASS_PTR;
++
++/* CK_HW_FEATURE_TYPE is new for v2.10. CK_HW_FEATURE_TYPE is a
++ * value that identifies the hardware feature type of an object
++ * with CK_OBJECT_CLASS equal to CKO_HW_FEATURE. */
++typedef CK_ULONG CK_HW_FEATURE_TYPE;
++
++/* The following hardware feature types are defined */
++/* CKH_USER_INTERFACE is new for v2.20 */
++#define CKH_MONOTONIC_COUNTER 0x00000001
++#define CKH_CLOCK 0x00000002
++#define CKH_USER_INTERFACE 0x00000003
++#define CKH_VENDOR_DEFINED 0x80000000
++
++/* CK_KEY_TYPE is a value that identifies a key type */
++/* CK_KEY_TYPE was changed from CK_USHORT to CK_ULONG for v2.0 */
++typedef CK_ULONG CK_KEY_TYPE;
++
++/* the following key types are defined: */
++#define CKK_RSA 0x00000000
++#define CKK_DSA 0x00000001
++#define CKK_DH 0x00000002
++
++/* CKK_ECDSA and CKK_KEA are new for v2.0 */
++/* CKK_ECDSA is deprecated in v2.11, CKK_EC is preferred. */
++#define CKK_ECDSA 0x00000003
++#define CKK_EC 0x00000003
++#define CKK_X9_42_DH 0x00000004
++#define CKK_KEA 0x00000005
++
++#define CKK_GENERIC_SECRET 0x00000010
++#define CKK_RC2 0x00000011
++#define CKK_RC4 0x00000012
++#define CKK_DES 0x00000013
++#define CKK_DES2 0x00000014
++#define CKK_DES3 0x00000015
++
++/* all these key types are new for v2.0 */
++#define CKK_CAST 0x00000016
++#define CKK_CAST3 0x00000017
++/* CKK_CAST5 is deprecated in v2.11, CKK_CAST128 is preferred. */
++#define CKK_CAST5 0x00000018
++#define CKK_CAST128 0x00000018
++#define CKK_RC5 0x00000019
++#define CKK_IDEA 0x0000001A
++#define CKK_SKIPJACK 0x0000001B
++#define CKK_BATON 0x0000001C
++#define CKK_JUNIPER 0x0000001D
++#define CKK_CDMF 0x0000001E
++#define CKK_AES 0x0000001F
++
++/* BlowFish and TwoFish are new for v2.20 */
++#define CKK_BLOWFISH 0x00000020
++#define CKK_TWOFISH 0x00000021
++
++#define CKK_VENDOR_DEFINED 0x80000000
++
++
++/* CK_CERTIFICATE_TYPE is a value that identifies a certificate
++ * type */
++/* CK_CERTIFICATE_TYPE was changed from CK_USHORT to CK_ULONG
++ * for v2.0 */
++typedef CK_ULONG CK_CERTIFICATE_TYPE;
++
++/* The following certificate types are defined: */
++/* CKC_X_509_ATTR_CERT is new for v2.10 */
++/* CKC_WTLS is new for v2.20 */
++#define CKC_X_509 0x00000000
++#define CKC_X_509_ATTR_CERT 0x00000001
++#define CKC_WTLS 0x00000002
++#define CKC_VENDOR_DEFINED 0x80000000
++
++
++/* CK_ATTRIBUTE_TYPE is a value that identifies an attribute
++ * type */
++/* CK_ATTRIBUTE_TYPE was changed from CK_USHORT to CK_ULONG for
++ * v2.0 */
++typedef CK_ULONG CK_ATTRIBUTE_TYPE;
++
++/* The CKF_ARRAY_ATTRIBUTE flag identifies an attribute which
++ consists of an array of values. */
++#define CKF_ARRAY_ATTRIBUTE 0x40000000
++
++/* The following attribute types are defined: */
++#define CKA_CLASS 0x00000000
++#define CKA_TOKEN 0x00000001
++#define CKA_PRIVATE 0x00000002
++#define CKA_LABEL 0x00000003
++#define CKA_APPLICATION 0x00000010
++#define CKA_VALUE 0x00000011
++
++/* CKA_OBJECT_ID is new for v2.10 */
++#define CKA_OBJECT_ID 0x00000012
++
++#define CKA_CERTIFICATE_TYPE 0x00000080
++#define CKA_ISSUER 0x00000081
++#define CKA_SERIAL_NUMBER 0x00000082
++
++/* CKA_AC_ISSUER, CKA_OWNER, and CKA_ATTR_TYPES are new
++ * for v2.10 */
++#define CKA_AC_ISSUER 0x00000083
++#define CKA_OWNER 0x00000084
++#define CKA_ATTR_TYPES 0x00000085
++
++/* CKA_TRUSTED is new for v2.11 */
++#define CKA_TRUSTED 0x00000086
++
++/* CKA_CERTIFICATE_CATEGORY ...
++ * CKA_CHECK_VALUE are new for v2.20 */
++#define CKA_CERTIFICATE_CATEGORY 0x00000087
++#define CKA_JAVA_MIDP_SECURITY_DOMAIN 0x00000088
++#define CKA_URL 0x00000089
++#define CKA_HASH_OF_SUBJECT_PUBLIC_KEY 0x0000008A
++#define CKA_HASH_OF_ISSUER_PUBLIC_KEY 0x0000008B
++#define CKA_CHECK_VALUE 0x00000090
++
++#define CKA_KEY_TYPE 0x00000100
++#define CKA_SUBJECT 0x00000101
++#define CKA_ID 0x00000102
++#define CKA_SENSITIVE 0x00000103
++#define CKA_ENCRYPT 0x00000104
++#define CKA_DECRYPT 0x00000105
++#define CKA_WRAP 0x00000106
++#define CKA_UNWRAP 0x00000107
++#define CKA_SIGN 0x00000108
++#define CKA_SIGN_RECOVER 0x00000109
++#define CKA_VERIFY 0x0000010A
++#define CKA_VERIFY_RECOVER 0x0000010B
++#define CKA_DERIVE 0x0000010C
++#define CKA_START_DATE 0x00000110
++#define CKA_END_DATE 0x00000111
++#define CKA_MODULUS 0x00000120
++#define CKA_MODULUS_BITS 0x00000121
++#define CKA_PUBLIC_EXPONENT 0x00000122
++#define CKA_PRIVATE_EXPONENT 0x00000123
++#define CKA_PRIME_1 0x00000124
++#define CKA_PRIME_2 0x00000125
++#define CKA_EXPONENT_1 0x00000126
++#define CKA_EXPONENT_2 0x00000127
++#define CKA_COEFFICIENT 0x00000128
++#define CKA_PRIME 0x00000130
++#define CKA_SUBPRIME 0x00000131
++#define CKA_BASE 0x00000132
++
++/* CKA_PRIME_BITS and CKA_SUB_PRIME_BITS are new for v2.11 */
++#define CKA_PRIME_BITS 0x00000133
++#define CKA_SUBPRIME_BITS 0x00000134
++#define CKA_SUB_PRIME_BITS CKA_SUBPRIME_BITS
++/* (To retain backwards-compatibility) */
++
++#define CKA_VALUE_BITS 0x00000160
++#define CKA_VALUE_LEN 0x00000161
++
++/* CKA_EXTRACTABLE, CKA_LOCAL, CKA_NEVER_EXTRACTABLE,
++ * CKA_ALWAYS_SENSITIVE, CKA_MODIFIABLE, CKA_ECDSA_PARAMS,
++ * and CKA_EC_POINT are new for v2.0 */
++#define CKA_EXTRACTABLE 0x00000162
++#define CKA_LOCAL 0x00000163
++#define CKA_NEVER_EXTRACTABLE 0x00000164
++#define CKA_ALWAYS_SENSITIVE 0x00000165
++
++/* CKA_KEY_GEN_MECHANISM is new for v2.11 */
++#define CKA_KEY_GEN_MECHANISM 0x00000166
++
++#define CKA_MODIFIABLE 0x00000170
++
++/* CKA_ECDSA_PARAMS is deprecated in v2.11,
++ * CKA_EC_PARAMS is preferred. */
++#define CKA_ECDSA_PARAMS 0x00000180
++#define CKA_EC_PARAMS 0x00000180
++
++#define CKA_EC_POINT 0x00000181
++
++/* CKA_SECONDARY_AUTH, CKA_AUTH_PIN_FLAGS,
++ * are new for v2.10. Deprecated in v2.11 and onwards. */
++#define CKA_SECONDARY_AUTH 0x00000200
++#define CKA_AUTH_PIN_FLAGS 0x00000201
++
++/* CKA_ALWAYS_AUTHENTICATE ...
++ * CKA_UNWRAP_TEMPLATE are new for v2.20 */
++#define CKA_ALWAYS_AUTHENTICATE 0x00000202
++
++#define CKA_WRAP_WITH_TRUSTED 0x00000210
++#define CKA_WRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000211)
++#define CKA_UNWRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000212)
++
++/* CKA_HW_FEATURE_TYPE, CKA_RESET_ON_INIT, and CKA_HAS_RESET
++ * are new for v2.10 */
++#define CKA_HW_FEATURE_TYPE 0x00000300
++#define CKA_RESET_ON_INIT 0x00000301
++#define CKA_HAS_RESET 0x00000302
++
++/* The following attributes are new for v2.20 */
++#define CKA_PIXEL_X 0x00000400
++#define CKA_PIXEL_Y 0x00000401
++#define CKA_RESOLUTION 0x00000402
++#define CKA_CHAR_ROWS 0x00000403
++#define CKA_CHAR_COLUMNS 0x00000404
++#define CKA_COLOR 0x00000405
++#define CKA_BITS_PER_PIXEL 0x00000406
++#define CKA_CHAR_SETS 0x00000480
++#define CKA_ENCODING_METHODS 0x00000481
++#define CKA_MIME_TYPES 0x00000482
++#define CKA_MECHANISM_TYPE 0x00000500
++#define CKA_REQUIRED_CMS_ATTRIBUTES 0x00000501
++#define CKA_DEFAULT_CMS_ATTRIBUTES 0x00000502
++#define CKA_SUPPORTED_CMS_ATTRIBUTES 0x00000503
++#define CKA_ALLOWED_MECHANISMS (CKF_ARRAY_ATTRIBUTE|0x00000600)
++
++#define CKA_VENDOR_DEFINED 0x80000000
++
++
++/* CK_ATTRIBUTE is a structure that includes the type, length
++ * and value of an attribute */
++typedef struct CK_ATTRIBUTE {
++ CK_ATTRIBUTE_TYPE type;
++ CK_VOID_PTR pValue;
++
++ /* ulValueLen went from CK_USHORT to CK_ULONG for v2.0 */
++ CK_ULONG ulValueLen; /* in bytes */
++} CK_ATTRIBUTE;
++
++typedef CK_ATTRIBUTE CK_PTR CK_ATTRIBUTE_PTR;
++
++
++/* CK_DATE is a structure that defines a date */
++typedef struct CK_DATE{
++ CK_CHAR year[4]; /* the year ("1900" - "9999") */
++ CK_CHAR month[2]; /* the month ("01" - "12") */
++ CK_CHAR day[2]; /* the day ("01" - "31") */
++} CK_DATE;
++
++
++/* CK_MECHANISM_TYPE is a value that identifies a mechanism
++ * type */
++/* CK_MECHANISM_TYPE was changed from CK_USHORT to CK_ULONG for
++ * v2.0 */
++typedef CK_ULONG CK_MECHANISM_TYPE;
++
++/* the following mechanism types are defined: */
++#define CKM_RSA_PKCS_KEY_PAIR_GEN 0x00000000
++#define CKM_RSA_PKCS 0x00000001
++#define CKM_RSA_9796 0x00000002
++#define CKM_RSA_X_509 0x00000003
++
++/* CKM_MD2_RSA_PKCS, CKM_MD5_RSA_PKCS, and CKM_SHA1_RSA_PKCS
++ * are new for v2.0. They are mechanisms which hash and sign */
++#define CKM_MD2_RSA_PKCS 0x00000004
++#define CKM_MD5_RSA_PKCS 0x00000005
++#define CKM_SHA1_RSA_PKCS 0x00000006
++
++/* CKM_RIPEMD128_RSA_PKCS, CKM_RIPEMD160_RSA_PKCS, and
++ * CKM_RSA_PKCS_OAEP are new for v2.10 */
++#define CKM_RIPEMD128_RSA_PKCS 0x00000007
++#define CKM_RIPEMD160_RSA_PKCS 0x00000008
++#define CKM_RSA_PKCS_OAEP 0x00000009
++
++/* CKM_RSA_X9_31_KEY_PAIR_GEN, CKM_RSA_X9_31, CKM_SHA1_RSA_X9_31,
++ * CKM_RSA_PKCS_PSS, and CKM_SHA1_RSA_PKCS_PSS are new for v2.11 */
++#define CKM_RSA_X9_31_KEY_PAIR_GEN 0x0000000A
++#define CKM_RSA_X9_31 0x0000000B
++#define CKM_SHA1_RSA_X9_31 0x0000000C
++#define CKM_RSA_PKCS_PSS 0x0000000D
++#define CKM_SHA1_RSA_PKCS_PSS 0x0000000E
++
++#define CKM_DSA_KEY_PAIR_GEN 0x00000010
++#define CKM_DSA 0x00000011
++#define CKM_DSA_SHA1 0x00000012
++#define CKM_DH_PKCS_KEY_PAIR_GEN 0x00000020
++#define CKM_DH_PKCS_DERIVE 0x00000021
++
++/* CKM_X9_42_DH_KEY_PAIR_GEN, CKM_X9_42_DH_DERIVE,
++ * CKM_X9_42_DH_HYBRID_DERIVE, and CKM_X9_42_MQV_DERIVE are new for
++ * v2.11 */
++#define CKM_X9_42_DH_KEY_PAIR_GEN 0x00000030
++#define CKM_X9_42_DH_DERIVE 0x00000031
++#define CKM_X9_42_DH_HYBRID_DERIVE 0x00000032
++#define CKM_X9_42_MQV_DERIVE 0x00000033
++
++/* CKM_SHA256/384/512 are new for v2.20 */
++#define CKM_SHA256_RSA_PKCS 0x00000040
++#define CKM_SHA384_RSA_PKCS 0x00000041
++#define CKM_SHA512_RSA_PKCS 0x00000042
++#define CKM_SHA256_RSA_PKCS_PSS 0x00000043
++#define CKM_SHA384_RSA_PKCS_PSS 0x00000044
++#define CKM_SHA512_RSA_PKCS_PSS 0x00000045
++
++#define CKM_RC2_KEY_GEN 0x00000100
++#define CKM_RC2_ECB 0x00000101
++#define CKM_RC2_CBC 0x00000102
++#define CKM_RC2_MAC 0x00000103
++
++/* CKM_RC2_MAC_GENERAL and CKM_RC2_CBC_PAD are new for v2.0 */
++#define CKM_RC2_MAC_GENERAL 0x00000104
++#define CKM_RC2_CBC_PAD 0x00000105
++
++#define CKM_RC4_KEY_GEN 0x00000110
++#define CKM_RC4 0x00000111
++#define CKM_DES_KEY_GEN 0x00000120
++#define CKM_DES_ECB 0x00000121
++#define CKM_DES_CBC 0x00000122
++#define CKM_DES_MAC 0x00000123
++
++/* CKM_DES_MAC_GENERAL and CKM_DES_CBC_PAD are new for v2.0 */
++#define CKM_DES_MAC_GENERAL 0x00000124
++#define CKM_DES_CBC_PAD 0x00000125
++
++#define CKM_DES2_KEY_GEN 0x00000130
++#define CKM_DES3_KEY_GEN 0x00000131
++#define CKM_DES3_ECB 0x00000132
++#define CKM_DES3_CBC 0x00000133
++#define CKM_DES3_MAC 0x00000134
++
++/* CKM_DES3_MAC_GENERAL, CKM_DES3_CBC_PAD, CKM_CDMF_KEY_GEN,
++ * CKM_CDMF_ECB, CKM_CDMF_CBC, CKM_CDMF_MAC,
++ * CKM_CDMF_MAC_GENERAL, and CKM_CDMF_CBC_PAD are new for v2.0 */
++#define CKM_DES3_MAC_GENERAL 0x00000135
++#define CKM_DES3_CBC_PAD 0x00000136
++#define CKM_CDMF_KEY_GEN 0x00000140
++#define CKM_CDMF_ECB 0x00000141
++#define CKM_CDMF_CBC 0x00000142
++#define CKM_CDMF_MAC 0x00000143
++#define CKM_CDMF_MAC_GENERAL 0x00000144
++#define CKM_CDMF_CBC_PAD 0x00000145
++
++/* the following four DES mechanisms are new for v2.20 */
++#define CKM_DES_OFB64 0x00000150
++#define CKM_DES_OFB8 0x00000151
++#define CKM_DES_CFB64 0x00000152
++#define CKM_DES_CFB8 0x00000153
++
++#define CKM_MD2 0x00000200
++
++/* CKM_MD2_HMAC and CKM_MD2_HMAC_GENERAL are new for v2.0 */
++#define CKM_MD2_HMAC 0x00000201
++#define CKM_MD2_HMAC_GENERAL 0x00000202
++
++#define CKM_MD5 0x00000210
++
++/* CKM_MD5_HMAC and CKM_MD5_HMAC_GENERAL are new for v2.0 */
++#define CKM_MD5_HMAC 0x00000211
++#define CKM_MD5_HMAC_GENERAL 0x00000212
++
++#define CKM_SHA_1 0x00000220
++
++/* CKM_SHA_1_HMAC and CKM_SHA_1_HMAC_GENERAL are new for v2.0 */
++#define CKM_SHA_1_HMAC 0x00000221
++#define CKM_SHA_1_HMAC_GENERAL 0x00000222
++
++/* CKM_RIPEMD128, CKM_RIPEMD128_HMAC,
++ * CKM_RIPEMD128_HMAC_GENERAL, CKM_RIPEMD160, CKM_RIPEMD160_HMAC,
++ * and CKM_RIPEMD160_HMAC_GENERAL are new for v2.10 */
++#define CKM_RIPEMD128 0x00000230
++#define CKM_RIPEMD128_HMAC 0x00000231
++#define CKM_RIPEMD128_HMAC_GENERAL 0x00000232
++#define CKM_RIPEMD160 0x00000240
++#define CKM_RIPEMD160_HMAC 0x00000241
++#define CKM_RIPEMD160_HMAC_GENERAL 0x00000242
++
++/* CKM_SHA256/384/512 are new for v2.20 */
++#define CKM_SHA256 0x00000250
++#define CKM_SHA256_HMAC 0x00000251
++#define CKM_SHA256_HMAC_GENERAL 0x00000252
++#define CKM_SHA384 0x00000260
++#define CKM_SHA384_HMAC 0x00000261
++#define CKM_SHA384_HMAC_GENERAL 0x00000262
++#define CKM_SHA512 0x00000270
++#define CKM_SHA512_HMAC 0x00000271
++#define CKM_SHA512_HMAC_GENERAL 0x00000272
++
++/* All of the following mechanisms are new for v2.0 */
++/* Note that CAST128 and CAST5 are the same algorithm */
++#define CKM_CAST_KEY_GEN 0x00000300
++#define CKM_CAST_ECB 0x00000301
++#define CKM_CAST_CBC 0x00000302
++#define CKM_CAST_MAC 0x00000303
++#define CKM_CAST_MAC_GENERAL 0x00000304
++#define CKM_CAST_CBC_PAD 0x00000305
++#define CKM_CAST3_KEY_GEN 0x00000310
++#define CKM_CAST3_ECB 0x00000311
++#define CKM_CAST3_CBC 0x00000312
++#define CKM_CAST3_MAC 0x00000313
++#define CKM_CAST3_MAC_GENERAL 0x00000314
++#define CKM_CAST3_CBC_PAD 0x00000315
++#define CKM_CAST5_KEY_GEN 0x00000320
++#define CKM_CAST128_KEY_GEN 0x00000320
++#define CKM_CAST5_ECB 0x00000321
++#define CKM_CAST128_ECB 0x00000321
++#define CKM_CAST5_CBC 0x00000322
++#define CKM_CAST128_CBC 0x00000322
++#define CKM_CAST5_MAC 0x00000323
++#define CKM_CAST128_MAC 0x00000323
++#define CKM_CAST5_MAC_GENERAL 0x00000324
++#define CKM_CAST128_MAC_GENERAL 0x00000324
++#define CKM_CAST5_CBC_PAD 0x00000325
++#define CKM_CAST128_CBC_PAD 0x00000325
++#define CKM_RC5_KEY_GEN 0x00000330
++#define CKM_RC5_ECB 0x00000331
++#define CKM_RC5_CBC 0x00000332
++#define CKM_RC5_MAC 0x00000333
++#define CKM_RC5_MAC_GENERAL 0x00000334
++#define CKM_RC5_CBC_PAD 0x00000335
++#define CKM_IDEA_KEY_GEN 0x00000340
++#define CKM_IDEA_ECB 0x00000341
++#define CKM_IDEA_CBC 0x00000342
++#define CKM_IDEA_MAC 0x00000343
++#define CKM_IDEA_MAC_GENERAL 0x00000344
++#define CKM_IDEA_CBC_PAD 0x00000345
++#define CKM_GENERIC_SECRET_KEY_GEN 0x00000350
++#define CKM_CONCATENATE_BASE_AND_KEY 0x00000360
++#define CKM_CONCATENATE_BASE_AND_DATA 0x00000362
++#define CKM_CONCATENATE_DATA_AND_BASE 0x00000363
++#define CKM_XOR_BASE_AND_DATA 0x00000364
++#define CKM_EXTRACT_KEY_FROM_KEY 0x00000365
++#define CKM_SSL3_PRE_MASTER_KEY_GEN 0x00000370
++#define CKM_SSL3_MASTER_KEY_DERIVE 0x00000371
++#define CKM_SSL3_KEY_AND_MAC_DERIVE 0x00000372
++
++/* CKM_SSL3_MASTER_KEY_DERIVE_DH, CKM_TLS_PRE_MASTER_KEY_GEN,
++ * CKM_TLS_MASTER_KEY_DERIVE, CKM_TLS_KEY_AND_MAC_DERIVE, and
++ * CKM_TLS_MASTER_KEY_DERIVE_DH are new for v2.11 */
++#define CKM_SSL3_MASTER_KEY_DERIVE_DH 0x00000373
++#define CKM_TLS_PRE_MASTER_KEY_GEN 0x00000374
++#define CKM_TLS_MASTER_KEY_DERIVE 0x00000375
++#define CKM_TLS_KEY_AND_MAC_DERIVE 0x00000376
++#define CKM_TLS_MASTER_KEY_DERIVE_DH 0x00000377
++
++/* CKM_TLS_PRF is new for v2.20 */
++#define CKM_TLS_PRF 0x00000378
++
++#define CKM_SSL3_MD5_MAC 0x00000380
++#define CKM_SSL3_SHA1_MAC 0x00000381
++#define CKM_MD5_KEY_DERIVATION 0x00000390
++#define CKM_MD2_KEY_DERIVATION 0x00000391
++#define CKM_SHA1_KEY_DERIVATION 0x00000392
++
++/* CKM_SHA256/384/512 are new for v2.20 */
++#define CKM_SHA256_KEY_DERIVATION 0x00000393
++#define CKM_SHA384_KEY_DERIVATION 0x00000394
++#define CKM_SHA512_KEY_DERIVATION 0x00000395
++
++#define CKM_PBE_MD2_DES_CBC 0x000003A0
++#define CKM_PBE_MD5_DES_CBC 0x000003A1
++#define CKM_PBE_MD5_CAST_CBC 0x000003A2
++#define CKM_PBE_MD5_CAST3_CBC 0x000003A3
++#define CKM_PBE_MD5_CAST5_CBC 0x000003A4
++#define CKM_PBE_MD5_CAST128_CBC 0x000003A4
++#define CKM_PBE_SHA1_CAST5_CBC 0x000003A5
++#define CKM_PBE_SHA1_CAST128_CBC 0x000003A5
++#define CKM_PBE_SHA1_RC4_128 0x000003A6
++#define CKM_PBE_SHA1_RC4_40 0x000003A7
++#define CKM_PBE_SHA1_DES3_EDE_CBC 0x000003A8
++#define CKM_PBE_SHA1_DES2_EDE_CBC 0x000003A9
++#define CKM_PBE_SHA1_RC2_128_CBC 0x000003AA
++#define CKM_PBE_SHA1_RC2_40_CBC 0x000003AB
++
++/* CKM_PKCS5_PBKD2 is new for v2.10 */
++#define CKM_PKCS5_PBKD2 0x000003B0
++
++#define CKM_PBA_SHA1_WITH_SHA1_HMAC 0x000003C0
++
++/* WTLS mechanisms are new for v2.20 */
++#define CKM_WTLS_PRE_MASTER_KEY_GEN 0x000003D0
++#define CKM_WTLS_MASTER_KEY_DERIVE 0x000003D1
++#define CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC 0x000003D2
++#define CKM_WTLS_PRF 0x000003D3
++#define CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE 0x000003D4
++#define CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE 0x000003D5
++
++#define CKM_KEY_WRAP_LYNKS 0x00000400
++#define CKM_KEY_WRAP_SET_OAEP 0x00000401
++
++/* CKM_CMS_SIG is new for v2.20 */
++#define CKM_CMS_SIG 0x00000500
++
++/* Fortezza mechanisms */
++#define CKM_SKIPJACK_KEY_GEN 0x00001000
++#define CKM_SKIPJACK_ECB64 0x00001001
++#define CKM_SKIPJACK_CBC64 0x00001002
++#define CKM_SKIPJACK_OFB64 0x00001003
++#define CKM_SKIPJACK_CFB64 0x00001004
++#define CKM_SKIPJACK_CFB32 0x00001005
++#define CKM_SKIPJACK_CFB16 0x00001006
++#define CKM_SKIPJACK_CFB8 0x00001007
++#define CKM_SKIPJACK_WRAP 0x00001008
++#define CKM_SKIPJACK_PRIVATE_WRAP 0x00001009
++#define CKM_SKIPJACK_RELAYX 0x0000100a
++#define CKM_KEA_KEY_PAIR_GEN 0x00001010
++#define CKM_KEA_KEY_DERIVE 0x00001011
++#define CKM_FORTEZZA_TIMESTAMP 0x00001020
++#define CKM_BATON_KEY_GEN 0x00001030
++#define CKM_BATON_ECB128 0x00001031
++#define CKM_BATON_ECB96 0x00001032
++#define CKM_BATON_CBC128 0x00001033
++#define CKM_BATON_COUNTER 0x00001034
++#define CKM_BATON_SHUFFLE 0x00001035
++#define CKM_BATON_WRAP 0x00001036
++
++/* CKM_ECDSA_KEY_PAIR_GEN is deprecated in v2.11,
++ * CKM_EC_KEY_PAIR_GEN is preferred */
++#define CKM_ECDSA_KEY_PAIR_GEN 0x00001040
++#define CKM_EC_KEY_PAIR_GEN 0x00001040
++
++#define CKM_ECDSA 0x00001041
++#define CKM_ECDSA_SHA1 0x00001042
++
++/* CKM_ECDH1_DERIVE, CKM_ECDH1_COFACTOR_DERIVE, and CKM_ECMQV_DERIVE
++ * are new for v2.11 */
++#define CKM_ECDH1_DERIVE 0x00001050
++#define CKM_ECDH1_COFACTOR_DERIVE 0x00001051
++#define CKM_ECMQV_DERIVE 0x00001052
++
++#define CKM_JUNIPER_KEY_GEN 0x00001060
++#define CKM_JUNIPER_ECB128 0x00001061
++#define CKM_JUNIPER_CBC128 0x00001062
++#define CKM_JUNIPER_COUNTER 0x00001063
++#define CKM_JUNIPER_SHUFFLE 0x00001064
++#define CKM_JUNIPER_WRAP 0x00001065
++#define CKM_FASTHASH 0x00001070
++
++/* CKM_AES_KEY_GEN, CKM_AES_ECB, CKM_AES_CBC, CKM_AES_MAC,
++ * CKM_AES_MAC_GENERAL, CKM_AES_CBC_PAD, CKM_DSA_PARAMETER_GEN,
++ * CKM_DH_PKCS_PARAMETER_GEN, and CKM_X9_42_DH_PARAMETER_GEN are
++ * new for v2.11 */
++#define CKM_AES_KEY_GEN 0x00001080
++#define CKM_AES_ECB 0x00001081
++#define CKM_AES_CBC 0x00001082
++#define CKM_AES_MAC 0x00001083
++#define CKM_AES_MAC_GENERAL 0x00001084
++#define CKM_AES_CBC_PAD 0x00001085
++
++/* BlowFish and TwoFish are new for v2.20 */
++#define CKM_BLOWFISH_KEY_GEN 0x00001090
++#define CKM_BLOWFISH_CBC 0x00001091
++#define CKM_TWOFISH_KEY_GEN 0x00001092
++#define CKM_TWOFISH_CBC 0x00001093
++
++
++/* CKM_xxx_ENCRYPT_DATA mechanisms are new for v2.20 */
++#define CKM_DES_ECB_ENCRYPT_DATA 0x00001100
++#define CKM_DES_CBC_ENCRYPT_DATA 0x00001101
++#define CKM_DES3_ECB_ENCRYPT_DATA 0x00001102
++#define CKM_DES3_CBC_ENCRYPT_DATA 0x00001103
++#define CKM_AES_ECB_ENCRYPT_DATA 0x00001104
++#define CKM_AES_CBC_ENCRYPT_DATA 0x00001105
++
++#define CKM_DSA_PARAMETER_GEN 0x00002000
++#define CKM_DH_PKCS_PARAMETER_GEN 0x00002001
++#define CKM_X9_42_DH_PARAMETER_GEN 0x00002002
++
++#define CKM_VENDOR_DEFINED 0x80000000
++
++typedef CK_MECHANISM_TYPE CK_PTR CK_MECHANISM_TYPE_PTR;
++
++
++/* CK_MECHANISM is a structure that specifies a particular
++ * mechanism */
++typedef struct CK_MECHANISM {
++ CK_MECHANISM_TYPE mechanism;
++ CK_VOID_PTR pParameter;
++
++ /* ulParameterLen was changed from CK_USHORT to CK_ULONG for
++ * v2.0 */
++ CK_ULONG ulParameterLen; /* in bytes */
++} CK_MECHANISM;
++
++typedef CK_MECHANISM CK_PTR CK_MECHANISM_PTR;
++
++
++/* CK_MECHANISM_INFO provides information about a particular
++ * mechanism */
++typedef struct CK_MECHANISM_INFO {
++ CK_ULONG ulMinKeySize;
++ CK_ULONG ulMaxKeySize;
++ CK_FLAGS flags;
++} CK_MECHANISM_INFO;
++
++/* The flags are defined as follows:
++ * Bit Flag Mask Meaning */
++#define CKF_HW 0x00000001 /* performed by HW */
++
++/* The flags CKF_ENCRYPT, CKF_DECRYPT, CKF_DIGEST, CKF_SIGN,
++ * CKG_SIGN_RECOVER, CKF_VERIFY, CKF_VERIFY_RECOVER,
++ * CKF_GENERATE, CKF_GENERATE_KEY_PAIR, CKF_WRAP, CKF_UNWRAP,
++ * and CKF_DERIVE are new for v2.0. They specify whether or not
++ * a mechanism can be used for a particular task */
++#define CKF_ENCRYPT 0x00000100
++#define CKF_DECRYPT 0x00000200
++#define CKF_DIGEST 0x00000400
++#define CKF_SIGN 0x00000800
++#define CKF_SIGN_RECOVER 0x00001000
++#define CKF_VERIFY 0x00002000
++#define CKF_VERIFY_RECOVER 0x00004000
++#define CKF_GENERATE 0x00008000
++#define CKF_GENERATE_KEY_PAIR 0x00010000
++#define CKF_WRAP 0x00020000
++#define CKF_UNWRAP 0x00040000
++#define CKF_DERIVE 0x00080000
++
++/* CKF_EC_F_P, CKF_EC_F_2M, CKF_EC_ECPARAMETERS, CKF_EC_NAMEDCURVE,
++ * CKF_EC_UNCOMPRESS, and CKF_EC_COMPRESS are new for v2.11. They
++ * describe a token's EC capabilities not available in mechanism
++ * information. */
++#define CKF_EC_F_P 0x00100000
++#define CKF_EC_F_2M 0x00200000
++#define CKF_EC_ECPARAMETERS 0x00400000
++#define CKF_EC_NAMEDCURVE 0x00800000
++#define CKF_EC_UNCOMPRESS 0x01000000
++#define CKF_EC_COMPRESS 0x02000000
++
++#define CKF_EXTENSION 0x80000000 /* FALSE for this version */
++
++typedef CK_MECHANISM_INFO CK_PTR CK_MECHANISM_INFO_PTR;
++
++
++/* CK_RV is a value that identifies the return value of a
++ * Cryptoki function */
++/* CK_RV was changed from CK_USHORT to CK_ULONG for v2.0 */
++typedef CK_ULONG CK_RV;
++
++#define CKR_OK 0x00000000
++#define CKR_CANCEL 0x00000001
++#define CKR_HOST_MEMORY 0x00000002
++#define CKR_SLOT_ID_INVALID 0x00000003
++
++/* CKR_FLAGS_INVALID was removed for v2.0 */
++
++/* CKR_GENERAL_ERROR and CKR_FUNCTION_FAILED are new for v2.0 */
++#define CKR_GENERAL_ERROR 0x00000005
++#define CKR_FUNCTION_FAILED 0x00000006
++
++/* CKR_ARGUMENTS_BAD, CKR_NO_EVENT, CKR_NEED_TO_CREATE_THREADS,
++ * and CKR_CANT_LOCK are new for v2.01 */
++#define CKR_ARGUMENTS_BAD 0x00000007
++#define CKR_NO_EVENT 0x00000008
++#define CKR_NEED_TO_CREATE_THREADS 0x00000009
++#define CKR_CANT_LOCK 0x0000000A
++
++#define CKR_ATTRIBUTE_READ_ONLY 0x00000010
++#define CKR_ATTRIBUTE_SENSITIVE 0x00000011
++#define CKR_ATTRIBUTE_TYPE_INVALID 0x00000012
++#define CKR_ATTRIBUTE_VALUE_INVALID 0x00000013
++#define CKR_DATA_INVALID 0x00000020
++#define CKR_DATA_LEN_RANGE 0x00000021
++#define CKR_DEVICE_ERROR 0x00000030
++#define CKR_DEVICE_MEMORY 0x00000031
++#define CKR_DEVICE_REMOVED 0x00000032
++#define CKR_ENCRYPTED_DATA_INVALID 0x00000040
++#define CKR_ENCRYPTED_DATA_LEN_RANGE 0x00000041
++#define CKR_FUNCTION_CANCELED 0x00000050
++#define CKR_FUNCTION_NOT_PARALLEL 0x00000051
++
++/* CKR_FUNCTION_NOT_SUPPORTED is new for v2.0 */
++#define CKR_FUNCTION_NOT_SUPPORTED 0x00000054
++
++#define CKR_KEY_HANDLE_INVALID 0x00000060
++
++/* CKR_KEY_SENSITIVE was removed for v2.0 */
++
++#define CKR_KEY_SIZE_RANGE 0x00000062
++#define CKR_KEY_TYPE_INCONSISTENT 0x00000063
++
++/* CKR_KEY_NOT_NEEDED, CKR_KEY_CHANGED, CKR_KEY_NEEDED,
++ * CKR_KEY_INDIGESTIBLE, CKR_KEY_FUNCTION_NOT_PERMITTED,
++ * CKR_KEY_NOT_WRAPPABLE, and CKR_KEY_UNEXTRACTABLE are new for
++ * v2.0 */
++#define CKR_KEY_NOT_NEEDED 0x00000064
++#define CKR_KEY_CHANGED 0x00000065
++#define CKR_KEY_NEEDED 0x00000066
++#define CKR_KEY_INDIGESTIBLE 0x00000067
++#define CKR_KEY_FUNCTION_NOT_PERMITTED 0x00000068
++#define CKR_KEY_NOT_WRAPPABLE 0x00000069
++#define CKR_KEY_UNEXTRACTABLE 0x0000006A
++
++#define CKR_MECHANISM_INVALID 0x00000070
++#define CKR_MECHANISM_PARAM_INVALID 0x00000071
++
++/* CKR_OBJECT_CLASS_INCONSISTENT and CKR_OBJECT_CLASS_INVALID
++ * were removed for v2.0 */
++#define CKR_OBJECT_HANDLE_INVALID 0x00000082
++#define CKR_OPERATION_ACTIVE 0x00000090
++#define CKR_OPERATION_NOT_INITIALIZED 0x00000091
++#define CKR_PIN_INCORRECT 0x000000A0
++#define CKR_PIN_INVALID 0x000000A1
++#define CKR_PIN_LEN_RANGE 0x000000A2
++
++/* CKR_PIN_EXPIRED and CKR_PIN_LOCKED are new for v2.0 */
++#define CKR_PIN_EXPIRED 0x000000A3
++#define CKR_PIN_LOCKED 0x000000A4
++
++#define CKR_SESSION_CLOSED 0x000000B0
++#define CKR_SESSION_COUNT 0x000000B1
++#define CKR_SESSION_HANDLE_INVALID 0x000000B3
++#define CKR_SESSION_PARALLEL_NOT_SUPPORTED 0x000000B4
++#define CKR_SESSION_READ_ONLY 0x000000B5
++#define CKR_SESSION_EXISTS 0x000000B6
++
++/* CKR_SESSION_READ_ONLY_EXISTS and
++ * CKR_SESSION_READ_WRITE_SO_EXISTS are new for v2.0 */
++#define CKR_SESSION_READ_ONLY_EXISTS 0x000000B7
++#define CKR_SESSION_READ_WRITE_SO_EXISTS 0x000000B8
++
++#define CKR_SIGNATURE_INVALID 0x000000C0
++#define CKR_SIGNATURE_LEN_RANGE 0x000000C1
++#define CKR_TEMPLATE_INCOMPLETE 0x000000D0
++#define CKR_TEMPLATE_INCONSISTENT 0x000000D1
++#define CKR_TOKEN_NOT_PRESENT 0x000000E0
++#define CKR_TOKEN_NOT_RECOGNIZED 0x000000E1
++#define CKR_TOKEN_WRITE_PROTECTED 0x000000E2
++#define CKR_UNWRAPPING_KEY_HANDLE_INVALID 0x000000F0
++#define CKR_UNWRAPPING_KEY_SIZE_RANGE 0x000000F1
++#define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT 0x000000F2
++#define CKR_USER_ALREADY_LOGGED_IN 0x00000100
++#define CKR_USER_NOT_LOGGED_IN 0x00000101
++#define CKR_USER_PIN_NOT_INITIALIZED 0x00000102
++#define CKR_USER_TYPE_INVALID 0x00000103
++
++/* CKR_USER_ANOTHER_ALREADY_LOGGED_IN and CKR_USER_TOO_MANY_TYPES
++ * are new to v2.01 */
++#define CKR_USER_ANOTHER_ALREADY_LOGGED_IN 0x00000104
++#define CKR_USER_TOO_MANY_TYPES 0x00000105
++
++#define CKR_WRAPPED_KEY_INVALID 0x00000110
++#define CKR_WRAPPED_KEY_LEN_RANGE 0x00000112
++#define CKR_WRAPPING_KEY_HANDLE_INVALID 0x00000113
++#define CKR_WRAPPING_KEY_SIZE_RANGE 0x00000114
++#define CKR_WRAPPING_KEY_TYPE_INCONSISTENT 0x00000115
++#define CKR_RANDOM_SEED_NOT_SUPPORTED 0x00000120
++
++/* These are new to v2.0 */
++#define CKR_RANDOM_NO_RNG 0x00000121
++
++/* These are new to v2.11 */
++#define CKR_DOMAIN_PARAMS_INVALID 0x00000130
++
++/* These are new to v2.0 */
++#define CKR_BUFFER_TOO_SMALL 0x00000150
++#define CKR_SAVED_STATE_INVALID 0x00000160
++#define CKR_INFORMATION_SENSITIVE 0x00000170
++#define CKR_STATE_UNSAVEABLE 0x00000180
++
++/* These are new to v2.01 */
++#define CKR_CRYPTOKI_NOT_INITIALIZED 0x00000190
++#define CKR_CRYPTOKI_ALREADY_INITIALIZED 0x00000191
++#define CKR_MUTEX_BAD 0x000001A0
++#define CKR_MUTEX_NOT_LOCKED 0x000001A1
++
++/* This is new to v2.20 */
++#define CKR_FUNCTION_REJECTED 0x00000200
++
++#define CKR_VENDOR_DEFINED 0x80000000
++
++
++/* CK_NOTIFY is an application callback that processes events */
++typedef CK_CALLBACK_FUNCTION(CK_RV, CK_NOTIFY)(
++ CK_SESSION_HANDLE hSession, /* the session's handle */
++ CK_NOTIFICATION event,
++ CK_VOID_PTR pApplication /* passed to C_OpenSession */
++);
++
++
++/* CK_FUNCTION_LIST is a structure holding a Cryptoki spec
++ * version and pointers of appropriate types to all the
++ * Cryptoki functions */
++/* CK_FUNCTION_LIST is new for v2.0 */
++typedef struct CK_FUNCTION_LIST CK_FUNCTION_LIST;
++
++typedef CK_FUNCTION_LIST CK_PTR CK_FUNCTION_LIST_PTR;
++
++typedef CK_FUNCTION_LIST_PTR CK_PTR CK_FUNCTION_LIST_PTR_PTR;
++
++
++/* CK_CREATEMUTEX is an application callback for creating a
++ * mutex object */
++typedef CK_CALLBACK_FUNCTION(CK_RV, CK_CREATEMUTEX)(
++ CK_VOID_PTR_PTR ppMutex /* location to receive ptr to mutex */
++);
++
++
++/* CK_DESTROYMUTEX is an application callback for destroying a
++ * mutex object */
++typedef CK_CALLBACK_FUNCTION(CK_RV, CK_DESTROYMUTEX)(
++ CK_VOID_PTR pMutex /* pointer to mutex */
++);
++
++
++/* CK_LOCKMUTEX is an application callback for locking a mutex */
++typedef CK_CALLBACK_FUNCTION(CK_RV, CK_LOCKMUTEX)(
++ CK_VOID_PTR pMutex /* pointer to mutex */
++);
++
++
++/* CK_UNLOCKMUTEX is an application callback for unlocking a
++ * mutex */
++typedef CK_CALLBACK_FUNCTION(CK_RV, CK_UNLOCKMUTEX)(
++ CK_VOID_PTR pMutex /* pointer to mutex */
++);
++
++
++/* CK_C_INITIALIZE_ARGS provides the optional arguments to
++ * C_Initialize */
++typedef struct CK_C_INITIALIZE_ARGS {
++ CK_CREATEMUTEX CreateMutex;
++ CK_DESTROYMUTEX DestroyMutex;
++ CK_LOCKMUTEX LockMutex;
++ CK_UNLOCKMUTEX UnlockMutex;
++ CK_FLAGS flags;
++ CK_VOID_PTR pReserved;
++} CK_C_INITIALIZE_ARGS;
++
++/* flags: bit flags that provide capabilities of the slot
++ * Bit Flag Mask Meaning
++ */
++#define CKF_LIBRARY_CANT_CREATE_OS_THREADS 0x00000001
++#define CKF_OS_LOCKING_OK 0x00000002
++
++typedef CK_C_INITIALIZE_ARGS CK_PTR CK_C_INITIALIZE_ARGS_PTR;
++
++
++/* additional flags for parameters to functions */
++
++/* CKF_DONT_BLOCK is for the function C_WaitForSlotEvent */
++#define CKF_DONT_BLOCK 1
++
++/* CK_RSA_PKCS_OAEP_MGF_TYPE is new for v2.10.
++ * CK_RSA_PKCS_OAEP_MGF_TYPE is used to indicate the Message
++ * Generation Function (MGF) applied to a message block when
++ * formatting a message block for the PKCS #1 OAEP encryption
++ * scheme. */
++typedef CK_ULONG CK_RSA_PKCS_MGF_TYPE;
++
++typedef CK_RSA_PKCS_MGF_TYPE CK_PTR CK_RSA_PKCS_MGF_TYPE_PTR;
++
++/* The following MGFs are defined */
++/* CKG_MGF1_SHA256, CKG_MGF1_SHA384, and CKG_MGF1_SHA512
++ * are new for v2.20 */
++#define CKG_MGF1_SHA1 0x00000001
++#define CKG_MGF1_SHA256 0x00000002
++#define CKG_MGF1_SHA384 0x00000003
++#define CKG_MGF1_SHA512 0x00000004
++
++/* CK_RSA_PKCS_OAEP_SOURCE_TYPE is new for v2.10.
++ * CK_RSA_PKCS_OAEP_SOURCE_TYPE is used to indicate the source
++ * of the encoding parameter when formatting a message block
++ * for the PKCS #1 OAEP encryption scheme. */
++typedef CK_ULONG CK_RSA_PKCS_OAEP_SOURCE_TYPE;
++
++typedef CK_RSA_PKCS_OAEP_SOURCE_TYPE CK_PTR CK_RSA_PKCS_OAEP_SOURCE_TYPE_PTR;
++
++/* The following encoding parameter sources are defined */
++#define CKZ_DATA_SPECIFIED 0x00000001
++
++/* CK_RSA_PKCS_OAEP_PARAMS is new for v2.10.
++ * CK_RSA_PKCS_OAEP_PARAMS provides the parameters to the
++ * CKM_RSA_PKCS_OAEP mechanism. */
++typedef struct CK_RSA_PKCS_OAEP_PARAMS {
++ CK_MECHANISM_TYPE hashAlg;
++ CK_RSA_PKCS_MGF_TYPE mgf;
++ CK_RSA_PKCS_OAEP_SOURCE_TYPE source;
++ CK_VOID_PTR pSourceData;
++ CK_ULONG ulSourceDataLen;
++} CK_RSA_PKCS_OAEP_PARAMS;
++
++typedef CK_RSA_PKCS_OAEP_PARAMS CK_PTR CK_RSA_PKCS_OAEP_PARAMS_PTR;
++
++/* CK_RSA_PKCS_PSS_PARAMS is new for v2.11.
++ * CK_RSA_PKCS_PSS_PARAMS provides the parameters to the
++ * CKM_RSA_PKCS_PSS mechanism(s). */
++typedef struct CK_RSA_PKCS_PSS_PARAMS {
++ CK_MECHANISM_TYPE hashAlg;
++ CK_RSA_PKCS_MGF_TYPE mgf;
++ CK_ULONG sLen;
++} CK_RSA_PKCS_PSS_PARAMS;
++
++typedef CK_RSA_PKCS_PSS_PARAMS CK_PTR CK_RSA_PKCS_PSS_PARAMS_PTR;
++
++/* CK_EC_KDF_TYPE is new for v2.11. */
++typedef CK_ULONG CK_EC_KDF_TYPE;
++
++/* The following EC Key Derivation Functions are defined */
++#define CKD_NULL 0x00000001
++#define CKD_SHA1_KDF 0x00000002
++
++/* CK_ECDH1_DERIVE_PARAMS is new for v2.11.
++ * CK_ECDH1_DERIVE_PARAMS provides the parameters to the
++ * CKM_ECDH1_DERIVE and CKM_ECDH1_COFACTOR_DERIVE mechanisms,
++ * where each party contributes one key pair.
++ */
++typedef struct CK_ECDH1_DERIVE_PARAMS {
++ CK_EC_KDF_TYPE kdf;
++ CK_ULONG ulSharedDataLen;
++ CK_BYTE_PTR pSharedData;
++ CK_ULONG ulPublicDataLen;
++ CK_BYTE_PTR pPublicData;
++} CK_ECDH1_DERIVE_PARAMS;
++
++typedef CK_ECDH1_DERIVE_PARAMS CK_PTR CK_ECDH1_DERIVE_PARAMS_PTR;
++
++
++/* CK_ECDH2_DERIVE_PARAMS is new for v2.11.
++ * CK_ECDH2_DERIVE_PARAMS provides the parameters to the
++ * CKM_ECMQV_DERIVE mechanism, where each party contributes two key pairs. */
++typedef struct CK_ECDH2_DERIVE_PARAMS {
++ CK_EC_KDF_TYPE kdf;
++ CK_ULONG ulSharedDataLen;
++ CK_BYTE_PTR pSharedData;
++ CK_ULONG ulPublicDataLen;
++ CK_BYTE_PTR pPublicData;
++ CK_ULONG ulPrivateDataLen;
++ CK_OBJECT_HANDLE hPrivateData;
++ CK_ULONG ulPublicDataLen2;
++ CK_BYTE_PTR pPublicData2;
++} CK_ECDH2_DERIVE_PARAMS;
++
++typedef CK_ECDH2_DERIVE_PARAMS CK_PTR CK_ECDH2_DERIVE_PARAMS_PTR;
++
++typedef struct CK_ECMQV_DERIVE_PARAMS {
++ CK_EC_KDF_TYPE kdf;
++ CK_ULONG ulSharedDataLen;
++ CK_BYTE_PTR pSharedData;
++ CK_ULONG ulPublicDataLen;
++ CK_BYTE_PTR pPublicData;
++ CK_ULONG ulPrivateDataLen;
++ CK_OBJECT_HANDLE hPrivateData;
++ CK_ULONG ulPublicDataLen2;
++ CK_BYTE_PTR pPublicData2;
++ CK_OBJECT_HANDLE publicKey;
++} CK_ECMQV_DERIVE_PARAMS;
++
++typedef CK_ECMQV_DERIVE_PARAMS CK_PTR CK_ECMQV_DERIVE_PARAMS_PTR;
++
++/* Typedefs and defines for the CKM_X9_42_DH_KEY_PAIR_GEN and the
++ * CKM_X9_42_DH_PARAMETER_GEN mechanisms (new for PKCS #11 v2.11) */
++typedef CK_ULONG CK_X9_42_DH_KDF_TYPE;
++typedef CK_X9_42_DH_KDF_TYPE CK_PTR CK_X9_42_DH_KDF_TYPE_PTR;
++
++/* The following X9.42 DH key derivation functions are defined
++ (besides CKD_NULL already defined : */
++#define CKD_SHA1_KDF_ASN1 0x00000003
++#define CKD_SHA1_KDF_CONCATENATE 0x00000004
++
++/* CK_X9_42_DH1_DERIVE_PARAMS is new for v2.11.
++ * CK_X9_42_DH1_DERIVE_PARAMS provides the parameters to the
++ * CKM_X9_42_DH_DERIVE key derivation mechanism, where each party
++ * contributes one key pair */
++typedef struct CK_X9_42_DH1_DERIVE_PARAMS {
++ CK_X9_42_DH_KDF_TYPE kdf;
++ CK_ULONG ulOtherInfoLen;
++ CK_BYTE_PTR pOtherInfo;
++ CK_ULONG ulPublicDataLen;
++ CK_BYTE_PTR pPublicData;
++} CK_X9_42_DH1_DERIVE_PARAMS;
++
++typedef struct CK_X9_42_DH1_DERIVE_PARAMS CK_PTR CK_X9_42_DH1_DERIVE_PARAMS_PTR;
++
++/* CK_X9_42_DH2_DERIVE_PARAMS is new for v2.11.
++ * CK_X9_42_DH2_DERIVE_PARAMS provides the parameters to the
++ * CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE key derivation
++ * mechanisms, where each party contributes two key pairs */
++typedef struct CK_X9_42_DH2_DERIVE_PARAMS {
++ CK_X9_42_DH_KDF_TYPE kdf;
++ CK_ULONG ulOtherInfoLen;
++ CK_BYTE_PTR pOtherInfo;
++ CK_ULONG ulPublicDataLen;
++ CK_BYTE_PTR pPublicData;
++ CK_ULONG ulPrivateDataLen;
++ CK_OBJECT_HANDLE hPrivateData;
++ CK_ULONG ulPublicDataLen2;
++ CK_BYTE_PTR pPublicData2;
++} CK_X9_42_DH2_DERIVE_PARAMS;
++
++typedef CK_X9_42_DH2_DERIVE_PARAMS CK_PTR CK_X9_42_DH2_DERIVE_PARAMS_PTR;
++
++typedef struct CK_X9_42_MQV_DERIVE_PARAMS {
++ CK_X9_42_DH_KDF_TYPE kdf;
++ CK_ULONG ulOtherInfoLen;
++ CK_BYTE_PTR pOtherInfo;
++ CK_ULONG ulPublicDataLen;
++ CK_BYTE_PTR pPublicData;
++ CK_ULONG ulPrivateDataLen;
++ CK_OBJECT_HANDLE hPrivateData;
++ CK_ULONG ulPublicDataLen2;
++ CK_BYTE_PTR pPublicData2;
++ CK_OBJECT_HANDLE publicKey;
++} CK_X9_42_MQV_DERIVE_PARAMS;
++
++typedef CK_X9_42_MQV_DERIVE_PARAMS CK_PTR CK_X9_42_MQV_DERIVE_PARAMS_PTR;
++
++/* CK_KEA_DERIVE_PARAMS provides the parameters to the
++ * CKM_KEA_DERIVE mechanism */
++/* CK_KEA_DERIVE_PARAMS is new for v2.0 */
++typedef struct CK_KEA_DERIVE_PARAMS {
++ CK_BBOOL isSender;
++ CK_ULONG ulRandomLen;
++ CK_BYTE_PTR pRandomA;
++ CK_BYTE_PTR pRandomB;
++ CK_ULONG ulPublicDataLen;
++ CK_BYTE_PTR pPublicData;
++} CK_KEA_DERIVE_PARAMS;
++
++typedef CK_KEA_DERIVE_PARAMS CK_PTR CK_KEA_DERIVE_PARAMS_PTR;
++
++
++/* CK_RC2_PARAMS provides the parameters to the CKM_RC2_ECB and
++ * CKM_RC2_MAC mechanisms. An instance of CK_RC2_PARAMS just
++ * holds the effective keysize */
++typedef CK_ULONG CK_RC2_PARAMS;
++
++typedef CK_RC2_PARAMS CK_PTR CK_RC2_PARAMS_PTR;
++
++
++/* CK_RC2_CBC_PARAMS provides the parameters to the CKM_RC2_CBC
++ * mechanism */
++typedef struct CK_RC2_CBC_PARAMS {
++ /* ulEffectiveBits was changed from CK_USHORT to CK_ULONG for
++ * v2.0 */
++ CK_ULONG ulEffectiveBits; /* effective bits (1-1024) */
++
++ CK_BYTE iv[8]; /* IV for CBC mode */
++} CK_RC2_CBC_PARAMS;
++
++typedef CK_RC2_CBC_PARAMS CK_PTR CK_RC2_CBC_PARAMS_PTR;
++
++
++/* CK_RC2_MAC_GENERAL_PARAMS provides the parameters for the
++ * CKM_RC2_MAC_GENERAL mechanism */
++/* CK_RC2_MAC_GENERAL_PARAMS is new for v2.0 */
++typedef struct CK_RC2_MAC_GENERAL_PARAMS {
++ CK_ULONG ulEffectiveBits; /* effective bits (1-1024) */
++ CK_ULONG ulMacLength; /* Length of MAC in bytes */
++} CK_RC2_MAC_GENERAL_PARAMS;
++
++typedef CK_RC2_MAC_GENERAL_PARAMS CK_PTR \
++ CK_RC2_MAC_GENERAL_PARAMS_PTR;
++
++
++/* CK_RC5_PARAMS provides the parameters to the CKM_RC5_ECB and
++ * CKM_RC5_MAC mechanisms */
++/* CK_RC5_PARAMS is new for v2.0 */
++typedef struct CK_RC5_PARAMS {
++ CK_ULONG ulWordsize; /* wordsize in bits */
++ CK_ULONG ulRounds; /* number of rounds */
++} CK_RC5_PARAMS;
++
++typedef CK_RC5_PARAMS CK_PTR CK_RC5_PARAMS_PTR;
++
++
++/* CK_RC5_CBC_PARAMS provides the parameters to the CKM_RC5_CBC
++ * mechanism */
++/* CK_RC5_CBC_PARAMS is new for v2.0 */
++typedef struct CK_RC5_CBC_PARAMS {
++ CK_ULONG ulWordsize; /* wordsize in bits */
++ CK_ULONG ulRounds; /* number of rounds */
++ CK_BYTE_PTR pIv; /* pointer to IV */
++ CK_ULONG ulIvLen; /* length of IV in bytes */
++} CK_RC5_CBC_PARAMS;
++
++typedef CK_RC5_CBC_PARAMS CK_PTR CK_RC5_CBC_PARAMS_PTR;
++
++
++/* CK_RC5_MAC_GENERAL_PARAMS provides the parameters for the
++ * CKM_RC5_MAC_GENERAL mechanism */
++/* CK_RC5_MAC_GENERAL_PARAMS is new for v2.0 */
++typedef struct CK_RC5_MAC_GENERAL_PARAMS {
++ CK_ULONG ulWordsize; /* wordsize in bits */
++ CK_ULONG ulRounds; /* number of rounds */
++ CK_ULONG ulMacLength; /* Length of MAC in bytes */
++} CK_RC5_MAC_GENERAL_PARAMS;
++
++typedef CK_RC5_MAC_GENERAL_PARAMS CK_PTR \
++ CK_RC5_MAC_GENERAL_PARAMS_PTR;
++
++
++/* CK_MAC_GENERAL_PARAMS provides the parameters to most block
++ * ciphers' MAC_GENERAL mechanisms. Its value is the length of
++ * the MAC */
++/* CK_MAC_GENERAL_PARAMS is new for v2.0 */
++typedef CK_ULONG CK_MAC_GENERAL_PARAMS;
++
++typedef CK_MAC_GENERAL_PARAMS CK_PTR CK_MAC_GENERAL_PARAMS_PTR;
++
++/* CK_DES/AES_ECB/CBC_ENCRYPT_DATA_PARAMS are new for v2.20 */
++typedef struct CK_DES_CBC_ENCRYPT_DATA_PARAMS {
++ CK_BYTE iv[8];
++ CK_BYTE_PTR pData;
++ CK_ULONG length;
++} CK_DES_CBC_ENCRYPT_DATA_PARAMS;
++
++typedef CK_DES_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_DES_CBC_ENCRYPT_DATA_PARAMS_PTR;
++
++typedef struct CK_AES_CBC_ENCRYPT_DATA_PARAMS {
++ CK_BYTE iv[16];
++ CK_BYTE_PTR pData;
++ CK_ULONG length;
++} CK_AES_CBC_ENCRYPT_DATA_PARAMS;
++
++typedef CK_AES_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_AES_CBC_ENCRYPT_DATA_PARAMS_PTR;
++
++/* CK_SKIPJACK_PRIVATE_WRAP_PARAMS provides the parameters to the
++ * CKM_SKIPJACK_PRIVATE_WRAP mechanism */
++/* CK_SKIPJACK_PRIVATE_WRAP_PARAMS is new for v2.0 */
++typedef struct CK_SKIPJACK_PRIVATE_WRAP_PARAMS {
++ CK_ULONG ulPasswordLen;
++ CK_BYTE_PTR pPassword;
++ CK_ULONG ulPublicDataLen;
++ CK_BYTE_PTR pPublicData;
++ CK_ULONG ulPAndGLen;
++ CK_ULONG ulQLen;
++ CK_ULONG ulRandomLen;
++ CK_BYTE_PTR pRandomA;
++ CK_BYTE_PTR pPrimeP;
++ CK_BYTE_PTR pBaseG;
++ CK_BYTE_PTR pSubprimeQ;
++} CK_SKIPJACK_PRIVATE_WRAP_PARAMS;
++
++typedef CK_SKIPJACK_PRIVATE_WRAP_PARAMS CK_PTR \
++ CK_SKIPJACK_PRIVATE_WRAP_PTR;
++
++
++/* CK_SKIPJACK_RELAYX_PARAMS provides the parameters to the
++ * CKM_SKIPJACK_RELAYX mechanism */
++/* CK_SKIPJACK_RELAYX_PARAMS is new for v2.0 */
++typedef struct CK_SKIPJACK_RELAYX_PARAMS {
++ CK_ULONG ulOldWrappedXLen;
++ CK_BYTE_PTR pOldWrappedX;
++ CK_ULONG ulOldPasswordLen;
++ CK_BYTE_PTR pOldPassword;
++ CK_ULONG ulOldPublicDataLen;
++ CK_BYTE_PTR pOldPublicData;
++ CK_ULONG ulOldRandomLen;
++ CK_BYTE_PTR pOldRandomA;
++ CK_ULONG ulNewPasswordLen;
++ CK_BYTE_PTR pNewPassword;
++ CK_ULONG ulNewPublicDataLen;
++ CK_BYTE_PTR pNewPublicData;
++ CK_ULONG ulNewRandomLen;
++ CK_BYTE_PTR pNewRandomA;
++} CK_SKIPJACK_RELAYX_PARAMS;
++
++typedef CK_SKIPJACK_RELAYX_PARAMS CK_PTR \
++ CK_SKIPJACK_RELAYX_PARAMS_PTR;
++
++
++typedef struct CK_PBE_PARAMS {
++ CK_BYTE_PTR pInitVector;
++ CK_UTF8CHAR_PTR pPassword;
++ CK_ULONG ulPasswordLen;
++ CK_BYTE_PTR pSalt;
++ CK_ULONG ulSaltLen;
++ CK_ULONG ulIteration;
++} CK_PBE_PARAMS;
++
++typedef CK_PBE_PARAMS CK_PTR CK_PBE_PARAMS_PTR;
++
++
++/* CK_KEY_WRAP_SET_OAEP_PARAMS provides the parameters to the
++ * CKM_KEY_WRAP_SET_OAEP mechanism */
++/* CK_KEY_WRAP_SET_OAEP_PARAMS is new for v2.0 */
++typedef struct CK_KEY_WRAP_SET_OAEP_PARAMS {
++ CK_BYTE bBC; /* block contents byte */
++ CK_BYTE_PTR pX; /* extra data */
++ CK_ULONG ulXLen; /* length of extra data in bytes */
++} CK_KEY_WRAP_SET_OAEP_PARAMS;
++
++typedef CK_KEY_WRAP_SET_OAEP_PARAMS CK_PTR \
++ CK_KEY_WRAP_SET_OAEP_PARAMS_PTR;
++
++
++typedef struct CK_SSL3_RANDOM_DATA {
++ CK_BYTE_PTR pClientRandom;
++ CK_ULONG ulClientRandomLen;
++ CK_BYTE_PTR pServerRandom;
++ CK_ULONG ulServerRandomLen;
++} CK_SSL3_RANDOM_DATA;
++
++
++typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS {
++ CK_SSL3_RANDOM_DATA RandomInfo;
++ CK_VERSION_PTR pVersion;
++} CK_SSL3_MASTER_KEY_DERIVE_PARAMS;
++
++typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS CK_PTR \
++ CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR;
++
++
++typedef struct CK_SSL3_KEY_MAT_OUT {
++ CK_OBJECT_HANDLE hClientMacSecret;
++ CK_OBJECT_HANDLE hServerMacSecret;
++ CK_OBJECT_HANDLE hClientKey;
++ CK_OBJECT_HANDLE hServerKey;
++ CK_BYTE_PTR pIVClient;
++ CK_BYTE_PTR pIVServer;
++} CK_SSL3_KEY_MAT_OUT;
++
++typedef CK_SSL3_KEY_MAT_OUT CK_PTR CK_SSL3_KEY_MAT_OUT_PTR;
++
++
++typedef struct CK_SSL3_KEY_MAT_PARAMS {
++ CK_ULONG ulMacSizeInBits;
++ CK_ULONG ulKeySizeInBits;
++ CK_ULONG ulIVSizeInBits;
++ CK_BBOOL bIsExport;
++ CK_SSL3_RANDOM_DATA RandomInfo;
++ CK_SSL3_KEY_MAT_OUT_PTR pReturnedKeyMaterial;
++} CK_SSL3_KEY_MAT_PARAMS;
++
++typedef CK_SSL3_KEY_MAT_PARAMS CK_PTR CK_SSL3_KEY_MAT_PARAMS_PTR;
++
++/* CK_TLS_PRF_PARAMS is new for version 2.20 */
++typedef struct CK_TLS_PRF_PARAMS {
++ CK_BYTE_PTR pSeed;
++ CK_ULONG ulSeedLen;
++ CK_BYTE_PTR pLabel;
++ CK_ULONG ulLabelLen;
++ CK_BYTE_PTR pOutput;
++ CK_ULONG_PTR pulOutputLen;
++} CK_TLS_PRF_PARAMS;
++
++typedef CK_TLS_PRF_PARAMS CK_PTR CK_TLS_PRF_PARAMS_PTR;
++
++/* WTLS is new for version 2.20 */
++typedef struct CK_WTLS_RANDOM_DATA {
++ CK_BYTE_PTR pClientRandom;
++ CK_ULONG ulClientRandomLen;
++ CK_BYTE_PTR pServerRandom;
++ CK_ULONG ulServerRandomLen;
++} CK_WTLS_RANDOM_DATA;
++
++typedef CK_WTLS_RANDOM_DATA CK_PTR CK_WTLS_RANDOM_DATA_PTR;
++
++typedef struct CK_WTLS_MASTER_KEY_DERIVE_PARAMS {
++ CK_MECHANISM_TYPE DigestMechanism;
++ CK_WTLS_RANDOM_DATA RandomInfo;
++ CK_BYTE_PTR pVersion;
++} CK_WTLS_MASTER_KEY_DERIVE_PARAMS;
++
++typedef CK_WTLS_MASTER_KEY_DERIVE_PARAMS CK_PTR \
++ CK_WTLS_MASTER_KEY_DERIVE_PARAMS_PTR;
++
++typedef struct CK_WTLS_PRF_PARAMS {
++ CK_MECHANISM_TYPE DigestMechanism;
++ CK_BYTE_PTR pSeed;
++ CK_ULONG ulSeedLen;
++ CK_BYTE_PTR pLabel;
++ CK_ULONG ulLabelLen;
++ CK_BYTE_PTR pOutput;
++ CK_ULONG_PTR pulOutputLen;
++} CK_WTLS_PRF_PARAMS;
++
++typedef CK_WTLS_PRF_PARAMS CK_PTR CK_WTLS_PRF_PARAMS_PTR;
++
++typedef struct CK_WTLS_KEY_MAT_OUT {
++ CK_OBJECT_HANDLE hMacSecret;
++ CK_OBJECT_HANDLE hKey;
++ CK_BYTE_PTR pIV;
++} CK_WTLS_KEY_MAT_OUT;
++
++typedef CK_WTLS_KEY_MAT_OUT CK_PTR CK_WTLS_KEY_MAT_OUT_PTR;
++
++typedef struct CK_WTLS_KEY_MAT_PARAMS {
++ CK_MECHANISM_TYPE DigestMechanism;
++ CK_ULONG ulMacSizeInBits;
++ CK_ULONG ulKeySizeInBits;
++ CK_ULONG ulIVSizeInBits;
++ CK_ULONG ulSequenceNumber;
++ CK_BBOOL bIsExport;
++ CK_WTLS_RANDOM_DATA RandomInfo;
++ CK_WTLS_KEY_MAT_OUT_PTR pReturnedKeyMaterial;
++} CK_WTLS_KEY_MAT_PARAMS;
++
++typedef CK_WTLS_KEY_MAT_PARAMS CK_PTR CK_WTLS_KEY_MAT_PARAMS_PTR;
++
++/* CMS is new for version 2.20 */
++typedef struct CK_CMS_SIG_PARAMS {
++ CK_OBJECT_HANDLE certificateHandle;
++ CK_MECHANISM_PTR pSigningMechanism;
++ CK_MECHANISM_PTR pDigestMechanism;
++ CK_UTF8CHAR_PTR pContentType;
++ CK_BYTE_PTR pRequestedAttributes;
++ CK_ULONG ulRequestedAttributesLen;
++ CK_BYTE_PTR pRequiredAttributes;
++ CK_ULONG ulRequiredAttributesLen;
++} CK_CMS_SIG_PARAMS;
++
++typedef CK_CMS_SIG_PARAMS CK_PTR CK_CMS_SIG_PARAMS_PTR;
++
++typedef struct CK_KEY_DERIVATION_STRING_DATA {
++ CK_BYTE_PTR pData;
++ CK_ULONG ulLen;
++} CK_KEY_DERIVATION_STRING_DATA;
++
++typedef CK_KEY_DERIVATION_STRING_DATA CK_PTR \
++ CK_KEY_DERIVATION_STRING_DATA_PTR;
++
++
++/* The CK_EXTRACT_PARAMS is used for the
++ * CKM_EXTRACT_KEY_FROM_KEY mechanism. It specifies which bit
++ * of the base key should be used as the first bit of the
++ * derived key */
++/* CK_EXTRACT_PARAMS is new for v2.0 */
++typedef CK_ULONG CK_EXTRACT_PARAMS;
++
++typedef CK_EXTRACT_PARAMS CK_PTR CK_EXTRACT_PARAMS_PTR;
++
++/* CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is new for v2.10.
++ * CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is used to
++ * indicate the Pseudo-Random Function (PRF) used to generate
++ * key bits using PKCS #5 PBKDF2. */
++typedef CK_ULONG CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE;
++
++typedef CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE CK_PTR CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR;
++
++/* The following PRFs are defined in PKCS #5 v2.0. */
++#define CKP_PKCS5_PBKD2_HMAC_SHA1 0x00000001
++
++
++/* CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is new for v2.10.
++ * CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is used to indicate the
++ * source of the salt value when deriving a key using PKCS #5
++ * PBKDF2. */
++typedef CK_ULONG CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE;
++
++typedef CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE CK_PTR CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR;
++
++/* The following salt value sources are defined in PKCS #5 v2.0. */
++#define CKZ_SALT_SPECIFIED 0x00000001
++
++/* CK_PKCS5_PBKD2_PARAMS is new for v2.10.
++ * CK_PKCS5_PBKD2_PARAMS is a structure that provides the
++ * parameters to the CKM_PKCS5_PBKD2 mechanism. */
++typedef struct CK_PKCS5_PBKD2_PARAMS {
++ CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE saltSource;
++ CK_VOID_PTR pSaltSourceData;
++ CK_ULONG ulSaltSourceDataLen;
++ CK_ULONG iterations;
++ CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE prf;
++ CK_VOID_PTR pPrfData;
++ CK_ULONG ulPrfDataLen;
++ CK_UTF8CHAR_PTR pPassword;
++ CK_ULONG_PTR ulPasswordLen;
++} CK_PKCS5_PBKD2_PARAMS;
++
++typedef CK_PKCS5_PBKD2_PARAMS CK_PTR CK_PKCS5_PBKD2_PARAMS_PTR;
++
++#endif
+diff -r -u -N openssl-0.9.8g/demos/easy_tls/cacerts.pem openssl/demos/easy_tls/cacerts.pem
+--- openssl-0.9.8g/demos/easy_tls/cacerts.pem 2001-09-17 21:06:57.000000000 +0200
++++ openssl/demos/easy_tls/cacerts.pem 2007-10-25 01:27:09.000000000 +0200
+@@ -1,4 +1,4 @@
+-$Id: openssl-0.9.8g-patch,v 1.2 2008/03/31 14:42:50 fdupont Exp $
++$Id: openssl-0.9.8g-patch,v 1.2 2008/03/31 14:42:50 fdupont Exp $
+
+ issuer= /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test PCA (1024 bit)
+ subject=/C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit)
+diff -r -u -N openssl-0.9.8g/demos/easy_tls/cert.pem openssl/demos/easy_tls/cert.pem
+--- openssl-0.9.8g/demos/easy_tls/cert.pem 2001-09-17 21:06:57.000000000 +0200
++++ openssl/demos/easy_tls/cert.pem 2007-10-25 01:27:09.000000000 +0200
+@@ -1,4 +1,4 @@
+-$Id: openssl-0.9.8g-patch,v 1.2 2008/03/31 14:42:50 fdupont Exp $
++$Id: openssl-0.9.8g-patch,v 1.2 2008/03/31 14:42:50 fdupont Exp $
+
+ Example certificate and key.
+
+diff -r -u -N openssl-0.9.8g/demos/easy_tls/easy-tls.c openssl/demos/easy_tls/easy-tls.c
+--- openssl-0.9.8g/demos/easy_tls/easy-tls.c 2002-03-05 10:07:16.000000000 +0100
++++ openssl/demos/easy_tls/easy-tls.c 2007-10-25 01:27:09.000000000 +0200
+@@ -1,7 +1,7 @@
+ /* -*- Mode: C; c-file-style: "bsd" -*- */
+ /*
+ * easy-tls.c -- generic TLS proxy.
+- * $Id: openssl-0.9.8g-patch,v 1.2 2008/03/31 14:42:50 fdupont Exp $
++ * $Id: openssl-0.9.8g-patch,v 1.2 2008/03/31 14:42:50 fdupont Exp $
+ */
+ /*
+ (c) Copyright 1999 Bodo Moeller. All rights reserved.
+@@ -73,7 +73,7 @@
+ */
+
+ static char const rcsid[] =
+-"$Id: openssl-0.9.8g-patch,v 1.2 2008/03/31 14:42:50 fdupont Exp $";
++"$Id: openssl-0.9.8g-patch,v 1.2 2008/03/31 14:42:50 fdupont Exp $";
+
+ #include <assert.h>
+ #include <errno.h>
+diff -r -u -N openssl-0.9.8g/demos/easy_tls/easy-tls.h openssl/demos/easy_tls/easy-tls.h
+--- openssl-0.9.8g/demos/easy_tls/easy-tls.h 2001-09-17 21:06:59.000000000 +0200
++++ openssl/demos/easy_tls/easy-tls.h 2007-10-25 01:27:09.000000000 +0200
+@@ -1,7 +1,7 @@
+ /* -*- Mode: C; c-file-style: "bsd" -*- */
+ /*
+ * easy-tls.h -- generic TLS proxy.
+- * $Id: openssl-0.9.8g-patch,v 1.2 2008/03/31 14:42:50 fdupont Exp $
++ * $Id: openssl-0.9.8g-patch,v 1.2 2008/03/31 14:42:50 fdupont Exp $
+ */
+ /*
+ * (c) Copyright 1999 Bodo Moeller. All rights reserved.
+diff -r -u -N openssl-0.9.8g/demos/easy_tls/Makefile openssl/demos/easy_tls/Makefile
+--- openssl-0.9.8g/demos/easy_tls/Makefile 2001-09-18 11:15:40.000000000 +0200
++++ openssl/demos/easy_tls/Makefile 2007-10-25 01:27:09.000000000 +0200
+@@ -1,5 +1,5 @@
+ # Makefile for easy-tls example application (rudimentary client and server)
+-# $Id: openssl-0.9.8g-patch,v 1.2 2008/03/31 14:42:50 fdupont Exp $
++# $Id: openssl-0.9.8g-patch,v 1.2 2008/03/31 14:42:50 fdupont Exp $
+
+ SOLARIS_CFLAGS=-Wall -pedantic -g -O2
+ SOLARIS_LIBS=-lxnet
+diff -r -u -N openssl-0.9.8g/demos/easy_tls/test.c openssl/demos/easy_tls/test.c
+--- openssl-0.9.8g/demos/easy_tls/test.c 2001-09-17 21:06:59.000000000 +0200
++++ openssl/demos/easy_tls/test.c 2007-10-25 01:27:09.000000000 +0200
+@@ -1,5 +1,5 @@
+ /* test.c */
+-/* $Id: openssl-0.9.8g-patch,v 1.2 2008/03/31 14:42:50 fdupont Exp $ */
++/* $Id: openssl-0.9.8g-patch,v 1.2 2008/03/31 14:42:50 fdupont Exp $ */
+
+ #define L_PORT 9999
+ #define C_PORT 443
+diff -r -u -N openssl-0.9.8g/demos/easy_tls/test.h openssl/demos/easy_tls/test.h
+--- openssl-0.9.8g/demos/easy_tls/test.h 2001-09-17 21:07:00.000000000 +0200
++++ openssl/demos/easy_tls/test.h 2007-10-25 01:27:09.000000000 +0200
+@@ -1,5 +1,5 @@
+ /* test.h */
+-/* $Id: openssl-0.9.8g-patch,v 1.2 2008/03/31 14:42:50 fdupont Exp $ */
++/* $Id: openssl-0.9.8g-patch,v 1.2 2008/03/31 14:42:50 fdupont Exp $ */
+
+
+ void test_process_init(int fd, int client_p, void *apparg);
+diff -r -u -N openssl-0.9.8g/engines/vendor_defns/hwcryptohook.h openssl/engines/vendor_defns/hwcryptohook.h
+--- openssl-0.9.8g/engines/vendor_defns/hwcryptohook.h 2002-10-11 19:10:59.000000000 +0200
++++ openssl/engines/vendor_defns/hwcryptohook.h 2007-10-25 01:27:09.000000000 +0200
+@@ -65,7 +65,7 @@
+ * please contact nCipher.
+ *
+ *
+- * $Id: openssl-0.9.8g-patch,v 1.2 2008/03/31 14:42:50 fdupont Exp $
++ * $Id: openssl-0.9.8g-patch,v 1.2 2008/03/31 14:42:50 fdupont Exp $
+ */
+
+ #ifndef HWCRYPTOHOOK_H
+diff -r -u -N openssl-0.9.8g/Makefile.org openssl/Makefile.org
+--- openssl-0.9.8g/Makefile.org 2007-04-24 01:49:54.000000000 +0200
++++ openssl/Makefile.org 2007-10-25 01:27:08.000000000 +0200
+@@ -26,6 +26,9 @@
+ INSTALL_PREFIX=
+ INSTALLTOP=/usr/local/ssl
+
++# You must set this through --pk11-libname configure option.
++PK11_LIB_LOCATION=
++
+ # Do not edit this manually. Use Configure --openssldir=DIR do change this!
+ OPENSSLDIR=/usr/local/ssl
+
+diff -r -u -N openssl-0.9.8g/README.pkcs11 openssl/README.pkcs11
+--- openssl-0.9.8g/README.pkcs11 1970-01-01 01:00:00.000000000 +0100
++++ openssl/README.pkcs11 2008-01-31 15:24:32.000000000 +0100
+@@ -0,0 +1,153 @@
++PKCS#11 engine support for OpenSSL 0.9.8g
++=========================================
++
++[Nov 21, 2007]
++
++This patch containing code available in OpenSolaris adds support for PKCS#11
++engine into OpenSSL and implements PKCS#11 v2.20. It is to be applied against
++OpenSSL 0.9.8g. Your system must provide PKCS#11 backend otherwise the patch
++is useless.
++
++Patch can be applied like this:
++
++ tar xfzv openssl-0.9.8g.tar.gz
++ cd openssl-0.9.8g
++ patch -p1 < ../pkcs11_engine-0.9.8g.patch.2007-11-21
++
++It is designed to support pure acceleration for RSA, DSA, DH and all the
++symetric ciphers and message digest algorithms that PKCS#11 and OpenSSL share
++except for missing support for patented algorithms MDC2, RC3, RC5 and IDEA.
++
++It also contains experimental code for accessing RSA keys stored in pkcs#11 key
++stores by reference. See below for more information.
++
++You must provide the location of PKCS#11 library in your system to the
++configure script, eg. if you use libraries from openCryptoki project on Linux
++AMD64 box, run configure like this:
++
++ ./config --pk11-libname=/usr/lib64/pkcs11/PKCS11_API.so
++
++To check whether newly built openssl really supports PKCS#11 it's enough to
++run "apps/openssl engine" and look for "(pkcs11) PKCS #11 engine support" in
++the output.
++
++This patch was tested on Solaris against PKCS#11 engine available from Solaris
++Cryptographic Framework (Solaris 10 and OpenSolaris) and also on Linux using
++PKCS#11 libraries from openCryptoki project (see openCryptoki website
++http://sourceforge.net/projects/opencryptoki for more information). Some Linux
++distributions even ship those libraries with the system. The patch should work
++on any system that is supported by OpenSSL itself and has functional PKCS#11
++library.
++
++The patch contains "RSA Security Inc. PKCS #11 Cryptographic Token Interface
++(Cryptoki)" - files cryptoki.h, pkcs11.h, pkcs11f.h and pkcs11t.h which are
++copyrighted by RSA Security Inc., see pkcs11.h for more information.
++
++Other added/modified code in this patch is copyrighted by Sun Microsystems,
++Inc. and is released under the OpenSSL license (see LICENSE file for more
++information).
++
++Revisions of patch for 0.9.8 branch
++===================================
++
++2007-11-21
++- update for 0.9.8g version
++- fixes in the draft code for "6607670 teach pkcs#11 engine how to use keys
++ be reference" so that it doesn't coredump when the referenced key is not
++ present
++
++2007-10-15
++- update for 0.9.8f version
++- update for "6607670 teach pkcs#11 engine how to use keys be reference"
++
++2007-10-02
++- draft for "6607670 teach pkcs#11 engine how to use keys be reference"
++- draft for "6607307 pkcs#11 engine can't read RSA private keys"
++
++2007-09-26
++- 6375348 Using pkcs11 as the SSLCryptoDevice with Apache/OpenSSL causes
++ significant performance drop
++- 6573196 memory is leaked when OpenSSL is used with PKCS#11 engine
++
++2007-05-25
++- 6558630 race in OpenSSL pkcs11 engine when using symetric block ciphers
++
++2007-05-19
++- initial patch for 0.9.8e using latest OpenSolaris code
++
++Notes
++=====
++
++This patch version contains not very well tested code for referencing RSA keys
++in keystores by labels. That code might and might not end up in OpenSolaris
++code base in the future. If you use this particular functionality with this
++patch I would be very grateful to get any feedback from you (please see my
++contact in the bottom).
++
++Issues
++------
++- can't reference public keys inside of certificates using certificate label
++- can't reference symetric keys
++- simple references in form of "pkcs11:LABEL" only are supported now. This is
++ supposed to be changed according to discussion on pkcs11 mailing list; comma
++ separated list of attributes is planned to be used.
++- getpassphrase(3c) is used for entering the PIN. This should be changed to a
++ more general approach; to check if the process has allocated tty and use
++ other means of entering the PIN if not.
++
++Usage
++-----
++See examples below using Solaris's pktool(1):
++
++# list private keys (note "mycert" label. Basically, we can't generate a
++# pub/priv key pair with pktool(1) without creating a certificate. This should
++# be changed in the future).
++$ pktool list objtype=private
++Enter PIN for Sun Software PKCS#11 softtoken :
++Found 1 keys.
++Key #1 - RSA private key: mycert
++
++# this file is going to be signed
++$ cat test
++hello
++
++# sign it, note "pkcs11:mycert" private key's label
++$ openssl rsautl -inkey pkcs11:mycert -out test2 -in test -sign -keyform e -engine pkcs11
++engine "pkcs11" set.
++Enter PIN:
++
++# export the certificate out of the keyring
++$ pktool export keystore=pkcs11 label=mycert outfile=mycert.cert outformat=pem
++Warning: file "mycert.cert" exists, will be overwritten.
++Continue with export? y
++
++# verify using OpenSSL without pkcs#11 engine and with the certificate in the
++# file. This is proof of concept that a file signed with key by reference is
++# successfully verified when stock OpenSSL is used (I didn't have public key
++# in the keystore, only the certificate. There is no way to reference a public
++# key inside of the certificate).
++$ openssl rsautl -verify -inkey mycert.cert -certin -in test2
++hello
++
++API
++---
++You can use ENGINE_load_public_key() and ENGINE_load_private_key() functions
++only. The 2nd parameter of those calls is the one to use for "pkcs11:LABEL"
++filename overloading. If used that way, both functions will look for the key
++in the available keystores. Only one such key must be present. The private key
++is never extracted from the keystore. See OpenSSL's engine(3) or header file
++openssl/engine.h for more information.
++
++Note that those functions return a pointer to EVP_PKEY structure that contains
++all necessary information for accesing the key by label then. The pointer can be
++used in other functions that work with RSA keys - X509_sign() for example. See
++source code in apps/ subdirectory for reference.
++
++Feedback
++========
++
++Please send feedback to security-discuss@opensolaris.org. The patch was
++created by Jan.Pechanec@Sun.COM from code available in OpenSolaris.
++
++Latest version should be always available on http://blogs.sun.com/janp.
++
diff --git a/contrib/pkcs11-keygen/readkey.c b/contrib/pkcs11-keygen/readkey.c
new file mode 100644
index 0000000..869717c
--- /dev/null
+++ b/contrib/pkcs11-keygen/readkey.c
@@ -0,0 +1,230 @@
+/* readkey [-s $slot] -l $label [-p $pin] -f $filename */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#ifndef OPENCRYPTOKI
+#include <security/cryptoki.h>
+#include <security/pkcs11.h>
+#else
+#include <opencryptoki/pkcs11.h>
+#endif
+#include <openssl/conf.h>
+#include <openssl/err.h>
+#include <openssl/rsa.h>
+#include <openssl/pem.h>
+
+static CK_BBOOL truevalue = TRUE;
+
+int
+main(int argc, char *argv[])
+{
+ RSA *rsa = NULL;
+ FILE *fp;
+ CK_RV rv;
+ CK_SLOT_ID slot = 0;
+ CK_SESSION_HANDLE hSession;
+ CK_UTF8CHAR *pin = NULL;
+ char *label;
+ CK_OBJECT_HANDLE key = CK_INVALID_HANDLE;
+ CK_OBJECT_CLASS kclass = CKO_PRIVATE_KEY;
+ char *filename;
+ int error = 0;
+ int i = 0;
+ int c, errflg = 0;
+ CK_ULONG ulObjectCount;
+ CK_ATTRIBUTE search_template[] = {
+ {CKA_LABEL, NULL, 0},
+ {CKA_TOKEN, &truevalue, sizeof (truevalue)},
+ {CKA_CLASS, &kclass, sizeof (kclass)}
+ };
+ CK_BYTE id[32];
+ CK_BYTE data[8][1024];
+ CK_ATTRIBUTE attr_template[] = {
+ {CKA_ID, &id, sizeof (id)},
+ {CKA_MODULUS, (void *)data[0], 1024}, /* n */
+ {CKA_PUBLIC_EXPONENT, (void *)data[1], 1024}, /* e */
+ {CKA_PRIVATE_EXPONENT, (void *)data[2], 1024}, /* d */
+ {CKA_PRIME_1, (void *)data[3], 1024}, /* p */
+ {CKA_PRIME_2, (void *)data[4], 1024}, /* q */
+ {CKA_EXPONENT_1, (void *)data[5], 1024}, /* dmp1 */
+ {CKA_EXPONENT_2, (void *)data[6], 1024}, /* dmq1 */
+ {CKA_COEFFICIENT, (void *)data[7], 1024} /* iqmp */
+ };
+ extern char *optarg;
+ extern int optopt;
+
+ while ((c = getopt(argc, argv, ":s:l:p:f:")) != -1) {
+ switch (c) {
+ case 's':
+ slot = atoi(optarg);
+ break;
+ case 'l':
+ label = optarg;
+ break;
+ case 'p':
+ pin = (CK_UTF8CHAR *)optarg;
+ break;
+ case ':':
+ fprintf(stderr, "Option -%c requires an operand\n", optopt);
+ errflg++;
+ break;
+ case 'f':
+ filename = optarg;
+ break;
+ case '?':
+ default:
+ fprintf(stderr, "Unrecognised option: -%c\n", optopt);
+ errflg++;
+ }
+ }
+ if ((errflg) || (!label) || (!filename)) {
+ fprintf(stderr,
+ "usage: readkey [-s slot] -l label [-p pin] -f filename\n");
+ exit(1);
+ }
+ if (slot)
+ printf("slot %d\n", slot);
+
+ /* Initialize OpenSSL library */
+ OPENSSL_config(NULL);
+ rsa = RSA_new();
+ if (!rsa) {
+ fprintf(stderr, "RSA_new failed\n");
+ ERR_print_errors_fp(stderr);
+ exit(1);
+ }
+
+ /* Initialize the CRYPTOKI library */
+ rv = C_Initialize(NULL_PTR);
+ if ((rv != CKR_OK) && (rv != CKR_CRYPTOKI_ALREADY_INITIALIZED)) {
+ fprintf(stderr, "C_Initialize: Error = 0x%.8X\n", rv);
+ exit(1);
+ }
+
+ /* Open a session on the slot found */
+ rv = C_OpenSession(slot, CKF_SERIAL_SESSION,
+ NULL_PTR, NULL_PTR, &hSession);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_OpenSession: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_program;
+ }
+
+ /* Login to the Token (Keystore) */
+ if (!pin)
+#ifndef OPENCRYPTOKI
+ pin = (CK_UTF8CHAR *)getpassphrase("Enter Pin: ");
+#else
+ pin = (CK_UTF8CHAR *)getpass("Enter Pin: ");
+#endif
+ rv = C_Login(hSession, CKU_USER, pin, strlen((char *)pin));
+ memset(pin, 0, strlen((char *)pin));
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_Login: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_session;
+ }
+
+ /* Set search template. */
+ if (strstr(label, "pkcs11:") == label)
+ label = strstr(label, ":") + 1;
+ search_template[0].pValue = label;
+ search_template[0].ulValueLen = strlen(label);
+
+ rv = C_FindObjectsInit(hSession, search_template, 3);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjectsInit: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_session;
+ }
+
+ rv = C_FindObjects(hSession, &key, 1, &ulObjectCount);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjects: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_search;
+ }
+ if (ulObjectCount == 0) {
+ fprintf(stderr, "C_FindObjects: can't find the key\n");
+ error = 1;
+ goto exit_search;
+ }
+
+ rv = C_GetAttributeValue(hSession, key, attr_template, 9);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_GetAttributeValue: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_search;
+ }
+
+ printf("ID[%u]=", attr_template[0].ulValueLen);
+ for (i = 0; i < attr_template[0].ulValueLen; i++)
+ printf("%02x", id[i]);
+ printf("\n");
+
+ if (attr_template[1].ulValueLen > 0)
+ rsa->n = BN_bin2bn(data[0], attr_template[1].ulValueLen, NULL);
+ if (attr_template[2].ulValueLen > 0)
+ rsa->e = BN_bin2bn(data[1], attr_template[2].ulValueLen, NULL);
+ if (attr_template[3].ulValueLen > 0)
+ rsa->d = BN_bin2bn(data[2], attr_template[3].ulValueLen, NULL);
+ if (attr_template[4].ulValueLen > 0)
+ rsa->p = BN_bin2bn(data[3], attr_template[4].ulValueLen, NULL);
+ if (attr_template[5].ulValueLen > 0)
+ rsa->q = BN_bin2bn(data[4], attr_template[5].ulValueLen, NULL);
+ if (attr_template[6].ulValueLen > 0)
+ rsa->dmp1 = BN_bin2bn(data[5], attr_template[6].ulValueLen, NULL);
+ if (attr_template[7].ulValueLen > 0)
+ rsa->dmq1 = BN_bin2bn(data[6], attr_template[7].ulValueLen, NULL);
+ if (attr_template[8].ulValueLen > 0)
+ rsa->iqmp = BN_bin2bn(data[7], attr_template[8].ulValueLen, NULL);
+
+ rv = C_FindObjects(hSession, &key, 1, &ulObjectCount);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjects: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_search;
+ }
+ if (ulObjectCount != 0) {
+ fprintf(stderr, "C_FindObjects: found extra keys?\n");
+ error = 1;
+ goto exit_search;
+ }
+
+ printf("RSA=");
+ RSA_print_fp(stdout, rsa, 4);
+
+ fp = fopen(filename, "w");
+ if (fp == NULL) {
+ printf("Error opening output file.\n");
+ error = 1;
+ goto exit_search;
+ }
+
+ if (!PEM_write_RSAPrivateKey(fp, rsa, NULL, NULL, 0, NULL, NULL)) {
+ printf("Error writing output file.\n");
+ ERR_print_errors_fp(stderr);
+ error = 1;
+ goto exit_search;
+ }
+
+ exit_search:
+ rv = C_FindObjectsFinal(hSession);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjectsFinal: Error = 0x%.8X\n", rv);
+ error = 1;
+ }
+
+ exit_session:
+ (void) C_CloseSession(hSession);
+
+ exit_program:
+ (void) C_Finalize(NULL_PTR);
+
+ exit(error);
+}
diff --git a/contrib/pkcs11-keygen/set_key_id.c b/contrib/pkcs11-keygen/set_key_id.c
new file mode 100644
index 0000000..5c3a3c4
--- /dev/null
+++ b/contrib/pkcs11-keygen/set_key_id.c
@@ -0,0 +1,159 @@
+/* set_key_id [-s slot] [-p $pin] -n $keytag {-i $id | -l $label} */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#ifndef OPENCRYPTOKI
+#include <security/cryptoki.h>
+#include <security/pkcs11.h>
+#else
+#include <opencryptoki/pkcs11.h>
+#endif
+
+int
+main(int argc, char *argv[])
+{
+ CK_RV rv;
+ CK_SLOT_ID slot = 0;
+ CK_SESSION_HANDLE hSession;
+ CK_UTF8CHAR *pin = NULL;
+ CK_BYTE old_id[2], new_id[2];
+ CK_OBJECT_HANDLE akey;
+ int error = 0;
+ int i = 0;
+ int c, errflg = 0;
+ char *label = NULL;
+ CK_ULONG ulObjectCount;
+ int oid = 0, nid = 0;
+ CK_ATTRIBUTE search_template[] = {
+ {CKA_ID, &old_id, sizeof(old_id)}
+ };
+ extern char *optarg;
+ extern int optopt;
+
+ while ((c = getopt(argc, argv, ":s:i:n:l:p:")) != -1) {
+ switch (c) {
+ case 's':
+ slot = atoi(optarg);
+ break;
+ case 'i':
+ oid = atoi(optarg);
+ oid &= 0xffff;
+ old_id[0] = (oid >> 8) & 0xff;
+ old_id[1] = oid & 0xff;
+ break;
+ case 'n':
+ nid = atoi(optarg);
+ nid &= 0xffff;
+ new_id[0] = (nid >> 8) & 0xff;
+ new_id[1] = nid & 0xff;
+ break;
+ case 'l':
+ label = optarg;
+ break;
+ case 'p':
+ pin = (CK_UTF8CHAR *)optarg;
+ break;
+ case ':':
+ fprintf(stderr, "Option -%c requires an operand\n", optopt);
+ errflg++;
+ break;
+ case '?':
+ default:
+ fprintf(stderr, "Unrecognised option: -%c\n", optopt);
+ errflg++;
+ }
+ }
+ if ((errflg) || (!nid) || ((!oid) && (!label))) {
+ fprintf(stderr,
+ "usage: set_key_id [-s slot] [-p pin] -n new_id "
+ "{ -i old_id | -l label }\n");
+ exit(1);
+ }
+ if (!label)
+ printf("old %i new %i\n", oid, nid);
+ else {
+ printf("label %s new %i\n", label, nid);
+ search_template[0].type = CKA_LABEL;
+ search_template[0].pValue = label;
+ search_template[0].ulValueLen = strlen(label);
+ }
+
+ /* Initialize the CRYPTOKI library */
+ rv = C_Initialize(NULL_PTR);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_Initialize: Error = 0x%.8X\n", rv);
+ exit(1);
+ }
+
+ /* Open a session on the slot found */
+ rv = C_OpenSession(slot, CKF_RW_SESSION+CKF_SERIAL_SESSION,
+ NULL_PTR, NULL_PTR, &hSession);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_OpenSession: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_program;
+ }
+
+ /* Login to the Token (Keystore) */
+ if (!pin)
+#ifndef OPENCRYPTOKI
+ pin = (CK_UTF8CHAR *)getpassphrase("Enter Pin: ");
+#else
+ pin = (CK_UTF8CHAR *)getpass("Enter Pin: ");
+#endif
+ rv = C_Login(hSession, CKU_USER, pin, strlen((char *)pin));
+ memset(pin, 0, strlen((char *)pin));
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_Login: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_session;
+ }
+
+ rv = C_FindObjectsInit(hSession, search_template, 1);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjectsInit: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_session;
+ }
+
+ ulObjectCount = 1;
+ while(ulObjectCount) {
+ rv = C_FindObjects(hSession, &akey, 1, &ulObjectCount);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjects: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_search;
+ } else if (ulObjectCount) {
+ /* Set update template. */
+ CK_ATTRIBUTE new_template[] = {
+ {CKA_ID, &new_id, sizeof(new_id)}
+ };
+
+ rv = C_SetAttributeValue(hSession, akey, new_template, 1);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_SetAttributeValue: rv = 0x%.8X\n", rv);
+ error = 1;
+ }
+ }
+ }
+
+ exit_search:
+ rv = C_FindObjectsFinal(hSession);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjectsFinal: Error = 0x%.8X\n", rv);
+ error = 1;
+ }
+
+ exit_session:
+ (void) C_CloseSession(hSession);
+
+ exit_program:
+ (void) C_Finalize(NULL_PTR);
+
+ exit(error);
+}
diff --git a/contrib/pkcs11-keygen/writekey.c b/contrib/pkcs11-keygen/writekey.c
new file mode 100644
index 0000000..3d1ba99
--- /dev/null
+++ b/contrib/pkcs11-keygen/writekey.c
@@ -0,0 +1,360 @@
+/* writekey [-s $slot] [-p $pin] -l $label -i $id -f $filename */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#ifndef OPENCRYPTOKI
+#include <security/cryptoki.h>
+#include <security/pkcs11.h>
+#else
+#include <opencryptoki/pkcs11.h>
+#endif
+#include <openssl/conf.h>
+#include <openssl/engine.h>
+#include <openssl/err.h>
+#include <openssl/rsa.h>
+#include <openssl/pem.h>
+
+/* Define static key template values */
+static CK_BBOOL truevalue = TRUE;
+static CK_BBOOL falsevalue = FALSE;
+
+int
+main(int argc, char *argv[])
+{
+ ENGINE *e;
+ RSA *rsa = NULL;
+ FILE *fp;
+ CK_RV rv;
+ CK_SLOT_ID slot = 0;
+ CK_SESSION_HANDLE hSession;
+ CK_UTF8CHAR *pin = NULL;
+ CK_BYTE new_id[2];
+ CK_OBJECT_HANDLE key = CK_INVALID_HANDLE;
+ CK_OBJECT_CLASS kclass;
+ CK_KEY_TYPE ktype = CKK_RSA;
+ CK_ATTRIBUTE template[50];
+ CK_ULONG template_size;
+ CK_BYTE data[8][1024];
+ CK_ULONG ulObjectCount;
+ char *label = NULL, *filename = NULL;
+ int id = 0;
+ int error = 0;
+ int c, errflg = 0;
+ extern char *optarg;
+ extern int optopt;
+
+ while ((c = getopt(argc, argv, ":s:l:i:p:f:")) != -1) {
+ switch (c) {
+ case 's':
+ slot = atoi(optarg);
+ break;
+ case 'l':
+ label = optarg;
+ break;
+ case 'i':
+ id = atoi(optarg);
+ id &= 0xffff;
+ break;
+ case 'p':
+ pin = (CK_UTF8CHAR *)optarg;
+ break;
+ case 'f':
+ filename = optarg;
+ break;
+ case ':':
+ fprintf(stderr, "Option -%c requires an operand\n", optopt);
+ errflg++;
+ break;
+ case '?':
+ default:
+ fprintf(stderr, "Unrecognised option: -%c\n", optopt);
+ errflg++;
+ }
+ }
+ if ((errflg) || (!label) || (!id) || (!filename)) {
+ fprintf(stderr,
+ "usage: writekey [-s slot] [-p pin] -l label -i id "
+ "-f filename\n");
+ exit(2);
+ }
+
+ /* Load the config file */
+ OPENSSL_config(NULL);
+
+ /* Register engine */
+ e = ENGINE_by_id("pkcs11");
+ if (!e) {
+ /* the engine isn't available */
+ printf("The engine isn't available\n");
+ ERR_print_errors_fp(stderr);
+ exit(1);
+ }
+
+ if (!ENGINE_init(e)) {
+ /* the engine couldn't initialise, release 'e' */
+ printf("The engine couldn't initialise\n");
+ ERR_print_errors_fp(stderr);
+ ENGINE_free(e);
+ exit(1);
+ }
+
+ /* Read the key */
+ fp = fopen(filename, "r");
+ if (fp == NULL) {
+ printf("Error opening input file.\n");
+ ENGINE_free(e);
+ exit(1);
+ }
+
+ rsa = PEM_read_RSAPrivateKey(fp, NULL, NULL, NULL);
+ (void) fclose(fp);
+ if (rsa == NULL) {
+ printf("Error reading input file.\n");
+ ERR_print_errors_fp(stderr);
+ ENGINE_free(e);
+ exit(1);
+ }
+
+ /* Initialize the CRYPTOKI library */
+ rv = C_Initialize(NULL_PTR);
+ if ((rv != CKR_OK) && (rv != CKR_CRYPTOKI_ALREADY_INITIALIZED)) {
+ fprintf(stderr, "C_Initialize: Error = 0x%.8X\n", rv);
+ ENGINE_free(e);
+ exit(1);
+ }
+
+ /* Open a session on the slot found */
+ rv = C_OpenSession(slot, CKF_RW_SESSION+CKF_SERIAL_SESSION,
+ NULL_PTR, NULL_PTR, &hSession);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_OpenSession: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_program;
+ }
+
+ /* Login to the Token (Keystore) */
+ if (!pin)
+#ifndef OPENCRYPTOKI
+ pin = (CK_UTF8CHAR *)getpassphrase("Enter Pin: ");
+#else
+ pin = (CK_UTF8CHAR *)getpass("Enter Pin: ");
+#endif
+ rv = C_Login(hSession, CKU_USER, pin, strlen((char *)pin));
+ memset(pin, 0, strlen((char *)pin));
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_Login: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_session;
+ }
+
+ /* fill the search template */
+ if (strstr(label, "pkcs11:") == label)
+ label = strstr(label, ":") + 1;
+ kclass = CKO_PRIVATE_KEY;
+ template[0].type = CKA_TOKEN;
+ template[0].pValue = &truevalue;
+ template[0].ulValueLen = sizeof (truevalue);
+ template[1].type = CKA_CLASS;
+ template[1].pValue = &kclass;
+ template[1].ulValueLen = sizeof (kclass);
+ template[2].type = CKA_LABEL;
+ template[2].pValue = label;
+ template[2].ulValueLen = strlen(label);
+
+ /* check if a key with the same label already exists */
+ rv = C_FindObjectsInit(hSession, template, 3);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjectsInit: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_session;
+ }
+ rv = C_FindObjects(hSession, &key, 1, &ulObjectCount);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjects: Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_search;
+ }
+ if (ulObjectCount != 0) {
+ fprintf(stderr, "Key already exists.\n");
+ error = 1;
+ goto exit_search;
+ }
+
+ /* fill attributes for the public key */
+ new_id[0] = (id >> 8) & 0xff;
+ new_id[1] = id & 0xff;
+ kclass = CKO_PUBLIC_KEY;
+ if (BN_num_bytes(rsa->n) > 1024) {
+ fprintf(stderr, "RSA modulus too large\n");
+ error = 1;
+ goto exit_search;
+ }
+ BN_bn2bin(rsa->n, data[0]);
+ if (BN_num_bytes(rsa->e) > 1024) {
+ fprintf(stderr, "RSA public exponent too large\n");
+ error = 1;
+ goto exit_search;
+ }
+ BN_bn2bin(rsa->e, data[1]);
+ if (BN_num_bytes(rsa->d) > 1024) {
+ fprintf(stderr, "RSA private exponent too large\n");
+ error = 1;
+ goto exit_search;
+ }
+ BN_bn2bin(rsa->d, data[2]);
+ if (BN_num_bytes(rsa->p) > 1024) {
+ fprintf(stderr, "RSA prime 1 too large\n");
+ error = 1;
+ goto exit_search;
+ }
+ BN_bn2bin(rsa->p, data[3]);
+ if (BN_num_bytes(rsa->q) > 1024) {
+ fprintf(stderr, "RSA prime 2 too large\n");
+ error = 1;
+ goto exit_search;
+ }
+ BN_bn2bin(rsa->q, data[4]);
+ if (BN_num_bytes(rsa->dmp1) > 1024) {
+ fprintf(stderr, "RSA exponent 1 too large\n");
+ error = 1;
+ goto exit_search;
+ }
+ BN_bn2bin(rsa->dmp1, data[5]);
+ if (BN_num_bytes(rsa->dmq1) > 1024) {
+ fprintf(stderr, "RSA exponent 2 too large\n");
+ error = 1;
+ goto exit_search;
+ }
+ BN_bn2bin(rsa->dmq1, data[6]);
+ if (BN_num_bytes(rsa->iqmp) > 1024) {
+ fprintf(stderr, "RSA coefficient too large\n");
+ error = 1;
+ goto exit_search;
+ }
+ BN_bn2bin(rsa->iqmp, data[7]);
+
+ template[0].type = CKA_TOKEN;
+ template[0].pValue = &truevalue;
+ template[0].ulValueLen = sizeof (truevalue);
+ template[1].type = CKA_CLASS;
+ template[1].pValue = &kclass;
+ template[1].ulValueLen = sizeof (kclass);
+ template[2].type = CKA_LABEL;
+ template[2].pValue = label;
+ template[2].ulValueLen = strlen(label);
+ template[3].type = CKA_ID;
+ template[3].pValue = new_id;
+ template[3].ulValueLen = sizeof (new_id);
+ template[4].type = CKA_KEY_TYPE;
+ template[4].pValue = &ktype;
+ template[4].ulValueLen = sizeof (ktype);
+ template[5].type = CKA_ENCRYPT;
+ template[5].pValue = &truevalue;
+ template[5].ulValueLen = sizeof (truevalue);
+ template[6].type = CKA_VERIFY;
+ template[6].pValue = &truevalue;
+ template[6].ulValueLen = sizeof (truevalue);
+ template[7].type = CKA_VERIFY_RECOVER;
+ template[7].pValue = &truevalue;
+ template[7].ulValueLen = sizeof (truevalue);
+ template[8].type = CKA_MODULUS;
+ template[8].pValue = data[0];
+ template[8].ulValueLen = BN_num_bytes(rsa->n);
+ template[9].type = CKA_PUBLIC_EXPONENT;
+ template[9].pValue = data[1];
+ template[9].ulValueLen = BN_num_bytes(rsa->e);
+
+ rv = C_CreateObject(hSession, template, 10, &key);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_CreateObject (pub): Error = 0x%.8X\n", rv);
+ error = 1;
+ goto exit_search;
+ }
+
+ /* fill attributes for the private key */
+ kclass = CKO_PRIVATE_KEY;
+ template[0].type = CKA_TOKEN;
+ template[0].pValue = &truevalue;
+ template[0].ulValueLen = sizeof (truevalue);
+ template[1].type = CKA_CLASS;
+ template[1].pValue = &kclass;
+ template[1].ulValueLen = sizeof (kclass);
+ template[2].type = CKA_LABEL;
+ template[2].pValue = label;
+ template[2].ulValueLen = strlen(label);
+ template[3].type = CKA_ID;
+ template[3].pValue = new_id;
+ template[3].ulValueLen = sizeof (new_id);
+ template[4].type = CKA_KEY_TYPE;
+ template[4].pValue = &ktype;
+ template[4].ulValueLen = sizeof (ktype);
+ template[5].type = CKA_SENSITIVE;
+ template[5].pValue = &falsevalue;
+ template[5].ulValueLen = sizeof (falsevalue);
+ template[6].type = CKA_EXTRACTABLE;
+ template[6].pValue = &truevalue;
+ template[6].ulValueLen = sizeof (truevalue);
+ template[7].type = CKA_DECRYPT;
+ template[7].pValue = &truevalue;
+ template[7].ulValueLen = sizeof (truevalue);
+ template[8].type = CKA_SIGN;
+ template[8].pValue = &truevalue;
+ template[8].ulValueLen = sizeof (truevalue);
+ template[9].type = CKA_SIGN_RECOVER;
+ template[9].pValue = &truevalue;
+ template[9].ulValueLen = sizeof (truevalue);
+ template[10].type = CKA_MODULUS;
+ template[10].pValue = data[0];
+ template[10].ulValueLen = BN_num_bytes(rsa->n);
+ template[11].type = CKA_PUBLIC_EXPONENT;
+ template[11].pValue = data[1];
+ template[11].ulValueLen = BN_num_bytes(rsa->e);
+ template[12].type = CKA_PRIVATE_EXPONENT;
+ template[12].pValue = data[2];
+ template[12].ulValueLen = BN_num_bytes(rsa->d);
+ template[13].type = CKA_PRIME_1;
+ template[13].pValue = data[3];
+ template[13].ulValueLen = BN_num_bytes(rsa->p);
+ template[14].type = CKA_PRIME_2;
+ template[14].pValue = data[4];
+ template[14].ulValueLen = BN_num_bytes(rsa->q);
+ template[15].type = CKA_EXPONENT_1;
+ template[15].pValue = data[5];
+ template[15].ulValueLen = BN_num_bytes(rsa->dmp1);
+ template[16].type = CKA_EXPONENT_2;
+ template[16].pValue = data[6];
+ template[16].ulValueLen = BN_num_bytes(rsa->dmq1);
+ template[17].type = CKA_COEFFICIENT;
+ template[17].pValue = data[7];
+ template[17].ulValueLen = BN_num_bytes(rsa->iqmp);
+
+ rv = C_CreateObject(hSession, template, 18, &key);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_CreateObject (priv): Error = 0x%.8X\n", rv);
+ (void) C_DestroyObject(hSession, key);
+ error = 1;
+ goto exit_search;
+ }
+
+ exit_search:
+ rv = C_FindObjectsFinal(hSession);
+ if (rv != CKR_OK) {
+ fprintf(stderr, "C_FindObjectsFinal: Error = 0x%.8X\n", rv);
+ error = 1;
+ }
+
+ exit_session:
+ (void) C_CloseSession(hSession);
+
+ exit_program:
+ (void) C_Finalize(NULL_PTR);
+ ENGINE_free(e);
+ ENGINE_cleanup();
+
+ exit(error);
+}
diff --git a/contrib/pkcs11-keygen/writekey.sh b/contrib/pkcs11-keygen/writekey.sh
new file mode 100755
index 0000000..9b235d0
--- /dev/null
+++ b/contrib/pkcs11-keygen/writekey.sh
@@ -0,0 +1,73 @@
+#!/bin/bash --debug
+
+usage="Usage: $0 -x ext -p pin -f keyrootname"
+tmp_file=/tmp/cur_pem.$$
+while getopts ":x:p:f:" opt; do
+ case $opt in
+ x ) ext=$OPTARG ;;
+ p ) pin=$OPTARG ;;
+ f ) root=$OPTARG ;;
+ \? ) echo $usage
+ exit 1 ;;
+ esac
+done
+shift $(($OPTIND -1))
+
+if [ ! "$ext" -o ! "$pin" -o ! "$root" ] ; then
+ echo $usage
+ exit 1
+fi
+
+keyfile=${root}.key
+privfile=${root}.private
+file=`basename $root | sed 's/^K//'`
+zone=`echo $file | awk -F+ '{ print $1 }' | sed 's/\.$//'`
+algo=`echo $file | awk -F+ '{ print $2 }'`
+tag=`echo $file | awk -F+ '{ print $3 }'`
+
+# debug
+echo 'zone: ' $zone
+echo 'algo: ' $algo
+echo 'tag: ' $tag
+
+if [ ! -r "$keyfile" ] ; then
+ echo "can't read " $keyfile
+ exit 1
+fi
+if [ ! -r "$privfile" ] ; then
+ echo "can't read " $privfile
+ exit 1
+fi
+
+if [ "$algo" != "005" ] ; then
+ echo 'algorithm must be 005'
+ exit 1
+fi
+
+# for testing
+mypath=.
+
+echo 'Reading key files'
+flag=`$mypath/keydump.pl -k $keyfile -p $privfile -o $tmp_file`
+
+if [ "$flag" = "256" ] ; then
+ label=$zone,zsk,$ext
+elif [ "$flag" = "257" ] ; then
+ label=$zone,ksk,$ext
+else
+ echo 'flag must be 256 or 257'
+ rm $tmp_file
+ exit 1
+fi
+
+echo "Label will be '"$label"'"
+$mypath/writekey -p $pin -l $label -i $tag -f $tmp_file
+
+rm $tmp_file
+
+echo 'Now you can add at the end of ' $privfile
+/usr/bin/perl <<EOF
+use MIME::Base64;
+print "Engine: ", encode_base64("pkcs11\0",""), "\n";
+print "Label: ", encode_base64("pkcs11:"."$label"."\0",""), "\n";
+EOF
diff --git a/contrib/query-loc-0.4.0/ADDRESSES b/contrib/query-loc-0.4.0/ADDRESSES
new file mode 100644
index 0000000..49fb7d8
--- /dev/null
+++ b/contrib/query-loc-0.4.0/ADDRESSES
@@ -0,0 +1,16 @@
+The following machines, at least today seem to have LOC
+records:
+
+147.210.73.0/24 (note the two /25 have different LOC, inherited differently)
+130.104.3.*
+Melanie.Tolna.Net
+204.92.254.*
+alink.net
+caida.org
+ckdhr.com
+distributed.net (rc5stats.distributed.net)
+nikhef.nl
+yahoo.com
+nic.af
+
+$Id: ADDRESSES,v 1.1 2008/02/15 01:47:15 marka Exp $
diff --git a/contrib/query-loc-0.4.0/ALGO b/contrib/query-loc-0.4.0/ALGO
new file mode 100644
index 0000000..4695dc1
--- /dev/null
+++ b/contrib/query-loc-0.4.0/ALGO
@@ -0,0 +1,48 @@
+Just for info, can be out of date.
+
+
+RFC 1876, 5.2, specially 5.2.3
+
+Important points:
+
+- LOC RRs are always attached to a *name*.
+- we can have two (or more) RRs for one address, one more specific than the other
+
+main
+ if (host is a name)
+ getLOCbyname
+ else # host is an IP address
+ gethostbyaddr
+ if (name)
+ getLOCbyname
+ # If there is none, do not search. We assume the above was sufficient # (But check 5.2.2)
+ else
+ getLOCbyaddress
+
+getLOCbyname (host)
+ get LOC for host
+ if (it exists)
+ OK
+ else
+ get all A records of the name
+ foreach A record
+ getLOCbyaddress
+ OK at the first one found
+ # we assume they are consistent
+ END
+
+getLOCbyaddress (address)
+ # May receive a mask. Otherwise, deduce it from the class
+ makeNetAddress
+ getLOCbynetwork
+
+getLOCbynetwork
+ get PTR and A for it
+ if (exist)
+ getLOCbyname
+ ******* DIFFICULT : we have to manage a stack. See the code
+ makeNetAddress (level--)
+ getLOCbynetwork
+ else
+ END
+
diff --git a/contrib/query-loc-0.4.0/INSTALL b/contrib/query-loc-0.4.0/INSTALL
new file mode 100644
index 0000000..97e740b
--- /dev/null
+++ b/contrib/query-loc-0.4.0/INSTALL
@@ -0,0 +1,9 @@
+Type './configure', then 'make' and (as root if necessary) 'make
+install'.
+
+It requires a recent libresolv, with loc_ntoa, but use an alternative
+which I provide, if not found.
+
+Tested on Linux (i386 and Alpha), Solaris (Sparc) and Digital Unix (Alpha).
+
+$Id: INSTALL,v 1.1 2008/02/15 01:47:15 marka Exp $
diff --git a/contrib/query-loc-0.4.0/Makefile.in b/contrib/query-loc-0.4.0/Makefile.in
new file mode 100644
index 0000000..eefa2ac
--- /dev/null
+++ b/contrib/query-loc-0.4.0/Makefile.in
@@ -0,0 +1,42 @@
+# $Id: Makefile.in,v 1.1 2008/02/15 01:47:15 marka Exp $
+CC=@CC@
+CFLAGS=@CFLAGS@
+LIBS=@LIBS@
+DESTDIR=@prefix@
+BINDIR=@prefix@/bin
+MANDIR=@prefix@/share/man/man1
+DISTRIB= README INSTALL ALGO USAGE ADDRESSES Makefile.in configure configure.in config.h.in install-sh loc.h loc.c query-loc.c loc_ntoa.c query-loc.1 reconf
+OBJS=query-loc.o loc.o @LOC_NTOA@
+VERSION=`grep VERSION loc.h | cut -d ' ' -f 3 | sed s/\"//g`
+
+all: query-loc
+
+query-loc: $(OBJS)
+ $(CC) -o $@ $(OBJS) $(LIBS)
+
+%.o: %.c loc.h
+ $(CC) $(CFLAGS) -c $<
+
+clean:
+ rm -f *.o query-loc *~
+
+distclean: clean
+ rm -f config.h config.cache config.log config.status Makefile
+
+dist: distrib
+
+distrib: clean
+ ./reconf
+ @(echo Query-Loc is version ${VERSION}; \
+ mkdir query-loc-${VERSION}; \
+ cp $(DISTRIB) query-loc-${VERSION};\
+ tar cvf query-loc-${VERSION}.tar query-loc-${VERSION}; \
+ rm -rf query-loc-${VERSION}; \
+ gzip -v -9 -f query-loc-${VERSION}.tar);
+
+install:
+ @INSTALL@ -m 0755 query-loc $(BINDIR)
+ if [ ! -d $(MANDIR) ]; then \
+ mkdir $(MANDIR); \
+ fi
+ @INSTALL@ -m 0644 query-loc.1 $(MANDIR)
diff --git a/contrib/query-loc-0.4.0/README b/contrib/query-loc-0.4.0/README
new file mode 100644
index 0000000..250b378
--- /dev/null
+++ b/contrib/query-loc-0.4.0/README
@@ -0,0 +1,21 @@
+ query-loc: a program to retrieve and display the location
+ information in the DNS.
+
+ It uses the algorithms described in
+ RFC 1876 (and RFC 1101 to get the network names).
+ You can find examples of networks wchich implement this scheme
+ in the ADDRESSES file.
+
+ It is under the General Public Licence (GPL, which
+ you can fetch from <http://www.gnu.org/copyleft/gpl.html>.
+
+ Copyright Stéphane Bortzmeyer <bortzmeyer@sources.org>, 1998-2007.
+
+ Thanks to Paul Vixie for the RFC and its encouragements. Thanks
+ to Björn Augustsson for the xtraceroute program
+ <http://www.dtek.chalmers.se/~d3august/xt/>. Thanks to Roland
+ Dirlewanger for extensive patching.
+
+$Id: README,v 1.1 2008/02/15 01:47:15 marka Exp $
+
+
diff --git a/contrib/query-loc-0.4.0/USAGE b/contrib/query-loc-0.4.0/USAGE
new file mode 100644
index 0000000..d3ee4c0
--- /dev/null
+++ b/contrib/query-loc-0.4.0/USAGE
@@ -0,0 +1,7 @@
+query-loc [-v] [-d nnn] host-name-or-address
+
+Examples of hosts with LOCation info (quite uncommon, if you know more,
+please tell me):
+
+See the ADDRESSES file
+
diff --git a/contrib/query-loc-0.4.0/config.h.in b/contrib/query-loc-0.4.0/config.h.in
new file mode 100644
index 0000000..d436639
--- /dev/null
+++ b/contrib/query-loc-0.4.0/config.h.in
@@ -0,0 +1,69 @@
+/* config.h.in. Generated from configure.in by autoheader. */
+/* $Id: config.h.in,v 1.1 2008/02/15 01:47:15 marka Exp $ */
+
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `resolv' library (-lresolv). */
+#undef HAVE_LIBRESOLV
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* The size of a `char', as computed by sizeof. */
+#undef SIZEOF_CHAR
+
+/* The size of a `int', as computed by sizeof. */
+#undef SIZEOF_INT
+
+/* The size of a `long', as computed by sizeof. */
+#undef SIZEOF_LONG
+
+/* The size of a `short', as computed by sizeof. */
+#undef SIZEOF_SHORT
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Is there a loc_ntoa on this system? */
+#undef HAVE_LOC_NTOA
diff --git a/contrib/query-loc-0.4.0/configure b/contrib/query-loc-0.4.0/configure
new file mode 100755
index 0000000..d77cf76
--- /dev/null
+++ b/contrib/query-loc-0.4.0/configure
@@ -0,0 +1,6436 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59.
+#
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete. It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="query-loc.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CPP EGREP LOC_NTOA LIBOBJS LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+ac_prev=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_option in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval "enable_$ac_feature=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_$ac_feature='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_$ac_package='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval "with_$ac_package=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+ localstatedir libdir includedir oldincludedir infodir mandir
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+ { (exit 1); exit 1; }; }
+ else
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+ fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+ cat <<_ACEOF
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
+_ACEOF
+
+ cat <<\_ACEOF
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+ cat <<\_ACEOF
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ ac_popdir=`pwd`
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d $ac_dir || continue
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+ cd $ac_dir
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f $ac_srcdir/configure.gnu; then
+ echo
+ $SHELL $ac_srcdir/configure.gnu --help=recursive
+ elif test -f $ac_srcdir/configure; then
+ echo
+ $SHELL $ac_srcdir/configure --help=recursive
+ elif test -f $ac_srcdir/configure.ac ||
+ test -f $ac_srcdir/configure.in; then
+ echo
+ $ac_configure --help
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi
+ cd "$ac_popdir"
+ done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+ cat <<\_ACEOF
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ # Get rid of the leading space.
+ ac_sep=" "
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+{
+ (set) 2>&1 |
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ sed -n \
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ ;;
+ *)
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+}
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ sed "/^$/d" confdefs.h | sort
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core &&
+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+ ' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
+ esac
+ fi
+else
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+ eval ac_new_val="\$ac_env_${ac_var}_value"
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_CC" && break
+done
+
+ CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
+ break;;
+ * )
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std1 is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std1. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ '' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+if test "$GCC" = "yes"; then
+ CFLAGS="${CFLAGS} -Wall"
+fi
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f $ac_dir/shtool; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL=$ac_install_sh
+ fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+
+
+echo "$as_me:$LINENO: checking for res_query in -lresolv" >&5
+echo $ECHO_N "checking for res_query in -lresolv... $ECHO_C" >&6
+if test "${ac_cv_lib_resolv_res_query+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lresolv $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char res_query ();
+int
+main ()
+{
+res_query ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_resolv_res_query=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_resolv_res_query=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_res_query" >&5
+echo "${ECHO_T}$ac_cv_lib_resolv_res_query" >&6
+if test $ac_cv_lib_resolv_res_query = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBRESOLV 1
+_ACEOF
+
+ LIBS="-lresolv $LIBS"
+
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ exit(2);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+ ac_config_headers="$ac_config_headers config.h"
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+if test "${ac_cv_header_resolv_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for resolv.h" >&5
+echo $ECHO_N "checking for resolv.h... $ECHO_C" >&6
+if test "${ac_cv_header_resolv_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_resolv_h" >&5
+echo "${ECHO_T}$ac_cv_header_resolv_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking resolv.h usability" >&5
+echo $ECHO_N "checking resolv.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <resolv.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking resolv.h presence" >&5
+echo $ECHO_N "checking resolv.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <resolv.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: resolv.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: resolv.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: resolv.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: resolv.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: resolv.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: resolv.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: resolv.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: resolv.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: resolv.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: resolv.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: resolv.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: resolv.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: resolv.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: resolv.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: resolv.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: resolv.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for resolv.h" >&5
+echo $ECHO_N "checking for resolv.h... $ECHO_C" >&6
+if test "${ac_cv_header_resolv_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_resolv_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_resolv_h" >&5
+echo "${ECHO_T}$ac_cv_header_resolv_h" >&6
+
+fi
+if test $ac_cv_header_resolv_h = yes; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: \"No headers for name service applications\"" >&5
+echo "$as_me: error: \"No headers for name service applications\"" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+if test "${ac_cv_header_arpa_nameser_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for arpa/nameser.h" >&5
+echo $ECHO_N "checking for arpa/nameser.h... $ECHO_C" >&6
+if test "${ac_cv_header_arpa_nameser_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_arpa_nameser_h" >&5
+echo "${ECHO_T}$ac_cv_header_arpa_nameser_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking arpa/nameser.h usability" >&5
+echo $ECHO_N "checking arpa/nameser.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <arpa/nameser.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking arpa/nameser.h presence" >&5
+echo $ECHO_N "checking arpa/nameser.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <arpa/nameser.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: arpa/nameser.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: arpa/nameser.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: arpa/nameser.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: arpa/nameser.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: arpa/nameser.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: arpa/nameser.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: arpa/nameser.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: arpa/nameser.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: arpa/nameser.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: arpa/nameser.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: arpa/nameser.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: arpa/nameser.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: arpa/nameser.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: arpa/nameser.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: arpa/nameser.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: arpa/nameser.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for arpa/nameser.h" >&5
+echo $ECHO_N "checking for arpa/nameser.h... $ECHO_C" >&6
+if test "${ac_cv_header_arpa_nameser_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_arpa_nameser_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_arpa_nameser_h" >&5
+echo "${ECHO_T}$ac_cv_header_arpa_nameser_h" >&6
+
+fi
+if test $ac_cv_header_arpa_nameser_h = yes; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: \"No headers for name service applications\"" >&5
+echo "$as_me: error: \"No headers for name service applications\"" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+if test "${ac_cv_header_sys_time_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for sys/time.h" >&5
+echo $ECHO_N "checking for sys/time.h... $ECHO_C" >&6
+if test "${ac_cv_header_sys_time_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_time_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_time_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking sys/time.h usability" >&5
+echo $ECHO_N "checking sys/time.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <sys/time.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking sys/time.h presence" >&5
+echo $ECHO_N "checking sys/time.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/time.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: sys/time.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sys/time.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/time.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: sys/time.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: sys/time.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sys/time.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/time.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sys/time.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/time.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: sys/time.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/time.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: sys/time.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/time.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/time.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/time.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: sys/time.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for sys/time.h" >&5
+echo $ECHO_N "checking for sys/time.h... $ECHO_C" >&6
+if test "${ac_cv_header_sys_time_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_sys_time_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_time_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_time_h" >&6
+
+fi
+if test $ac_cv_header_sys_time_h = yes; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: \"Mandatory header missing on your system\"" >&5
+echo "$as_me: error: \"Mandatory header missing on your system\"" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+if test "${ac_cv_header_unistd_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for unistd.h" >&5
+echo $ECHO_N "checking for unistd.h... $ECHO_C" >&6
+if test "${ac_cv_header_unistd_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_unistd_h" >&5
+echo "${ECHO_T}$ac_cv_header_unistd_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking unistd.h usability" >&5
+echo $ECHO_N "checking unistd.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <unistd.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking unistd.h presence" >&5
+echo $ECHO_N "checking unistd.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <unistd.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: unistd.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: unistd.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: unistd.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: unistd.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: unistd.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: unistd.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: unistd.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: unistd.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: unistd.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: unistd.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: unistd.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: unistd.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: unistd.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: unistd.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: unistd.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: unistd.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for unistd.h" >&5
+echo $ECHO_N "checking for unistd.h... $ECHO_C" >&6
+if test "${ac_cv_header_unistd_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_unistd_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_unistd_h" >&5
+echo "${ECHO_T}$ac_cv_header_unistd_h" >&6
+
+fi
+if test $ac_cv_header_unistd_h = yes; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: \"Mandatory header missing on your system\"" >&5
+echo "$as_me: error: \"Mandatory header missing on your system\"" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+
+
+echo "$as_me:$LINENO: checking if libnsl is mandatory" >&5
+echo $ECHO_N "checking if libnsl is mandatory... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+ #include <netinet/in.h>
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+ union
+ {
+ HEADER hdr;
+ u_char buf[4096]; /* With RFC 2671, otherwise 512 is enough */
+ }
+ response;
+ char *domain;
+ int requested_type;
+int
+main ()
+{
+res_query(domain,
+ C_IN,
+ requested_type,
+ (u_char *) & response,
+ sizeof (response))
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; LIBS="${LIBS} -lnsl"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+echo "$as_me:$LINENO: checking loc_ntoa" >&5
+echo $ECHO_N "checking loc_ntoa... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <resolv.h>
+int
+main ()
+{
+ u_char *cp; char *result; loc_ntoa(cp, result)
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF
+#define HAVE_LOC_NTOA 1
+_ACEOF
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ echo "$as_me:$LINENO: result: no, using the alternative" >&5
+echo "${ECHO_T}no, using the alternative" >&6; LOC_NTOA=loc_ntoa.o
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+
+echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
+if test "${ac_cv_c_const+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset x;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *ccp;
+ char **p;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ ccp = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++ccp;
+ p = (char**) ccp;
+ ccp = (char const *const *) p;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ }
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_const=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_const=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for long" >&5
+echo $ECHO_N "checking for long... $ECHO_C" >&6
+if test "${ac_cv_type_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((long *) 0)
+ return 0;
+if (sizeof (long))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_long=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_long=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5
+echo "${ECHO_T}$ac_cv_type_long" >&6
+
+echo "$as_me:$LINENO: checking size of long" >&5
+echo $ECHO_N "checking size of long... $ECHO_C" >&6
+if test "${ac_cv_sizeof_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_long" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_long=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (long)); }
+unsigned long ulongval () { return (long) (sizeof (long)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (long))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (long))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (long))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_long=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_long=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_long" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+_ACEOF
+
+
+echo "$as_me:$LINENO: checking for int" >&5
+echo $ECHO_N "checking for int... $ECHO_C" >&6
+if test "${ac_cv_type_int+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((int *) 0)
+ return 0;
+if (sizeof (int))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_int=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_int=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5
+echo "${ECHO_T}$ac_cv_type_int" >&6
+
+echo "$as_me:$LINENO: checking size of int" >&5
+echo $ECHO_N "checking size of int... $ECHO_C" >&6
+if test "${ac_cv_sizeof_int+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_int" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_int=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (int)); }
+unsigned long ulongval () { return (long) (sizeof (int)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (int))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (int))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (int))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_int=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_int=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
+echo "${ECHO_T}$ac_cv_sizeof_int" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+_ACEOF
+
+
+echo "$as_me:$LINENO: checking for short" >&5
+echo $ECHO_N "checking for short... $ECHO_C" >&6
+if test "${ac_cv_type_short+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((short *) 0)
+ return 0;
+if (sizeof (short))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_short=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_short=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5
+echo "${ECHO_T}$ac_cv_type_short" >&6
+
+echo "$as_me:$LINENO: checking size of short" >&5
+echo $ECHO_N "checking size of short... $ECHO_C" >&6
+if test "${ac_cv_sizeof_short+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_short" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_short=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (short), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (short)); }
+unsigned long ulongval () { return (long) (sizeof (short)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (short))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (short))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (short))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_short=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (short), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_short=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5
+echo "${ECHO_T}$ac_cv_sizeof_short" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_SHORT $ac_cv_sizeof_short
+_ACEOF
+
+
+echo "$as_me:$LINENO: checking for char" >&5
+echo $ECHO_N "checking for char... $ECHO_C" >&6
+if test "${ac_cv_type_char+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((char *) 0)
+ return 0;
+if (sizeof (char))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_char=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_char=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_char" >&5
+echo "${ECHO_T}$ac_cv_type_char" >&6
+
+echo "$as_me:$LINENO: checking size of char" >&5
+echo $ECHO_N "checking size of char... $ECHO_C" >&6
+if test "${ac_cv_sizeof_char+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_char" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (char))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (char))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (char))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (char))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (char))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_char=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (char), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (char), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (char)); }
+unsigned long ulongval () { return (long) (sizeof (char)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (char))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (char))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (char))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_char=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (char), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (char), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_char=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_char" >&5
+echo "${ECHO_T}$ac_cv_sizeof_char" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_CHAR $ac_cv_sizeof_char
+_ACEOF
+
+
+
+ ac_config_files="$ac_config_files Makefile"
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+ (set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+ if test -w $cache_file; then
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ cat confcache >$cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ ]*$//;
+}'
+fi
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_i=`echo "$ac_i" |
+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+ # 2. Add them.
+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling. Logging --version etc. is OK.
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.59,
+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "x$1" : 'x\([^=]*\)='`
+ ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ -*)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ *) # This is not an option, so the user has probably given explicit
+ # arguments.
+ ac_option=$1
+ ac_need_defaults=false;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --vers* | -V )
+ echo "$ac_cs_version"; exit 0 ;;
+ --he | --h)
+ # Conflict between --help and --header
+ { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1" ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./confstat$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CPP@,$CPP,;t t
+s,@EGREP@,$EGREP,;t t
+s,@LOC_NTOA@,$LOC_NTOA,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+ cat >>$CONFIG_STATUS <<\_ACEOF
+ # Split the substitutions into bite-sized pieces for seds with
+ # small command number limits, like on Digital OSF/1 and HP-UX.
+ ac_max_sed_lines=48
+ ac_sed_frag=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_lines # Line after last line for current file.
+ ac_more_lines=:
+ ac_sed_cmds=
+ while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ else
+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ fi
+ if test ! -s $tmp/subs.frag; then
+ ac_more_lines=false
+ else
+ # The purpose of the label and of the branching condition is to
+ # speed up the sed processing (if there are no `@' at all, there
+ # is no need to browse any of the substitutions).
+ # These are the two extra sed commands mentioned above.
+ (echo ':t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+ fi
+ ac_sed_frag=`expr $ac_sed_frag + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_lines`
+ fi
+ done
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+ fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
+ esac
+
+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+ esac
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ configure_input=
+ else
+ configure_input="$ac_file. "
+ fi
+ configure_input=$configure_input"Generated from `echo $ac_file_in |
+ sed 's,.*/,,'` by configure."
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo "$f";;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo "$f"
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo "$srcdir/$f"
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+ rm -f $tmp/stdin
+ if test x"$ac_file" != x-; then
+ mv $tmp/out $ac_file
+ else
+ cat $tmp/out
+ rm -f $tmp/out
+ fi
+
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_HEADER section.
+#
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='[ ].*$,\1#\2'
+ac_dC=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='$,\1#\2define\3'
+ac_uC=' '
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
+ esac
+
+ test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ # Do quote $f, to prevent DOS paths from being IFS'd.
+ echo "$f";;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo "$f"
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo "$srcdir/$f"
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+ # Remove the trailing spaces.
+ sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h. The first handles `#define'
+# templates, and the second `#undef' templates.
+# And first: Protect against being on the right side of a sed subst in
+# config.status. Protect against being in an unquoted here document
+# in config.status.
+rm -f conftest.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless. Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >>conftest.undefs <<\_ACEOF
+s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo ' :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+ # Write a limited-size here document to $tmp/defines.sed.
+ echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#define' lines.
+ echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f $tmp/defines.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+ rm -f conftest.defines
+ mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo ' fi # grep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.undefs >/dev/null
+do
+ # Write a limited-size here document to $tmp/undefs.sed.
+ echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#undef'
+ echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+ rm -f conftest.undefs
+ mv conftest.tail conftest.undefs
+done
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ echo "/* Generated by configure. */" >$tmp/config.h
+ else
+ echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
+ fi
+ cat $tmp/in >>$tmp/config.h
+ rm -f $tmp/in
+ if test x"$ac_file" != x-; then
+ if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+ { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ rm -f $ac_file
+ mv $tmp/config.h $ac_file
+ fi
+ else
+ cat $tmp/config.h
+ rm -f $tmp/config.h
+ fi
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+
+
+
+
diff --git a/contrib/query-loc-0.4.0/configure.in b/contrib/query-loc-0.4.0/configure.in
new file mode 100644
index 0000000..2530fb0
--- /dev/null
+++ b/contrib/query-loc-0.4.0/configure.in
@@ -0,0 +1,65 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_RELEASE("$Id: configure.in,v 1.1 2008/02/15 01:47:15 marka Exp $")
+AC_INIT(query-loc.c)
+
+dnl Checks for programs.
+AC_PROG_CC
+if test "$GCC" = "yes"; then
+ CFLAGS="${CFLAGS} -Wall"
+fi
+AC_PROG_INSTALL
+
+dnl Checks for libraries.
+AC_CHECK_LIB(resolv, res_query)
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CONFIG_HEADER(config.h)
+AC_CHECK_HEADER(resolv.h, , AC_MSG_ERROR("No headers for name service applications"))
+AC_CHECK_HEADER(arpa/nameser.h, , AC_MSG_ERROR("No headers for name service applications"))
+AC_CHECK_HEADER(sys/time.h, , AC_MSG_ERROR("Mandatory header missing on your system"))
+AC_CHECK_HEADER(unistd.h, , AC_MSG_ERROR("Mandatory header missing on your system"))
+
+
+dnl This one is only useful for Solaris?
+AC_MSG_CHECKING(if libnsl is mandatory)
+AC_TRY_LINK([#include <sys/types.h>
+ #include <netinet/in.h>
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+ union
+ {
+ HEADER hdr;
+ u_char buf[4096]; /* With RFC 2671, otherwise 512 is enough */
+ }
+ response;
+ char *domain;
+ int requested_type; ],
+ [res_query(domain,
+ C_IN,
+ requested_type,
+ (u_char *) & response,
+ sizeof (response)) ], dnl
+ [AC_MSG_RESULT(no)], dnl
+ [AC_MSG_RESULT(yes); LIBS="${LIBS} -lnsl"])
+
+dnl Check for the loc_ntoa macro/function
+AC_MSG_CHECKING(loc_ntoa)
+AC_TRY_LINK([#include <resolv.h>], dnl
+ [u_char *cp; char *result; loc_ntoa(cp, result)], dnl
+ [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_LOC_NTOA)], dnl
+ [AC_MSG_RESULT([no, using the alternative]); LOC_NTOA=loc_ntoa.o])
+AC_SUBST(LOC_NTOA)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(short)
+AC_CHECK_SIZEOF(char)
+
+dnl Misc.
+AC_OUTPUT(Makefile)
+
+
+
diff --git a/contrib/query-loc-0.4.0/install-sh b/contrib/query-loc-0.4.0/install-sh
new file mode 100755
index 0000000..1a83534
--- /dev/null
+++ b/contrib/query-loc-0.4.0/install-sh
@@ -0,0 +1,323 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2005-02-02.21
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c (ignored)
+-d create directories instead of installing files.
+-g GROUP $chgrpprog installed files to GROUP.
+-m MODE $chmodprog installed files to MODE.
+-o USER $chownprog installed files to USER.
+-s $stripprog installed files.
+-t DIRECTORY install into DIRECTORY.
+-T report an error if DSTFILE is a directory.
+--help display this help and exit.
+--version display version info and exit.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+ case $1 in
+ -c) shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd=$stripprog
+ shift
+ continue;;
+
+ -t) dstarg=$2
+ shift
+ shift
+ continue;;
+
+ -T) no_target_directory=true
+ shift
+ continue;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ *) # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ test -n "$dir_arg$dstarg" && break
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dstarg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dstarg"
+ shift # fnord
+ fi
+ shift # arg
+ dstarg=$arg
+ done
+ break;;
+ esac
+done
+
+if test -z "$1"; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src ;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ src=
+
+ if test -d "$dst"; then
+ mkdircmd=:
+ chmodcmd=
+ else
+ mkdircmd=$mkdirprog
+ fi
+ else
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dstarg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+
+ dst=$dstarg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst ;;
+ esac
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dstarg: Is a directory" >&2
+ exit 1
+ fi
+ dst=$dst/`basename "$src"`
+ fi
+ fi
+
+ # This sed command emulates the dirname command.
+ dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+
+ # Make sure that the destination directory exists.
+
+ # Skip lots of stat calls in the usual case.
+ if test ! -d "$dstdir"; then
+ defaultIFS='
+ '
+ IFS="${IFS-$defaultIFS}"
+
+ oIFS=$IFS
+ # Some sh's can't handle IFS=/ for some reason.
+ IFS='%'
+ set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+ shift
+ IFS=$oIFS
+
+ pathcomp=
+
+ while test $# -ne 0 ; do
+ pathcomp=$pathcomp$1
+ shift
+ if test ! -d "$pathcomp"; then
+ $mkdirprog "$pathcomp"
+ # mkdir can fail with a `File exist' error in case several
+ # install-sh are creating the directory concurrently. This
+ # is OK.
+ test -d "$pathcomp" || exit
+ fi
+ pathcomp=$pathcomp/
+ done
+ fi
+
+ if test -n "$dir_arg"; then
+ $doit $mkdircmd "$dst" \
+ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+ else
+ dstfile=`basename "$dst"`
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+ trap '(exit $?); exit' 1 2 13 15
+
+ # Copy the file name to the temp name.
+ $doit $cpprog "$src" "$dsttmp" &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+ # Now rename the file to the real destination.
+ { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+ || {
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ if test -f "$dstdir/$dstfile"; then
+ $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+ || {
+ echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+ (exit 1); exit 1
+ }
+ else
+ :
+ fi
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+ }
+ }
+ fi || { (exit 1); exit 1; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+ (exit 0); exit 0
+}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/contrib/query-loc-0.4.0/loc.c b/contrib/query-loc-0.4.0/loc.c
new file mode 100644
index 0000000..57e3737
--- /dev/null
+++ b/contrib/query-loc-0.4.0/loc.c
@@ -0,0 +1,590 @@
+#include "loc.h"
+
+/* $Id: loc.c,v 1.1 2008/02/15 01:47:15 marka Exp $ */
+
+/* Global variables */
+
+short rr_errno;
+
+/*
+ Prints the actual usage
+ */
+void
+usage ()
+{
+ (void) fprintf (stderr,
+ "Usage: %s: [-v] [-d nnn] hostname\n", progname);
+ exit (2);
+}
+
+/*
+ Panics
+ */
+void
+panic (message)
+ char *message;
+{
+ (void) fprintf (stderr,
+ "%s: %s\n", progname, message);
+ exit (2);
+}
+
+/*
+ ** IN_ADDR_ARPA -- Convert dotted quad string to reverse in-addr.arpa
+ ** ------------------------------------------------------------------
+ **
+ ** Returns:
+ ** Pointer to appropriate reverse in-addr.arpa name
+ ** with trailing dot to force absolute domain name.
+ ** NULL in case of invalid dotted quad input string.
+ */
+
+#ifndef ARPA_ROOT
+#define ARPA_ROOT "in-addr.arpa"
+#endif
+
+char *
+in_addr_arpa (dottedquad)
+ char *dottedquad; /* input string with dotted quad */
+{
+ static char addrbuf[4 * 4 + sizeof (ARPA_ROOT) + 2];
+ unsigned int a[4];
+ register int n;
+
+ n = sscanf (dottedquad, "%u.%u.%u.%u", &a[0], &a[1], &a[2], &a[3]);
+ switch (n)
+ {
+ case 4:
+ (void) sprintf (addrbuf, "%u.%u.%u.%u.%s.",
+ a[3] & 0xff, a[2] & 0xff, a[1] & 0xff, a[0] & 0xff, ARPA_ROOT);
+ break;
+
+ case 3:
+ (void) sprintf (addrbuf, "%u.%u.%u.%s.",
+ a[2] & 0xff, a[1] & 0xff, a[0] & 0xff, ARPA_ROOT);
+ break;
+
+ case 2:
+ (void) sprintf (addrbuf, "%u.%u.%s.",
+ a[1] & 0xff, a[0] & 0xff, ARPA_ROOT);
+ break;
+
+ case 1:
+ (void) sprintf (addrbuf, "%u.%s.",
+ a[0] & 0xff, ARPA_ROOT);
+ break;
+
+ default:
+ return (NULL);
+ }
+
+ while (--n >= 0)
+ if (a[n] > 255)
+ return (NULL);
+
+ return (addrbuf);
+}
+
+/*
+ Returns a human-readable version of the LOC information or
+ NULL if it failed. Argument is a name (of a network or a machine)
+ and a boolean telling is it is a network name or a machine name.
+ */
+char *
+getlocbyname (name, is_network)
+ const char *name;
+ short is_network;
+{
+ char *result;
+ struct list_in_addr *list, *p;
+ result = findRR (name, T_LOC);
+ if (result != NULL)
+ {
+ if (debug >= 2)
+ printf ("LOC record found for the name %s\n", name);
+ return result;
+ }
+ else
+ {
+ if (!is_network)
+ {
+ list = findA (name);
+ if (debug >= 2)
+ printf ("No LOC record found for the name %s, trying addresses\n", name);
+ if (list != NULL)
+ {
+ for (p = list; p != NULL; p = p->next)
+ {
+ if (debug >= 2)
+ printf ("Trying address %s\n", inet_ntoa (p->addr));
+ result = getlocbyaddr (p->addr, NULL);
+ if (result != NULL)
+ return result;
+ }
+ return NULL;
+ }
+ else
+ {
+ if (debug >= 2)
+ printf (" No A record found for %s\n", name);
+ return NULL;
+ }
+ }
+ else
+ {
+ if (debug >= 2)
+ printf ("No LOC record found for the network name %s\n", name);
+ return NULL;
+ }
+ }
+}
+
+/*
+ Returns a human-readable version of the LOC information or
+ NULL if it failed. Argument is an IP address.
+ */
+char *
+getlocbyaddr (addr, mask)
+ const struct in_addr addr;
+ const struct in_addr *mask;
+{
+ struct in_addr netaddr;
+ u_int32_t a;
+ struct in_addr themask;
+ char *text_addr, *text_mask;
+
+ if (mask == NULL)
+ {
+ themask.s_addr = (u_int32_t) 0;
+ }
+ else
+ {
+ themask = *mask;
+ }
+
+ text_addr = (char *) malloc (256);
+ text_mask = (char *) malloc (256);
+ strcpy (text_addr, inet_ntoa (addr));
+ strcpy (text_mask, inet_ntoa (themask));
+
+ if (debug >= 2)
+ printf ("Testing address %s/%s\n", text_addr, text_mask);
+ if (mask == NULL)
+ {
+ a = ntohl (addr.s_addr);
+ if (IN_CLASSA (a))
+ {
+ netaddr.s_addr = htonl (a & IN_CLASSA_NET);
+ themask.s_addr = htonl(IN_CLASSA_NET);
+ }
+ else if (IN_CLASSB (a))
+ {
+ netaddr.s_addr = htonl (a & IN_CLASSB_NET);
+ themask.s_addr = htonl(IN_CLASSB_NET);
+ }
+ else if (IN_CLASSC (a))
+ {
+ netaddr.s_addr = htonl (a & IN_CLASSC_NET);
+ themask.s_addr = htonl(IN_CLASSC_NET);
+ }
+ else
+ {
+ /* Error */
+ return NULL;
+ }
+ return getlocbynet (in_addr_arpa (inet_ntoa (netaddr)), addr, &themask);
+ }
+ else
+ {
+ netaddr.s_addr = addr.s_addr & themask.s_addr;
+ return getlocbynet (in_addr_arpa (inet_ntoa (netaddr)), addr, mask);
+ }
+}
+
+/*
+ Returns a human-readable LOC.
+ Argument is a network name in the 0.z.y.x.in-addr.arpa format
+ and the original address
+ */
+char *
+getlocbynet (name, addr, mask)
+ char *name;
+ struct in_addr addr;
+ struct in_addr *mask;
+{
+ char *network;
+ char *result;
+ struct list_in_addr *list;
+ struct in_addr newmask;
+ u_int32_t a;
+ char newname[4 * 4 + sizeof (ARPA_ROOT) + 2];
+
+ if (debug >= 2)
+ printf ("Testing network %s with mask %s\n", name, inet_ntoa(*mask));
+
+ /* Check if this network has an A RR */
+ list = findA (name);
+ if (list != NULL)
+ {
+ /* Yes, it does. This A record will be used as the
+ * new mask for recursion if it is longer than
+ * the actual mask. */
+ if (mask != NULL && mask->s_addr < list->addr.s_addr)
+ {
+ /* compute the new arguments for recursion
+ * - compute the new network by applying the new mask
+ * to the address and get the in_addr_arpa representation
+ * of it.
+ * - the address remains unchanged
+ * - the new mask is the one given in the A record
+ */
+ a = ntohl(addr.s_addr); /* start from host address */
+ a &= ntohl(list->addr.s_addr); /* apply new mask */
+ newname[sizeof newname - 1] = 0;
+ strncpy(
+ newname,
+ in_addr_arpa(inet_ntoa(inet_makeaddr(a, 0))),
+ sizeof newname);
+ newmask = inet_makeaddr(ntohl(list->addr.s_addr), 0);
+ result = getlocbynet (newname, addr, &newmask);
+ if (result != NULL)
+ {
+ return result;
+ }
+ }
+ /* couldn't find a LOC. Fall through and try with name */
+ }
+
+ /* Check if this network has a name */
+ network = findRR (name, T_PTR);
+ if (network == NULL)
+ {
+ if (debug >= 2)
+ printf ("No name for network %s\n", name);
+ return NULL;
+ }
+ else
+ {
+ return getlocbyname (network, TRUE);
+ }
+}
+
+/*
+ The code for these two functions is stolen from the examples in Liu and Albitz
+ book "DNS and BIND" (O'Reilly).
+ */
+
+/****************************************************************
+ * skipName -- This routine skips over a domain name. If the *
+ * domain name expansion fails, it crashes. *
+ * dn_skipname() is probably not on your manual *
+ * page; it is similar to dn_expand() except that it just *
+ * skips over the name. dn_skipname() is in res_comp.c if *
+ * you need to find it. *
+ ****************************************************************/
+int
+skipName (cp, endOfMsg)
+ u_char *cp;
+ u_char *endOfMsg;
+{
+ int n;
+
+ if ((n = dn_skipname (cp, endOfMsg)) < 0)
+ {
+ panic ("dn_skipname failed\n");
+ }
+ return (n);
+}
+
+/****************************************************************
+ * skipToData -- This routine advances the cp pointer to the *
+ * start of the resource record data portion. On the way, *
+ * it fills in the type, class, ttl, and data length *
+ ****************************************************************/
+int
+skipToData (cp, type, class, ttl, dlen, endOfMsg)
+ u_char *cp;
+ u_short *type;
+ u_short *class;
+ u_int32_t *ttl;
+ u_short *dlen;
+ u_char *endOfMsg;
+{
+ u_char *tmp_cp = cp; /* temporary version of cp */
+
+ /* Skip the domain name; it matches the name we looked up */
+ tmp_cp += skipName (tmp_cp, endOfMsg);
+
+ /*
+ * Grab the type, class, and ttl. GETSHORT and GETLONG
+ * are macros defined in arpa/nameser.h.
+ */
+ GETSHORT (*type, tmp_cp);
+ GETSHORT (*class, tmp_cp);
+ GETLONG (*ttl, tmp_cp);
+ GETSHORT (*dlen, tmp_cp);
+
+ return (tmp_cp - cp);
+}
+
+
+/*
+ Returns a human-readable version of a DNS RR (resource record)
+ associated with the name 'domain'.
+ If it does not find, ir returns NULL and sets rr_errno to explain why.
+
+ The code for this function is stolen from the examples in Liu and Albitz
+ book "DNS and BIND" (O'Reilly).
+ */
+char *
+findRR (domain, requested_type)
+ char *domain;
+ int requested_type;
+{
+ char *result, *message;
+
+ union
+ {
+ HEADER hdr; /* defined in resolv.h */
+ u_char buf[PACKETSZ]; /* defined in arpa/nameser.h */
+ }
+ response; /* response buffers */
+short found = 0;
+int responseLen; /* buffer length */
+
+ u_char *cp; /* character pointer to parse DNS packet */
+ u_char *endOfMsg; /* need to know the end of the message */
+ u_short class; /* classes defined in arpa/nameser.h */
+ u_short type; /* types defined in arpa/nameser.h */
+ u_int32_t ttl; /* resource record time to live */
+ u_short dlen; /* size of resource record data */
+
+ int i, count, dup; /* misc variables */
+
+ char *ptrList[1];
+ int ptrNum = 0;
+ struct in_addr addr;
+
+ result = (char *) malloc (256);
+ message = (char *) malloc (256);
+ /*
+ * Look up the records for the given domain name.
+ * We expect the domain to be a fully qualified name, so
+ * we use res_query(). If we wanted the resolver search
+ * algorithm, we would have used res_search() instead.
+ */
+ if ((responseLen =
+ res_query (domain, /* the domain we care about */
+ C_IN, /* Internet class records */
+ requested_type, /* Look up name server records */
+ (u_char *) & response, /*response buffer */
+ sizeof (response))) /*buffer size */
+ < 0)
+ { /*If negative */
+ rr_errno = h_errno;
+ return NULL;
+ }
+
+ /*
+ * Keep track of the end of the message so we don't
+ * pass it while parsing the response. responseLen is
+ * the value returned by res_query.
+ */
+ endOfMsg = response.buf + responseLen;
+
+ /*
+ * Set a pointer to the start of the question section,
+ * which begins immediately AFTER the header.
+ */
+ cp = response.buf + sizeof (HEADER);
+
+ /*
+ * Skip over the whole question section. The question
+ * section is comprised of a name, a type, and a class.
+ * QFIXEDSZ (defined in arpa/nameser.h) is the size of
+ * the type and class portions, which is fixed. Therefore,
+ * we can skip the question section by skipping the
+ * name (at the beginning) and then advancing QFIXEDSZ.
+ * After this calculation, cp points to the start of the
+ * answer section, which is a list of NS records.
+ */
+ cp += skipName (cp, endOfMsg) + QFIXEDSZ;
+
+ count = ntohs (response.hdr.ancount) +
+ ntohs (response.hdr.nscount);
+ while ((--count >= 0) /* still more records */
+ && (cp < endOfMsg))
+ { /* still inside the packet */
+
+
+ /* Skip to the data portion of the resource record */
+ cp += skipToData (cp, &type, &class, &ttl, &dlen, endOfMsg);
+
+ if (type == requested_type)
+ {
+ switch (requested_type)
+ {
+ case (T_LOC):
+ loc_ntoa (cp, result);
+ return result;
+ break;
+ case (T_PTR):
+ ptrList[ptrNum] = (char *) malloc (MAXDNAME);
+ if (ptrList[ptrNum] == NULL)
+ {
+ panic ("Malloc failed");
+ }
+
+ if (dn_expand (response.buf, /* Start of the packet */
+ endOfMsg, /* End of the packet */
+ cp, /* Position in the packet */
+ (char *) ptrList[ptrNum], /* Result */
+ MAXDNAME) /* size of ptrList buffer */
+ < 0)
+ { /* Negative: error */
+ panic ("dn_expand failed");
+ }
+
+ /*
+ * Check the name we've just unpacked and add it to
+ * the list if it is not a duplicate.
+ * If it is a duplicate, just ignore it.
+ */
+ for (i = 0, dup = 0; (i < ptrNum) && !dup; i++)
+ dup = !strcasecmp (ptrList[i], ptrList[ptrNum]);
+ if (dup)
+ free (ptrList[ptrNum]);
+ else
+ ptrNum++;
+ strcpy (result, ptrList[0]);
+ return result;
+ break;
+ case (T_A):
+ bcopy ((char *) cp, (char *) &addr, INADDRSZ);
+ strcat (result, " ");
+ strcat (result, inet_ntoa (addr));
+ found = 1;
+ break;
+ default:
+ sprintf (message, "Unexpected type %u", requested_type);
+ panic (message);
+ }
+ }
+
+ /* Advance the pointer over the resource record data */
+ cp += dlen;
+
+ } /* end of while */
+ if (found)
+ return result;
+else
+return NULL;
+}
+
+struct list_in_addr *
+findA (domain)
+ char *domain;
+{
+
+ struct list_in_addr *result, *end;
+
+ union
+ {
+ HEADER hdr; /* defined in resolv.h */
+ u_char buf[PACKETSZ]; /* defined in arpa/nameser.h */
+ }
+ response; /* response buffers */
+ int responseLen; /* buffer length */
+
+ u_char *cp; /* character pointer to parse DNS packet */
+ u_char *endOfMsg; /* need to know the end of the message */
+ u_short class; /* classes defined in arpa/nameser.h */
+ u_short type; /* types defined in arpa/nameser.h */
+ u_int32_t ttl; /* resource record time to live */
+ u_short dlen; /* size of resource record data */
+
+ int count; /* misc variables */
+
+ struct in_addr addr;
+
+ end = NULL;
+ result = NULL;
+
+ /*
+ * Look up the records for the given domain name.
+ * We expect the domain to be a fully qualified name, so
+ * we use res_query(). If we wanted the resolver search
+ * algorithm, we would have used res_search() instead.
+ */
+ if ((responseLen =
+ res_query (domain, /* the domain we care about */
+ C_IN, /* Internet class records */
+ T_A,
+ (u_char *) & response, /*response buffer */
+ sizeof (response))) /*buffer size */
+ < 0)
+ { /*If negative */
+ rr_errno = h_errno;
+ return NULL;
+ }
+
+ /*
+ * Keep track of the end of the message so we don't
+ * pass it while parsing the response. responseLen is
+ * the value returned by res_query.
+ */
+ endOfMsg = response.buf + responseLen;
+
+ /*
+ * Set a pointer to the start of the question section,
+ * which begins immediately AFTER the header.
+ */
+ cp = response.buf + sizeof (HEADER);
+
+ /*
+ * Skip over the whole question section. The question
+ * section is comprised of a name, a type, and a class.
+ * QFIXEDSZ (defined in arpa/nameser.h) is the size of
+ * the type and class portions, which is fixed. Therefore,
+ * we can skip the question section by skipping the
+ * name (at the beginning) and then advancing QFIXEDSZ.
+ * After this calculation, cp points to the start of the
+ * answer section, which is a list of NS records.
+ */
+ cp += skipName (cp, endOfMsg) + QFIXEDSZ;
+
+ count = ntohs (response.hdr.ancount) +
+ ntohs (response.hdr.nscount);
+ while ((--count >= 0) /* still more records */
+ && (cp < endOfMsg))
+ { /* still inside the packet */
+
+
+ /* Skip to the data portion of the resource record */
+ cp += skipToData (cp, &type, &class, &ttl, &dlen, endOfMsg);
+
+ if (type == T_A)
+ {
+ bcopy ((char *) cp, (char *) &addr, INADDRSZ);
+ if (end == NULL)
+ {
+ result = (void *) malloc (sizeof (struct list_in_addr));
+ result->addr = addr;
+ result->next = NULL;
+ end = result;
+ }
+ else
+ {
+ end->next = (void *) malloc (sizeof (struct list_in_addr));
+ end = end->next;
+ end->addr = addr;
+ end->next = NULL;
+ }
+ }
+
+ /* Advance the pointer over the resource record data */
+ cp += dlen;
+
+ } /* end of while */
+ return result;
+}
diff --git a/contrib/query-loc-0.4.0/loc.h b/contrib/query-loc-0.4.0/loc.h
new file mode 100644
index 0000000..c9b74db
--- /dev/null
+++ b/contrib/query-loc-0.4.0/loc.h
@@ -0,0 +1,78 @@
+/* $Id: loc.h,v 1.1 2008/02/15 01:47:15 marka Exp $ */
+
+#define VERSION "0.4.0"
+
+#include "config.h"
+
+/* Probably too many inclusions but this is to keep 'gcc -Wall' happy... */
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <netdb.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <sys/time.h>
+#include <errno.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#if SIZEOF_LONG == 4
+#define u_int32_t unsigned long
+#ifndef int32_t
+#define int32_t long
+#endif
+#else
+#define u_int32_t unsigned int
+#ifndef int32_t
+#define int32_t int
+#endif
+#endif
+
+#if SIZEOF_CHAR == 1
+#define u_int8_t unsigned char
+#ifndef int8_t
+#define int8_t char
+#endif
+#else
+#if SIZEOF_SHORT == 1
+#define u_int8_t unsigned short
+#ifndef int8_t
+#define int8_t short
+#endif
+#else
+#error "No suitable native type for storing bytes"
+#endif
+#endif
+
+#ifndef INADDR_NONE
+#define INADDR_NONE (in_addr_t)-1
+#endif
+
+struct list_in_addr
+ {
+ struct in_addr addr;
+ void *next;
+ };
+
+void usage ();
+void panic ();
+
+char *getlocbyname ();
+char *getlocbyaddr ();
+char *getlocbynet ();
+char *findRR ();
+struct list_in_addr *findA ();
+
+extern char *progname;
+extern short debug;
diff --git a/contrib/query-loc-0.4.0/loc_ntoa.c b/contrib/query-loc-0.4.0/loc_ntoa.c
new file mode 100644
index 0000000..21eada3
--- /dev/null
+++ b/contrib/query-loc-0.4.0/loc_ntoa.c
@@ -0,0 +1,248 @@
+/* Stolen from BIND */
+
+/*
+ * Copyright (c) 1985
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+/*
+ * Portions Copyright (c) 1995 by International Business Machines, Inc.
+ *
+ * International Business Machines, Inc. (hereinafter called IBM) grants
+ * permission under its copyrights to use, copy, modify, and distribute this
+ * Software with or without fee, provided that the above copyright notice and
+ * all paragraphs of this notice appear in all copies, and that the name of IBM
+ * not be used in connection with the marketing of any product incorporating
+ * the Software or modifications thereof, without specific, written prior
+ * permission.
+ *
+ * To the extent it has a right to do so, IBM grants an immunity from suit
+ * under its patents, if any, for the use, sale or manufacture of products to
+ * the extent that such products are used for performing Domain Name System
+ * dynamic updates in TCP/IP networks by means of the Software. No immunity is
+ * granted for any product per se or for any other function of any product.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
+ * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+/*
+ * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <math.h>
+#include <netdb.h>
+#include <resolv.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include "loc.h"
+
+const char *precsize_ntoa();
+
+/* takes an on-the-wire LOC RR and formats it in a human readable format. */
+const char *
+loc_ntoa(binary, ascii)
+ const u_char *binary;
+ char *ascii;
+{
+ static char *error = "?";
+ static char tmpbuf[sizeof
+"1000 60 60.000 N 1000 60 60.000 W -12345678.00m 90000000.00m 90000000.00m 90000000.00m"];
+ const u_char *cp = binary;
+
+ int latdeg, latmin, latsec, latsecfrac;
+ int longdeg, longmin, longsec, longsecfrac;
+ char northsouth, eastwest;
+ int altmeters, altfrac, altsign;
+
+ const u_int32_t referencealt = 100000 * 100;
+
+ int32_t latval, longval, altval;
+ u_int32_t templ;
+ u_int8_t sizeval, hpval, vpval, versionval;
+
+ char *sizestr, *hpstr, *vpstr;
+
+ versionval = *cp++;
+
+ if (ascii == NULL)
+ ascii = tmpbuf;
+
+ if (versionval) {
+ (void) sprintf(ascii, "; error: unknown LOC RR version");
+ return (ascii);
+ }
+
+ sizeval = *cp++;
+
+ hpval = *cp++;
+ vpval = *cp++;
+
+ GETLONG(templ, cp);
+ latval = (templ - ((unsigned)1<<31));
+
+ GETLONG(templ, cp);
+ longval = (templ - ((unsigned)1<<31));
+
+ GETLONG(templ, cp);
+ if (templ < referencealt) { /* below WGS 84 spheroid */
+ altval = referencealt - templ;
+ altsign = -1;
+ } else {
+ altval = templ - referencealt;
+ altsign = 1;
+ }
+
+ if (latval < 0) {
+ northsouth = 'S';
+ latval = -latval;
+ } else
+ northsouth = 'N';
+
+ latsecfrac = latval % 1000;
+ latval = latval / 1000;
+ latsec = latval % 60;
+ latval = latval / 60;
+ latmin = latval % 60;
+ latval = latval / 60;
+ latdeg = latval;
+
+ if (longval < 0) {
+ eastwest = 'W';
+ longval = -longval;
+ } else
+ eastwest = 'E';
+
+ longsecfrac = longval % 1000;
+ longval = longval / 1000;
+ longsec = longval % 60;
+ longval = longval / 60;
+ longmin = longval % 60;
+ longval = longval / 60;
+ longdeg = longval;
+
+ altfrac = altval % 100;
+ altmeters = (altval / 100) * altsign;
+
+ if ((sizestr = strdup(precsize_ntoa(sizeval))) == NULL)
+ sizestr = error;
+ if ((hpstr = strdup(precsize_ntoa(hpval))) == NULL)
+ hpstr = error;
+ if ((vpstr = strdup(precsize_ntoa(vpval))) == NULL)
+ vpstr = error;
+
+ sprintf(ascii,
+ "%d %.2d %.2d.%.3d %c %d %.2d %.2d.%.3d %c %d.%.2dm %sm %sm %sm",
+ latdeg, latmin, latsec, latsecfrac, northsouth,
+ longdeg, longmin, longsec, longsecfrac, eastwest,
+ altmeters, altfrac, sizestr, hpstr, vpstr);
+
+ if (sizestr != error)
+ free(sizestr);
+ if (hpstr != error)
+ free(hpstr);
+ if (vpstr != error)
+ free(vpstr);
+
+ return (ascii);
+}
+
+static unsigned int poweroften[10] = {1, 10, 100, 1000, 10000, 100000,
+ 1000000,10000000,100000000,1000000000};
+
+/* takes an XeY precision/size value, returns a string representation. */
+const char *
+precsize_ntoa(prec)
+ u_int8_t prec;
+{
+ static char retbuf[sizeof "90000000.00"]; /* XXX nonreentrant */
+ unsigned long val;
+ int mantissa, exponent;
+
+ mantissa = (int)((prec >> 4) & 0x0f) % 10;
+ exponent = (int)((prec >> 0) & 0x0f) % 10;
+
+ val = mantissa * poweroften[exponent];
+
+ (void) sprintf(retbuf, "%ld.%.2ld", val/100, val%100);
+ return (retbuf);
+}
+
diff --git a/contrib/query-loc-0.4.0/query-loc.1 b/contrib/query-loc-0.4.0/query-loc.1
new file mode 100644
index 0000000..df55b4d
--- /dev/null
+++ b/contrib/query-loc-0.4.0/query-loc.1
@@ -0,0 +1,55 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH QUERY-LOC 1 "January 11, 2005"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+query-loc \- to retrieve and display the location information in the DNS
+.SH SYNOPSIS
+.B query-loc
+.RI [-v] [-d nnn] " host"
+.SH DESCRIPTION
+This manual page documents briefly the
+.B query-loc
+command.
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
+.\" respectively.
+\fBquery-loc\fP is a program to retrieve and display the location
+information in the DNS.
+
+It uses the algorithms described in
+RFC 1876 (and RFC 1101 to get the network names).
+You can find examples of networks wchich implement this scheme
+in the ADDRESSES file.
+
+.SH OPTIONS
+.TP
+.B \-v
+Verbose mode.
+.TP
+.B \-d nnn
+Debug mode. Displays the RFC's algorithm
+
+.SH BUGS
+
+Very few hosts have location information.
+
+.SH AUTHOR
+This manual page was written by Stephane Bortzmeyer
+<bortzmeyer@debian.org>.
+
+.\" $Id: query-loc.1,v 1.1 2008/02/15 01:47:15 marka Exp $
diff --git a/contrib/query-loc-0.4.0/query-loc.c b/contrib/query-loc-0.4.0/query-loc.c
new file mode 100644
index 0000000..2492d5b
--- /dev/null
+++ b/contrib/query-loc-0.4.0/query-loc.c
@@ -0,0 +1,98 @@
+#include "loc.h"
+
+/* $Id: query-loc.c,v 1.1 2008/02/15 01:47:15 marka Exp $ */
+
+/* Global variables */
+char *progname;
+short debug;
+
+int
+main (argc, argv)
+ int argc;
+ char *argv[];
+{
+ extern char *optarg;
+ extern int optind;
+
+ short verbose = FALSE;
+ char *host;
+
+ char ch;
+
+ char *loc = NULL;
+ struct in_addr addr;
+ struct hostent *hp;
+
+ progname = argv[0];
+ while ((ch = getopt (argc, argv, "vd:")) != EOF)
+ {
+ switch (ch)
+ {
+ case 'v':
+ verbose = TRUE;
+ break;
+ case 'd':
+ debug = atoi (optarg);
+ if (debug <= 0)
+ {
+ (void) fprintf (stderr,
+ "%s: illegal debug value.\n", progname);
+ exit (2);
+ }
+ break;
+ default:
+ usage ();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+ if (argc != 1)
+ {
+ usage ();
+ }
+ if (verbose || debug)
+ {
+ printf ("\nThis is %s, version %s.\n\n", progname, VERSION);
+ }
+ host = argv[0];
+ (void) res_init ();
+
+ if ((addr.s_addr = inet_addr (host)) == INADDR_NONE)
+ {
+ if (debug >= 1)
+ printf ("%s is a name\n", host);
+ loc = getlocbyname (host, FALSE);
+ }
+ else
+ {
+ if (debug >= 1)
+ printf ("%s is an IP address ", host);
+ hp = (struct hostent *) gethostbyaddr
+ ((char *) &addr, sizeof (addr), AF_INET);
+ if (hp)
+ {
+ if (debug >= 1)
+ printf ("and %s is its official name\n",
+ hp->h_name);
+ loc = getlocbyname (hp->h_name, FALSE);
+ }
+ else
+ {
+ if (debug >= 1)
+ printf ("which has no name\n");
+ loc = getlocbyaddr (addr, NULL);
+ }
+ }
+ if (loc == NULL)
+ {
+ printf ("No LOCation found for %s\n", host);
+ exit (1);
+ }
+ else
+ {
+ if (verbose || debug)
+ printf ("LOCation for %s is ", host);
+ printf ("%s\n", loc);
+ exit (0);
+ }
+}
diff --git a/contrib/query-loc-0.4.0/reconf b/contrib/query-loc-0.4.0/reconf
new file mode 100755
index 0000000..c1cf732
--- /dev/null
+++ b/contrib/query-loc-0.4.0/reconf
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# $Id: reconf,v 1.1 2008/02/15 01:47:15 marka Exp $
+
+autoreconf
+# We do not use automake but we need its install-sh file. We do not
+# care about the exit code.
+automake --add-missing || true
diff --git a/contrib/queryperf/Makefile.in b/contrib/queryperf/Makefile.in
new file mode 100644
index 0000000..6e16cad
--- /dev/null
+++ b/contrib/queryperf/Makefile.in
@@ -0,0 +1,28 @@
+# Copyright (C) 2000, 2001 Nominum, Inc. All Rights Reserved.
+
+CC = @CC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+DEFS = @DEFS@
+
+queryperf: queryperf.o $(LIBOBJS)
+ $(CC) $(CFLAGS) $(DEFS) $(LDFLAGS) queryperf.o $(LIBOBJS) $(LIBS) -lm -o queryperf
+
+queryperf.o: queryperf.c
+ $(CC) $(CFLAGS) $(DEFS) -c queryperf.c
+
+# under missing subdir
+getaddrinfo.o: ./missing/getaddrinfo.c
+ $(CC) $(CFLAGS) -c ./missing/$*.c
+
+getnameinfo.o: ./missing/getnameinfo.c
+ $(CC) $(CFLAGS) -c ./missing/$*.c
+
+clean:
+ rm -f *.o queryperf
+
+distclean: clean
+ rm -f config.log
+ rm -f config.cache
+ rm -f config.status
+ rm -f Makefile
diff --git a/contrib/queryperf/README b/contrib/queryperf/README
new file mode 100644
index 0000000..a1e0c62
--- /dev/null
+++ b/contrib/queryperf/README
@@ -0,0 +1,82 @@
+
+$Id: README,v 1.1.1.1 2001/07/12 02:02:09 gson Exp $
+
+This is queryperf, a DNS server query performance testing tool.
+
+It is primarily intended for measuring the performance of
+authoritative DNS servers, but it has also been used for measuring
+caching server performance. This document describes the use of
+queryperf for authoritative server performance testing.
+
+
+Building
+
+To build queryperf, just do
+
+ sh configure
+ make
+
+
+The test environment
+
+It is recommended that you run queryperf and the name server under
+test on separate machines, so that the CPU usage of queryperf itself
+does not slow down the name server. The two machines should be
+connected with a fast network, preferably a dedicated 100baseT
+segment. Testing through a router or firewall is not advisable.
+
+
+Configuring the server
+
+The name server under test should be set up as an authoritative
+server, serving one or more zones similar in size and number to
+what the server is expected to serve in production.
+
+Be sure to turn off recursion in the server's configuration
+(in BIND 8/9, specify "recursion no;" in the options block).
+In BIND 8, you should also specify "fetch-glue no;"; otherwise
+the server may attempt to retrieve glue information from the
+Internet during the test, slowing it down by an unpredictable
+factor.
+
+
+Constructing the input file
+
+You need to construct a queryperf input file containing a large and
+realistic set of queries, on the order of ten thousand to a million.
+The input file contains one line per query, consisting of a domain
+name and an RR type name separated by a space. The class of the
+query is implicitly IN.
+
+When measuring the performance serving non-terminal zones such as the
+root zone or TLDs, note that such servers spend most of their time
+providing referral responses, not authoritative answers. Therefore, a
+realistic input file might consist mostly of queries for type A for
+names *below*, not at, the delegations present in the zone. For
+example, when testing the performance of a server configured to be
+authoritative for the top-level domain "fi.", which contains
+delegations for domains like "helsinki.fi" and "turku.fi", the input
+file could contain lines like
+
+ www.turku.fi A
+ www.helsinki.fi A
+
+where the "www" prefix ensures that the server will respond with a
+referral. Ideally, a realistic proportion of queries for nonexistent
+domains should be mixed in with those for existing ones, and the lines
+of the input file should be in a random order.
+
+
+Running the tests
+
+Queryperf is run specifying the input file using the "-d" option, as
+in
+
+ queryperf -d input_file -s server
+
+The output of queryperf is mostly self-explanatory. Pay attention to
+the number of dropped packets reported - when running the test over a
+local Ethernet connection, it should be zero. If one or more packets
+has been dropped, there may be a problem with the network connection.
+In that case, the results should be considered suspect and the test
+repeated.
diff --git a/contrib/queryperf/config.h.in b/contrib/queryperf/config.h.in
new file mode 100644
index 0000000..744afdd
--- /dev/null
+++ b/contrib/queryperf/config.h.in
@@ -0,0 +1,37 @@
+/* config.h.in. Generated from configure.in by autoheader. */
+
+/* Define to 1 if you have the `getaddrinfo' function. */
+#undef HAVE_GETADDRINFO
+
+/* Define to 1 if you have the `gethostbyname2' function. */
+#undef HAVE_GETHOSTBYNAME2
+
+/* Define to 1 if you have the `getnameinfo' function. */
+#undef HAVE_GETNAMEINFO
+
+/* Define to 1 if you have the `nsl' library (-lnsl). */
+#undef HAVE_LIBNSL
+
+/* Define to 1 if you have the `socket' library (-lsocket). */
+#undef HAVE_LIBSOCKET
+
+/* Define to 1 if `struct sockaddr' has element `sa_len'. */
+#undef HAVE_SA_LEN
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to `int' if `socklen_t' does not exist. */
+#undef socklen_t
diff --git a/contrib/queryperf/configure b/contrib/queryperf/configure
new file mode 100755
index 0000000..9cd2a99
--- /dev/null
+++ b/contrib/queryperf/configure
@@ -0,0 +1,4365 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.61.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+if test "x$CONFIG_SHELL" = x; then
+ if (eval ":") 2>/dev/null; then
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+
+ if test $as_have_required = yes && (eval ":
+(as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=\$LINENO
+ as_lineno_2=\$LINENO
+ test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+ test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+ :
+else
+ as_candidate_shells=
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ case $as_dir in
+ /*)
+ for as_base in sh bash ksh sh5; do
+ as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+ done;;
+ esac
+done
+IFS=$as_save_IFS
+
+
+ for as_shell in $as_candidate_shells $SHELL; do
+ # Try only shells that exist, to save several forks.
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { ("$as_shell") 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+_ASEOF
+}; then
+ CONFIG_SHELL=$as_shell
+ as_have_required=yes
+ if { "$as_shell" 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+(as_func_return () {
+ (exit $1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+ break
+fi
+
+fi
+
+ done
+
+ if test "x$CONFIG_SHELL" != x; then
+ for as_var in BASH_ENV ENV
+ do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ done
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+ if test $as_have_required = no; then
+ echo This script requires a shell more modern than all the
+ echo shells that I found on your system. Please install a
+ echo modern shell, or manually run the script under such a
+ echo shell if you do have one.
+ { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+ echo No shell found that supports shell functions.
+ echo Please tell autoconf@gnu.org about your system,
+ echo including any error possibly output before this
+ echo message
+}
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+
+exec 7<&0 </dev/null 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="queryperf.c"
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+LIBOBJS
+LTLIBOBJS'
+ac_subst_files=''
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+ eval enable_$ac_feature=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+ eval enable_$ac_feature=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+ eval with_$ac_package=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+ eval with_$ac_package=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute directory names.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; }
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ { echo "$as_me: error: Working directory cannot be determined" >&2
+ { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ { echo "$as_me: error: pwd does not report name of working directory" >&2
+ { (exit 1); exit 1; }; }
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$0" ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$0" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
+ { (exit 1); exit 1; }; }
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+ cat <<\_ACEOF
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" || continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+configure
+generated by GNU Autoconf 2.61
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.61. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ echo "PATH: $as_dir"
+done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args '$ac_arg'"
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -n "$CONFIG_SITE"; then
+ set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+ set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+ set x "$ac_default_prefix/share/config.site" \
+ "$ac_default_prefix/etc/config.site"
+fi
+shift
+for ac_site_file
+do
+ if test -r "$ac_site_file"; then
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort. b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions. Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
+if test -z "$ac_file"; then
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6; }
+
+{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cc_c89=$ac_arg
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+ xno)
+ { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+ac_config_headers="$ac_config_headers config.h"
+
+
+{ echo "$as_me:$LINENO: checking for library containing res_mkquery" >&5
+echo $ECHO_N "checking for library containing res_mkquery... $ECHO_C" >&6; }
+if test "${ac_cv_search_res_mkquery+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char res_mkquery ();
+int
+main ()
+{
+return res_mkquery ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' resolv bind; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_search_res_mkquery=$ac_res
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext
+ if test "${ac_cv_search_res_mkquery+set}" = set; then
+ break
+fi
+done
+if test "${ac_cv_search_res_mkquery+set}" = set; then
+ :
+else
+ ac_cv_search_res_mkquery=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_search_res_mkquery" >&5
+echo "${ECHO_T}$ac_cv_search_res_mkquery" >&6; }
+ac_res=$ac_cv_search_res_mkquery
+if test "$ac_res" != no; then
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+{ echo "$as_me:$LINENO: checking for library containing __res_mkquery" >&5
+echo $ECHO_N "checking for library containing __res_mkquery... $ECHO_C" >&6; }
+if test "${ac_cv_search___res_mkquery+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char __res_mkquery ();
+int
+main ()
+{
+return __res_mkquery ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' resolv bind; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_search___res_mkquery=$ac_res
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext
+ if test "${ac_cv_search___res_mkquery+set}" = set; then
+ break
+fi
+done
+if test "${ac_cv_search___res_mkquery+set}" = set; then
+ :
+else
+ ac_cv_search___res_mkquery=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_search___res_mkquery" >&5
+echo "${ECHO_T}$ac_cv_search___res_mkquery" >&6; }
+ac_res=$ac_cv_search___res_mkquery
+if test "$ac_res" != no; then
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking for socket in -lsocket" >&5
+echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6; }
+if test "${ac_cv_lib_socket_socket+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsocket $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char socket ();
+int
+main ()
+{
+return socket ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_lib_socket_socket=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_socket_socket=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5
+echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6; }
+if test $ac_cv_lib_socket_socket = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSOCKET 1
+_ACEOF
+
+ LIBS="-lsocket $LIBS"
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking for inet_ntoa in -lnsl" >&5
+echo $ECHO_N "checking for inet_ntoa in -lnsl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_nsl_inet_ntoa+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lnsl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char inet_ntoa ();
+int
+main ()
+{
+return inet_ntoa ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_lib_nsl_inet_ntoa=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_nsl_inet_ntoa=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_inet_ntoa" >&5
+echo "${ECHO_T}$ac_cv_lib_nsl_inet_ntoa" >&6; }
+if test $ac_cv_lib_nsl_inet_ntoa = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBNSL 1
+_ACEOF
+
+ LIBS="-lnsl $LIBS"
+
+fi
+
+
+for ac_func in gethostbyname2
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+{ echo "$as_me:$LINENO: checking for getaddrinfo" >&5
+echo $ECHO_N "checking for getaddrinfo... $ECHO_C" >&6; }
+if test "${ac_cv_func_getaddrinfo+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define getaddrinfo to an innocuous variant, in case <limits.h> declares getaddrinfo.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define getaddrinfo innocuous_getaddrinfo
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char getaddrinfo (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef getaddrinfo
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char getaddrinfo ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_getaddrinfo || defined __stub___getaddrinfo
+choke me
+#endif
+
+int
+main ()
+{
+return getaddrinfo ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_func_getaddrinfo=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_func_getaddrinfo=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_getaddrinfo" >&5
+echo "${ECHO_T}$ac_cv_func_getaddrinfo" >&6; }
+if test $ac_cv_func_getaddrinfo = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETADDRINFO 1
+_ACEOF
+
+else
+ case " $LIBOBJS " in
+ *" getaddrinfo.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS getaddrinfo.$ac_objext"
+ ;;
+esac
+
+fi
+
+{ echo "$as_me:$LINENO: checking for getnameinfo" >&5
+echo $ECHO_N "checking for getnameinfo... $ECHO_C" >&6; }
+if test "${ac_cv_func_getnameinfo+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define getnameinfo to an innocuous variant, in case <limits.h> declares getnameinfo.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define getnameinfo innocuous_getnameinfo
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char getnameinfo (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef getnameinfo
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char getnameinfo ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_getnameinfo || defined __stub___getnameinfo
+choke me
+#endif
+
+int
+main ()
+{
+return getnameinfo ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_func_getnameinfo=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_func_getnameinfo=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_getnameinfo" >&5
+echo "${ECHO_T}$ac_cv_func_getnameinfo" >&6; }
+if test $ac_cv_func_getnameinfo = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETNAMEINFO 1
+_ACEOF
+
+else
+ case " $LIBOBJS " in
+ *" getnameinfo.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS getnameinfo.$ac_objext"
+ ;;
+esac
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking for socklen_t" >&5
+echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_socklen_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+ #include <sys/socket.h>
+int
+main ()
+{
+socklen_t len = 42; return len;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_type_socklen_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_socklen_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5
+echo "${ECHO_T}$ac_cv_type_socklen_t" >&6; }
+ if test $ac_cv_type_socklen_t != yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define socklen_t int
+_ACEOF
+
+ fi
+
+{ echo "$as_me:$LINENO: checking for sa_len" >&5
+echo $ECHO_N "checking for sa_len... $ECHO_C" >&6; }
+if test "${ac_cv_sa_len+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+ #include <sys/socket.h>
+int
+main ()
+{
+struct sockaddr sa; sa.sa_len = 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_sa_len=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_sa_len=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sa_len" >&5
+echo "${ECHO_T}$ac_cv_sa_len" >&6; }
+ if test $ac_cv_sa_len = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SA_LEN 1
+_ACEOF
+
+ fi
+
+
+ac_config_files="$ac_config_files Makefile"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ test "x$cache_file" != "x/dev/null" &&
+ { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
+ cat confcache >$cache_file
+ else
+ { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.61. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Report bugs to <bug-autoconf@gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.61,
+ with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2006 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ echo "$ac_cs_version"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ { echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ CONFIG_SHELL=$SHELL
+ export CONFIG_SHELL
+ exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+#
+# Set up the sed scripts for CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "$CONFIG_FILES"; then
+
+_ACEOF
+
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+CC!$CC$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
+_ACEOF
+
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 46; then
+ break
+ elif $ac_last_try; then
+ { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+ ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+ ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
+_ACEOF
+
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[ ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+ { (exit 1); exit 1; }; };;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+ ac_file_inputs="$ac_file_inputs $ac_f"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input="Generated from "`IFS=:
+ echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ fi
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$tmp/stdin";;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir="$ac_dir"
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+case `sed -n '/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s&@configure_input@&$configure_input&;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&5
+echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&2;}
+
+ rm -f "$tmp/stdin"
+ case $ac_file in
+ -) cat "$tmp/out"; rm -f "$tmp/out";;
+ *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+ esac
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+_ACEOF
+
+# Transform confdefs.h into a sed script `conftest.defines', that
+# substitutes the proper values into config.h.in to produce config.h.
+rm -f conftest.defines conftest.tail
+# First, append a space to every undef/define line, to ease matching.
+echo 's/$/ /' >conftest.defines
+# Then, protect against being on the right side of a sed subst, or in
+# an unquoted here document, in config.status. If some macros were
+# called several times there might be several #defines for the same
+# symbol, which is useless. But do not sort them, since the last
+# AC_DEFINE must be honored.
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
+# NAME is the cpp macro being defined, VALUE is the value it is being given.
+# PARAMS is the parameter list in the macro definition--in most cases, it's
+# just an empty string.
+ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*'
+ac_dB='\\)[ (].*,\\1define\\2'
+ac_dC=' '
+ac_dD=' ,'
+
+uniq confdefs.h |
+ sed -n '
+ t rset
+ :rset
+ s/^[ ]*#[ ]*define[ ][ ]*//
+ t ok
+ d
+ :ok
+ s/[\\&,]/\\&/g
+ s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
+ s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
+ ' >>conftest.defines
+
+# Remove the space that was appended to ease matching.
+# Then replace #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+# (The regexp can be short, since the line contains either #define or #undef.)
+echo 's/ $//
+s,^[ #]*u.*,/* & */,' >>conftest.defines
+
+# Break up conftest.defines:
+ac_max_sed_lines=50
+
+# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1"
+# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2"
+# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1"
+# et cetera.
+ac_in='$ac_file_inputs'
+ac_out='"$tmp/out1"'
+ac_nxt='"$tmp/out2"'
+
+while :
+do
+ # Write a here document:
+ cat >>$CONFIG_STATUS <<_ACEOF
+ # First, check the format of the line:
+ cat >"\$tmp/defines.sed" <<\\CEOF
+/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def
+/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def
+b
+:def
+_ACEOF
+ sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
+ ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
+ sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
+ grep . conftest.tail >/dev/null || break
+ rm -f conftest.defines
+ mv conftest.tail conftest.defines
+done
+rm -f conftest.defines conftest.tail
+
+echo "ac_result=$ac_in" >>$CONFIG_STATUS
+cat >>$CONFIG_STATUS <<\_ACEOF
+ if test x"$ac_file" != x-; then
+ echo "/* $configure_input */" >"$tmp/config.h"
+ cat "$ac_result" >>"$tmp/config.h"
+ if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
+ { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f $ac_file
+ mv "$tmp/config.h" $ac_file
+ fi
+ else
+ echo "/* $configure_input */"
+ cat "$ac_result"
+ fi
+ rm -f "$tmp/out12"
+ ;;
+
+
+ esac
+
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+
diff --git a/contrib/queryperf/configure.in b/contrib/queryperf/configure.in
new file mode 100644
index 0000000..2f0f7af
--- /dev/null
+++ b/contrib/queryperf/configure.in
@@ -0,0 +1,70 @@
+#
+# Copyright (C) 2000, 2001 Nominum, Inc.
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+AC_INIT(queryperf.c)
+
+AC_PREREQ(2.13)
+
+AC_PROG_CC
+
+AC_DEFUN(AC_TYPE_SOCKLEN_T,
+[AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
+[
+ AC_TRY_COMPILE(
+ [#include <sys/types.h>
+ #include <sys/socket.h>],
+ [socklen_t len = 42; return len;],
+ ac_cv_type_socklen_t=yes,
+ ac_cv_type_socklen_t=no)
+])
+ if test $ac_cv_type_socklen_t != yes; then
+ AC_DEFINE(socklen_t, int, [Define to `int' if `socklen_t' does not exist.])
+ fi
+])
+
+AC_DEFUN(AC_SA_LEN,
+[AC_CACHE_CHECK([for sa_len], ac_cv_sa_len,
+[
+ AC_TRY_COMPILE(
+ [#include <sys/types.h>
+ #include <sys/socket.h>],
+ [struct sockaddr sa; sa.sa_len = 0;],
+ ac_cv_sa_len=yes,
+ ac_cv_sa_len=no)
+])
+ if test $ac_cv_sa_len = yes; then
+ AC_DEFINE(HAVE_SA_LEN, 1, [Define to 1 if `struct sockaddr' has element `sa_len'.])
+ fi
+])
+
+AC_CONFIG_HEADERS(config.h)
+AC_SEARCH_LIBS(res_mkquery, resolv bind)
+AC_SEARCH_LIBS(__res_mkquery, resolv bind)
+AC_CHECK_LIB(socket, socket)
+AC_CHECK_LIB(nsl, inet_ntoa)
+AC_CHECK_FUNCS(gethostbyname2)
+AC_CHECK_FUNC(getaddrinfo,
+ AC_DEFINE(HAVE_GETADDRINFO, 1, [Define to 1 if you have the `getaddrinfo' function.]),
+ [AC_LIBOBJ(getaddrinfo)])
+AC_CHECK_FUNC(getnameinfo,
+ AC_DEFINE(HAVE_GETNAMEINFO, 1, [Define to 1 if you have the `getnameinfo' function.]),
+ [AC_LIBOBJ(getnameinfo)])
+
+AC_TYPE_SOCKLEN_T
+AC_SA_LEN
+
+AC_OUTPUT(Makefile)
diff --git a/contrib/queryperf/input/sample.0 b/contrib/queryperf/input/sample.0
new file mode 100644
index 0000000..024d8a0
--- /dev/null
+++ b/contrib/queryperf/input/sample.0
@@ -0,0 +1,6 @@
+; This is a comment
+#server ns.sector93.ie
+#port 53
+#maxwait 5
+meow.com MX
+1.0.0.10.in-addr.arpa PTR
diff --git a/contrib/queryperf/input/sample.1 b/contrib/queryperf/input/sample.1
new file mode 100644
index 0000000..e2911a5
--- /dev/null
+++ b/contrib/queryperf/input/sample.1
@@ -0,0 +1,13 @@
+; Sample input data file
+
+;#server ns.sector93.ie
+;#port 53
+;#maxwait 10
+
+1-host.com ANY
+1-linknet.com A
+1.0-127.35.195.200.in-addr.arpa PTR
+1.0-63.236.210.200.in-addr.arpa PTR
+1.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.0.0.0.0.0.ip6.int PTR
+1.0.0.0.in-addr.arpa PTR
+1.0.0.10.in-addr.arpa PTR
diff --git a/contrib/queryperf/missing/addrinfo.h b/contrib/queryperf/missing/addrinfo.h
new file mode 100644
index 0000000..54a5e85
--- /dev/null
+++ b/contrib/queryperf/missing/addrinfo.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef HAVE_GETADDRINFO
+
+/*
+ * Error return codes from getaddrinfo()
+ */
+#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
+#define EAI_AGAIN 2 /* temporary failure in name resolution */
+#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
+#define EAI_FAIL 4 /* non-recoverable failure in name resolution */
+#define EAI_FAMILY 5 /* ai_family not supported */
+#define EAI_MEMORY 6 /* memory allocation failure */
+#define EAI_NODATA 7 /* no address associated with hostname */
+#define EAI_NONAME 8 /* hostname nor servname provided, or not known */
+#define EAI_SERVICE 9 /* servname not supported for ai_socktype */
+#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
+#define EAI_SYSTEM 11 /* system error returned in errno */
+#define EAI_BADHINTS 12
+#define EAI_PROTOCOL 13
+#define EAI_MAX 14
+
+/*
+ * Flag values for getaddrinfo()
+ */
+#define AI_PASSIVE 0x00000001 /* get address to use bind() */
+#define AI_CANONNAME 0x00000002 /* fill ai_canonname */
+#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */
+/* valid flags for addrinfo */
+#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)
+
+#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
+#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */
+#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */
+#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */
+/* special recommended flags for getipnodebyname */
+#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
+
+/*
+ * Constants for getnameinfo()
+ */
+#define NI_MAXHOST 1025
+#define NI_MAXSERV 32
+
+/*
+ * Flag values for getnameinfo()
+ */
+#define NI_NOFQDN 0x00000001
+#define NI_NUMERICHOST 0x00000002
+#define NI_NAMEREQD 0x00000004
+#define NI_NUMERICSERV 0x00000008
+#define NI_DGRAM 0x00000010
+
+struct addrinfo {
+ int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
+ int ai_family; /* PF_xxx */
+ int ai_socktype; /* SOCK_xxx */
+ int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
+ size_t ai_addrlen; /* length of ai_addr */
+ char *ai_canonname; /* canonical name for hostname */
+ struct sockaddr *ai_addr; /* binary address */
+ struct addrinfo *ai_next; /* next structure in linked list */
+};
+
+struct sockaddr_storage {
+ u_char __ss_len;
+ u_char __ss_family;
+ u_char fill[126];
+};
+
+extern void freehostent(struct hostent *);
+extern char *gai_strerror(int);
+#endif
diff --git a/contrib/queryperf/missing/getaddrinfo.c b/contrib/queryperf/missing/getaddrinfo.c
new file mode 100644
index 0000000..69eb748
--- /dev/null
+++ b/contrib/queryperf/missing/getaddrinfo.c
@@ -0,0 +1,632 @@
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+#include <netdb.h>
+#include <resolv.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <ctype.h>
+#include <unistd.h>
+
+#include "addrinfo.h"
+
+#define SUCCESS 0
+#define ANY 0
+#define YES 1
+#define NO 0
+
+static const char in_addrany[] = { 0, 0, 0, 0 };
+static const char in6_addrany[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+static const char in_loopback[] = { 127, 0, 0, 1 };
+static const char in6_loopback[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
+};
+
+struct sockinet {
+ u_char si_len;
+ u_char si_family;
+ u_short si_port;
+};
+
+static struct afd {
+ int a_af;
+ int a_addrlen;
+ int a_socklen;
+ int a_off;
+ const char *a_addrany;
+ const char *a_loopback;
+} afdl [] = {
+#ifdef INET6
+#define N_INET6 0
+ {PF_INET6, sizeof(struct in6_addr),
+ sizeof(struct sockaddr_in6),
+ offsetof(struct sockaddr_in6, sin6_addr),
+ in6_addrany, in6_loopback},
+#define N_INET 1
+#else
+#define N_INET 0
+#endif
+ {PF_INET, sizeof(struct in_addr),
+ sizeof(struct sockaddr_in),
+ offsetof(struct sockaddr_in, sin_addr),
+ in_addrany, in_loopback},
+ {0, 0, 0, 0, NULL, NULL},
+};
+
+#ifdef INET6
+#define PTON_MAX 16
+#else
+#define PTON_MAX 4
+#endif
+
+
+static int get_name(const char *, struct afd *,
+ struct addrinfo **, char *, struct addrinfo *,
+ int);
+static int get_addr(const char *, int, struct addrinfo **,
+ struct addrinfo *, int);
+static int get_addr0(const char *, int, struct addrinfo **,
+ struct addrinfo *, int);
+static int str_isnumber(const char *);
+
+static char *ai_errlist[] = {
+ "Success",
+ "Address family for hostname not supported", /* EAI_ADDRFAMILY */
+ "Temporary failure in name resolution", /* EAI_AGAIN */
+ "Invalid value for ai_flags", /* EAI_BADFLAGS */
+ "Non-recoverable failure in name resolution", /* EAI_FAIL */
+ "ai_family not supported", /* EAI_FAMILY */
+ "Memory allocation failure", /* EAI_MEMORY */
+ "No address associated with hostname", /* EAI_NODATA */
+ "hostname nor servname provided, or not known",/* EAI_NONAME */
+ "servname not supported for ai_socktype", /* EAI_SERVICE */
+ "ai_socktype not supported", /* EAI_SOCKTYPE */
+ "System error returned in errno", /* EAI_SYSTEM */
+ "Invalid value for hints", /* EAI_BADHINTS */
+ "Resolved protocol is unknown", /* EAI_PROTOCOL */
+ "Unknown error", /* EAI_MAX */
+};
+
+#define GET_CANONNAME(ai, str) \
+if (pai->ai_flags & AI_CANONNAME) {\
+ if (((ai)->ai_canonname = (char *)malloc(strlen(str) + 1)) != NULL) {\
+ strcpy((ai)->ai_canonname, (str));\
+ } else {\
+ error = EAI_MEMORY;\
+ goto free;\
+ }\
+}
+
+#ifdef HAVE_SA_LEN
+#define SET_AILEN(ai,l) (ai)->ai_addr->sa_len = (ai)->ai_addrlen = (l)
+#else
+#define SET_AILEN(ai,l) (ai)->ai_addrlen = (l)
+#endif
+
+#define GET_AI(ai, afd, addr, port) {\
+ char *p;\
+ if (((ai) = (struct addrinfo *)malloc(sizeof(struct addrinfo) +\
+ ((afd)->a_socklen)))\
+ == NULL) {\
+ error = EAI_MEMORY;\
+ goto free;\
+ }\
+ memcpy(ai, pai, sizeof(struct addrinfo));\
+ (ai)->ai_addr = (struct sockaddr *)((ai) + 1);\
+ memset((ai)->ai_addr, 0, (afd)->a_socklen);\
+ SET_AILEN((ai), (afd)->a_socklen);\
+ (ai)->ai_addr->sa_family = (ai)->ai_family = (afd)->a_af;\
+ ((struct sockinet *)(ai)->ai_addr)->si_port = port;\
+ p = (char *)((ai)->ai_addr);\
+ memcpy(p + (afd)->a_off, (addr), (afd)->a_addrlen);\
+}
+
+#define ERR(err) { error = (err); goto bad; }
+
+char *
+gai_strerror(ecode)
+ int ecode;
+{
+ if (ecode < 0 || ecode > EAI_MAX)
+ ecode = EAI_MAX;
+ return ai_errlist[ecode];
+}
+
+void
+freeaddrinfo(ai)
+ struct addrinfo *ai;
+{
+ struct addrinfo *next;
+
+ do {
+ next = ai->ai_next;
+ if (ai->ai_canonname)
+ free(ai->ai_canonname);
+ /* no need to free(ai->ai_addr) */
+ free(ai);
+ } while ((ai = next) != NULL);
+}
+
+static int
+str_isnumber(p)
+ const char *p;
+{
+ char *q = (char *)p;
+ while (*q) {
+ if (! isdigit(*q))
+ return NO;
+ q++;
+ }
+ return YES;
+}
+
+int
+getaddrinfo(hostname, servname, hints, res)
+ const char *hostname, *servname;
+ const struct addrinfo *hints;
+ struct addrinfo **res;
+{
+ struct addrinfo sentinel;
+ struct addrinfo *top = NULL;
+ struct addrinfo *cur;
+ int i, error = 0;
+ char pton[PTON_MAX];
+ struct addrinfo ai;
+ struct addrinfo *pai;
+ u_short port;
+
+ /* initialize file static vars */
+ sentinel.ai_next = NULL;
+ cur = &sentinel;
+ pai = &ai;
+ pai->ai_flags = 0;
+ pai->ai_family = PF_UNSPEC;
+ pai->ai_socktype = ANY;
+ pai->ai_protocol = ANY;
+ pai->ai_addrlen = 0;
+ pai->ai_canonname = NULL;
+ pai->ai_addr = NULL;
+ pai->ai_next = NULL;
+ port = ANY;
+
+ if (hostname == NULL && servname == NULL)
+ return EAI_NONAME;
+ if (hints) {
+ /* error check for hints */
+ if (hints->ai_addrlen || hints->ai_canonname ||
+ hints->ai_addr || hints->ai_next)
+ ERR(EAI_BADHINTS); /* xxx */
+ if (hints->ai_flags & ~AI_MASK)
+ ERR(EAI_BADFLAGS);
+ switch (hints->ai_family) {
+ case PF_UNSPEC:
+ case PF_INET:
+#ifdef INET6
+ case PF_INET6:
+#endif
+ break;
+ default:
+ ERR(EAI_FAMILY);
+ }
+ memcpy(pai, hints, sizeof(*pai));
+ switch (pai->ai_socktype) {
+ case ANY:
+ switch (pai->ai_protocol) {
+ case ANY:
+ break;
+ case IPPROTO_UDP:
+ pai->ai_socktype = SOCK_DGRAM;
+ break;
+ case IPPROTO_TCP:
+ pai->ai_socktype = SOCK_STREAM;
+ break;
+ default:
+ pai->ai_socktype = SOCK_RAW;
+ break;
+ }
+ break;
+ case SOCK_RAW:
+ break;
+ case SOCK_DGRAM:
+ if (pai->ai_protocol != IPPROTO_UDP &&
+ pai->ai_protocol != ANY)
+ ERR(EAI_BADHINTS); /*xxx*/
+ pai->ai_protocol = IPPROTO_UDP;
+ break;
+ case SOCK_STREAM:
+ if (pai->ai_protocol != IPPROTO_TCP &&
+ pai->ai_protocol != ANY)
+ ERR(EAI_BADHINTS); /*xxx*/
+ pai->ai_protocol = IPPROTO_TCP;
+ break;
+ default:
+ ERR(EAI_SOCKTYPE);
+ break;
+ }
+ }
+
+ /*
+ * service port
+ */
+ if (servname) {
+ if (str_isnumber(servname)) {
+ if (pai->ai_socktype == ANY) {
+ /* caller accept *ANY* socktype */
+ pai->ai_socktype = SOCK_DGRAM;
+ pai->ai_protocol = IPPROTO_UDP;
+ }
+ port = htons(atoi(servname));
+ } else {
+ struct servent *sp;
+ char *proto;
+
+ proto = NULL;
+ switch (pai->ai_socktype) {
+ case ANY:
+ proto = NULL;
+ break;
+ case SOCK_DGRAM:
+ proto = "udp";
+ break;
+ case SOCK_STREAM:
+ proto = "tcp";
+ break;
+ default:
+ fprintf(stderr, "panic!\n");
+ break;
+ }
+ if ((sp = getservbyname(servname, proto)) == NULL)
+ ERR(EAI_SERVICE);
+ port = sp->s_port;
+ if (pai->ai_socktype == ANY) {
+ if (strcmp(sp->s_proto, "udp") == 0) {
+ pai->ai_socktype = SOCK_DGRAM;
+ pai->ai_protocol = IPPROTO_UDP;
+ } else if (strcmp(sp->s_proto, "tcp") == 0) {
+ pai->ai_socktype = SOCK_STREAM;
+ pai->ai_protocol = IPPROTO_TCP;
+ } else
+ ERR(EAI_PROTOCOL); /*xxx*/
+ }
+ }
+ }
+
+ /*
+ * hostname == NULL.
+ * passive socket -> anyaddr (0.0.0.0 or ::)
+ * non-passive socket -> localhost (127.0.0.1 or ::1)
+ */
+ if (hostname == NULL) {
+ struct afd *afd;
+ int s;
+
+ for (afd = &afdl[0]; afd->a_af; afd++) {
+ if (!(pai->ai_family == PF_UNSPEC
+ || pai->ai_family == afd->a_af)) {
+ continue;
+ }
+
+ /*
+ * filter out AFs that are not supported by the kernel
+ * XXX errno?
+ */
+ s = socket(afd->a_af, SOCK_DGRAM, 0);
+ if (s < 0)
+ continue;
+ close(s);
+
+ if (pai->ai_flags & AI_PASSIVE) {
+ GET_AI(cur->ai_next, afd, afd->a_addrany, port);
+ /* xxx meaningless?
+ * GET_CANONNAME(cur->ai_next, "anyaddr");
+ */
+ } else {
+ GET_AI(cur->ai_next, afd, afd->a_loopback,
+ port);
+ /* xxx meaningless?
+ * GET_CANONNAME(cur->ai_next, "localhost");
+ */
+ }
+ cur = cur->ai_next;
+ }
+ top = sentinel.ai_next;
+ if (top)
+ goto good;
+ else
+ ERR(EAI_FAMILY);
+ }
+
+ /* hostname as numeric name */
+ for (i = 0; afdl[i].a_af; i++) {
+ if (inet_pton(afdl[i].a_af, hostname, pton) == 1) {
+ u_long v4a;
+ u_char pfx;
+
+ switch (afdl[i].a_af) {
+ case AF_INET:
+ v4a = ntohl(((struct in_addr *)pton)->s_addr);
+ if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
+ pai->ai_flags &= ~AI_CANONNAME;
+ v4a >>= IN_CLASSA_NSHIFT;
+ if (v4a == 0 || v4a == IN_LOOPBACKNET)
+ pai->ai_flags &= ~AI_CANONNAME;
+ break;
+#ifdef INET6
+ case AF_INET6:
+ pfx = ((struct in6_addr *)pton)->s6_addr[0];
+ if (pfx == 0 || pfx == 0xfe || pfx == 0xff)
+ pai->ai_flags &= ~AI_CANONNAME;
+ break;
+#endif
+ }
+
+ if (pai->ai_family == afdl[i].a_af ||
+ pai->ai_family == PF_UNSPEC) {
+ if (! (pai->ai_flags & AI_CANONNAME)) {
+ GET_AI(top, &afdl[i], pton, port);
+ goto good;
+ }
+ /*
+ * if AI_CANONNAME and if reverse lookup
+ * fail, return ai anyway to pacify
+ * calling application.
+ *
+ * XXX getaddrinfo() is a name->address
+ * translation function, and it looks strange
+ * that we do addr->name translation here.
+ */
+ get_name(pton, &afdl[i], &top, pton, pai, port);
+ goto good;
+ } else
+ ERR(EAI_FAMILY); /*xxx*/
+ }
+ }
+
+ if (pai->ai_flags & AI_NUMERICHOST)
+ ERR(EAI_NONAME);
+
+ /* hostname as alphabetical name */
+ error = get_addr(hostname, pai->ai_family, &top, pai, port);
+ if (error == 0) {
+ if (top) {
+ good:
+ *res = top;
+ return SUCCESS;
+ } else
+ error = EAI_FAIL;
+ }
+ free:
+ if (top)
+ freeaddrinfo(top);
+ bad:
+ *res = NULL;
+ return error;
+}
+
+static int
+get_name(addr, afd, res, numaddr, pai, port0)
+ const char *addr;
+ struct afd *afd;
+ struct addrinfo **res;
+ char *numaddr;
+ struct addrinfo *pai;
+ int port0;
+{
+ u_short port = port0 & 0xffff;
+ struct hostent *hp;
+ struct addrinfo *cur;
+ int error = 0;
+ hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af);
+ if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) {
+ GET_AI(cur, afd, hp->h_addr_list[0], port);
+ GET_CANONNAME(cur, hp->h_name);
+ } else
+ GET_AI(cur, afd, numaddr, port);
+
+ *res = cur;
+ return SUCCESS;
+ free:
+ if (cur)
+ freeaddrinfo(cur);
+
+ /* bad: */
+ *res = NULL;
+ return error;
+}
+
+static int
+get_addr(hostname, af, res0, pai, port0)
+ const char *hostname;
+ int af;
+ struct addrinfo **res0;
+ struct addrinfo *pai;
+ int port0;
+{
+ int i, error, ekeep;
+ struct addrinfo *cur;
+ struct addrinfo **res;
+ int retry;
+ int s;
+
+ res = res0;
+ ekeep = 0;
+ error = 0;
+ for (i = 0; afdl[i].a_af; i++) {
+ retry = 0;
+ if (af == AF_UNSPEC) {
+ /*
+ * filter out AFs that are not supported by the kernel
+ * XXX errno?
+ */
+ s = socket(afdl[i].a_af, SOCK_DGRAM, 0);
+ if (s < 0)
+ continue;
+ close(s);
+ } else {
+ if (af != afdl[i].a_af)
+ continue;
+ }
+ /* It is WRONG, we need getipnodebyname(). */
+again:
+ error = get_addr0(hostname, afdl[i].a_af, res, pai, port0);
+ switch (error) {
+ case EAI_AGAIN:
+ if (++retry < 3)
+ goto again;
+ /* FALL THROUGH*/
+ default:
+ if (ekeep == 0)
+ ekeep = error;
+ break;
+ }
+ if (*res) {
+ /* make chain of addrs */
+ for (cur = *res;
+ cur && cur->ai_next;
+ cur = cur->ai_next)
+ ;
+ if (!cur)
+ return EAI_FAIL;
+ res = &cur->ai_next;
+ }
+ }
+
+ /* if we got something, it's okay */
+ if (*res0)
+ return 0;
+
+ return error ? error : ekeep;
+}
+
+static int
+get_addr0(hostname, af, res, pai, port0)
+ const char *hostname;
+ int af;
+ struct addrinfo **res;
+ struct addrinfo *pai;
+ int port0;
+{
+ u_short port = port0 & 0xffff;
+ struct addrinfo sentinel;
+ struct hostent *hp;
+ struct addrinfo *top, *cur;
+ struct afd *afd;
+ int i, error = 0, h_error;
+ char *ap;
+
+ top = NULL;
+ sentinel.ai_next = NULL;
+ cur = &sentinel;
+
+#ifdef HAVE_GETHOSTBYNAME2
+ if (af == AF_UNSPEC) {
+ error = EAI_FAIL;
+ goto bad;
+ }
+ hp = gethostbyname2(hostname, af);
+#else
+ if (af != AF_UNSPEC && af != AF_INET) {
+ error = EAI_FAIL;
+ goto bad;
+ }
+ hp = gethostbyname(hostname);
+#endif
+ h_error = h_errno;
+
+ if (hp == NULL) {
+ switch (h_error) {
+ case HOST_NOT_FOUND:
+ case NO_DATA:
+ error = EAI_NODATA;
+ break;
+ case TRY_AGAIN:
+ error = EAI_AGAIN;
+ break;
+ case NO_RECOVERY:
+ case NETDB_INTERNAL:
+ default:
+ error = EAI_FAIL;
+ break;
+ }
+ goto bad;
+ }
+
+ if ((hp->h_name == NULL) || (hp->h_name[0] == 0) ||
+ (hp->h_addr_list[0] == NULL))
+ ERR(EAI_FAIL);
+
+ for (i = 0; (ap = hp->h_addr_list[i]) != NULL; i++) {
+ switch (af) {
+#ifdef INET6
+ case AF_INET6:
+ afd = &afdl[N_INET6];
+ break;
+#endif
+#ifndef INET6
+ default: /* AF_UNSPEC */
+#endif
+ case AF_INET:
+ afd = &afdl[N_INET];
+ break;
+#ifdef INET6
+ default: /* AF_UNSPEC */
+ if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)ap)) {
+ ap += sizeof(struct in6_addr) -
+ sizeof(struct in_addr);
+ afd = &afdl[N_INET];
+ } else
+ afd = &afdl[N_INET6];
+ break;
+#endif
+ }
+ GET_AI(cur->ai_next, afd, ap, port);
+ if (cur == &sentinel) {
+ top = cur->ai_next;
+ GET_CANONNAME(top, hp->h_name);
+ }
+ cur = cur->ai_next;
+ }
+ *res = top;
+ return SUCCESS;
+ free:
+ if (top)
+ freeaddrinfo(top);
+ bad:
+ *res = NULL;
+ return error;
+}
diff --git a/contrib/queryperf/missing/getnameinfo.c b/contrib/queryperf/missing/getnameinfo.c
new file mode 100644
index 0000000..6b1cbe1
--- /dev/null
+++ b/contrib/queryperf/missing/getnameinfo.c
@@ -0,0 +1,226 @@
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Issues to be discussed:
+ * - Thread safe-ness must be checked
+ * - Return values. There seems to be no standard for return value (RFC2553)
+ * but INRIA implementation returns EAI_xxx defined for getaddrinfo().
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+#include <netdb.h>
+#include <resolv.h>
+#include <string.h>
+#include <stddef.h>
+
+#include "addrinfo.h"
+
+#define SUCCESS 0
+#define ANY 0
+#define YES 1
+#define NO 0
+
+static struct afd {
+ int a_af;
+ int a_addrlen;
+ int a_socklen;
+ int a_off;
+} afdl [] = {
+#ifdef INET6
+ {PF_INET6, sizeof(struct in6_addr), sizeof(struct sockaddr_in6),
+ offsetof(struct sockaddr_in6, sin6_addr)},
+#endif
+ {PF_INET, sizeof(struct in_addr), sizeof(struct sockaddr_in),
+ offsetof(struct sockaddr_in, sin_addr)},
+ {0, 0, 0},
+};
+
+struct sockinet {
+ u_char si_len;
+ u_char si_family;
+ u_short si_port;
+};
+
+#define ENI_NOSOCKET 0
+#define ENI_NOSERVNAME 1
+#define ENI_NOHOSTNAME 2
+#define ENI_MEMORY 3
+#define ENI_SYSTEM 4
+#define ENI_FAMILY 5
+#define ENI_SALEN 6
+
+int
+getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
+ const struct sockaddr *sa;
+ size_t salen;
+ char *host;
+ size_t hostlen;
+ char *serv;
+ size_t servlen;
+ int flags;
+{
+ struct afd *afd;
+ struct servent *sp;
+ struct hostent *hp;
+ u_short port;
+ int family, len, i;
+ char *addr, *p;
+ u_long v4a;
+ int h_error;
+ char numserv[512];
+ char numaddr[512];
+
+ if (sa == NULL)
+ return ENI_NOSOCKET;
+
+#ifdef HAVE_SA_LEN
+ len = sa->sa_len;
+ if (len != salen) return ENI_SALEN;
+#else
+ len = salen;
+#endif
+
+ family = sa->sa_family;
+ for (i = 0; afdl[i].a_af; i++)
+ if (afdl[i].a_af == family) {
+ afd = &afdl[i];
+ goto found;
+ }
+ return ENI_FAMILY;
+
+ found:
+ if (len != afd->a_socklen) return ENI_SALEN;
+
+ port = ((struct sockinet *)sa)->si_port; /* network byte order */
+ addr = (char *)sa + afd->a_off;
+
+ if (serv == NULL || servlen == 0) {
+ /* what we should do? */
+ } else if (flags & NI_NUMERICSERV) {
+ snprintf(numserv, sizeof(numserv), "%d", ntohs(port));
+ if (strlen(numserv) > servlen)
+ return ENI_MEMORY;
+ strcpy(serv, numserv);
+ } else {
+ sp = getservbyport(port, (flags & NI_DGRAM) ? "udp" : "tcp");
+ if (sp) {
+ if (strlen(sp->s_name) > servlen)
+ return ENI_MEMORY;
+ strcpy(serv, sp->s_name);
+ } else
+ return ENI_NOSERVNAME;
+ }
+
+ switch (sa->sa_family) {
+ case AF_INET:
+ v4a = ntohl(((struct sockaddr_in *)sa)->sin_addr.s_addr);
+ if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
+ flags |= NI_NUMERICHOST;
+ v4a >>= IN_CLASSA_NSHIFT;
+ if (v4a == 0 || v4a == IN_LOOPBACKNET)
+ flags |= NI_NUMERICHOST;
+ break;
+#ifdef INET6
+ case AF_INET6:
+ {
+ struct sockaddr_in6 *sin6;
+ sin6 = (struct sockaddr_in6 *)sa;
+ switch (sin6->sin6_addr.s6_addr[0]) {
+ case 0x00:
+ if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr))
+ ;
+ else if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr))
+ ;
+ else
+ flags |= NI_NUMERICHOST;
+ break;
+ default:
+ if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))
+ flags |= NI_NUMERICHOST;
+ else if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
+ flags |= NI_NUMERICHOST;
+ break;
+ }
+ }
+ break;
+#endif
+ }
+ if (host == NULL || hostlen == 0) {
+ /* what should we do? */
+ } else if (flags & NI_NUMERICHOST) {
+ /* NUMERICHOST and NAMEREQD conflicts with each other */
+ if (flags & NI_NAMEREQD)
+ return ENI_NOHOSTNAME;
+ if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr))
+ == NULL)
+ return ENI_SYSTEM;
+ if (strlen(numaddr) > hostlen)
+ return ENI_MEMORY;
+ strcpy(host, numaddr);
+ } else {
+#ifdef USE_GETIPNODEBY
+ hp = getipnodebyaddr(addr, afd->a_addrlen, afd->a_af, &h_error);
+#else
+ hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af);
+ h_error = h_errno;
+#endif
+
+ if (hp) {
+ if (flags & NI_NOFQDN) {
+ p = strchr(hp->h_name, '.');
+ if (p) *p = '\0';
+ }
+ if (strlen(hp->h_name) > hostlen) {
+#ifdef USE_GETIPNODEBY
+ freehostent(hp);
+#endif
+ return ENI_MEMORY;
+ }
+ strcpy(host, hp->h_name);
+#ifdef USE_GETIPNODEBY
+ freehostent(hp);
+#endif
+ } else {
+ if (flags & NI_NAMEREQD)
+ return ENI_NOHOSTNAME;
+ if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr))
+ == NULL)
+ return ENI_NOHOSTNAME;
+ if (strlen(numaddr) > hostlen)
+ return ENI_MEMORY;
+ strcpy(host, numaddr);
+ }
+ }
+ return SUCCESS;
+}
diff --git a/contrib/queryperf/queryperf.c b/contrib/queryperf/queryperf.c
new file mode 100644
index 0000000..d15b7c4
--- /dev/null
+++ b/contrib/queryperf/queryperf.c
@@ -0,0 +1,2113 @@
+/*
+ * Copyright (C) 2000, 2001 Nominum, Inc.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/***
+ *** DNS Query Performance Testing Tool (queryperf.c)
+ ***
+ *** Version $Id: queryperf.c,v 1.12 2007/09/05 07:36:04 marka Exp $
+ ***
+ *** Stephen Jacob <sj@nominum.com>
+ ***/
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <time.h>
+#include <unistd.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+#include <math.h>
+#include <errno.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#ifndef HAVE_GETADDRINFO
+#include "missing/addrinfo.h"
+#endif
+#endif
+
+/*
+ * Configuration defaults
+ */
+
+#define DEF_MAX_QUERIES_OUTSTANDING 20
+#define DEF_QUERY_TIMEOUT 5 /* in seconds */
+#define DEF_SERVER_TO_QUERY "127.0.0.1"
+#define DEF_SERVER_PORT "53"
+#define DEF_BUFFER_SIZE 32 /* in k */
+
+#define DEF_RTTARRAY_SIZE 50000
+#define DEF_RTTARRAY_UNIT 100 /* in usec */
+
+/*
+ * Other constants / definitions
+ */
+
+#define COMMENT_CHAR ';'
+#define CONFIG_CHAR '#'
+#define MAX_PORT 65535
+#define MAX_INPUT_LEN 512
+#define MAX_DOMAIN_LEN 255
+#define MAX_BUFFER_LEN 8192 /* in bytes */
+#define HARD_TIMEOUT_EXTRA 5 /* in seconds */
+#define RESPONSE_BLOCKING_WAIT_TIME 0.1 /* in seconds */
+#define EDNSLEN 11
+
+#define FALSE 0
+#define TRUE 1
+
+#define WHITESPACE " \t\n"
+
+enum directives_enum { V_SERVER, V_PORT, V_MAXQUERIES, V_MAXWAIT };
+#define DIRECTIVES { "server", "port", "maxqueries", "maxwait" }
+#define DIR_VALUES { V_SERVER, V_PORT, V_MAXQUERIES, V_MAXWAIT }
+
+#define QTYPE_STRINGS { \
+ "A", "NS", "MD", "MF", "CNAME", "SOA", "MB", "MG", \
+ "MR", "NULL", "WKS", "PTR", "HINFO", "MINFO", "MX", "TXT", \
+ "AAAA", "SRV", "NAPTR", "A6", "AXFR", "MAILB", "MAILA", "*", "ANY" \
+}
+
+#define QTYPE_CODES { \
+ 1, 2, 3, 4, 5, 6, 7, 8, \
+ 9, 10, 11, 12, 13, 14, 15, 16, \
+ 28, 33, 35, 38, 252, 253, 254, 255, 255 \
+}
+
+#define RCODE_STRINGS { \
+ "NOERROR", "FORMERR", "SERVFAIL", "NXDOMAIN", \
+ "NOTIMP", "REFUSED", "YXDOMAIN", "YXRRSET", \
+ "NXRRSET", "NOTAUTH", "NOTZONE", "rcode11", \
+ "rcode12", "rcode13", "rcode14", "rcode15" \
+}
+
+/*
+ * Data type definitions
+ */
+
+#define QUERY_STATUS_MAGIC 0x51535441U /* QSTA */
+#define VALID_QUERY_STATUS(q) ((q) != NULL && \
+ (q)->magic == QUERY_STATUS_MAGIC)
+
+struct query_status {
+ unsigned int magic;
+ int in_use;
+ unsigned short int id;
+ struct timeval sent_timestamp;
+ char *desc;
+};
+
+/*
+ * Configuration options (global)
+ */
+
+unsigned int max_queries_outstanding; /* init 0 */
+unsigned int query_timeout = DEF_QUERY_TIMEOUT;
+int ignore_config_changes = FALSE;
+unsigned int socket_bufsize = DEF_BUFFER_SIZE;
+
+int family = AF_UNSPEC;
+int use_stdin = TRUE;
+char *datafile_name; /* init NULL */
+
+char *server_to_query; /* init NULL */
+char *server_port; /* init NULL */
+struct addrinfo *server_ai; /* init NULL */
+
+int run_only_once = FALSE;
+int use_timelimit = FALSE;
+unsigned int run_timelimit; /* init 0 */
+unsigned int print_interval; /* init 0 */
+
+unsigned int target_qps; /* init 0 */
+
+int serverset = FALSE, portset = FALSE;
+int queriesset = FALSE, timeoutset = FALSE;
+int edns = FALSE, dnssec = FALSE;
+int countrcodes = FALSE;
+int rcodecounts[16] = {0};
+
+int verbose = FALSE;
+
+/*
+ * Other global stuff
+ */
+
+int setup_phase = TRUE;
+
+FILE *datafile_ptr; /* init NULL */
+unsigned int runs_through_file; /* init 0 */
+
+unsigned int num_queries_sent; /* init 0 */
+unsigned int num_queries_sent_interval;
+unsigned int num_queries_outstanding; /* init 0 */
+unsigned int num_queries_timed_out; /* init 0 */
+unsigned int num_queries_possiblydelayed; /* init 0 */
+unsigned int num_queries_timed_out_interval;
+unsigned int num_queries_possiblydelayed_interval;
+
+struct timeval time_of_program_start;
+struct timeval time_of_first_query;
+double time_of_first_query_sec;
+struct timeval time_of_first_query_interval;
+struct timeval time_of_end_of_run;
+struct timeval time_of_stop_sending;
+
+struct timeval time_of_queryset_start;
+double query_interval;
+struct timeval time_of_next_queryset;
+
+double rtt_max = -1;
+double rtt_max_interval = -1;
+double rtt_min = -1;
+double rtt_min_interval = -1;
+double rtt_total;
+double rtt_total_interval;
+int rttarray_size = DEF_RTTARRAY_SIZE;
+int rttarray_unit = DEF_RTTARRAY_UNIT;
+unsigned int *rttarray = NULL;
+unsigned int *rttarray_interval = NULL;
+unsigned int rtt_overflows;
+unsigned int rtt_overflows_interval;
+char *rtt_histogram_file = NULL;
+
+struct query_status *status; /* init NULL */
+unsigned int query_status_allocated; /* init 0 */
+
+int query_socket = -1;
+int socket4 = -1, socket6 = -1;
+
+static char *rcode_strings[] = RCODE_STRINGS;
+
+/*
+ * get_uint16:
+ * Get an unsigned short integer from a buffer (in network order)
+ */
+static unsigned short
+get_uint16(unsigned char *buf) {
+ unsigned short ret;
+
+ ret = buf[0] * 256 + buf[1];
+
+ return (ret);
+}
+
+/*
+ * show_startup_info:
+ * Show name/version
+ */
+void
+show_startup_info(void) {
+ printf("\n"
+"DNS Query Performance Testing Tool\n"
+"Version: $Id: queryperf.c,v 1.12 2007/09/05 07:36:04 marka Exp $\n"
+"\n");
+}
+
+/*
+ * show_usage:
+ * Print out usage/syntax information
+ */
+void
+show_usage(void) {
+ fprintf(stderr,
+"\n"
+"Usage: queryperf [-d datafile] [-s server_addr] [-p port] [-q num_queries]\n"
+" [-b bufsize] [-t timeout] [-n] [-l limit] [-f family] [-1]\n"
+" [-i interval] [-r arraysize] [-u unit] [-H histfile]\n"
+" [-T qps] [-e] [-D] [-c] [-v] [-h]\n"
+" -d specifies the input data file (default: stdin)\n"
+" -s sets the server to query (default: %s)\n"
+" -p sets the port on which to query the server (default: %s)\n"
+" -q specifies the maximum number of queries outstanding (default: %d)\n"
+" -t specifies the timeout for query completion in seconds (default: %d)\n"
+" -n causes configuration changes to be ignored\n"
+" -l specifies how a limit for how long to run tests in seconds (no default)\n"
+" -1 run through input only once (default: multiple iff limit given)\n"
+" -b set input/output buffer size in kilobytes (default: %d k)\n"
+" -i specifies interval of intermediate outputs in seconds (default: 0=none)\n"
+" -f specify address family of DNS transport, inet or inet6 (default: any)\n"
+" -r set RTT statistics array size (default: %d)\n"
+" -u set RTT statistics time unit in usec (default: %d)\n"
+" -H specifies RTT histogram data file (default: none)\n"
+" -T specify the target qps (default: 0=unspecified)\n"
+" -e enable EDNS 0\n"
+" -D set the DNSSEC OK bit (implies EDNS)\n"
+" -c print the number of packets with each rcode\n"
+" -v verbose: report the RCODE of each response on stdout\n"
+" -h print this usage\n"
+"\n",
+ DEF_SERVER_TO_QUERY, DEF_SERVER_PORT,
+ DEF_MAX_QUERIES_OUTSTANDING, DEF_QUERY_TIMEOUT,
+ DEF_BUFFER_SIZE, DEF_RTTARRAY_SIZE, DEF_RTTARRAY_UNIT);
+}
+
+/*
+ * set_datafile:
+ * Set the datafile to read
+ *
+ * Return -1 on failure
+ * Return a non-negative integer otherwise
+ */
+int
+set_datafile(char *new_file) {
+ char *dfname_tmp;
+
+ if ((new_file == NULL) || (new_file[0] == '\0')) {
+ fprintf(stderr, "Error: null datafile name\n");
+ return (-1);
+ }
+
+ if ((dfname_tmp = malloc(strlen(new_file) + 1)) == NULL) {
+ fprintf(stderr, "Error allocating memory for datafile name: "
+ "%s\n", new_file);
+ return (-1);
+ }
+
+ free(datafile_name);
+ datafile_name = dfname_tmp;
+
+ strcpy(datafile_name, new_file);
+ use_stdin = FALSE;
+
+ return (0);
+}
+
+/*
+ * set_input_stdin:
+ * Set the input to be stdin (instead of a datafile)
+ */
+void
+set_input_stdin(void) {
+ use_stdin = TRUE;
+ free(datafile_name);
+ datafile_name = NULL;
+}
+
+/*
+ * set_server:
+ * Set the server to be queried
+ *
+ * Return -1 on failure
+ * Return a non-negative integer otherwise
+ */
+int
+set_server(char *new_name) {
+ static struct hostent *server_he;
+
+ /* If no change in server name, don't do anything... */
+ if ((server_to_query != NULL) && (new_name != NULL))
+ if (strcmp(new_name, server_to_query) == 0)
+ return (0);
+
+ if ((new_name == NULL) || (new_name[0] == '\0')) {
+ fprintf(stderr, "Error: null server name\n");
+ return (-1);
+ }
+
+ free(server_to_query);
+ server_to_query = NULL;
+
+ if ((server_to_query = malloc(strlen(new_name) + 1)) == NULL) {
+ fprintf(stderr, "Error allocating memory for server name: "
+ "%s\n", new_name);
+ return (-1);
+ }
+
+ strcpy(server_to_query, new_name);
+
+ return (0);
+}
+
+/*
+ * set_server_port:
+ * Set the port on which to contact the server
+ *
+ * Return -1 if port is invalid
+ * Return a non-negative integer otherwise
+ */
+int
+set_server_port(char *new_port) {
+ unsigned int uint_val;
+
+ if ((is_uint(new_port, &uint_val)) != TRUE)
+ return (-1);
+
+ if (uint_val && uint_val > MAX_PORT)
+ return (-1);
+ else {
+ if (server_port != NULL && new_port != NULL &&
+ strcmp(server_port, new_port) == 0)
+ return (0);
+
+ free(server_port);
+ server_port = NULL;
+
+ if ((server_port = malloc(strlen(new_port) + 1)) == NULL) {
+ fprintf(stderr,
+ "Error allocating memory for server port: "
+ "%s\n", new_port);
+ return (-1);
+ }
+
+ strcpy(server_port, new_port);
+
+ return (0);
+ }
+}
+
+int
+set_server_sa(void) {
+ struct addrinfo hints, *res;
+ static struct protoent *proto;
+ int error;
+
+ if (proto == NULL && (proto = getprotobyname("udp")) == NULL) {
+ fprintf(stderr, "Error: getprotobyname call failed");
+ return (-1);
+ }
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = family;
+ hints.ai_socktype = SOCK_DGRAM;
+ hints.ai_protocol = proto->p_proto;
+ if ((error = getaddrinfo(server_to_query, server_port,
+ &hints, &res)) != 0) {
+ fprintf(stderr, "Error: getaddrinfo(%s, %s) failed\n",
+ server_to_query, server_port);
+ return (-1);
+ }
+
+ /* replace the server's addrinfo */
+ if (server_ai != NULL)
+ freeaddrinfo(server_ai);
+ server_ai = res;
+ return (0);
+}
+
+/*
+ * is_digit:
+ * Tests if a character is a digit
+ *
+ * Return TRUE if it is
+ * Return FALSE if it is not
+ */
+int
+is_digit(char d) {
+ if (d < '0' || d > '9')
+ return (FALSE);
+ else
+ return (TRUE);
+}
+
+/*
+ * is_uint:
+ * Tests if a string, test_int, is a valid unsigned integer
+ *
+ * Sets *result to be the unsigned integer if it is valid
+ *
+ * Return TRUE if it is
+ * Return FALSE if it is not
+ */
+int
+is_uint(char *test_int, unsigned int *result) {
+ unsigned long int value;
+ char *end;
+
+ if (test_int == NULL)
+ return (FALSE);
+
+ if (is_digit(test_int[0]) == FALSE)
+ return (FALSE);
+
+ value = strtoul(test_int, &end, 10);
+
+ if ((errno == ERANGE) || (*end != '\0') || (value > UINT_MAX))
+ return (FALSE);
+
+ *result = (unsigned int)value;
+ return (TRUE);
+}
+
+/*
+ * set_max_queries:
+ * Set the maximum number of outstanding queries
+ *
+ * Returns -1 on failure
+ * Returns a non-negative integer otherwise
+ */
+int
+set_max_queries(unsigned int new_max) {
+ static unsigned int size_qs = sizeof(struct query_status);
+ struct query_status *temp_stat;
+ unsigned int count;
+
+ if (new_max < 0) {
+ fprintf(stderr, "Unable to change max outstanding queries: "
+ "must be positive and non-zero: %u\n", new_max);
+ return (-1);
+ }
+
+ if (new_max > query_status_allocated) {
+ temp_stat = realloc(status, new_max * size_qs);
+
+ if (temp_stat == NULL) {
+ fprintf(stderr, "Error resizing query_status\n");
+ return (-1);
+ } else {
+ status = temp_stat;
+
+ /*
+ * Be careful to only initialise between above
+ * the previously allocated space. Note that the
+ * allocation may be larger than the current
+ * max_queries_outstanding. We don't want to
+ * "forget" any outstanding queries! We might
+ * still have some above the bounds of the max.
+ */
+ count = query_status_allocated;
+ for (; count < new_max; count++) {
+ status[count].in_use = FALSE;
+ status[count].magic = QUERY_STATUS_MAGIC;
+ status[count].desc = NULL;
+ }
+
+ query_status_allocated = new_max;
+ }
+ }
+
+ max_queries_outstanding = new_max;
+
+ return (0);
+}
+
+/*
+ * parse_args:
+ * Parse program arguments and set configuration options
+ *
+ * Return -1 on failure
+ * Return a non-negative integer otherwise
+ */
+int
+parse_args(int argc, char **argv) {
+ int c;
+ unsigned int uint_arg_val;
+
+ while ((c = getopt(argc, argv,
+ "f:q:t:i:nd:s:p:1l:b:eDcvr:T::u:H:h")) != -1) {
+ switch (c) {
+ case 'f':
+ if (strcmp(optarg, "inet") == 0)
+ family = AF_INET;
+#ifdef AF_INET6
+ else if (strcmp(optarg, "inet6") == 0)
+ family = AF_INET6;
+#endif
+ else if (strcmp(optarg, "any") == 0)
+ family = AF_UNSPEC;
+ else {
+ fprintf(stderr, "Invalid address family: %s\n",
+ optarg);
+ return (-1);
+ }
+ break;
+ case 'q':
+ if (is_uint(optarg, &uint_arg_val) == TRUE) {
+ set_max_queries(uint_arg_val);
+ queriesset = TRUE;
+ } else {
+ fprintf(stderr, "Option requires a positive "
+ "integer value: -%c %s\n",
+ c, optarg);
+ return (-1);
+ }
+ break;
+
+ case 't':
+ if (is_uint(optarg, &uint_arg_val) == TRUE) {
+ query_timeout = uint_arg_val;
+ timeoutset = TRUE;
+ } else {
+ fprintf(stderr, "Option requires a positive "
+ "integer value: -%c %s\n",
+ c, optarg);
+ return (-1);
+ }
+ break;
+
+ case 'n':
+ ignore_config_changes = TRUE;
+ break;
+
+ case 'd':
+ if (set_datafile(optarg) == -1) {
+ fprintf(stderr, "Error setting datafile "
+ "name: %s\n", optarg);
+ return (-1);
+ }
+ break;
+
+ case 's':
+ if (set_server(optarg) == -1) {
+ fprintf(stderr, "Error setting server "
+ "name: %s\n", optarg);
+ return (-1);
+ }
+ serverset = TRUE;
+ break;
+
+ case 'p':
+ if (is_uint(optarg, &uint_arg_val) == TRUE &&
+ uint_arg_val < MAX_PORT)
+ {
+ set_server_port(optarg);
+ portset = TRUE;
+ } else {
+ fprintf(stderr, "Option requires a positive "
+ "integer between 0 and %d: -%c %s\n",
+ MAX_PORT - 1, c, optarg);
+ return (-1);
+ }
+ break;
+
+ case '1':
+ run_only_once = TRUE;
+ break;
+
+ case 'l':
+ if (is_uint(optarg, &uint_arg_val) == TRUE) {
+ use_timelimit = TRUE;
+ run_timelimit = uint_arg_val;
+ } else {
+ fprintf(stderr, "Option requires a positive "
+ "integer: -%c %s\n",
+ c, optarg);
+ return (-1);
+ }
+ break;
+
+ case 'b':
+ if (is_uint(optarg, &uint_arg_val) == TRUE) {
+ socket_bufsize = uint_arg_val;
+ } else {
+ fprintf(stderr, "Option requires a positive "
+ "integer: -%c %s\n",
+ c, optarg);
+ return (-1);
+ }
+ break;
+ case 'e':
+ edns = TRUE;
+ break;
+ case 'D':
+ dnssec = TRUE;
+ edns = TRUE;
+ break;
+ case 'c':
+ countrcodes = TRUE;
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ case 'i':
+ if (is_uint(optarg, &uint_arg_val) == TRUE)
+ print_interval = uint_arg_val;
+ else {
+ fprintf(stderr, "Invalid interval: %s\n",
+ optarg);
+ return (-1);
+ }
+ break;
+ case 'r':
+ if (is_uint(optarg, &uint_arg_val) == TRUE)
+ rttarray_size = uint_arg_val;
+ else {
+ fprintf(stderr, "Invalid RTT array size: %s\n",
+ optarg);
+ return (-1);
+ }
+ break;
+ case 'u':
+ if (is_uint(optarg, &uint_arg_val) == TRUE)
+ rttarray_unit = uint_arg_val;
+ else {
+ fprintf(stderr, "Invalid RTT unit: %s\n",
+ optarg);
+ return (-1);
+ }
+ break;
+ case 'H':
+ rtt_histogram_file = optarg;
+ break;
+ case 'T':
+ if (is_uint(optarg, &uint_arg_val) == TRUE)
+ target_qps = uint_arg_val;
+ else {
+ fprintf(stderr, "Invalid target qps: %s\n",
+ optarg);
+ return (-1);
+ }
+ break;
+ case 'h':
+ return (-1);
+ default:
+ fprintf(stderr, "Invalid option: -%c\n", optopt);
+ return (-1);
+ }
+ }
+
+ if (run_only_once == FALSE && use_timelimit == FALSE)
+ run_only_once = TRUE;
+
+ return (0);
+}
+
+/*
+ * open_datafile:
+ * Open the data file ready for reading
+ *
+ * Return -1 on failure
+ * Return non-negative integer on success
+ */
+int
+open_datafile(void) {
+ if (use_stdin == TRUE) {
+ datafile_ptr = stdin;
+ return (0);
+ } else {
+ if ((datafile_ptr = fopen(datafile_name, "r")) == NULL) {
+ fprintf(stderr, "Error: unable to open datafile: %s\n",
+ datafile_name);
+ return (-1);
+ } else
+ return (0);
+ }
+}
+
+/*
+ * close_datafile:
+ * Close the data file if any is open
+ *
+ * Return -1 on failure
+ * Return non-negative integer on success, including if not needed
+ */
+int
+close_datafile(void) {
+ if ((use_stdin == FALSE) && (datafile_ptr != NULL)) {
+ if (fclose(datafile_ptr) != 0) {
+ fprintf(stderr, "Error: unable to close datafile\n");
+ return (-1);
+ }
+ }
+
+ return (0);
+}
+
+/*
+ * open_socket:
+ * Open a socket for the queries. When we have an active socket already,
+ * close it and open a new one.
+ *
+ * Return -1 on failure
+ * Return the socket identifier
+ */
+int
+open_socket(void) {
+ int sock;
+ int ret;
+ int bufsize;
+ struct addrinfo hints, *res;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = server_ai->ai_family;
+ hints.ai_socktype = server_ai->ai_socktype;
+ hints.ai_protocol = server_ai->ai_protocol;
+ hints.ai_flags = AI_PASSIVE;
+
+ if ((ret = getaddrinfo(NULL, "0", &hints, &res)) != 0) {
+ fprintf(stderr,
+ "Error: getaddrinfo for bind socket failed: %s\n",
+ gai_strerror(ret));
+ return (-1);
+ }
+
+ if ((sock = socket(res->ai_family, SOCK_DGRAM,
+ res->ai_protocol)) == -1) {
+ fprintf(stderr, "Error: socket call failed");
+ goto fail;
+ }
+
+#if defined(AF_INET6) && defined(IPV6_V6ONLY)
+ if (res->ai_family == AF_INET6) {
+ int on = 1;
+
+ if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY,
+ &on, sizeof(on)) == -1) {
+ fprintf(stderr,
+ "Warning: setsockopt(IPV6_V6ONLY) failed\n");
+ }
+ }
+#endif
+
+ if (bind(sock, res->ai_addr, res->ai_addrlen) == -1)
+ fprintf(stderr, "Error: bind call failed");
+
+ freeaddrinfo(res);
+
+ bufsize = 1024 * socket_bufsize;
+
+ ret = setsockopt(sock, SOL_SOCKET, SO_RCVBUF,
+ (char *) &bufsize, sizeof(bufsize));
+ if (ret < 0)
+ fprintf(stderr, "Warning: setsockbuf(SO_RCVBUF) failed\n");
+
+ ret = setsockopt(sock, SOL_SOCKET, SO_SNDBUF,
+ (char *) &bufsize, sizeof(bufsize));
+ if (ret < 0)
+ fprintf(stderr, "Warning: setsockbuf(SO_SNDBUF) failed\n");
+
+ return (sock);
+
+ fail:
+ if (res)
+ freeaddrinfo(res);
+ return (-1);
+}
+
+/*
+ * close_socket:
+ * Close the query socket(s)
+ *
+ * Return -1 on failure
+ * Return a non-negative integer otherwise
+ */
+int
+close_socket(void) {
+ if (socket4 != -1) {
+ if (close(socket4) != 0) {
+ fprintf(stderr,
+ "Error: unable to close IPv4 socket\n");
+ return (-1);
+ }
+ }
+
+ if (socket6 != -1) {
+ if (close(socket6) != 0) {
+ fprintf(stderr,
+ "Error: unable to close IPv6 socket\n");
+ return (-1);
+ }
+ }
+
+ query_socket = -1;
+
+ return (0);
+}
+
+/*
+ * change_socket:
+ * Choose an appropriate socket according to the address family of the
+ * current server. Open a new socket if necessary.
+ *
+ * Return -1 on failure
+ * Return the socket identifier
+ */
+int
+change_socket(void) {
+ int s, *sockp;
+
+ switch (server_ai->ai_family) {
+ case AF_INET:
+ sockp = &socket4;
+ break;
+#ifdef AF_INET6
+ case AF_INET6:
+ sockp = &socket6;
+ break;
+#endif
+ default:
+ fprintf(stderr, "unexpected address family: %d\n",
+ server_ai->ai_family);
+ exit(1);
+ }
+
+ if (*sockp == -1) {
+ if ((s = open_socket()) == -1)
+ return (-1);
+ *sockp = s;
+ }
+
+ return (*sockp);
+}
+
+/*
+ * reset_rttarray:
+ * (re)allocate RTT array and zero-clear the whole buffer.
+ * if array is being used, it is freed.
+ * Returns -1 on failure
+ * Returns a non-negative integer otherwise
+ */
+int
+reset_rttarray(int size) {
+ if (rttarray != NULL)
+ free(rttarray);
+ if (rttarray_interval != NULL)
+ free(rttarray_interval);
+
+ rttarray = NULL;
+ rttarray_interval = NULL;
+ rtt_max = -1;
+ rtt_min = -1;
+
+ if (size > 0) {
+ rttarray = malloc(size * sizeof(rttarray[0]));
+ if (rttarray == NULL) {
+ fprintf(stderr,
+ "Error: allocating memory for RTT array\n");
+ return (-1);
+ }
+ memset(rttarray, 0, size * sizeof(rttarray[0]));
+
+ rttarray_interval = malloc(size *
+ sizeof(rttarray_interval[0]));
+ if (rttarray_interval == NULL) {
+ fprintf(stderr,
+ "Error: allocating memory for RTT array\n");
+ return (-1);
+ }
+
+ memset(rttarray_interval, 0,
+ size * sizeof(rttarray_interval[0]));
+ }
+
+ return (0);
+}
+
+/*
+ * set_query_interval:
+ * set the interval of consecutive queries if the target qps are specified.
+ * Returns -1 on failure
+ * Returns a non-negative integer otherwise
+ */
+int
+set_query_interval(unsigned int qps) {
+ if (qps == 0)
+ return (0);
+
+ query_interval = (1.0 / (double)qps);
+
+ return (0);
+}
+
+/*
+ * setup:
+ * Set configuration options from command line arguments
+ * Open datafile ready for reading
+ *
+ * Return -1 on failure
+ * Return non-negative integer on success
+ */
+int
+setup(int argc, char **argv) {
+ set_input_stdin();
+
+ if (set_max_queries(DEF_MAX_QUERIES_OUTSTANDING) == -1) {
+ fprintf(stderr, "%s: Unable to set default max outstanding "
+ "queries\n", argv[0]);
+ return (-1);
+ }
+
+ if (set_server(DEF_SERVER_TO_QUERY) == -1) {
+ fprintf(stderr, "%s: Error setting default server name\n",
+ argv[0]);
+ return (-1);
+ }
+
+ if (set_server_port(DEF_SERVER_PORT) == -1) {
+ fprintf(stderr, "%s: Error setting default server port\n",
+ argv[0]);
+ return (-1);
+ }
+
+ if (parse_args(argc, argv) == -1) {
+ show_usage();
+ return (-1);
+ }
+
+ if (open_datafile() == -1)
+ return (-1);
+
+ if (set_server_sa() == -1)
+ return (-1);
+
+ if ((query_socket = change_socket()) == -1)
+ return (-1);
+
+ if (reset_rttarray(rttarray_size) == -1)
+ return (-1);
+
+ if (set_query_interval(target_qps) == -1)
+ return (-1);
+
+ return (0);
+}
+
+/*
+ * set_timenow:
+ * Set a timeval struct to indicate the current time
+ */
+void
+set_timenow(struct timeval *tv) {
+ if (gettimeofday(tv, NULL) == -1) {
+ fprintf(stderr, "Error in gettimeofday(). Using inaccurate "
+ "time() instead\n");
+ tv->tv_sec = time(NULL);
+ tv->tv_usec = 0;
+ }
+}
+
+/*
+ * addtv:
+ * add tv1 and tv2, store the result in tv_result.
+ */
+void
+addtv(struct timeval *tv1, struct timeval *tv2, struct timeval *tv_result) {
+ tv_result->tv_sec = tv1->tv_sec + tv2->tv_sec;
+ tv_result->tv_usec = tv1->tv_usec + tv2->tv_usec;
+ if (tv_result->tv_usec > 1000000) {
+ tv_result->tv_sec++;
+ tv_result->tv_usec -= 1000000;
+ }
+}
+
+/*
+ * difftv:
+ * Find the difference in seconds between two timeval structs.
+ *
+ * Return the difference between tv1 and tv2 in seconds in a double.
+ */
+double
+difftv(struct timeval tv1, struct timeval tv2) {
+ long diff_sec, diff_usec;
+ double diff;
+
+ diff_sec = tv1.tv_sec - tv2.tv_sec;
+ diff_usec = tv1.tv_usec - tv2.tv_usec;
+
+ diff = (double)diff_sec + ((double)diff_usec / 1000000.0);
+
+ return (diff);
+}
+
+/*
+ * timelimit_reached:
+ * Have we reached the time limit (if any)?
+ *
+ * Returns FALSE if there is no time limit or if we have not reached it
+ * Returns TRUE otherwise
+ */
+int
+timelimit_reached(void) {
+ struct timeval time_now;
+
+ set_timenow(&time_now);
+
+ if (use_timelimit == FALSE)
+ return (FALSE);
+
+ if (setup_phase == TRUE) {
+ if (difftv(time_now, time_of_program_start)
+ < (double)(run_timelimit + HARD_TIMEOUT_EXTRA))
+ return (FALSE);
+ else
+ return (TRUE);
+ } else {
+ if (difftv(time_now, time_of_first_query)
+ < (double)run_timelimit)
+ return (FALSE);
+ else
+ return (TRUE);
+ }
+}
+
+/*
+ * keep_sending:
+ * Should we keep sending queries or stop here?
+ *
+ * Return TRUE if we should keep on sending queries
+ * Return FALSE if we should stop
+ *
+ * Side effects:
+ * Rewinds the input and clears reached_end_input if we have reached the
+ * end of the input, but we are meant to run through it multiple times
+ * and have not hit the time limit yet (if any is set).
+ */
+int
+keep_sending(int *reached_end_input) {
+ static int stop = FALSE;
+
+ if (stop == TRUE)
+ return (FALSE);
+
+ if ((*reached_end_input == FALSE) && (timelimit_reached() == FALSE))
+ return (TRUE);
+ else if ((*reached_end_input == TRUE) && (run_only_once == FALSE)
+ && (timelimit_reached() == FALSE)) {
+ rewind(datafile_ptr);
+ *reached_end_input = FALSE;
+ runs_through_file++;
+ return (TRUE);
+ } else {
+ if (*reached_end_input == TRUE)
+ runs_through_file++;
+ set_timenow(&time_of_stop_sending);
+ stop = TRUE;
+ return (FALSE);
+ }
+}
+
+/*
+ * queries_outstanding:
+ * How many queries are outstanding?
+ *
+ * Returns the number of outstanding queries
+ */
+unsigned int
+queries_outstanding(void) {
+ return (num_queries_outstanding);
+}
+
+/*
+ * next_input_line:
+ * Get the next non-comment line from the input file
+ *
+ * Put text in line, up to max of n chars. Skip comment lines.
+ * Skip empty lines.
+ *
+ * Return line length on success
+ * Return 0 if cannot read a non-comment line (EOF or error)
+ */
+int
+next_input_line(char *line, int n) {
+ char *result;
+
+ do {
+ result = fgets(line, n, datafile_ptr);
+ } while ((result != NULL) &&
+ ((line[0] == COMMENT_CHAR) || (line[0] == '\n')));
+
+ if (result == NULL)
+ return (0);
+ else
+ return (strlen(line));
+}
+
+/*
+ * identify_directive:
+ * Gives us a numerical value equivelant for a directive string
+ *
+ * Returns the value for the directive
+ * Returns -1 if not a valid directive
+ */
+int
+identify_directive(char *dir) {
+ static char *directives[] = DIRECTIVES;
+ static int dir_values[] = DIR_VALUES;
+ unsigned int index, num_directives;
+
+ num_directives = sizeof(directives) / sizeof(directives[0]);
+
+ if (num_directives > (sizeof(dir_values) / sizeof(int)))
+ num_directives = sizeof(dir_values) / sizeof(int);
+
+ for (index = 0; index < num_directives; index++) {
+ if (strcmp(dir, directives[index]) == 0)
+ return (dir_values[index]);
+ }
+
+ return (-1);
+}
+
+/*
+ * update_config:
+ * Update configuration options from a line from the input file
+ */
+void
+update_config(char *config_change_desc) {
+ char *directive, *config_value, *trailing_garbage;
+ char conf_copy[MAX_INPUT_LEN + 1];
+ unsigned int uint_val;
+ int directive_number;
+ int check;
+ int old_af;
+
+ if (ignore_config_changes == TRUE) {
+ fprintf(stderr, "Ignoring configuration change: %s",
+ config_change_desc);
+ return;
+ }
+
+ strcpy(conf_copy, config_change_desc);
+
+ ++config_change_desc;
+
+ if (*config_change_desc == '\0') {
+ fprintf(stderr, "Invalid config: No directive present: %s\n",
+ conf_copy);
+ return;
+ }
+
+ if (index(WHITESPACE, *config_change_desc) != NULL) {
+ fprintf(stderr, "Invalid config: Space before directive or "
+ "no directive present: %s\n", conf_copy);
+ return;
+ }
+
+ directive = strtok(config_change_desc, WHITESPACE);
+ config_value = strtok(NULL, WHITESPACE);
+ trailing_garbage = strtok(NULL, WHITESPACE);
+
+ if ((directive_number = identify_directive(directive)) == -1) {
+ fprintf(stderr, "Invalid config: Bad directive: %s\n",
+ conf_copy);
+ return;
+ }
+
+ if (config_value == NULL) {
+ fprintf(stderr, "Invalid config: No value present: %s\n",
+ conf_copy);
+ return;
+ }
+
+ if (trailing_garbage != NULL) {
+ fprintf(stderr, "Config warning: "
+ "trailing garbage: %s\n", conf_copy);
+ }
+
+ switch(directive_number) {
+
+ case V_SERVER:
+ if (serverset && (setup_phase == TRUE)) {
+ fprintf(stderr, "Config change overridden by command "
+ "line: %s\n", directive);
+ return;
+ }
+
+ if (set_server(config_value) == -1) {
+ fprintf(stderr, "Set server error: unable to change "
+ "the server name to '%s'\n", config_value);
+ return;
+ }
+
+ old_af = server_ai->ai_family;
+ if (set_server_sa() == -1) {
+ fprintf(stderr, "Set server error: unable to resolve "
+ "a new server '%s'\n",
+ config_value);
+ return;
+ }
+ if (old_af != server_ai->ai_family) {
+ if ((query_socket = change_socket()) == -1) {
+ /* XXX: this is fatal */
+ fprintf(stderr, "Set server error: "
+ "unable to open a new socket "
+ "for '%s'\n", config_value);
+ exit(1);
+ }
+ }
+
+ break;
+
+ case V_PORT:
+ if (portset && (setup_phase == TRUE)) {
+ fprintf(stderr, "Config change overridden by command "
+ "line: %s\n", directive);
+ return;
+ }
+
+ check = is_uint(config_value, &uint_val);
+
+ if ((check == TRUE) && (uint_val > 0)) {
+ if (set_server_port(config_value) == -1) {
+ fprintf(stderr, "Invalid config: Bad value for"
+ " %s: %s\n", directive, config_value);
+ } else {
+ if (set_server_sa() == -1) {
+ fprintf(stderr,
+ "Failed to set a new port\n");
+ return;
+ }
+ }
+ } else
+ fprintf(stderr, "Invalid config: Bad value for "
+ "%s: %s\n", directive, config_value);
+ break;
+
+ case V_MAXQUERIES:
+ if (queriesset && (setup_phase == TRUE)) {
+ fprintf(stderr, "Config change overridden by command "
+ "line: %s\n", directive);
+ return;
+ }
+
+ check = is_uint(config_value, &uint_val);
+
+ if ((check == TRUE) && (uint_val > 0)) {
+ set_max_queries(uint_val);
+ } else
+ fprintf(stderr, "Invalid config: Bad value for "
+ "%s: %s\n", directive, config_value);
+ break;
+
+ case V_MAXWAIT:
+ if (timeoutset && (setup_phase == TRUE)) {
+ fprintf(stderr, "Config change overridden by command "
+ "line: %s\n", directive);
+ return;
+ }
+
+ check = is_uint(config_value, &uint_val);
+
+ if ((check == TRUE) && (uint_val > 0)) {
+ query_timeout = uint_val;
+ } else
+ fprintf(stderr, "Invalid config: Bad value for "
+ "%s: %s\n", directive, config_value);
+ break;
+
+ default:
+ fprintf(stderr, "Invalid config: Bad directive: %s\n",
+ directive);
+ break;
+ }
+}
+
+/*
+ * parse_query:
+ * Parse a query line from the input file
+ *
+ * Set qname to be the domain to query (up to a max of qnlen chars)
+ * Set qtype to be the type of the query
+ *
+ * Return -1 on failure
+ * Return a non-negative integer otherwise
+ */
+int
+parse_query(char *input, char *qname, int qnlen, int *qtype) {
+ static char *qtype_strings[] = QTYPE_STRINGS;
+ static int qtype_codes[] = QTYPE_CODES;
+ int num_types, index;
+ int found = FALSE;
+ char incopy[MAX_INPUT_LEN + 1];
+ char *domain_str, *type_str;
+
+ num_types = sizeof(qtype_strings) / sizeof(qtype_strings[0]);
+ if (num_types > (sizeof(qtype_codes) / sizeof(int)))
+ num_types = sizeof(qtype_codes) / sizeof(int);
+
+ strcpy(incopy, input);
+
+ domain_str = strtok(incopy, WHITESPACE);
+ type_str = strtok(NULL, WHITESPACE);
+
+ if ((domain_str == NULL) || (type_str == NULL)) {
+ fprintf(stderr, "Invalid query input format: %s\n", input);
+ return (-1);
+ }
+
+ if (strlen(domain_str) > qnlen) {
+ fprintf(stderr, "Query domain too long: %s\n", domain_str);
+ return (-1);
+ }
+
+ for (index = 0; (index < num_types) && (found == FALSE); index++) {
+ if (strcasecmp(type_str, qtype_strings[index]) == 0) {
+ *qtype = qtype_codes[index];
+ found = TRUE;
+ }
+ }
+
+ if (found == FALSE) {
+ fprintf(stderr, "Query type not understood: %s\n", type_str);
+ return (-1);
+ }
+
+ strcpy(qname, domain_str);
+
+ return (0);
+}
+
+/*
+ * dispatch_query:
+ * Send the query packet for the entry
+ *
+ * Return -1 on failure
+ * Return a non-negative integer otherwise
+ */
+int
+dispatch_query(unsigned short int id, char *dom, int qt) {
+ static u_char packet_buffer[PACKETSZ + 1];
+ static socklen_t sockaddrlen = sizeof(struct sockaddr);
+ int buffer_len = PACKETSZ;
+ int bytes_sent;
+ unsigned short int net_id = htons(id);
+ char *id_ptr = (char *)&net_id;
+
+ buffer_len = res_mkquery(QUERY, dom, C_IN, qt, NULL, 0,
+ NULL, packet_buffer, PACKETSZ);
+ if (buffer_len == -1) {
+ fprintf(stderr, "Failed to create query packet: %s %d\n",
+ dom, qt);
+ return (-1);
+ }
+ if (edns) {
+ unsigned char *p;
+ if (buffer_len + EDNSLEN >= PACKETSZ) {
+ fprintf(stderr, "Failed to add OPT to query packet\n");
+ return (-1);
+ }
+ packet_buffer[11] = 1;
+ p = &packet_buffer[buffer_len];
+ *p++ = 0; /* root name */
+ *p++ = 0;
+ *p++ = 41; /* OPT */
+ *p++ = 16;
+ *p++ = 0; /* UDP payload size (4K) */
+ *p++ = 0; /* extended rcode */
+ *p++ = 0; /* version */
+ if (dnssec)
+ *p++ = 0x80; /* upper flag bits - DO set */
+ else
+ *p++ = 0; /* upper flag bits */
+ *p++ = 0; /* lower flag bit */
+ *p++ = 0;
+ *p++ = 0; /* rdlen == 0 */
+ buffer_len += EDNSLEN;
+ }
+
+ packet_buffer[0] = id_ptr[0];
+ packet_buffer[1] = id_ptr[1];
+
+ bytes_sent = sendto(query_socket, packet_buffer, buffer_len, 0,
+ server_ai->ai_addr, server_ai->ai_addrlen);
+ if (bytes_sent == -1) {
+ fprintf(stderr, "Failed to send query packet: %s %d\n",
+ dom, qt);
+ return (-1);
+ }
+
+ if (bytes_sent != buffer_len)
+ fprintf(stderr, "Warning: incomplete packet sent: %s %d\n",
+ dom, qt);
+
+ return (0);
+}
+
+/*
+ * send_query:
+ * Send a query based on a line of input
+ */
+void
+send_query(char *query_desc) {
+ static unsigned short int use_query_id = 0;
+ static int qname_len = MAX_DOMAIN_LEN;
+ static char domain[MAX_DOMAIN_LEN + 1];
+ char serveraddr[NI_MAXHOST];
+ int query_type;
+ unsigned int count;
+
+ use_query_id++;
+
+ if (parse_query(query_desc, domain, qname_len, &query_type) == -1) {
+ fprintf(stderr, "Error parsing query: %s\n", query_desc);
+ return;
+ }
+
+ if (dispatch_query(use_query_id, domain, query_type) == -1) {
+ char *addrstr;
+
+ if (getnameinfo(server_ai->ai_addr, server_ai->ai_addrlen,
+ serveraddr, sizeof(serveraddr), NULL, 0,
+ NI_NUMERICHOST) == 0) {
+ addrstr = serveraddr;
+ } else
+ addrstr = "???"; /* XXX: this should not happen */
+ fprintf(stderr, "Error sending query to %s: %s\n",
+ addrstr, query_desc);
+ return;
+ }
+
+ if (setup_phase == TRUE) {
+ set_timenow(&time_of_first_query);
+ time_of_first_query_sec = (double)time_of_first_query.tv_sec +
+ ((double)time_of_first_query.tv_usec / 1000000.0);
+ setup_phase = FALSE;
+ if (getnameinfo(server_ai->ai_addr, server_ai->ai_addrlen,
+ serveraddr, sizeof(serveraddr), NULL, 0,
+ NI_NUMERICHOST) != 0) {
+ fprintf(stderr, "Error printing server address\n");
+ return;
+ }
+ printf("[Status] Sending queries (beginning with %s)\n",
+ serveraddr);
+ }
+
+ /* Find the first slot in status[] that is not in use */
+ for (count = 0; (status[count].in_use == TRUE)
+ && (count < max_queries_outstanding); count++);
+
+ if (status[count].in_use == TRUE) {
+ fprintf(stderr, "Unexpected error: We have run out of "
+ "status[] space!\n");
+ return;
+ }
+
+ /* Register the query in status[] */
+ status[count].in_use = TRUE;
+ status[count].id = use_query_id;
+ if (verbose)
+ status[count].desc = strdup(query_desc);
+ set_timenow(&status[count].sent_timestamp);
+
+ if (num_queries_sent_interval == 0)
+ set_timenow(&time_of_first_query_interval);
+
+ num_queries_sent++;
+ num_queries_sent_interval++;
+ num_queries_outstanding++;
+}
+
+void
+register_rtt(struct timeval *timestamp) {
+ int i;
+ int oldquery = FALSE;
+ struct timeval now;
+ double rtt;
+
+ set_timenow(&now);
+ rtt = difftv(now, *timestamp);
+
+ if (difftv(*timestamp, time_of_first_query_interval) < 0)
+ oldquery = TRUE;
+
+ if (rtt_max < 0 || rtt_max < rtt)
+ rtt_max = rtt;
+
+ if (rtt_min < 0 || rtt_min > rtt)
+ rtt_min = rtt;
+
+ rtt_total += rtt;
+
+ if (!oldquery) {
+ if (rtt_max_interval < 0 || rtt_max_interval < rtt)
+ rtt_max_interval = rtt;
+
+ if (rtt_min_interval < 0 || rtt_min_interval > rtt)
+ rtt_min_interval = rtt;
+
+ rtt_total_interval += rtt;
+ }
+
+ if (rttarray == NULL)
+ return;
+
+ i = (int)(rtt * (1000000.0 / rttarray_unit));
+ if (i < rttarray_size) {
+ rttarray[i]++;
+ if (!oldquery)
+ rttarray_interval[i]++;
+ } else {
+ fprintf(stderr, "Warning: RTT is out of range: %.6lf\n",
+ rtt);
+ rtt_overflows++;
+ if (!oldquery)
+ rtt_overflows_interval++;
+ }
+}
+
+/*
+ * register_response:
+ * Register receipt of a query
+ *
+ * Removes (sets in_use = FALSE) the record for the given query id in
+ * status[] if any exists.
+ */
+void
+register_response(unsigned short int id, unsigned int rcode) {
+ unsigned int ct = 0;
+ int found = FALSE;
+ struct timeval now;
+ double rtt;
+
+ for (; (ct < query_status_allocated) && (found == FALSE); ct++) {
+ if ((status[ct].in_use == TRUE) && (status[ct].id == id)) {
+ status[ct].in_use = FALSE;
+ num_queries_outstanding--;
+ found = TRUE;
+
+ register_rtt(&status[ct].sent_timestamp);
+
+ if (status[ct].desc) {
+ printf("> %s %s\n", rcode_strings[rcode],
+ status[ct].desc);
+ free(status[ct].desc);
+ }
+ if (countrcodes)
+ rcodecounts[rcode]++;
+ }
+ }
+
+ if (found == FALSE) {
+ if (target_qps > 0) {
+ num_queries_possiblydelayed++;
+ num_queries_possiblydelayed_interval++;
+ } else {
+ fprintf(stderr, "Warning: Received a response with an "
+ "unexpected (maybe timed out) id: %u\n", id);
+ }
+ }
+}
+
+/*
+ * process_single_response:
+ * Receive from the given socket & process an invididual response packet.
+ * Remove it from the list of open queries (status[]) and decrement the
+ * number of outstanding queries if it matches an open query.
+ */
+void
+process_single_response(int sockfd) {
+ struct sockaddr_storage from_addr_ss;
+ struct sockaddr *from_addr;
+ static unsigned char in_buf[MAX_BUFFER_LEN];
+ int numbytes, addr_len, resp_id;
+ int flags;
+
+ memset(&from_addr_ss, 0, sizeof(from_addr_ss));
+ from_addr = (struct sockaddr *)&from_addr_ss;
+ addr_len = sizeof(from_addr_ss);
+
+ if ((numbytes = recvfrom(sockfd, in_buf, MAX_BUFFER_LEN,
+ 0, from_addr, &addr_len)) == -1) {
+ fprintf(stderr, "Error receiving datagram\n");
+ return;
+ }
+
+ resp_id = get_uint16(in_buf);
+ flags = get_uint16(in_buf + 2);
+
+ register_response(resp_id, flags & 0xF);
+}
+
+/*
+ * data_available:
+ * Is there data available on the given file descriptor?
+ *
+ * Return TRUE if there is
+ * Return FALSE otherwise
+ */
+int
+data_available(double wait) {
+ fd_set read_fds;
+ struct timeval tv;
+ int retval;
+ int available = FALSE;
+ int maxfd = -1;
+
+ /* Set list of file descriptors */
+ FD_ZERO(&read_fds);
+ if (socket4 != -1) {
+ FD_SET(socket4, &read_fds);
+ maxfd = socket4;
+ }
+ if (socket6 != -1) {
+ FD_SET(socket6, &read_fds);
+ if (maxfd == -1 || maxfd < socket6)
+ maxfd = socket6;
+ }
+
+ if ((wait > 0.0) && (wait < (double)LONG_MAX)) {
+ tv.tv_sec = (long)floor(wait);
+ tv.tv_usec = (long)(1000000.0 * (wait - floor(wait)));
+ } else {
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+ }
+
+ retval = select(maxfd + 1, &read_fds, NULL, NULL, &tv);
+
+ if (socket4 != -1 && FD_ISSET(socket4, &read_fds)) {
+ available = TRUE;
+ process_single_response(socket4);
+ }
+ if (socket6 != -1 && FD_ISSET(socket6, &read_fds)) {
+ available = TRUE;
+ process_single_response(socket6);
+ }
+
+ return (available);
+}
+
+/*
+ * process_responses:
+ * Go through any/all received responses and remove them from the list of
+ * open queries (set in_use = FALSE for their entry in status[]), also
+ * decrementing the number of outstanding queries.
+ */
+void
+process_responses(int adjust_rate) {
+ double wait;
+ struct timeval now, waituntil;
+ double first_packet_wait = RESPONSE_BLOCKING_WAIT_TIME;
+ unsigned int outstanding = queries_outstanding();
+
+ if (adjust_rate == TRUE) {
+ double u;
+
+ u = time_of_first_query_sec +
+ query_interval * num_queries_sent;
+ waituntil.tv_sec = (long)floor(u);
+ waituntil.tv_usec = (long)(1000000.0 * (u - waituntil.tv_sec));
+
+ /*
+ * Wait until a response arrives or the specified limit is
+ * reached.
+ */
+ while (1) {
+ set_timenow(&now);
+ wait = difftv(waituntil, now);
+ if (wait <= 0)
+ wait = 0.0;
+ if (data_available(wait) != TRUE)
+ break;
+
+ /*
+ * We have reached the limit. Read as many responses
+ * as possible without waiting, and exit.
+ */
+ if (wait == 0) {
+ while (data_available(0.0) == TRUE)
+ ;
+ break;
+ }
+ }
+ } else {
+ /*
+ * Don't block waiting for packets at all if we aren't
+ * looking for any responses or if we are now able to send new
+ * queries.
+ */
+ if ((outstanding == 0) ||
+ (outstanding < max_queries_outstanding)) {
+ first_packet_wait = 0.0;
+ }
+
+ if (data_available(first_packet_wait) == TRUE) {
+ while (data_available(0.0) == TRUE)
+ ;
+ }
+ }
+}
+
+/*
+ * retire_old_queries:
+ * Go through the list of open queries (status[]) and remove any queries
+ * (i.e. set in_use = FALSE) which are older than the timeout, decrementing
+ * the number of queries outstanding for each one removed.
+ */
+void
+retire_old_queries(int sending) {
+ unsigned int count = 0;
+ struct timeval curr_time;
+ double timeout = query_timeout;
+ int timeout_reduced = FALSE;
+
+ /*
+ * If we have target qps and would not be able to send any packets
+ * due to buffer full, check whether we are behind the schedule.
+ * If we are, purge some queries more aggressively.
+ */
+ if (target_qps > 0 && sending == TRUE && count == 0 &&
+ queries_outstanding() == max_queries_outstanding) {
+ struct timeval next, now;
+ double n;
+
+ n = time_of_first_query_sec +
+ query_interval * num_queries_sent;
+ next.tv_sec = (long)floor(n);
+ next.tv_usec = (long)(1000000.0 * (n - next.tv_sec));
+
+ set_timenow(&now);
+ if (difftv(next, now) <= 0) {
+ timeout_reduced = TRUE;
+ timeout = 0.001; /* XXX: ad-hoc value */
+ }
+ }
+
+ set_timenow(&curr_time);
+
+ for (; count < query_status_allocated; count++) {
+
+ if ((status[count].in_use == TRUE)
+ && (difftv(curr_time, status[count].sent_timestamp)
+ >= (double)timeout)) {
+
+ status[count].in_use = FALSE;
+ num_queries_outstanding--;
+ num_queries_timed_out++;
+ num_queries_timed_out_interval++;
+
+ if (timeout_reduced == FALSE) {
+ if (status[count].desc) {
+ printf("> T %s\n", status[count].desc);
+ free(status[count].desc);
+ } else {
+ printf("[Timeout] Query timed out: "
+ "msg id %u\n",
+ status[count].id);
+ }
+ }
+ }
+ }
+}
+
+/*
+ * print_histogram
+ * Print RTT histogram to the specified file in the gnuplot format
+ */
+void
+print_histogram(unsigned int total) {
+ int i;
+ double ratio;
+ FILE *fp;
+
+ if (rtt_histogram_file == NULL || rttarray == NULL)
+ return;
+
+ fp = fopen((const char *)rtt_histogram_file, "w+");
+ if (fp == NULL) {
+ fprintf(stderr, "Error opening RTT histogram file: %s\n",
+ rtt_histogram_file);
+ return;
+ }
+
+ for (i = 0; i < rttarray_size; i++) {
+ ratio = ((double)rttarray[i] / (double)total) * 100;
+ fprintf(fp, "%.6lf %.3lf\n",
+ (double)(i * rttarray_unit) +
+ (double)rttarray_unit / 2,
+ ratio);
+ }
+
+ (void)fclose(fp);
+}
+
+/*
+ * print_statistics:
+ * Print out statistics based on the results of the test
+ */
+void
+print_statistics(int intermediate, unsigned int sent, unsigned int timed_out,
+ unsigned int possibly_delayed,
+ struct timeval *first_query,
+ struct timeval *program_start,
+ struct timeval *end_perf, struct timeval *end_query,
+ double rmax, double rmin, double rtotal,
+ unsigned int roverflows, unsigned int *rarray)
+{
+ unsigned int num_queries_completed;
+ double per_lost, per_completed, per_lost2, per_completed2;
+ double run_time, queries_per_sec, queries_per_sec2;
+ double queries_per_sec_total;
+ double rtt_average, rtt_stddev;
+ struct timeval start_time;
+
+ num_queries_completed = sent - timed_out;
+
+ if (num_queries_completed == 0) {
+ per_lost = 0.0;
+ per_completed = 0.0;
+
+ per_lost2 = 0.0;
+ per_completed2 = 0.0;
+ } else {
+ per_lost = (100.0 * (double)timed_out) / (double)sent;
+ per_completed = 100.0 - per_lost;
+
+ per_lost2 = (100.0 * (double)(timed_out - possibly_delayed))
+ / (double)sent;
+ per_completed2 = 100 - per_lost2;
+ }
+
+ if (sent == 0) {
+ start_time.tv_sec = program_start->tv_sec;
+ start_time.tv_usec = program_start->tv_usec;
+ run_time = 0.0;
+ queries_per_sec = 0.0;
+ queries_per_sec2 = 0.0;
+ queries_per_sec_total = 0.0;
+ } else {
+ start_time.tv_sec = first_query->tv_sec;
+ start_time.tv_usec = first_query->tv_usec;
+ run_time = difftv(*end_perf, *first_query);
+ queries_per_sec = (double)num_queries_completed / run_time;
+ queries_per_sec2 = (double)(num_queries_completed +
+ possibly_delayed) / run_time;
+
+ queries_per_sec_total = (double)sent /
+ difftv(*end_query, *first_query);
+ }
+
+ if (num_queries_completed > 0) {
+ int i;
+ double sum = 0;
+
+ rtt_average = rtt_total / (double)num_queries_completed;
+ for (i = 0; i < rttarray_size; i++) {
+ if (rarray[i] != 0) {
+ double mean, diff;
+
+ mean = (double)(i * rttarray_unit) +
+ (double)rttarray_unit / 2;
+ diff = rtt_average - (mean / 1000000.0);
+ sum += (diff * diff) * rarray[i];
+ }
+ }
+ rtt_stddev = sqrt(sum / (double)num_queries_completed);
+ } else {
+ rtt_average = 0.0;
+ rtt_stddev = 0.0;
+ }
+
+ printf("\n");
+
+ printf("%sStatistics:\n", intermediate ? "Intermediate " : "");
+
+ printf("\n");
+
+ if (!intermediate) {
+ printf(" Parse input file: %s\n",
+ ((run_only_once == TRUE) ? "once" : "multiple times"));
+ if (use_timelimit)
+ printf(" Run time limit: %u seconds\n",
+ run_timelimit);
+ if (run_only_once == FALSE)
+ printf(" Ran through file: %u times\n",
+ runs_through_file);
+ else
+ printf(" Ended due to: reaching %s\n",
+ ((runs_through_file == 0) ? "time limit"
+ : "end of file"));
+
+ printf("\n");
+ }
+
+ printf(" Queries sent: %u queries\n", sent);
+ printf(" Queries completed: %u queries\n", num_queries_completed);
+ printf(" Queries lost: %u queries\n", timed_out);
+ printf(" Queries delayed(?): %u queries\n", possibly_delayed);
+
+ printf("\n");
+
+ printf(" RTT max: %3.6lf sec\n", rmax);
+ printf(" RTT min: %3.6lf sec\n", rmin);
+ printf(" RTT average: %3.6lf sec\n", rtt_average);
+ printf(" RTT std deviation: %3.6lf sec\n", rtt_stddev);
+ printf(" RTT out of range: %u queries\n", roverflows);
+
+ if (!intermediate) /* XXX should we print this case also? */
+ print_histogram(num_queries_completed);
+
+ printf("\n");
+
+ if (countrcodes) {
+ unsigned int i;
+
+ for (i = 0; i < 16; i++) {
+ if (rcodecounts[i] == 0)
+ continue;
+ printf(" Returned %8s: %u queries\n",
+ rcode_strings[i], rcodecounts[i]);
+ }
+ printf("\n");
+ }
+
+ printf(" Percentage completed: %6.2lf%%\n", per_completed);
+ if (possibly_delayed > 0)
+ printf(" (w/ delayed qrys): %6.2lf%%\n", per_completed2);
+ printf(" Percentage lost: %6.2lf%%\n", per_lost);
+ if (possibly_delayed > 0)
+ printf(" (w/o delayed qrys): %6.2lf%%\n", per_lost2);
+
+ printf("\n");
+
+ printf(" Started at: %s",
+ ctime((const time_t *)&start_time.tv_sec));
+ printf(" Finished at: %s",
+ ctime((const time_t *)&end_perf->tv_sec));
+ printf(" Ran for: %.6lf seconds\n", run_time);
+
+ printf("\n");
+
+ printf(" Queries per second: %.6lf qps\n", queries_per_sec);
+ if (possibly_delayed > 0) {
+ printf(" (w/ delayed qrys): %.6lf qps\n",
+ queries_per_sec2);
+ }
+ if (target_qps > 0) {
+ printf(" Total QPS/target: %.6lf/%d qps\n",
+ queries_per_sec_total, target_qps);
+ }
+
+ printf("\n");
+}
+
+void
+print_interval_statistics() {
+ struct timeval time_now;
+
+ if (use_timelimit == FALSE)
+ return;
+
+ if (setup_phase == TRUE)
+ return;
+
+ if (print_interval == 0)
+ return;
+
+ if (timelimit_reached() == TRUE)
+ return;
+
+ set_timenow(&time_now);
+ if (difftv(time_now, time_of_first_query_interval)
+ <= (double)print_interval)
+ return;
+
+ /* Don't count currently outstanding queries */
+ num_queries_sent_interval -= queries_outstanding();
+ print_statistics(TRUE, num_queries_sent_interval,
+ num_queries_timed_out_interval,
+ num_queries_possiblydelayed_interval,
+ &time_of_first_query_interval,
+ &time_of_first_query_interval, &time_now, &time_now,
+ rtt_max_interval, rtt_min_interval,
+ rtt_total_interval, rtt_overflows_interval,
+ rttarray_interval);
+
+ /* Reset intermediate counters */
+ num_queries_sent_interval = 0;
+ num_queries_timed_out_interval = 0;
+ num_queries_possiblydelayed_interval = 0;
+ rtt_max_interval = -1;
+ rtt_min_interval = -1;
+ rtt_total_interval = 0.0;
+ rtt_overflows_interval = 0;
+ if (rttarray_interval != NULL) {
+ memset(rttarray_interval, 0,
+ sizeof(rttarray_interval[0]) * rttarray_size);
+ }
+}
+
+/*
+ * queryperf Program Mainline
+ */
+int
+main(int argc, char **argv) {
+ int adjust_rate;
+ int sending = FALSE;
+ int got_eof = FALSE;
+ int input_length = MAX_INPUT_LEN;
+ char input_line[MAX_INPUT_LEN + 1];
+
+ set_timenow(&time_of_program_start);
+ time_of_first_query.tv_sec = 0;
+ time_of_first_query.tv_usec = 0;
+ time_of_first_query_interval.tv_sec = 0;
+ time_of_first_query_interval.tv_usec = 0;
+ time_of_end_of_run.tv_sec = 0;
+ time_of_end_of_run.tv_usec = 0;
+
+ input_line[0] = '\0';
+
+ show_startup_info();
+
+ if (setup(argc, argv) == -1)
+ return (-1);
+
+ printf("[Status] Processing input data\n");
+
+ while ((sending = keep_sending(&got_eof)) == TRUE ||
+ queries_outstanding() > 0) {
+ print_interval_statistics();
+ adjust_rate = FALSE;
+
+ while ((sending = keep_sending(&got_eof)) == TRUE &&
+ queries_outstanding() < max_queries_outstanding) {
+ int len = next_input_line(input_line, input_length);
+ if (len == 0) {
+ got_eof = TRUE;
+ } else {
+ /* Zap the trailing newline */
+ if (input_line[len - 1] == '\n')
+ input_line[len - 1] = '\0';
+
+ /*
+ * TODO: Should test if we got a whole line
+ * and flush to the next \n in input if not
+ * here... Add this later. Only do the next
+ * few lines if we got a whole line, else
+ * print a warning. Alternative: Make the
+ * max line size really big. BAD! :)
+ */
+
+ if (input_line[0] == CONFIG_CHAR)
+ update_config(input_line);
+ else {
+ send_query(input_line);
+ if (target_qps > 0 &&
+ (num_queries_sent %
+ max_queries_outstanding) == 0) {
+ adjust_rate = TRUE;
+ }
+ }
+ }
+ }
+
+ process_responses(adjust_rate);
+ retire_old_queries(sending);
+ }
+
+ set_timenow(&time_of_end_of_run);
+
+ printf("[Status] Testing complete\n");
+
+ close_socket();
+ close_datafile();
+
+ print_statistics(FALSE, num_queries_sent, num_queries_timed_out,
+ num_queries_possiblydelayed,
+ &time_of_first_query, &time_of_program_start,
+ &time_of_end_of_run, &time_of_stop_sending,
+ rtt_max, rtt_min, rtt_total, rtt_overflows, rttarray);
+
+ return (0);
+}
diff --git a/contrib/queryperf/utils/gen-data-queryperf.py b/contrib/queryperf/utils/gen-data-queryperf.py
new file mode 100644
index 0000000..52074b7
--- /dev/null
+++ b/contrib/queryperf/utils/gen-data-queryperf.py
@@ -0,0 +1,113 @@
+#!/usr/bin/python
+
+#
+# $Id: gen-data-queryperf.py,v 1.2 2008/06/13 18:17:08 jinmei Exp $
+#
+# Contributed by Stephane Bortzmeyer <bortzmeyer@nic.fr>
+#
+# "A small tool which may be useful with contrib/queryperf. This script
+# can generate files of queries, both with random names (to test the
+# behaviour with NXdomain) and with domains from a real zone file."
+#
+
+import sys
+import getopt
+import random
+import re
+
+ldh = []
+# Letters
+for i in range(97, 122):
+ ldh.append(chr(i))
+# Digits
+for i in range(48, 57):
+ ldh.append(chr(i))
+# Hyphen
+ldh.append('-')
+
+maxsize=10
+tld='org'
+num=4
+percent_random = 0.3
+gen = None
+zone_file = None
+domains = {}
+domain_ns = r'^([a-z0-9-\.]+)((\s+\d+)?(\s+IN)?|(\s+IN)(\s+\d+)?)\s+NS'
+domain_ns_re = re.compile(domain_ns, re.IGNORECASE)
+
+def remove_tld(label, tld):
+ if label.endswith('.' + tld + '.'):
+ return label[0:-(1+ len(tld) + 1)]
+ else:
+ return label
+
+def gen_random_label():
+ label = ""
+ for i in range(gen.randint(1, maxsize)):
+ label = label + gen.choice(ldh)
+ return label
+
+def make_domain(label):
+ return "www." + label + "." + tld + " A"
+
+def usage():
+ sys.stdout.write("Usage: " + sys.argv[0] + " [-n number] " + \
+ "[-p percent-random] [-t TLD]\n")
+ sys.stdout.write(" [-m MAXSIZE] [-f zone-file]\n")
+
+try:
+ optlist, args = getopt.getopt(sys.argv[1:], "hp:f:n:t:m:",
+ ["help", "percentrandom=", "zonefile=",
+ "number=", "tld=",
+ "maxsize="])
+ for option, value in optlist:
+ if option == "--help" or option == "-h":
+ usage()
+ sys.exit(0)
+ elif option == "--number" or option == "-n":
+ num = int(value)
+ elif option == "--maxsize" or option == "-m":
+ maxsize = int(value)
+ elif option == "--percentrandom" or option == "-p":
+ percent_random = float(value)
+ elif option == "--tld" or option == "-t":
+ tld = str(value)
+ elif option == "--zonefile" or option == "-f":
+ zone_file = str(value)
+ else:
+ error("Unknown option " + option)
+except getopt.error, reason:
+ sys.stderr.write(sys.argv[0] + ": " + str(reason) + "\n")
+ usage()
+ sys.exit(1)
+
+if len(args) <> 0:
+ usage()
+ sys.exit(1)
+
+gen = random.Random()
+if zone_file:
+ file = open(zone_file)
+ line = file.readline()
+ while line:
+ domain_line = domain_ns_re.match(line)
+ if domain_line:
+ print domain_line.group(1)
+ domain = remove_tld(domain_line.group(1), tld)
+ domains[domain] = 1
+ line = file.readline()
+ file.close()
+if zone_file:
+ domains = domains.keys()
+ if len(domains) == 0:
+ sys.stderr.write("No domains found in '%s'\n" % zone_file)
+ sys.exit(1)
+for i in range(num):
+ if zone_file:
+ if gen.random() < percent_random:
+ sys.stdout.write(make_domain(gen_random_label()))
+ else:
+ sys.stdout.write(make_domain(gen.choice(domains)))
+ else:
+ sys.stdout.write(make_domain(gen_random_label()))
+ sys.stdout.write("\n")
diff --git a/contrib/sdb/bdb/README b/contrib/sdb/bdb/README
new file mode 100644
index 0000000..d2acf4e
--- /dev/null
+++ b/contrib/sdb/bdb/README
@@ -0,0 +1,37 @@
+(Message trash:37216)
+
+Date: Wed, 15 May 2002 20:44:45 +0100
+To: <bind-workers@isc.org>
+From: Nuno Miguel Rodrigues <nmr@co.sapo.pt>
+Subject: Berkeley DB BIND9 SDB
+
+Replied: Thu, 16 May 2002 11:47:35 +1000
+Replied: Nuno Miguel Rodrigues <nmr@co.sapo.pt>
+Return-Path: <bind-workers-bounce@isc.org>
+X-X-Sender: <nmr@angelina.sl.pt>
+MIME-Version: 1.0
+X-ecartis-version: Ecartis v1.0.0
+Sender: bind-workers-bounce@isc.org
+Errors-To: bind-workers-bounce@isc.org
+X-original-sender: nmr@co.sapo.pt
+Precedence: bulk
+X-list: bind-workers
+Status:
+
+
+
+Hello all,
+
+I'm making available a BIND9 SDB using Berkeley DB 4.0.
+
+You can get it at http://www.dhis.org/~nmr/bind9_berkeleydb_sdb-1.0.tar
+
+Thanks,
+
+
+--
+Nuno M. Rodrigues <nmr@co.sapo.pt>
+
+
+
+
diff --git a/contrib/sdb/bdb/bdb.c b/contrib/sdb/bdb/bdb.c
new file mode 100644
index 0000000..10f5811
--- /dev/null
+++ b/contrib/sdb/bdb/bdb.c
@@ -0,0 +1,235 @@
+/*
+ * Copyright (C) 2002 Nuno M. Rodrigues.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND NUNO M. RODRIGUES
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: bdb.c,v 1.1 2002/05/16 04:25:22 marka Exp $ */
+
+/*
+ * BIND 9.1.x simple database driver
+ * implementation, using Berkeley DB.
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <isc/file.h>
+#include <isc/log.h>
+#include <isc/lib.h>
+#include <isc/mem.h>
+#include <isc/msgs.h>
+#include <isc/msgcat.h>
+#include <isc/region.h>
+#include <isc/result.h>
+#include <isc/types.h>
+#include <isc/util.h>
+
+#include <dns/sdb.h>
+#include <dns/log.h>
+#include <dns/lib.h>
+#include <dns/ttl.h>
+
+#include <named/bdb.h>
+#include <named/globals.h>
+#include <named/config.h>
+
+#include <db.h>
+
+#define DRIVERNAME "bdb"
+
+static dns_sdbimplementation_t *bdb_imp;
+
+static isc_result_t
+bdb_create(const char *zone, int argc, char **argv,
+ void *unused, void **dbdata)
+{
+ int ret;
+
+ UNUSED(zone);
+ UNUSED(unused);
+
+ if (argc < 1)
+ return ISC_R_FAILURE; /* database path must be given */
+
+ if (db_create((DB **)dbdata, NULL, 0) != 0) {
+ /*
+ * XXX Should use dns_msgcat et al
+ * but seems to be unavailable.
+ */
+ isc_log_iwrite(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_SDB, ISC_LOG_CRITICAL, isc_msgcat,
+ ISC_MSGSET_GENERAL, ISC_MSG_FATALERROR,
+ "db_create");
+ return ISC_R_FAILURE;
+ }
+
+ if (isc_file_exists(*argv) != ISC_TRUE) {
+ isc_log_iwrite(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_SDB, ISC_LOG_CRITICAL, isc_msgcat,
+ ISC_MSGSET_GENERAL, ISC_MSG_FATALERROR,
+ "isc_file_exists: %s", *argv);
+ return ISC_R_FAILURE;
+ }
+
+ if ((ret = (*(DB **)dbdata)->open(*(DB **)dbdata, *argv, NULL, DB_HASH,
+ DB_RDONLY, 0)) != 0) {
+ isc_log_iwrite(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_SDB, ISC_LOG_CRITICAL,
+ isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FATALERROR, "DB->open: %s",
+ db_strerror(ret));
+ return ISC_R_FAILURE;
+ }
+ return ISC_R_SUCCESS;
+}
+
+static isc_result_t
+bdb_lookup(const char *zone, const char *name, void *dbdata,
+ dns_sdblookup_t *l)
+{
+ int ret;
+ char *type, *rdata;
+ dns_ttl_t ttl;
+ isc_consttextregion_t ttltext;
+ DBC *c;
+ DBT key, data;
+
+ UNUSED(zone);
+
+ if ((ret = ((DB *)dbdata)->cursor((DB *)dbdata, NULL, &c, 0)) != 0) {
+ isc_log_iwrite(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_SDB, ISC_LOG_ERROR,
+ isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "DB->cursor: %s",
+ db_strerror(ret));
+ return ISC_R_FAILURE;
+ }
+
+ memset(&key, 0, sizeof(DBT));
+ memset(&data, 0, sizeof(DBT));
+
+ (const char *)key.data = name;
+ key.size = strlen(name);
+
+ ret = c->c_get(c, &key, &data, DB_SET);
+ while (ret == 0) {
+ ((char *)key.data)[key.size] = 0;
+ ((char *)data.data)[data.size] = 0;
+ ttltext.base = strtok((char *)data.data, " ");
+ ttltext.length = strlen(ttltext.base);
+ dns_ttl_fromtext((isc_textregion_t *)&ttltext, &ttl);
+ type = strtok(NULL, " ");
+ rdata = type + strlen(type) + 1;
+
+ if (dns_sdb_putrr(l, type, ttl, rdata) != ISC_R_SUCCESS) {
+ isc_log_iwrite(dns_lctx,
+ DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_SDB, ISC_LOG_ERROR,
+ isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "dns_sdb_putrr");
+ return ISC_R_FAILURE;
+ }
+ ret = c->c_get(c, &key, &data, DB_NEXT_DUP);
+ }
+
+ c->c_close(c);
+ return ISC_R_SUCCESS;
+}
+
+static isc_result_t
+bdb_allnodes(const char *zone, void *dbdata, dns_sdballnodes_t *n)
+{
+ int ret;
+ char *type, *rdata;
+ dns_ttl_t ttl;
+ isc_consttextregion_t ttltext;
+ DBC *c;
+ DBT key, data;
+
+ UNUSED(zone);
+
+ if ((ret = ((DB *)dbdata)->cursor((DB *)dbdata, NULL, &c, 0)) != 0) {
+ isc_log_iwrite(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_SDB, ISC_LOG_ERROR,
+ isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "DB->cursor: %s",
+ db_strerror(ret));
+ return ISC_R_FAILURE;
+ }
+
+ memset(&key, 0, sizeof(DBT));
+ memset(&data, 0, sizeof(DBT));
+
+ while (c->c_get(c, &key, &data, DB_NEXT) == 0) {
+ ((char *)key.data)[key.size] = 0;
+ ((char *)data.data)[data.size] = 0;
+ ttltext.base = strtok((char *)data.data, " ");
+ ttltext.length = strlen(ttltext.base);
+ dns_ttl_fromtext((isc_textregion_t *)&ttltext, &ttl);
+ type = strtok(NULL, " ");
+ rdata = type + strlen(type) + 1;
+
+ if (dns_sdb_putnamedrr(n, key.data, type, ttl, rdata) !=
+ ISC_R_SUCCESS) {
+ isc_log_iwrite(dns_lctx,
+ DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_SDB, ISC_LOG_ERROR,
+ isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "dns_sdb_putnamedrr");
+ return ISC_R_FAILURE;
+ }
+
+ }
+
+ c->c_close(c);
+ return ISC_R_SUCCESS;
+}
+
+static isc_result_t
+bdb_destroy(const char *zone, void *unused, void **dbdata)
+{
+
+ UNUSED(zone);
+ UNUSED(unused);
+
+ (*(DB **)dbdata)->close(*(DB **)dbdata, 0);
+
+ return ISC_R_SUCCESS;
+}
+
+isc_result_t
+bdb_init(void)
+{
+ static dns_sdbmethods_t bdb_methods = {
+ bdb_lookup,
+ NULL,
+ bdb_allnodes,
+ bdb_create,
+ bdb_destroy
+ };
+
+ return dns_sdb_register(DRIVERNAME, &bdb_methods, NULL, 0, ns_g_mctx,
+ &bdb_imp);
+}
+
+void
+bdb_clear(void)
+{
+
+ if (bdb_imp != NULL)
+ dns_sdb_unregister(&bdb_imp);
+}
diff --git a/contrib/sdb/bdb/bdb.h b/contrib/sdb/bdb/bdb.h
new file mode 100644
index 0000000..7ab56b4
--- /dev/null
+++ b/contrib/sdb/bdb/bdb.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2002 Nuno M. Rodrigues.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND NUNO M. RODRIGUES
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: bdb.h,v 1.1 2002/05/16 04:25:22 marka Exp $ */
+
+#ifndef BDB_H
+#define BDB_H 1
+
+#include <isc/types.h>
+
+/*
+ * Prototypes.
+ */
+isc_result_t bdb_init(void);
+void bdb_clear(void);
+
+#endif /* BDB_H */
diff --git a/contrib/sdb/bdb/zone2bdb.c b/contrib/sdb/bdb/zone2bdb.c
new file mode 100644
index 0000000..36326af
--- /dev/null
+++ b/contrib/sdb/bdb/zone2bdb.c
@@ -0,0 +1,187 @@
+/*
+ * Copyright (C) 2002 Nuno M. Rodrigues.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND NUNO M. RODRIGUES
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: zone2bdb.c,v 1.2 2008/09/24 02:46:21 marka Exp $ */
+
+#include <stdio.h>
+
+#include <isc/mem.h>
+#include <isc/result.h>
+#include <isc/types.h>
+#include <isc/util.h>
+
+#include <dns/db.h>
+#include <dns/dbiterator.h>
+#include <dns/fixedname.h>
+#include <dns/name.h>
+#include <dns/rdata.h>
+#include <dns/rdataset.h>
+#include <dns/rdatasetiter.h>
+#include <dns/rdatatype.h>
+#include <dns/ttl.h>
+#include <dns/types.h>
+
+#include <db.h>
+
+#define MAX_RDATATEXT 63 + 4 + 65535 + 2 /* ttl + type + rdata + sep */
+
+/*
+ * Returns a valid 'DB' handle.
+ *
+ * Requires:
+ * 'file' is a valid non-existant path.
+ */
+DB *
+bdb_init(const char *file)
+{
+ DB *db;
+
+ REQUIRE(db_create(&db, NULL, 0) == 0);
+ REQUIRE(db->set_flags(db, DB_DUP) == 0);
+ REQUIRE(db->open(db, file, NULL, DB_HASH, DB_CREATE | DB_EXCL, 0) == 0);
+
+ return db;
+}
+
+/*
+ * Puts resource record data on 'db'.
+ */
+isc_result_t
+bdb_putrdata(DB *db, dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata)
+{
+ static DBT key, data;
+ isc_buffer_t keybuf, databuf;
+ char nametext[DNS_NAME_MAXTEXT];
+ char rdatatext[MAX_RDATATEXT];
+
+ isc_buffer_init(&keybuf, nametext, DNS_NAME_MAXTEXT);
+
+ dns_name_totext(name, ISC_TRUE, &keybuf);
+
+ key.data = isc_buffer_base(&keybuf);
+ key.size = isc_buffer_usedlength(&keybuf);
+
+ isc_buffer_init(&databuf, rdatatext, MAX_RDATATEXT);
+
+ dns_ttl_totext(ttl, ISC_FALSE, &databuf);
+ *(char *)isc_buffer_used(&databuf) = ' ';
+ isc_buffer_add(&databuf, 1);
+
+ dns_rdatatype_totext(rdata->type, &databuf); /* XXX private data */
+ *(char *)isc_buffer_used(&databuf) = ' ';
+ isc_buffer_add(&databuf, 1);
+
+ dns_rdata_totext(rdata, NULL, &databuf);
+
+ data.data = isc_buffer_base(&databuf);
+ data.size = isc_buffer_usedlength(&databuf);
+
+ REQUIRE(db->put(db, NULL, &key, &data, 0) == 0);
+
+ return ISC_R_SUCCESS;
+}
+
+isc_result_t
+bdb_destroy(DB *db)
+{
+
+ return (db->close(db, 0) == 0) ? ISC_R_SUCCESS : ISC_R_FAILURE;
+}
+
+void
+usage(const char *prog)
+{
+
+ fprintf(stderr, "Usage: %s <origin> <zonefile> <db>\n", prog);
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ isc_mem_t *mctx = NULL;
+ isc_buffer_t b;
+ int n;
+ dns_fixedname_t origin, name;
+ dns_db_t *db = NULL;
+ dns_dbiterator_t *dbiter = NULL;
+ isc_result_t res;
+ dns_dbnode_t *node = NULL;
+ dns_rdataset_t rdataset;
+ dns_rdatasetiter_t *rdatasetiter = NULL;
+ dns_rdata_t rdata;
+ DB *bdb;
+
+ if (argc != 4) usage(*argv);
+
+ REQUIRE(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
+
+ n = strlen(argv[1]);
+ isc_buffer_init(&b, argv[1], n);
+ isc_buffer_add(&b, n);
+
+ dns_fixedname_init(&origin);
+
+ REQUIRE(dns_name_fromtext(dns_fixedname_name(&origin), &b, dns_rootname,
+ ISC_FALSE, NULL) == ISC_R_SUCCESS);
+ REQUIRE(dns_db_create(mctx, "rbt", dns_fixedname_name(&origin),
+ dns_dbtype_zone, dns_rdataclass_in, 0, NULL,
+ &db) == ISC_R_SUCCESS);
+
+ REQUIRE(dns_db_load(db, argv[2]) == ISC_R_SUCCESS);
+
+ REQUIRE(dns_db_createiterator(db, 0, &dbiter) == ISC_R_SUCCESS);
+
+ dns_rdataset_init(&rdataset);
+ dns_rdata_init(&rdata);
+ dns_fixedname_init(&name);
+ bdb = bdb_init(argv[3]);
+
+ for (res = dns_dbiterator_first(dbiter); res == ISC_R_SUCCESS;
+ res = dns_dbiterator_next(dbiter)) {
+ dns_dbiterator_current(dbiter, &node, dns_fixedname_name(&name));
+ REQUIRE(dns_db_allrdatasets(db, node, NULL, 0, &rdatasetiter)
+ == ISC_R_SUCCESS);
+
+ for (res = dns_rdatasetiter_first(rdatasetiter);
+ res == ISC_R_SUCCESS;
+ res = dns_rdatasetiter_next(rdatasetiter)) {
+ dns_rdatasetiter_current(rdatasetiter, &rdataset);
+
+ res = dns_rdataset_first(&rdataset);
+ while (res == ISC_R_SUCCESS) {
+ dns_rdataset_current(&rdataset, &rdata);
+ REQUIRE(bdb_putrdata(bdb,
+ dns_fixedname_name(&name),
+ rdataset.ttl, &rdata)
+ == ISC_R_SUCCESS);
+
+ dns_rdata_reset(&rdata);
+ res = dns_rdataset_next(&rdataset);
+ }
+
+ dns_rdataset_disassociate(&rdataset);
+ }
+ dns_rdatasetiter_destroy(&rdatasetiter);
+ dns_db_detachnode(db, &node);
+ }
+ dns_dbiterator_destroy(&dbiter);
+
+ REQUIRE(bdb_destroy(bdb) == ISC_R_SUCCESS);
+
+ return 0;
+}
diff --git a/contrib/sdb/dir/dirdb.c b/contrib/sdb/dir/dirdb.c
new file mode 100644
index 0000000..ca82cf8
--- /dev/null
+++ b/contrib/sdb/dir/dirdb.c
@@ -0,0 +1,195 @@
+/*
+ * Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000, 2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: dirdb.c,v 1.12 2007/06/19 23:47:07 tbox Exp $ */
+
+/*
+ * A simple database driver that returns basic information about
+ * files and directories in the Unix file system as DNS data.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
+
+#include <isc/mem.h>
+#include <isc/print.h>
+#include <isc/result.h>
+#include <isc/util.h>
+
+#include <dns/sdb.h>
+
+#include <named/globals.h>
+
+#include "dirdb.h"
+
+static dns_sdbimplementation_t *dirdb = NULL;
+
+#define CHECK(op) \
+ do { result = (op); \
+ if (result != ISC_R_SUCCESS) return (result); \
+ } while (0)
+
+#define CHECKN(op) \
+ do { n = (op); \
+ if (n < 0) return (ISC_R_FAILURE); \
+ } while (0)
+
+
+/*
+ * This database operates on relative names.
+ *
+ * Any name will be interpreted as a pathname offset from the directory
+ * specified in the configuration file.
+ */
+static isc_result_t
+dirdb_lookup(const char *zone, const char *name, void *dbdata,
+ dns_sdblookup_t *lookup)
+{
+ char filename[255];
+ char filename2[255];
+ char buf[1024];
+ struct stat statbuf;
+ isc_result_t result;
+ int n;
+
+ UNUSED(zone);
+ UNUSED(dbdata);
+
+ if (strcmp(name, "@") == 0)
+ snprintf(filename, sizeof(filename), "%s", (char *)dbdata);
+ else
+ snprintf(filename, sizeof(filename), "%s/%s",
+ (char *)dbdata, name);
+ CHECKN(lstat(filename, &statbuf));
+
+ if (S_ISDIR(statbuf.st_mode))
+ CHECK(dns_sdb_putrr(lookup, "txt", 3600, "dir"));
+ else if (S_ISCHR(statbuf.st_mode) || S_ISBLK(statbuf.st_mode)) {
+ CHECKN(snprintf(buf, sizeof(buf),
+ "\"%sdev\" \"major %d\" \"minor %d\"",
+ S_ISCHR(statbuf.st_mode) ? "chr" : "blk",
+ major(statbuf.st_rdev),
+ minor(statbuf.st_rdev)));
+ CHECK(dns_sdb_putrr(lookup, "txt", 3600, buf));
+ } else if (S_ISFIFO(statbuf.st_mode))
+ CHECK(dns_sdb_putrr(lookup, "txt", 3600, "pipe"));
+ else if (S_ISSOCK(statbuf.st_mode))
+ CHECK(dns_sdb_putrr(lookup, "txt", 3600, "socket"));
+ else if (S_ISLNK(statbuf.st_mode)) {
+ CHECKN(readlink(filename, filename2, sizeof(filename2) - 1));
+ buf[n] = 0;
+ CHECKN(snprintf(buf, sizeof(buf), "\"symlink\" \"%s\"",
+ filename2));
+ CHECK(dns_sdb_putrr(lookup, "txt", 3600, buf));
+ } else if (!S_ISREG(statbuf.st_mode))
+ CHECK(dns_sdb_putrr(lookup, "txt", 3600, "unknown"));
+ else {
+ CHECKN(snprintf(buf, sizeof(buf), "\"file\" \"size = %u\"",
+ (unsigned int)statbuf.st_size));
+ CHECK(dns_sdb_putrr(lookup, "txt", 3600, buf));
+ }
+
+ return (ISC_R_SUCCESS);
+}
+
+/*
+ * lookup () does not return SOA or NS records, so authority() must be defined.
+ */
+static isc_result_t
+dirdb_authority(const char *zone, void *dbdata, dns_sdblookup_t *lookup) {
+ isc_result_t result;
+
+ UNUSED(zone);
+ UNUSED(dbdata);
+
+ result = dns_sdb_putsoa(lookup, "ns", "hostmaster", 0);
+ INSIST(result == ISC_R_SUCCESS);
+ result = dns_sdb_putrr(lookup, "ns", 86400, "ns1");
+ INSIST(result == ISC_R_SUCCESS);
+ result = dns_sdb_putrr(lookup, "ns", 86400, "ns2");
+ INSIST(result == ISC_R_SUCCESS);
+ return (ISC_R_SUCCESS);
+}
+
+/*
+ * Each database stores the top-level directory as the dbdata opaque
+ * object. The create() function allocates it. argv[0] holds the top
+ * level directory.
+ */
+static isc_result_t
+dirdb_create(const char *zone, int argc, char **argv,
+ void *driverdata, void **dbdata)
+{
+ UNUSED(zone);
+ UNUSED(driverdata);
+
+ if (argc < 1)
+ return (ISC_R_FAILURE);
+ *dbdata = isc_mem_strdup((isc_mem_t *)driverdata, argv[0]);
+ if (*dbdata == NULL)
+ return (ISC_R_NOMEMORY);
+ return (ISC_R_SUCCESS);
+}
+
+/*
+ * The destroy() function frees the memory allocated by create().
+ */
+static void
+dirdb_destroy(const char *zone, void *driverdata, void **dbdata) {
+ UNUSED(zone);
+ UNUSED(driverdata);
+ isc_mem_free((isc_mem_t *)driverdata, *dbdata);
+}
+
+/*
+ * This zone does not support zone transfer, so allnodes() is NULL.
+ */
+static dns_sdbmethods_t dirdb_methods = {
+ dirdb_lookup,
+ dirdb_authority,
+ NULL, /* allnodes */
+ dirdb_create,
+ dirdb_destroy
+};
+
+/*
+ * Wrapper around dns_sdb_register(). Note that the first ns_g_mctx is
+ * being passed as the "driverdata" parameter, so that will it will be
+ * passed to create() and destroy().
+ */
+isc_result_t
+dirdb_init(void) {
+ unsigned int flags;
+ flags = DNS_SDBFLAG_RELATIVEOWNER | DNS_SDBFLAG_RELATIVERDATA |
+ DNS_SDBFLAG_THREADSAFE;
+ return (dns_sdb_register("dir", &dirdb_methods, ns_g_mctx, flags,
+ ns_g_mctx, &dirdb));
+}
+
+/*
+ * Wrapper around dns_sdb_unregister().
+ */
+void
+dirdb_clear(void) {
+ if (dirdb != NULL)
+ dns_sdb_unregister(&dirdb);
+}
diff --git a/contrib/sdb/dir/dirdb.h b/contrib/sdb/dir/dirdb.h
new file mode 100644
index 0000000..0deea13
--- /dev/null
+++ b/contrib/sdb/dir/dirdb.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000, 2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: dirdb.h,v 1.5 2007/06/19 23:47:07 tbox Exp $ */
+
+#include <isc/types.h>
+
+isc_result_t dirdb_init(void);
+
+void dirdb_clear(void);
+
diff --git a/contrib/sdb/ldap/INSTALL.ldap b/contrib/sdb/ldap/INSTALL.ldap
new file mode 100644
index 0000000..9151129
--- /dev/null
+++ b/contrib/sdb/ldap/INSTALL.ldap
@@ -0,0 +1,83 @@
+This is the INSTALL file for 1.0-beta. See
+http://www.venaas.no/ldap/bind-sdb/ for updates or other information.
+
+BUILDING
+
+You need the source for BIND 9.1.0 or newer (for zone transfers you
+will need at least 9.1.1rc3 due to a bug). Basically you need to follow
+the instructions in doc/misc/sdb, if my instructions don't make sense,
+please have a look at those as well.
+
+Copy ldapdb.c to bin/named and ldapdb.h to bin/named/include in the
+source tree.
+
+Next alter bin/named/Makefile.in. Add ldapdb.@O@ to DBDRIVER_OBJS and
+ldapdb.c to DBDRIVER_SRCS. You also need to add something like
+-I/usr/local/include to DBDRIVER_INCLUDES and
+-L/usr/local/lib -lldap -llber -lresolv to DBDRIVER_LIBS
+depending on what LDAP library you have and where you installed it.
+
+Finally you need to edit bin/named/main.c. Below where it says
+"#include "xxdb.h"", add the line "#include <ldapdb.h>". Below where
+it says "xxdb_init();" add the line "ldapdb_init();", and finally
+below where it says "xxdb_clear();", add "ldapdb_clear();".
+
+Now you should hopefully be able to build as usual; first configure
+and then make. If you get an error message about ldap_memfree() not
+being defined, you're probably using an LDAP library with the
+interface defined in RFC 1823. To build, uncomment the "#define
+LDAPDB_RFC1823API" line near the top of ldapdb.c.
+
+Also, if you're using an LDAPv2 only server, you need to change
+the line "#define LDAPDB_LDAP_VERSION 3" in ldapdb.c. Simply
+replace 3 with 2. Instead of editing the file, you may define
+LDAPDB_LDAP_VERSION yourself.
+
+If you want to use TLS, you need to uncommed the #define LDAPDB_TLS"
+line near the top of ldapdb.c.
+
+CONFIGURING
+
+Before you do any configuring of LDAP stuff, please try to configure
+and start bind as usual to see if things work.
+
+To do anything useful, you need to store a zone in some LDAP server.
+You must use a schema called dNSZone. Note that it relies on some
+attribute definitions in the Cosine schema, so that must be included
+as well. The Cosine schema probably comes with your LDAP server. You
+can find dNSZone and further details on how to store the data in your
+LDAP server at http://www.venaas.no/ldap/bind-sdb/
+
+To make BIND use a zone stored in LDAP, you will have to put something
+like this in named.conf:
+
+zone "venaas.com" {
+ type master;
+ database "ldap ldap://158.38.160.245/dc=venaas,dc=com,o=DNS,dc=venaas,dc=no 172800";
+};
+
+When doing lookups BIND will do a sub-tree search below the base in the
+URL. The number 172800 is the TTL which will be used for all entries that
+haven't got the dNSTTL attribute. It is also possible to add a filter to
+the URL, say "ldap://host/base???(o=internal)".
+
+Version 1.0 also has support for simple LDAP bind, that is, binding to
+LDAP using plain text authentication. The bind dn and password is coded
+into the URL as extensions, according to RFC 2255. If you want simple
+bind with say dn "cn=Manager,dc=venaas,dc=no" and password "secret", the
+URL will be something like this:
+
+ldap://158.38.160.245/dc=venaas,dc=com,o=DNS,dc=venaas,dc=no????!bindname=cn=Manager%2cdc=venaas%2cdc=no,!x-bindpw=secret
+
+This URL may also include a filter part if you need it. Note that in
+the bind dn, "," is hex-escaped as "%2c". This is necessary since ","
+is the separator between the extension elements. The "!" in front of
+"bindname" and "x-bindpw" can be omitted if you prefer. "x-bindpw" is
+not standardized, but it's used by several other LDAP applications. See
+RFC 2255 for details.
+
+Finally, if you enabled TLS when compiling, you can also use TLS if
+you like. To do this you use the extension "x-tls", e.g.
+ldap://158.38.160.245/dc=venaas,dc=com,o=DNS,dc=venaas,dc=no????!bindname=cn=Manager%2cdc=venaas%2cdc=no,!x-bindpw=secret,x-tls
+
+Stig Venaas <venaas@uninett.no> 2004-08-15
diff --git a/contrib/sdb/ldap/README.ldap b/contrib/sdb/ldap/README.ldap
new file mode 100644
index 0000000..b4ea18a
--- /dev/null
+++ b/contrib/sdb/ldap/README.ldap
@@ -0,0 +1,48 @@
+This is an attempt at an LDAP back-end for BIND 9 using the new simplified
+database interface "sdb". This is release 1.0-beta and should be pretty
+stable. Note that since version 0.4 a new schema is used. It is not
+backwards compatible with versions before 0.4.
+
+1.0-beta fixes a large memory leak. An extension x-tls for enabling TLS
+has been added.
+
+1.0-alpha uses LDAPv3 by default and also supports LDAP simple bind. That
+is, one can use plain text password for authentication. The bind dn and
+password is coded into the URL using extensions bindname and x-bindpw
+per RFC 2255.
+
+In 0.9 the code has been cleaned up a bit and should be slightly faster
+than previous versions. It also fixes an error with zone transfers (AXFR)
+and entries with multiple relativeDomainName values. The problem was
+that it would only use the first value in the result. There's no need
+to upgrade unless you use such entries.
+
+0.8 uses asynchronous LDAP search which should give better performance.
+Thanks to Ashley Burston for providing patch. Another new feature is
+allowing filters in URLs. The syntax is as in RFC 2255. Few people will
+need this, but if you have say an internal and external version of the
+same zone, you could stick say o=internal and o=external into different
+entries, and specify for instance ldap://host/base???(o=internal)
+Some error logging has also been added.
+
+0.7 allows space and other characters to be used in URLs by use of %-quoting.
+For instance space can be written as %20. It also fixes a problem with some
+servers and/or APIs that do not preserve attribute casing.
+
+0.6 fixes some memory leaks present in older versions unless compiled with
+the RFC 1823 API.
+
+The big changes in 0.5 are thread support and improved connection handling.
+Multiple threads can now access the back-end simultaneously, and rather than
+having one connection per zone, there is now one connection per thread per
+LDAP server. This should help people with multiple CPUs and people with a
+huge number of zones. One final change is support for literal IPv6 addresses
+in LDAP URLs. At least OpenLDAP 2 has IPv6 support, so if you use OpenLDAP 2
+libraries and server, you got all you need.
+
+If you have bug reports, fixes, comments, questions or whatever, please
+contact me. See also http://www.venaas.no/ldap/bind-sdb/ for information.
+
+See INSTALL for how to build, install and use.
+
+Stig Venaas <venaas@uninett.no> 2004-08-15
diff --git a/contrib/sdb/ldap/README.zone2ldap b/contrib/sdb/ldap/README.zone2ldap
new file mode 100644
index 0000000..edb367b
--- /dev/null
+++ b/contrib/sdb/ldap/README.zone2ldap
@@ -0,0 +1,17 @@
+INSTALLATION
+
+To Compile zone2ldap from contrib/sdb directory:
+
+ gcc -g `../../isc-config.sh --cflags isc dns` -c zone2ldap.c
+ gcc -g -o zone2ldap zone2ldap.o `isc-config.sh --libs isc dns` -lldap -llber -lresolv
+
+USAGE:
+
+See zone2ldap.1
+
+BUGS:
+
+Jeff McNeil <jeff@snapcase.g-rock.net>
+
+
+
diff --git a/contrib/sdb/ldap/ldapdb.c b/contrib/sdb/ldap/ldapdb.c
new file mode 100644
index 0000000..ed124c0
--- /dev/null
+++ b/contrib/sdb/ldap/ldapdb.c
@@ -0,0 +1,667 @@
+/*
+ * ldapdb.c version 1.0-beta
+ *
+ * Copyright (C) 2002, 2004 Stig Venaas
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * Contributors: Jeremy C. McDermond
+ */
+
+/*
+ * If you want to use TLS, uncomment the define below
+ */
+/* #define LDAPDB_TLS */
+
+/*
+ * If you are using an old LDAP API uncomment the define below. Only do this
+ * if you know what you're doing or get compilation errors on ldap_memfree().
+ * This also forces LDAPv2.
+ */
+/* #define LDAPDB_RFC1823API */
+
+/* Using LDAPv3 by default, change this if you want v2 */
+#ifndef LDAPDB_LDAP_VERSION
+#define LDAPDB_LDAP_VERSION 3
+#endif
+
+#include <config.h>
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+#include <isc/mem.h>
+#include <isc/print.h>
+#include <isc/result.h>
+#include <isc/util.h>
+#include <isc/thread.h>
+
+#include <dns/sdb.h>
+
+#include <named/globals.h>
+#include <named/log.h>
+
+#include <ldap.h>
+#include "ldapdb.h"
+
+/*
+ * A simple database driver for LDAP
+ */
+
+/* enough for name with 8 labels of max length */
+#define MAXNAMELEN 519
+
+static dns_sdbimplementation_t *ldapdb = NULL;
+
+struct ldapdb_data {
+ char *hostport;
+ char *hostname;
+ int portno;
+ char *base;
+ int defaultttl;
+ char *filterall;
+ int filteralllen;
+ char *filterone;
+ int filteronelen;
+ char *filtername;
+ char *bindname;
+ char *bindpw;
+#ifdef LDAPDB_TLS
+ int tls;
+#endif
+};
+
+/* used by ldapdb_getconn */
+
+struct ldapdb_entry {
+ void *index;
+ size_t size;
+ void *data;
+ struct ldapdb_entry *next;
+};
+
+static struct ldapdb_entry *ldapdb_find(struct ldapdb_entry *stack,
+ const void *index, size_t size) {
+ while (stack != NULL) {
+ if (stack->size == size && !memcmp(stack->index, index, size))
+ return stack;
+ stack = stack->next;
+ }
+ return NULL;
+}
+
+static void ldapdb_insert(struct ldapdb_entry **stack,
+ struct ldapdb_entry *item) {
+ item->next = *stack;
+ *stack = item;
+}
+
+static void ldapdb_lock(int what) {
+ static isc_mutex_t lock;
+
+ switch (what) {
+ case 0:
+ isc_mutex_init(&lock);
+ break;
+ case 1:
+ LOCK(&lock);
+ break;
+ case -1:
+ UNLOCK(&lock);
+ break;
+ }
+}
+
+/* data == NULL means cleanup */
+static LDAP **
+ldapdb_getconn(struct ldapdb_data *data)
+{
+ static struct ldapdb_entry *allthreadsdata = NULL;
+ struct ldapdb_entry *threaddata, *conndata;
+ unsigned long threadid;
+
+ if (data == NULL) {
+ /* cleanup */
+ /* lock out other threads */
+ ldapdb_lock(1);
+ while (allthreadsdata != NULL) {
+ threaddata = allthreadsdata;
+ free(threaddata->index);
+ while (threaddata->data != NULL) {
+ conndata = threaddata->data;
+ free(conndata->index);
+ if (conndata->data != NULL)
+ ldap_unbind((LDAP *)conndata->data);
+ threaddata->data = conndata->next;
+ free(conndata);
+ }
+ allthreadsdata = threaddata->next;
+ free(threaddata);
+ }
+ ldapdb_lock(-1);
+ return (NULL);
+ }
+
+ /* look for connection data for current thread */
+ threadid = isc_thread_self();
+ threaddata = ldapdb_find(allthreadsdata, &threadid, sizeof(threadid));
+ if (threaddata == NULL) {
+ /* no data for this thread, create empty connection list */
+ threaddata = malloc(sizeof(*threaddata));
+ if (threaddata == NULL)
+ return (NULL);
+ threaddata->index = malloc(sizeof(threadid));
+ if (threaddata->index == NULL) {
+ free(threaddata);
+ return (NULL);
+ }
+ *(unsigned long *)threaddata->index = threadid;
+ threaddata->size = sizeof(threadid);
+ threaddata->data = NULL;
+
+ /* need to lock out other threads here */
+ ldapdb_lock(1);
+ ldapdb_insert(&allthreadsdata, threaddata);
+ ldapdb_lock(-1);
+ }
+
+ /* threaddata points at the connection list for current thread */
+ /* look for existing connection to our server */
+ conndata = ldapdb_find((struct ldapdb_entry *)threaddata->data,
+ data->hostport, strlen(data->hostport));
+ if (conndata == NULL) {
+ /* no connection data structure for this server, create one */
+ conndata = malloc(sizeof(*conndata));
+ if (conndata == NULL)
+ return (NULL);
+ conndata->index = data->hostport;
+ conndata->size = strlen(data->hostport);
+ conndata->data = NULL;
+ ldapdb_insert((struct ldapdb_entry **)&threaddata->data,
+ conndata);
+ }
+
+ return (LDAP **)&conndata->data;
+}
+
+static void
+ldapdb_bind(struct ldapdb_data *data, LDAP **ldp)
+{
+#ifndef LDAPDB_RFC1823API
+ const int ver = LDAPDB_LDAP_VERSION;
+#endif
+
+ if (*ldp != NULL)
+ ldap_unbind(*ldp);
+ *ldp = ldap_open(data->hostname, data->portno);
+ if (*ldp == NULL)
+ return;
+
+#ifndef LDAPDB_RFC1823API
+ ldap_set_option(*ldp, LDAP_OPT_PROTOCOL_VERSION, &ver);
+#endif
+
+#ifdef LDAPDB_TLS
+ if (data->tls) {
+ ldap_start_tls_s(*ldp, NULL, NULL);
+ }
+#endif
+
+ if (ldap_simple_bind_s(*ldp, data->bindname, data->bindpw) != LDAP_SUCCESS) {
+ ldap_unbind(*ldp);
+ *ldp = NULL;
+ }
+}
+
+static isc_result_t
+ldapdb_search(const char *zone, const char *name, void *dbdata, void *retdata)
+{
+ struct ldapdb_data *data = dbdata;
+ isc_result_t result = ISC_R_NOTFOUND;
+ LDAP **ldp;
+ LDAPMessage *res, *e;
+ char *fltr, *a, **vals = NULL, **names = NULL;
+ char type[64];
+#ifdef LDAPDB_RFC1823API
+ void *ptr;
+#else
+ BerElement *ptr;
+#endif
+ int i, j, errno, msgid;
+
+ ldp = ldapdb_getconn(data);
+ if (ldp == NULL)
+ return (ISC_R_FAILURE);
+ if (*ldp == NULL) {
+ ldapdb_bind(data, ldp);
+ if (*ldp == NULL) {
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
+ "LDAP sdb zone '%s': bind failed", zone);
+ return (ISC_R_FAILURE);
+ }
+ }
+
+ if (name == NULL) {
+ fltr = data->filterall;
+ } else {
+ if (strlen(name) > MAXNAMELEN) {
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
+ "LDAP sdb zone '%s': name %s too long", zone, name);
+ return (ISC_R_FAILURE);
+ }
+ sprintf(data->filtername, "%s))", name);
+ fltr = data->filterone;
+ }
+
+ msgid = ldap_search(*ldp, data->base, LDAP_SCOPE_SUBTREE, fltr, NULL, 0);
+ if (msgid == -1) {
+ ldapdb_bind(data, ldp);
+ if (*ldp != NULL)
+ msgid = ldap_search(*ldp, data->base, LDAP_SCOPE_SUBTREE, fltr, NULL, 0);
+ }
+
+ if (*ldp == NULL || msgid == -1) {
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
+ "LDAP sdb zone '%s': search failed, filter %s", zone, fltr);
+ return (ISC_R_FAILURE);
+ }
+
+ /* Get the records one by one as they arrive and return them to bind */
+ while ((errno = ldap_result(*ldp, msgid, 0, NULL, &res)) != LDAP_RES_SEARCH_RESULT ) {
+ LDAP *ld = *ldp;
+ int ttl = data->defaultttl;
+
+ /* not supporting continuation references at present */
+ if (errno != LDAP_RES_SEARCH_ENTRY) {
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
+ "LDAP sdb zone '%s': ldap_result returned %d", zone, errno);
+ ldap_msgfree(res);
+ return (ISC_R_FAILURE);
+ }
+
+ /* only one entry per result message */
+ e = ldap_first_entry(ld, res);
+ if (e == NULL) {
+ ldap_msgfree(res);
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
+ "LDAP sdb zone '%s': ldap_first_entry failed", zone);
+ return (ISC_R_FAILURE);
+ }
+
+ if (name == NULL) {
+ names = ldap_get_values(ld, e, "relativeDomainName");
+ if (names == NULL)
+ continue;
+ }
+
+ vals = ldap_get_values(ld, e, "dNSTTL");
+ if (vals != NULL) {
+ ttl = atoi(vals[0]);
+ ldap_value_free(vals);
+ }
+
+ for (a = ldap_first_attribute(ld, e, &ptr); a != NULL; a = ldap_next_attribute(ld, e, ptr)) {
+ char *s;
+
+ for (s = a; *s; s++)
+ *s = toupper(*s);
+ s = strstr(a, "RECORD");
+ if ((s == NULL) || (s == a) || (s - a >= (signed int)sizeof(type))) {
+#ifndef LDAPDB_RFC1823API
+ ldap_memfree(a);
+#endif
+ continue;
+ }
+
+ strncpy(type, a, s - a);
+ type[s - a] = '\0';
+ vals = ldap_get_values(ld, e, a);
+ if (vals != NULL) {
+ for (i = 0; vals[i] != NULL; i++) {
+ if (name != NULL) {
+ result = dns_sdb_putrr(retdata, type, ttl, vals[i]);
+ } else {
+ for (j = 0; names[j] != NULL; j++) {
+ result = dns_sdb_putnamedrr(retdata, names[j], type, ttl, vals[i]);
+ if (result != ISC_R_SUCCESS)
+ break;
+ }
+ }
+; if (result != ISC_R_SUCCESS) {
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
+ "LDAP sdb zone '%s': dns_sdb_put... failed for %s", zone, vals[i]);
+ ldap_value_free(vals);
+#ifndef LDAPDB_RFC1823API
+ ldap_memfree(a);
+ if (ptr != NULL)
+ ber_free(ptr, 0);
+#endif
+ if (name == NULL)
+ ldap_value_free(names);
+ ldap_msgfree(res);
+ return (ISC_R_FAILURE);
+ }
+ }
+ ldap_value_free(vals);
+ }
+#ifndef LDAPDB_RFC1823API
+ ldap_memfree(a);
+#endif
+ }
+#ifndef LDAPDB_RFC1823API
+ if (ptr != NULL)
+ ber_free(ptr, 0);
+#endif
+ if (name == NULL)
+ ldap_value_free(names);
+
+ /* free this result */
+ ldap_msgfree(res);
+ }
+
+ /* free final result */
+ ldap_msgfree(res);
+ return (result);
+}
+
+
+/* callback routines */
+static isc_result_t
+ldapdb_lookup(const char *zone, const char *name, void *dbdata,
+ dns_sdblookup_t *lookup)
+{
+ return ldapdb_search(zone, name, dbdata, lookup);
+}
+
+static isc_result_t
+ldapdb_allnodes(const char *zone, void *dbdata,
+ dns_sdballnodes_t *allnodes)
+{
+ return ldapdb_search(zone, NULL, dbdata, allnodes);
+}
+
+static char *
+unhex(char *in)
+{
+ static const char hexdigits[] = "0123456789abcdef";
+ char *p, *s = in;
+ int d1, d2;
+
+ while ((s = strchr(s, '%'))) {
+ if (!(s[1] && s[2]))
+ return NULL;
+ if ((p = strchr(hexdigits, tolower(s[1]))) == NULL)
+ return NULL;
+ d1 = p - hexdigits;
+ if ((p = strchr(hexdigits, tolower(s[2]))) == NULL)
+ return NULL;
+ d2 = p - hexdigits;
+ *s++ = d1 << 4 | d2;
+ memmove(s, s + 2, strlen(s) - 1);
+ }
+ return in;
+}
+
+/* returns 0 for ok, -1 for bad syntax, -2 for unknown critical extension */
+static int
+parseextensions(char *extensions, struct ldapdb_data *data)
+{
+ char *s, *next, *name, *value;
+ int critical;
+
+ while (extensions != NULL) {
+ s = strchr(extensions, ',');
+ if (s != NULL) {
+ *s++ = '\0';
+ next = s;
+ } else {
+ next = NULL;
+ }
+
+ if (*extensions != '\0') {
+ s = strchr(extensions, '=');
+ if (s != NULL) {
+ *s++ = '\0';
+ value = *s != '\0' ? s : NULL;
+ } else {
+ value = NULL;
+ }
+ name = extensions;
+
+ critical = *name == '!';
+ if (critical) {
+ name++;
+ }
+ if (*name == '\0') {
+ return -1;
+ }
+
+ if (!strcasecmp(name, "bindname")) {
+ data->bindname = value;
+ } else if (!strcasecmp(name, "x-bindpw")) {
+ data->bindpw = value;
+#ifdef LDAPDB_TLS
+ } else if (!strcasecmp(name, "x-tls")) {
+ data->tls = value == NULL || !strcasecmp(value, "true");
+#endif
+ } else if (critical) {
+ return -2;
+ }
+ }
+ extensions = next;
+ }
+ return 0;
+}
+
+static void
+free_data(struct ldapdb_data *data)
+{
+ if (data->hostport != NULL)
+ isc_mem_free(ns_g_mctx, data->hostport);
+ if (data->hostname != NULL)
+ isc_mem_free(ns_g_mctx, data->hostname);
+ if (data->filterall != NULL)
+ isc_mem_put(ns_g_mctx, data->filterall, data->filteralllen);
+ if (data->filterone != NULL)
+ isc_mem_put(ns_g_mctx, data->filterone, data->filteronelen);
+ isc_mem_put(ns_g_mctx, data, sizeof(struct ldapdb_data));
+}
+
+
+static isc_result_t
+ldapdb_create(const char *zone, int argc, char **argv,
+ void *driverdata, void **dbdata)
+{
+ struct ldapdb_data *data;
+ char *s, *filter = NULL, *extensions = NULL;
+ int defaultttl;
+
+ UNUSED(driverdata);
+
+ /* we assume that only one thread will call create at a time */
+ /* want to do this only once for all instances */
+
+ if ((argc < 2)
+ || (argv[0] != strstr( argv[0], "ldap://"))
+ || ((defaultttl = atoi(argv[1])) < 1))
+ return (ISC_R_FAILURE);
+ data = isc_mem_get(ns_g_mctx, sizeof(struct ldapdb_data));
+ if (data == NULL)
+ return (ISC_R_NOMEMORY);
+
+ memset(data, 0, sizeof(struct ldapdb_data));
+ data->hostport = isc_mem_strdup(ns_g_mctx, argv[0] + strlen("ldap://"));
+ if (data->hostport == NULL) {
+ free_data(data);
+ return (ISC_R_NOMEMORY);
+ }
+
+ data->defaultttl = defaultttl;
+
+ s = strchr(data->hostport, '/');
+ if (s != NULL) {
+ *s++ = '\0';
+ data->base = s;
+ /* attrs, scope, filter etc? */
+ s = strchr(s, '?');
+ if (s != NULL) {
+ *s++ = '\0';
+ /* ignore attributes */
+ s = strchr(s, '?');
+ if (s != NULL) {
+ *s++ = '\0';
+ /* ignore scope */
+ s = strchr(s, '?');
+ if (s != NULL) {
+ *s++ = '\0';
+ /* filter */
+ filter = s;
+ s = strchr(s, '?');
+ if (s != NULL) {
+ *s++ = '\0';
+ /* extensions */
+ extensions = s;
+ s = strchr(s, '?');
+ if (s != NULL) {
+ *s++ = '\0';
+ }
+ if (*extensions == '\0') {
+ extensions = NULL;
+ }
+ }
+ if (*filter == '\0') {
+ filter = NULL;
+ }
+ }
+ }
+ }
+ if (*data->base == '\0') {
+ data->base = NULL;
+ }
+ }
+
+ /* parse extensions */
+ if (extensions != NULL) {
+ int err;
+
+ err = parseextensions(extensions, data);
+ if (err < 0) {
+ /* err should be -1 or -2 */
+ free_data(data);
+ if (err == -1) {
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
+ "LDAP sdb zone '%s': URL: extension syntax error", zone);
+ } else if (err == -2) {
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
+ "LDAP sdb zone '%s': URL: unknown critical extension", zone);
+ }
+ return (ISC_R_FAILURE);
+ }
+ }
+
+ if ((data->base != NULL && unhex(data->base) == NULL) ||
+ (filter != NULL && unhex(filter) == NULL) ||
+ (data->bindname != NULL && unhex(data->bindname) == NULL) ||
+ (data->bindpw != NULL && unhex(data->bindpw) == NULL)) {
+ free_data(data);
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
+ "LDAP sdb zone '%s': URL: bad hex values", zone);
+ return (ISC_R_FAILURE);
+ }
+
+ /* compute filterall and filterone once and for all */
+ if (filter == NULL) {
+ data->filteralllen = strlen(zone) + strlen("(zoneName=)") + 1;
+ data->filteronelen = strlen(zone) + strlen("(&(zoneName=)(relativeDomainName=))") + MAXNAMELEN + 1;
+ } else {
+ data->filteralllen = strlen(filter) + strlen(zone) + strlen("(&(zoneName=))") + 1;
+ data->filteronelen = strlen(filter) + strlen(zone) + strlen("(&(zoneName=)(relativeDomainName=))") + MAXNAMELEN + 1;
+ }
+
+ data->filterall = isc_mem_get(ns_g_mctx, data->filteralllen);
+ if (data->filterall == NULL) {
+ free_data(data);
+ return (ISC_R_NOMEMORY);
+ }
+ data->filterone = isc_mem_get(ns_g_mctx, data->filteronelen);
+ if (data->filterone == NULL) {
+ free_data(data);
+ return (ISC_R_NOMEMORY);
+ }
+
+ if (filter == NULL) {
+ sprintf(data->filterall, "(zoneName=%s)", zone);
+ sprintf(data->filterone, "(&(zoneName=%s)(relativeDomainName=", zone);
+ } else {
+ sprintf(data->filterall, "(&%s(zoneName=%s))", filter, zone);
+ sprintf(data->filterone, "(&%s(zoneName=%s)(relativeDomainName=", filter, zone);
+ }
+ data->filtername = data->filterone + strlen(data->filterone);
+
+ /* support URLs with literal IPv6 addresses */
+ data->hostname = isc_mem_strdup(ns_g_mctx, data->hostport + (*data->hostport == '[' ? 1 : 0));
+ if (data->hostname == NULL) {
+ free_data(data);
+ return (ISC_R_NOMEMORY);
+ }
+
+ if (*data->hostport == '[' &&
+ (s = strchr(data->hostname, ']')) != NULL )
+ *s++ = '\0';
+ else
+ s = data->hostname;
+ s = strchr(s, ':');
+ if (s != NULL) {
+ *s++ = '\0';
+ data->portno = atoi(s);
+ } else
+ data->portno = LDAP_PORT;
+
+ *dbdata = data;
+ return (ISC_R_SUCCESS);
+}
+
+static void
+ldapdb_destroy(const char *zone, void *driverdata, void **dbdata) {
+ struct ldapdb_data *data = *dbdata;
+
+ UNUSED(zone);
+ UNUSED(driverdata);
+
+ free_data(data);
+}
+
+static dns_sdbmethods_t ldapdb_methods = {
+ ldapdb_lookup,
+ NULL, /* authority */
+ ldapdb_allnodes,
+ ldapdb_create,
+ ldapdb_destroy
+};
+
+/* Wrapper around dns_sdb_register() */
+isc_result_t
+ldapdb_init(void) {
+ unsigned int flags =
+ DNS_SDBFLAG_RELATIVEOWNER |
+ DNS_SDBFLAG_RELATIVERDATA |
+ DNS_SDBFLAG_THREADSAFE;
+
+ ldapdb_lock(0);
+ return (dns_sdb_register("ldap", &ldapdb_methods, NULL, flags,
+ ns_g_mctx, &ldapdb));
+}
+
+/* Wrapper around dns_sdb_unregister() */
+void
+ldapdb_clear(void) {
+ if (ldapdb != NULL) {
+ /* clean up thread data */
+ ldapdb_getconn(NULL);
+ dns_sdb_unregister(&ldapdb);
+ }
+}
diff --git a/contrib/sdb/ldap/ldapdb.h b/contrib/sdb/ldap/ldapdb.h
new file mode 100644
index 0000000..a08eb20
--- /dev/null
+++ b/contrib/sdb/ldap/ldapdb.h
@@ -0,0 +1,6 @@
+#include <isc/types.h>
+
+isc_result_t ldapdb_init(void);
+
+void ldapdb_clear(void);
+
diff --git a/contrib/sdb/ldap/zone2ldap.1 b/contrib/sdb/ldap/zone2ldap.1
new file mode 100644
index 0000000..781114b
--- /dev/null
+++ b/contrib/sdb/ldap/zone2ldap.1
@@ -0,0 +1,64 @@
+.TH zone2ldap 1 "8 March 2001"
+.SH NAME
+zone2ldap /- Load BIND 9 Zone files into LDAP Directory
+.SH SYNOPSIS
+zone2ldap [-D Bind DN] [-w Bind Password] [-b Base DN] [-z Zone] [-f Zone File ] [-h Ldap Host] [-cd] [-v]
+.SH DESCRIPTION
+zone2ldap will parse a complete BIND 9 format DNS zone file, and load
+the contents into an LDAP directory, for use with the LDAP sdb back-end.
+
+If the zone already exists, zone2ldap will exit succesfully. If the zone does not exists, or
+partially exists, zone2ldap will attempt to add all/missing zone data.
+
+.SS Options
+.TP
+-b
+LDAP Base DN. LDAP systems require a "base dn", which is generally considered the LDAP Directory root.
+If the zone you are loading is different from the base, then you will need to tell zone2ldap what your LDAP
+base is.
+.TP
+-v
+Print version information, and immediatly exit.
+.TP
+-f
+Zone file. Bind 9.1 compatible zone file, from which zone information will be read.
+.TP
+-d
+Dump debug information to standard out.
+.TP
+-w
+LDAP Bind password, corresponding the the value of "-b".
+.TP
+-h
+LDAP Directory host. This is the hostname of the LDAP system you wish to store zone information on.
+An LDAP server should be listening on port 389 of the target system. This may be ommited, and will default
+to "localhost".
+.TP
+-c
+This will create the zone portion of the DN you are importing. For instance, if you are creating a domain.com zone,
+zone2ldap should first create "dc=domain,dc=com". This is useful if you are creating multiple domains.
+.TP
+-z
+This is the name of the zone specified in the SOA record.
+.SH EXAMPLES
+Following are brief examples of how to import a zone file into your LDAP DIT.
+.SS Loading zone domain.com, with an LDAP Base DN of dc=domain,dc=com
+zone2ldap -D dc=root -w secret -h localhost -z domain.com -f domain.com.zone
+
+This will add Resource Records into an ALREADY EXISTING dc=domain,dc=com. The final SOA DN in this case, will be
+dc=@,dc=domain,dc=com
+
+.SS Loading customer.com, if your LDAP Base DN is dc=provider,dc=net.
+zone2ldap -D dc=root -w secret -h localhost -z customer.com -b dc=provider,dc=net -f customer.com.zone -c
+
+This will create dc=customer,dc=com under dc=provider,dc=net, and add all necessary Resource Records. The final
+root DN to the SOA will be dc=@,dc=customer,dc=com,dc=provider,dc=net.
+
+.SH "SEE ALSO"
+named(8) ldap(3)
+http://www.venaas.no/ldap/bind-sdb/
+.SH "BUGS"
+Send all bug reports to Jeff McNeil <jeff@snapcase.g-rock.net>
+.SH AUTHOR
+Jeff McNeil <jeff@snapcase.g-rock.net>
+
diff --git a/contrib/sdb/ldap/zone2ldap.c b/contrib/sdb/ldap/zone2ldap.c
new file mode 100644
index 0000000..c2820fd
--- /dev/null
+++ b/contrib/sdb/ldap/zone2ldap.c
@@ -0,0 +1,734 @@
+/*
+ * Copyright (C) 2001 Jeff McNeil <jeff@snapcase.g-rock.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * Change Log
+ *
+ * Tue May 1 19:19:54 EDT 2001 - Jeff McNeil
+ * Update to objectClass code, and add_to_rr_list function
+ * (I need to rename that) to support the dNSZone schema,
+ * ditched dNSDomain2 schema support. Version 0.3-ALPHA
+ */
+
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <getopt.h>
+
+#include <isc/buffer.h>
+#include <isc/entropy.h>
+#include <isc/hash.h>
+#include <isc/mem.h>
+#include <isc/print.h>
+#include <isc/result.h>
+
+#include <dns/db.h>
+#include <dns/dbiterator.h>
+#include <dns/fixedname.h>
+#include <dns/name.h>
+#include <dns/rdata.h>
+#include <dns/rdataset.h>
+#include <dns/rdatasetiter.h>
+#include <dns/result.h>
+#include <dns/rdatatype.h>
+
+#include <ldap.h>
+
+#define DNS_OBJECT 6
+#define DNS_TOP 2
+
+#define VERSION "0.4-ALPHA"
+
+#define NO_SPEC 0
+#define WI_SPEC 1
+
+/* Global Zone Pointer */
+char *gbl_zone = NULL;
+
+typedef struct LDAP_INFO
+{
+ char *dn;
+ LDAPMod **attrs;
+ struct LDAP_INFO *next;
+ int attrcnt;
+}
+ldap_info;
+
+/* usage Info */
+void usage ();
+
+/* Add to the ldap dit */
+void add_ldap_values (ldap_info * ldinfo);
+
+/* Init an ldap connection */
+void init_ldap_conn ();
+
+/* Ldap error checking */
+void ldap_result_check (char *msg, char *dn, int err);
+
+/* Put a hostname into a char ** array */
+char **hostname_to_dn_list (char *hostname, char *zone, unsigned int flags);
+
+/* Find out how many items are in a char ** array */
+int get_attr_list_size (char **tmp);
+
+/* Get a DN */
+char *build_dn_from_dc_list (char **dc_list, unsigned int ttl, int flag);
+
+/* Add to RR list */
+void add_to_rr_list (char *dn, char *name, char *type, char *data,
+ unsigned int ttl, unsigned int flags);
+
+/* Error checking */
+void isc_result_check (isc_result_t res, char *errorstr);
+
+/* Generate LDIF Format files */
+void generate_ldap (dns_name_t * dnsname, dns_rdata_t * rdata,
+ unsigned int ttl);
+
+/* head pointer to the list */
+ldap_info *ldap_info_base = NULL;
+
+char *argzone, *ldapbase, *binddn, *bindpw = NULL;
+char *ldapsystem = "localhost";
+static char *objectClasses[] =
+ { "top", "dNSZone", NULL };
+static char *topObjectClasses[] = { "top", NULL };
+LDAP *conn;
+unsigned int debug = 0;
+
+#ifdef DEBUG
+debug = 1;
+#endif
+
+int
+main (int *argc, char **argv)
+{
+ isc_mem_t *mctx = NULL;
+ isc_entropy_t *ectx = NULL;
+ isc_result_t result;
+ char *basedn;
+ ldap_info *tmp;
+ LDAPMod *base_attrs[2];
+ LDAPMod base;
+ isc_buffer_t buff;
+ char *zonefile;
+ char fullbasedn[1024];
+ char *ctmp;
+ dns_fixedname_t fixedzone, fixedname;
+ dns_rdataset_t rdataset;
+ char **dc_list;
+ dns_rdata_t rdata = DNS_RDATA_INIT;
+ dns_rdatasetiter_t *riter;
+ dns_name_t *zone, *name;
+ dns_db_t *db = NULL;
+ dns_dbiterator_t *dbit = NULL;
+ dns_dbnode_t *node;
+ extern char *optarg;
+ extern int optind, opterr, optopt;
+ int create_base = 0;
+ int topt;
+
+ if ((int) argc < 2)
+ {
+ usage ();
+ exit (-1);
+ }
+
+ while ((topt = getopt ((int) argc, argv, "D:w:b:z:f:h:?dcv")) != -1)
+ {
+ switch (topt)
+ {
+ case 'v':
+ printf("%s\n", VERSION);
+ exit(0);
+ case 'c':
+ create_base++;
+ break;
+ case 'd':
+ debug++;
+ break;
+ case 'D':
+ binddn = strdup (optarg);
+ break;
+ case 'w':
+ bindpw = strdup (optarg);
+ break;
+ case 'b':
+ ldapbase = strdup (optarg);
+ break;
+ case 'z':
+ argzone = strdup (optarg);
+ // We wipe argzone all to hell when we parse it for the DN */
+ gbl_zone = strdup(argzone);
+ break;
+ case 'f':
+ zonefile = strdup (optarg);
+ break;
+ case 'h':
+ ldapsystem = strdup (optarg);
+ break;
+ case '?':
+ default:
+ usage ();
+ exit (0);
+ }
+ }
+
+ if ((argzone == NULL) || (zonefile == NULL))
+ {
+ usage ();
+ exit (-1);
+ }
+
+ if (debug)
+ printf ("Initializing ISC Routines, parsing zone file\n");
+
+ result = isc_mem_create (0, 0, &mctx);
+ isc_result_check (result, "isc_mem_create");
+
+ result = isc_entropy_create(mctx, &ectx);
+ isc_result_check (result, "isc_entropy_create");
+
+ result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE);
+ isc_result_check (result, "isc_hash_create");
+
+ isc_buffer_init (&buff, argzone, strlen (argzone));
+ isc_buffer_add (&buff, strlen (argzone));
+ dns_fixedname_init (&fixedzone);
+ zone = dns_fixedname_name (&fixedzone);
+ result = dns_name_fromtext (zone, &buff, dns_rootname, ISC_FALSE, NULL);
+ isc_result_check (result, "dns_name_fromtext");
+
+ result = dns_db_create (mctx, "rbt", zone, dns_dbtype_zone,
+ dns_rdataclass_in, 0, NULL, &db);
+ isc_result_check (result, "dns_db_create");
+
+ result = dns_db_load (db, zonefile);
+ isc_result_check (result, "Check Zone Syntax: dns_db_load");
+
+ result = dns_db_createiterator (db, 0, &dbit);
+ isc_result_check (result, "dns_db_createiterator");
+
+ result = dns_dbiterator_first (dbit);
+ isc_result_check (result, "dns_dbiterator_first");
+
+ dns_fixedname_init (&fixedname);
+ name = dns_fixedname_name (&fixedname);
+ dns_rdataset_init (&rdataset);
+ dns_rdata_init (&rdata);
+
+ while (result == ISC_R_SUCCESS)
+ {
+ node = NULL;
+ result = dns_dbiterator_current (dbit, &node, name);
+
+ if (result == ISC_R_NOMORE)
+ break;
+
+ isc_result_check (result, "dns_dbiterator_current");
+
+ riter = NULL;
+ result = dns_db_allrdatasets (db, node, NULL, 0, &riter);
+ isc_result_check (result, "dns_db_allrdatasets");
+
+ result = dns_rdatasetiter_first (riter);
+ //isc_result_check(result, "dns_rdatasetiter_first");
+
+ while (result == ISC_R_SUCCESS)
+ {
+ dns_rdatasetiter_current (riter, &rdataset);
+ result = dns_rdataset_first (&rdataset);
+ isc_result_check (result, "dns_rdatasetiter_current");
+
+ while (result == ISC_R_SUCCESS)
+ {
+ dns_rdataset_current (&rdataset, &rdata);
+ generate_ldap (name, &rdata, rdataset.ttl);
+ dns_rdata_reset (&rdata);
+ result = dns_rdataset_next (&rdataset);
+ }
+ dns_rdataset_disassociate (&rdataset);
+ result = dns_rdatasetiter_next (riter);
+
+ }
+ dns_rdatasetiter_destroy (&riter);
+ result = dns_dbiterator_next (dbit);
+
+ }
+
+ /* Initialize the LDAP Connection */
+ if (debug)
+ printf ("Initializing LDAP Connection to %s as %s\n", ldapsystem, binddn);
+
+ init_ldap_conn ();
+
+ if (create_base)
+ {
+ if (debug)
+ printf ("Creating base zone DN %s\n", argzone);
+
+ dc_list = hostname_to_dn_list (argzone, argzone, DNS_TOP);
+ basedn = build_dn_from_dc_list (dc_list, 0, NO_SPEC);
+
+ for (ctmp = &basedn[strlen (basedn)]; ctmp >= &basedn[0]; ctmp--)
+ {
+ if ((*ctmp == ',') || (ctmp == &basedn[0]))
+ {
+ base.mod_op = LDAP_MOD_ADD;
+ base.mod_type = "objectClass";
+ base.mod_values = topObjectClasses;
+ base_attrs[0] = &base;
+ base_attrs[1] = NULL;
+
+ if (ldapbase)
+ {
+ if (ctmp != &basedn[0])
+ sprintf (fullbasedn, "%s,%s", ctmp + 1, ldapbase);
+ else
+ sprintf (fullbasedn, "%s,%s", ctmp, ldapbase);
+
+ }
+ else
+ {
+ if (ctmp != &basedn[0])
+ sprintf (fullbasedn, "%s", ctmp + 1);
+ else
+ sprintf (fullbasedn, "%s", ctmp);
+ }
+ result = ldap_add_s (conn, fullbasedn, base_attrs);
+ ldap_result_check ("intial ldap_add_s", fullbasedn, result);
+ }
+
+ }
+ }
+ else
+ {
+ if (debug)
+ printf ("Skipping zone base dn creation for %s\n", argzone);
+ }
+
+ for (tmp = ldap_info_base; tmp != NULL; tmp = tmp->next)
+ {
+
+ if (debug)
+ printf ("Adding DN: %s\n", tmp->dn);
+
+ add_ldap_values (tmp);
+ }
+
+ if (debug)
+ printf("Operation Complete.\n");
+
+ /* Cleanup */
+ isc_hash_destroy();
+ isc_entropy_detach(&ectx);
+ isc_mem_destroy(&mctx);
+
+ return 0;
+}
+
+
+/* Check the status of an isc_result_t after any isc routines.
+ * I should probably rename this function, as not to cause any
+ * confusion with the isc* routines. Will exit on error. */
+void
+isc_result_check (isc_result_t res, char *errorstr)
+{
+ if (res != ISC_R_SUCCESS)
+ {
+ fprintf (stderr, " %s: %s\n", errorstr, isc_result_totext (res));
+ exit (-1);
+ }
+}
+
+
+/* Takes DNS information, in bind data structure format, and adds textual
+ * zone information to the LDAP run queue. */
+void
+generate_ldap (dns_name_t * dnsname, dns_rdata_t * rdata, unsigned int ttl)
+{
+ unsigned char name[DNS_NAME_MAXTEXT + 1];
+ unsigned int len;
+ unsigned char type[20];
+ unsigned char data[2048];
+ char **dc_list;
+ char *dn;
+
+ isc_buffer_t buff;
+ isc_result_t result;
+
+ isc_buffer_init (&buff, name, sizeof (name));
+ result = dns_name_totext (dnsname, ISC_TRUE, &buff);
+ isc_result_check (result, "dns_name_totext");
+ name[isc_buffer_usedlength (&buff)] = 0;
+
+ isc_buffer_init (&buff, type, sizeof (type));
+ result = dns_rdatatype_totext (rdata->type, &buff);
+ isc_result_check (result, "dns_rdatatype_totext");
+ type[isc_buffer_usedlength (&buff)] = 0;
+
+ isc_buffer_init (&buff, data, sizeof (data));
+ result = dns_rdata_totext (rdata, NULL, &buff);
+ isc_result_check (result, "dns_rdata_totext");
+ data[isc_buffer_usedlength (&buff)] = 0;
+
+ dc_list = hostname_to_dn_list (name, argzone, DNS_OBJECT);
+ len = (get_attr_list_size (dc_list) - 2);
+ dn = build_dn_from_dc_list (dc_list, ttl, WI_SPEC);
+
+ if (debug)
+ printf ("Adding %s (%s %s) to run queue list.\n", dn, type, data);
+
+ add_to_rr_list (dn, dc_list[len], type, data, ttl, DNS_OBJECT);
+}
+
+
+/* Locate an item in the Run queue linked list, by DN. Used by functions
+ * which add items to the run queue.
+ */
+ldap_info *
+locate_by_dn (char *dn)
+{
+ ldap_info *tmp;
+ for (tmp = ldap_info_base; tmp != (ldap_info *) NULL; tmp = tmp->next)
+ {
+ if (!strncmp (tmp->dn, dn, strlen (dn)))
+ return tmp;
+ }
+ return (ldap_info *) NULL;
+}
+
+
+
+/* Take textual zone data, and add to the LDAP Run queue. This works like so:
+ * If locate_by_dn does not return, alloc a new ldap_info structure, and then
+ * calloc a LDAPMod array, fill in the default "everyone needs this" information,
+ * including object classes and dc's. If it locate_by_dn does return, then we'll
+ * realloc for more LDAPMod structs, and appened the new data. If an LDAPMod exists
+ * for the parameter we're adding, then we'll realloc the mod_values array, and
+ * add the new value to the existing LDAPMod. Finnaly, it assures linkage exists
+ * within the Run queue linked ilst*/
+
+void
+add_to_rr_list (char *dn, char *name, char *type,
+ char *data, unsigned int ttl, unsigned int flags)
+{
+ int i;
+ int x;
+ ldap_info *tmp;
+ int attrlist;
+ char ldap_type_buffer[128];
+ char charttl[64];
+
+
+ if ((tmp = locate_by_dn (dn)) == NULL)
+ {
+
+ /* There wasn't one already there, so we need to allocate a new one,
+ * and stick it on the list */
+
+ tmp = (ldap_info *) malloc (sizeof (ldap_info));
+ if (tmp == (ldap_info *) NULL)
+ {
+ fprintf (stderr, "malloc: %s\n", strerror (errno));
+ ldap_unbind_s (conn);
+ exit (-1);
+ }
+
+ tmp->dn = strdup (dn);
+ tmp->attrs = (LDAPMod **) calloc (sizeof (LDAPMod *), flags);
+ if (tmp->attrs == (LDAPMod **) NULL)
+ {
+ fprintf (stderr, "calloc: %s\n", strerror (errno));
+ ldap_unbind_s (conn);
+ exit (-1);
+ }
+
+ for (i = 0; i < flags; i++)
+ {
+ tmp->attrs[i] = (LDAPMod *) malloc (sizeof (LDAPMod));
+ if (tmp->attrs[i] == (LDAPMod *) NULL)
+ {
+ fprintf (stderr, "malloc: %s\n", strerror (errno));
+ exit (-1);
+ }
+ }
+ tmp->attrs[0]->mod_op = LDAP_MOD_ADD;
+ tmp->attrs[0]->mod_type = "objectClass";
+
+ if (flags == DNS_OBJECT)
+ tmp->attrs[0]->mod_values = objectClasses;
+ else
+ {
+ tmp->attrs[0]->mod_values = topObjectClasses;
+ tmp->attrs[1] = NULL;
+ tmp->attrcnt = 2;
+ tmp->next = ldap_info_base;
+ ldap_info_base = tmp;
+ return;
+ }
+
+ tmp->attrs[1]->mod_op = LDAP_MOD_ADD;
+ tmp->attrs[1]->mod_type = "relativeDomainName";
+ tmp->attrs[1]->mod_values = (char **) calloc (sizeof (char *), 2);
+
+ if (tmp->attrs[1]->mod_values == (char **)NULL)
+ exit(-1);
+
+ tmp->attrs[1]->mod_values[0] = strdup (name);
+ tmp->attrs[1]->mod_values[2] = NULL;
+
+ sprintf (ldap_type_buffer, "%sRecord", type);
+
+ tmp->attrs[2]->mod_op = LDAP_MOD_ADD;
+ tmp->attrs[2]->mod_type = strdup (ldap_type_buffer);
+ tmp->attrs[2]->mod_values = (char **) calloc (sizeof (char *), 2);
+
+ if (tmp->attrs[2]->mod_values == (char **)NULL)
+ exit(-1);
+
+ tmp->attrs[2]->mod_values[0] = strdup (data);
+ tmp->attrs[2]->mod_values[1] = NULL;
+
+ tmp->attrs[3]->mod_op = LDAP_MOD_ADD;
+ tmp->attrs[3]->mod_type = "dNSTTL";
+ tmp->attrs[3]->mod_values = (char **) calloc (sizeof (char *), 2);
+
+ if (tmp->attrs[3]->mod_values == (char **)NULL)
+ exit(-1);
+
+ sprintf (charttl, "%d", ttl);
+ tmp->attrs[3]->mod_values[0] = strdup (charttl);
+ tmp->attrs[3]->mod_values[1] = NULL;
+
+ tmp->attrs[4]->mod_op = LDAP_MOD_ADD;
+ tmp->attrs[4]->mod_type = "zoneName";
+ tmp->attrs[4]->mod_values = (char **)calloc(sizeof(char *), 2);
+ tmp->attrs[4]->mod_values[0] = gbl_zone;
+ tmp->attrs[4]->mod_values[1] = NULL;
+
+ tmp->attrs[5] = NULL;
+ tmp->attrcnt = flags;
+ tmp->next = ldap_info_base;
+ ldap_info_base = tmp;
+ }
+ else
+ {
+
+ for (i = 0; tmp->attrs[i] != NULL; i++)
+ {
+ sprintf (ldap_type_buffer, "%sRecord", type);
+ if (!strncmp
+ (ldap_type_buffer, tmp->attrs[i]->mod_type,
+ strlen (tmp->attrs[i]->mod_type)))
+ {
+ attrlist = get_attr_list_size (tmp->attrs[i]->mod_values);
+ tmp->attrs[i]->mod_values =
+ (char **) realloc (tmp->attrs[i]->mod_values,
+ sizeof (char *) * (attrlist + 1));
+
+ if (tmp->attrs[i]->mod_values == (char **) NULL)
+ {
+ fprintf (stderr, "realloc: %s\n", strerror (errno));
+ ldap_unbind_s (conn);
+ exit (-1);
+ }
+ for (x = 0; tmp->attrs[i]->mod_values[x] != NULL; x++);
+
+ tmp->attrs[i]->mod_values[x] = strdup (data);
+ tmp->attrs[i]->mod_values[x + 1] = NULL;
+ return;
+ }
+ }
+ tmp->attrs =
+ (LDAPMod **) realloc (tmp->attrs,
+ sizeof (LDAPMod) * ++(tmp->attrcnt));
+ if (tmp->attrs == NULL)
+ {
+ fprintf (stderr, "realloc: %s\n", strerror (errno));
+ ldap_unbind_s (conn);
+ exit (-1);
+ }
+
+ for (x = 0; tmp->attrs[x] != NULL; x++);
+ tmp->attrs[x] = (LDAPMod *) malloc (sizeof (LDAPMod));
+ tmp->attrs[x]->mod_op = LDAP_MOD_ADD;
+ tmp->attrs[x]->mod_type = strdup (ldap_type_buffer);
+ tmp->attrs[x]->mod_values = (char **) calloc (sizeof (char *), 2);
+ tmp->attrs[x]->mod_values[0] = strdup (data);
+ tmp->attrs[x]->mod_values[1] = NULL;
+ tmp->attrs[x + 1] = NULL;
+ }
+}
+
+/* Size of a mod_values list, plus the terminating NULL field. */
+int
+get_attr_list_size (char **tmp)
+{
+ int i = 0;
+ char **ftmp = tmp;
+ while (*ftmp != NULL)
+ {
+ i++;
+ ftmp++;
+ }
+ return ++i;
+}
+
+
+/* take a hostname, and split it into a char ** of the dc parts,
+ * example, we have www.domain.com, this function will return:
+ * array[0] = com, array[1] = domain, array[2] = www. */
+
+char **
+hostname_to_dn_list (char *hostname, char *zone, unsigned int flags)
+{
+ char *tmp;
+ static char *dn_buffer[64];
+ int i = 0;
+ char *zname;
+ char *hnamebuff;
+
+ zname = strdup (hostname);
+
+ if (flags == DNS_OBJECT)
+ {
+
+ if (strlen (zname) != strlen (zone))
+ {
+ tmp = &zname[strlen (zname) - strlen (zone)];
+ *--tmp = '\0';
+ hnamebuff = strdup (zname);
+ zname = ++tmp;
+ }
+ else
+ hnamebuff = "@";
+ }
+ else
+ {
+ zname = zone;
+ hnamebuff = NULL;
+ }
+
+ for (tmp = strrchr (zname, '.'); tmp != (char *) 0;
+ tmp = strrchr (zname, '.'))
+ {
+ *tmp++ = '\0';
+ dn_buffer[i++] = tmp;
+ }
+ dn_buffer[i++] = zname;
+ dn_buffer[i++] = hnamebuff;
+ dn_buffer[i] = NULL;
+
+ return dn_buffer;
+}
+
+
+/* build an sdb compatible LDAP DN from a "dc_list" (char **).
+ * will append dNSTTL information to each RR Record, with the
+ * exception of "@"/SOA. */
+
+char *
+build_dn_from_dc_list (char **dc_list, unsigned int ttl, int flag)
+{
+ int size;
+ int x;
+ static char dn[1024];
+ char tmp[128];
+
+ bzero (tmp, sizeof (tmp));
+ bzero (dn, sizeof (dn));
+ size = get_attr_list_size (dc_list);
+ for (x = size - 2; x > 0; x--)
+ {
+ if (flag == WI_SPEC)
+ {
+ if (x == (size - 2) && (strncmp (dc_list[x], "@", 1) == 0) && (ttl))
+ sprintf (tmp, "relativeDomainName=%s + dNSTTL=%d,", dc_list[x], ttl);
+ else if (x == (size - 2))
+ sprintf(tmp, "relativeDomainName=%s,",dc_list[x]);
+ else
+ sprintf(tmp,"dc=%s,", dc_list[x]);
+ }
+ else
+ {
+ sprintf(tmp, "dc=%s,", dc_list[x]);
+ }
+
+
+ strncat (dn, tmp, sizeof (dn) - strlen (dn));
+ }
+
+ sprintf (tmp, "dc=%s", dc_list[0]);
+ strncat (dn, tmp, sizeof (dn) - strlen (dn));
+
+ fflush(NULL);
+ return dn;
+}
+
+
+/* Initialize LDAP Conn */
+void
+init_ldap_conn ()
+{
+ int result;
+ conn = ldap_open (ldapsystem, LDAP_PORT);
+ if (conn == NULL)
+ {
+ fprintf (stderr, "Error opening Ldap connection: %s\n",
+ strerror (errno));
+ exit (-1);
+ }
+
+ result = ldap_simple_bind_s (conn, binddn, bindpw);
+ ldap_result_check ("ldap_simple_bind_s", "LDAP Bind", result);
+}
+
+/* Like isc_result_check, only for LDAP */
+void
+ldap_result_check (char *msg, char *dn, int err)
+{
+ if ((err != LDAP_SUCCESS) && (err != LDAP_ALREADY_EXISTS))
+ {
+ fprintf(stderr, "Error while adding %s (%s):\n",
+ dn, msg);
+ ldap_perror (conn, dn);
+ ldap_unbind_s (conn);
+ exit (-1);
+ }
+}
+
+
+
+/* For running the ldap_info run queue. */
+void
+add_ldap_values (ldap_info * ldinfo)
+{
+ int result;
+ char dnbuffer[1024];
+
+
+ if (ldapbase != NULL)
+ sprintf (dnbuffer, "%s,%s", ldinfo->dn, ldapbase);
+ else
+ sprintf (dnbuffer, "%s", ldinfo->dn);
+
+ result = ldap_add_s (conn, dnbuffer, ldinfo->attrs);
+ ldap_result_check ("ldap_add_s", dnbuffer, result);
+}
+
+
+
+
+/* name says it all */
+void
+usage ()
+{
+ fprintf (stderr,
+ "zone2ldap -D [BIND DN] -w [BIND PASSWORD] -b [BASE DN] -z [ZONE] -f [ZONE FILE] -h [LDAP HOST]
+ [-c Create LDAP Base structure][-d Debug Output (lots !)] \n ");}
diff --git a/contrib/sdb/pgsql/pgsqldb.c b/contrib/sdb/pgsql/pgsqldb.c
new file mode 100644
index 0000000..ca3bfbf
--- /dev/null
+++ b/contrib/sdb/pgsql/pgsqldb.c
@@ -0,0 +1,348 @@
+/*
+ * Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000, 2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: pgsqldb.c,v 1.15 2007/06/19 23:47:07 tbox Exp $ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <pgsql/libpq-fe.h>
+
+#include <isc/mem.h>
+#include <isc/print.h>
+#include <isc/result.h>
+#include <isc/util.h>
+
+#include <dns/sdb.h>
+#include <dns/result.h>
+
+#include <named/globals.h>
+
+#include "pgsqldb.h"
+
+/*
+ * A simple database driver that interfaces to a PostgreSQL database. This
+ * is not complete, and not designed for general use. It opens one
+ * connection to the database per zone, which is inefficient. It also may
+ * not handle quoting correctly.
+ *
+ * The table must contain the fields "name", "rdtype", and "rdata", and
+ * is expected to contain a properly constructed zone. The program "zonetodb"
+ * creates such a table.
+ */
+
+static dns_sdbimplementation_t *pgsqldb = NULL;
+
+struct dbinfo {
+ PGconn *conn;
+ char *database;
+ char *table;
+ char *host;
+ char *user;
+ char *passwd;
+};
+
+static void
+pgsqldb_destroy(const char *zone, void *driverdata, void **dbdata);
+
+/*
+ * Canonicalize a string before writing it to the database.
+ * "dest" must be an array of at least size 2*strlen(source) + 1.
+ */
+static void
+quotestring(const char *source, char *dest) {
+ while (*source != 0) {
+ if (*source == '\'')
+ *dest++ = '\'';
+ /* SQL doesn't treat \ as special, but PostgreSQL does */
+ else if (*source == '\\')
+ *dest++ = '\\';
+ *dest++ = *source++;
+ }
+ *dest++ = 0;
+}
+
+/*
+ * Connect to the database.
+ */
+static isc_result_t
+db_connect(struct dbinfo *dbi) {
+ dbi->conn = PQsetdbLogin(dbi->host, NULL, NULL, NULL, dbi->database,
+ dbi->user, dbi->passwd);
+
+ if (PQstatus(dbi->conn) == CONNECTION_OK)
+ return (ISC_R_SUCCESS);
+ else
+ return (ISC_R_FAILURE);
+}
+
+/*
+ * Check to see if the connection is still valid. If not, attempt to
+ * reconnect.
+ */
+static isc_result_t
+maybe_reconnect(struct dbinfo *dbi) {
+ if (PQstatus(dbi->conn) == CONNECTION_OK)
+ return (ISC_R_SUCCESS);
+
+ return (db_connect(dbi));
+}
+
+/*
+ * This database operates on absolute names.
+ *
+ * Queries are converted into SQL queries and issued synchronously. Errors
+ * are handled really badly.
+ */
+static isc_result_t
+pgsqldb_lookup(const char *zone, const char *name, void *dbdata,
+ dns_sdblookup_t *lookup)
+{
+ isc_result_t result;
+ struct dbinfo *dbi = dbdata;
+ PGresult *res;
+ char str[1500];
+ char *canonname;
+ int i;
+
+ UNUSED(zone);
+
+ canonname = isc_mem_get(ns_g_mctx, strlen(name) * 2 + 1);
+ if (canonname == NULL)
+ return (ISC_R_NOMEMORY);
+ quotestring(name, canonname);
+ snprintf(str, sizeof(str),
+ "SELECT TTL,RDTYPE,RDATA FROM \"%s\" WHERE "
+ "lower(NAME) = lower('%s')", dbi->table, canonname);
+ isc_mem_put(ns_g_mctx, canonname, strlen(name) * 2 + 1);
+
+ result = maybe_reconnect(dbi);
+ if (result != ISC_R_SUCCESS)
+ return (result);
+
+ res = PQexec(dbi->conn, str);
+ if (!res || PQresultStatus(res) != PGRES_TUPLES_OK) {
+ PQclear(res);
+ return (ISC_R_FAILURE);
+ }
+ if (PQntuples(res) == 0) {
+ PQclear(res);
+ return (ISC_R_NOTFOUND);
+ }
+
+ for (i = 0; i < PQntuples(res); i++) {
+ char *ttlstr = PQgetvalue(res, i, 0);
+ char *type = PQgetvalue(res, i, 1);
+ char *data = PQgetvalue(res, i, 2);
+ dns_ttl_t ttl;
+ char *endp;
+ ttl = strtol(ttlstr, &endp, 10);
+ if (*endp != '\0') {
+ PQclear(res);
+ return (DNS_R_BADTTL);
+ }
+ result = dns_sdb_putrr(lookup, type, ttl, data);
+ if (result != ISC_R_SUCCESS) {
+ PQclear(res);
+ return (ISC_R_FAILURE);
+ }
+ }
+
+ PQclear(res);
+ return (ISC_R_SUCCESS);
+}
+
+/*
+ * Issue an SQL query to return all nodes in the database and fill the
+ * allnodes structure.
+ */
+static isc_result_t
+pgsqldb_allnodes(const char *zone, void *dbdata, dns_sdballnodes_t *allnodes) {
+ struct dbinfo *dbi = dbdata;
+ PGresult *res;
+ isc_result_t result;
+ char str[1500];
+ int i;
+
+ UNUSED(zone);
+
+ snprintf(str, sizeof(str),
+ "SELECT TTL,NAME,RDTYPE,RDATA FROM \"%s\" ORDER BY NAME",
+ dbi->table);
+
+ result = maybe_reconnect(dbi);
+ if (result != ISC_R_SUCCESS)
+ return (result);
+
+ res = PQexec(dbi->conn, str);
+ if (!res || PQresultStatus(res) != PGRES_TUPLES_OK ) {
+ PQclear(res);
+ return (ISC_R_FAILURE);
+ }
+ if (PQntuples(res) == 0) {
+ PQclear(res);
+ return (ISC_R_NOTFOUND);
+ }
+
+ for (i = 0; i < PQntuples(res); i++) {
+ char *ttlstr = PQgetvalue(res, i, 0);
+ char *name = PQgetvalue(res, i, 1);
+ char *type = PQgetvalue(res, i, 2);
+ char *data = PQgetvalue(res, i, 3);
+ dns_ttl_t ttl;
+ char *endp;
+ ttl = strtol(ttlstr, &endp, 10);
+ if (*endp != '\0') {
+ PQclear(res);
+ return (DNS_R_BADTTL);
+ }
+ result = dns_sdb_putnamedrr(allnodes, name, type, ttl, data);
+ if (result != ISC_R_SUCCESS) {
+ PQclear(res);
+ return (ISC_R_FAILURE);
+ }
+ }
+
+ PQclear(res);
+ return (ISC_R_SUCCESS);
+}
+
+/*
+ * Create a connection to the database and save any necessary information
+ * in dbdata.
+ *
+ * argv[0] is the name of the database
+ * argv[1] is the name of the table
+ * argv[2] (if present) is the name of the host to connect to
+ * argv[3] (if present) is the name of the user to connect as
+ * argv[4] (if present) is the name of the password to connect with
+ */
+static isc_result_t
+pgsqldb_create(const char *zone, int argc, char **argv,
+ void *driverdata, void **dbdata)
+{
+ struct dbinfo *dbi;
+ isc_result_t result;
+
+ UNUSED(zone);
+ UNUSED(driverdata);
+
+ if (argc < 2)
+ return (ISC_R_FAILURE);
+
+ dbi = isc_mem_get(ns_g_mctx, sizeof(struct dbinfo));
+ if (dbi == NULL)
+ return (ISC_R_NOMEMORY);
+ dbi->conn = NULL;
+ dbi->database = NULL;
+ dbi->table = NULL;
+ dbi->host = NULL;
+ dbi->user = NULL;
+ dbi->passwd = NULL;
+
+#define STRDUP_OR_FAIL(target, source) \
+ do { \
+ target = isc_mem_strdup(ns_g_mctx, source); \
+ if (target == NULL) { \
+ result = ISC_R_NOMEMORY; \
+ goto cleanup; \
+ } \
+ } while (0);
+
+ STRDUP_OR_FAIL(dbi->database, argv[0]);
+ STRDUP_OR_FAIL(dbi->table, argv[1]);
+ if (argc > 2)
+ STRDUP_OR_FAIL(dbi->host, argv[2]);
+ if (argc > 3)
+ STRDUP_OR_FAIL(dbi->user, argv[3]);
+ if (argc > 4)
+ STRDUP_OR_FAIL(dbi->passwd, argv[4]);
+
+ result = db_connect(dbi);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+
+ *dbdata = dbi;
+ return (ISC_R_SUCCESS);
+
+ cleanup:
+ pgsqldb_destroy(zone, driverdata, (void **)&dbi);
+ return (result);
+}
+
+/*
+ * Close the connection to the database.
+ */
+static void
+pgsqldb_destroy(const char *zone, void *driverdata, void **dbdata) {
+ struct dbinfo *dbi = *dbdata;
+
+ UNUSED(zone);
+ UNUSED(driverdata);
+
+ if (dbi->conn != NULL)
+ PQfinish(dbi->conn);
+ if (dbi->database != NULL)
+ isc_mem_free(ns_g_mctx, dbi->database);
+ if (dbi->table != NULL)
+ isc_mem_free(ns_g_mctx, dbi->table);
+ if (dbi->host != NULL)
+ isc_mem_free(ns_g_mctx, dbi->host);
+ if (dbi->user != NULL)
+ isc_mem_free(ns_g_mctx, dbi->user);
+ if (dbi->passwd != NULL)
+ isc_mem_free(ns_g_mctx, dbi->passwd);
+ if (dbi->database != NULL)
+ isc_mem_free(ns_g_mctx, dbi->database);
+ isc_mem_put(ns_g_mctx, dbi, sizeof(struct dbinfo));
+}
+
+/*
+ * Since the SQL database corresponds to a zone, the authority data should
+ * be returned by the lookup() function. Therefore the authority() function
+ * is NULL.
+ */
+static dns_sdbmethods_t pgsqldb_methods = {
+ pgsqldb_lookup,
+ NULL, /* authority */
+ pgsqldb_allnodes,
+ pgsqldb_create,
+ pgsqldb_destroy
+};
+
+/*
+ * Wrapper around dns_sdb_register().
+ */
+isc_result_t
+pgsqldb_init(void) {
+ unsigned int flags;
+ flags = 0;
+ return (dns_sdb_register("pgsql", &pgsqldb_methods, NULL, flags,
+ ns_g_mctx, &pgsqldb));
+}
+
+/*
+ * Wrapper around dns_sdb_unregister().
+ */
+void
+pgsqldb_clear(void) {
+ if (pgsqldb != NULL)
+ dns_sdb_unregister(&pgsqldb);
+}
diff --git a/contrib/sdb/pgsql/pgsqldb.h b/contrib/sdb/pgsql/pgsqldb.h
new file mode 100644
index 0000000..20dc742
--- /dev/null
+++ b/contrib/sdb/pgsql/pgsqldb.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000, 2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: pgsqldb.h,v 1.5 2007/06/19 23:47:08 tbox Exp $ */
+
+#include <isc/types.h>
+
+isc_result_t pgsqldb_init(void);
+
+void pgsqldb_clear(void);
+
diff --git a/contrib/sdb/pgsql/zonetodb.c b/contrib/sdb/pgsql/zonetodb.c
new file mode 100644
index 0000000..ba93027
--- /dev/null
+++ b/contrib/sdb/pgsql/zonetodb.c
@@ -0,0 +1,292 @@
+/*
+ * Copyright (C) 2004, 2005, 2007, 2008 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000-2002 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: zonetodb.c,v 1.20 2008/09/25 04:02:38 tbox Exp $ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <isc/buffer.h>
+#include <isc/entropy.h>
+#include <isc/hash.h>
+#include <isc/mem.h>
+#include <isc/print.h>
+#include <isc/result.h>
+
+#include <dns/db.h>
+#include <dns/dbiterator.h>
+#include <dns/fixedname.h>
+#include <dns/name.h>
+#include <dns/rdata.h>
+#include <dns/rdataset.h>
+#include <dns/rdatasetiter.h>
+#include <dns/rdatatype.h>
+#include <dns/result.h>
+
+#include <pgsql/libpq-fe.h>
+
+/*
+ * Generate a PostgreSQL table from a zone.
+ *
+ * This is compiled this with something like the following (assuming bind9 has
+ * been installed):
+ *
+ * gcc -g `isc-config.sh --cflags isc dns` -c zonetodb.c
+ * gcc -g -o zonetodb zonetodb.o `isc-config.sh --libs isc dns` -lpq
+ */
+
+PGconn *conn = NULL;
+char *dbname, *dbtable;
+char str[10240];
+
+void
+closeandexit(int status) {
+ if (conn != NULL)
+ PQfinish(conn);
+ exit(status);
+}
+
+void
+check_result(isc_result_t result, const char *message) {
+ if (result != ISC_R_SUCCESS) {
+ fprintf(stderr, "%s: %s\n", message,
+ isc_result_totext(result));
+ closeandexit(1);
+ }
+}
+
+/*
+ * Canonicalize a string before writing it to the database.
+ * "dest" must be an array of at least size 2*strlen(source) + 1.
+ */
+static void
+quotestring(const char *source, char *dest) {
+ while (*source != 0) {
+ if (*source == '\'')
+ *dest++ = '\'';
+ else if (*source == '\\')
+ *dest++ = '\\';
+ *dest++ = *source++;
+ }
+ *dest++ = 0;
+}
+
+void
+addrdata(dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata) {
+ unsigned char namearray[DNS_NAME_MAXTEXT + 1];
+ unsigned char canonnamearray[2 * DNS_NAME_MAXTEXT + 1];
+ unsigned char typearray[20];
+ unsigned char canontypearray[40];
+ unsigned char dataarray[2048];
+ unsigned char canondataarray[4096];
+ isc_buffer_t b;
+ isc_result_t result;
+ PGresult *res;
+
+ isc_buffer_init(&b, namearray, sizeof(namearray) - 1);
+ result = dns_name_totext(name, ISC_TRUE, &b);
+ check_result(result, "dns_name_totext");
+ namearray[isc_buffer_usedlength(&b)] = 0;
+ quotestring(namearray, canonnamearray);
+
+ isc_buffer_init(&b, typearray, sizeof(typearray) - 1);
+ result = dns_rdatatype_totext(rdata->type, &b);
+ check_result(result, "dns_rdatatype_totext");
+ typearray[isc_buffer_usedlength(&b)] = 0;
+ quotestring(typearray, canontypearray);
+
+ isc_buffer_init(&b, dataarray, sizeof(dataarray) - 1);
+ result = dns_rdata_totext(rdata, NULL, &b);
+ check_result(result, "dns_rdata_totext");
+ dataarray[isc_buffer_usedlength(&b)] = 0;
+ quotestring(dataarray, canondataarray);
+
+ snprintf(str, sizeof(str),
+ "INSERT INTO %s (NAME, TTL, RDTYPE, RDATA)"
+ " VALUES ('%s', %d, '%s', '%s')",
+ dbtable, canonnamearray, ttl, canontypearray, canondataarray);
+ printf("%s\n", str);
+ res = PQexec(conn, str);
+ if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) {
+ fprintf(stderr, "INSERT INTO command failed: %s\n",
+ PQresultErrorMessage(res));
+ PQclear(res);
+ closeandexit(1);
+ }
+ PQclear(res);
+}
+
+int
+main(int argc, char **argv) {
+ char *porigin, *zonefile;
+ dns_fixedname_t forigin, fname;
+ dns_name_t *origin, *name;
+ dns_db_t *db = NULL;
+ dns_dbiterator_t *dbiter;
+ dns_dbnode_t *node;
+ dns_rdatasetiter_t *rdsiter;
+ dns_rdataset_t rdataset;
+ dns_rdata_t rdata = DNS_RDATA_INIT;
+ isc_mem_t *mctx = NULL;
+ isc_entropy_t *ectx = NULL;
+ isc_buffer_t b;
+ isc_result_t result;
+ PGresult *res;
+
+ if (argc != 5) {
+ printf("usage: %s origin file dbname dbtable\n", argv[0]);
+ printf("Note that dbname must be an existing database.\n");
+ exit(1);
+ }
+
+ porigin = argv[1];
+ zonefile = argv[2];
+ dbname = argv[3];
+ dbtable = argv[4];
+
+ dns_result_register();
+
+ mctx = NULL;
+ result = isc_mem_create(0, 0, &mctx);
+ check_result(result, "isc_mem_create");
+
+ result = isc_entropy_create(mctx, &ectx);
+ result_check (result, "isc_entropy_create");
+
+ result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE);
+ check_result (result, "isc_hash_create");
+
+ isc_buffer_init(&b, porigin, strlen(porigin));
+ isc_buffer_add(&b, strlen(porigin));
+ dns_fixedname_init(&forigin);
+ origin = dns_fixedname_name(&forigin);
+ result = dns_name_fromtext(origin, &b, dns_rootname, ISC_FALSE, NULL);
+ check_result(result, "dns_name_fromtext");
+
+ db = NULL;
+ result = dns_db_create(mctx, "rbt", origin, dns_dbtype_zone,
+ dns_rdataclass_in, 0, NULL, &db);
+ check_result(result, "dns_db_create");
+
+ result = dns_db_load(db, zonefile);
+ if (result == DNS_R_SEENINCLUDE)
+ result = ISC_R_SUCCESS;
+ check_result(result, "dns_db_load");
+
+ printf("Connecting to '%s'\n", dbname);
+ conn = PQsetdb(NULL, NULL, NULL, NULL, dbname);
+ if (PQstatus(conn) == CONNECTION_BAD) {
+ fprintf(stderr, "Connection to database '%s' failed: %s\n",
+ dbname, PQerrorMessage(conn));
+ closeandexit(1);
+ }
+
+ snprintf(str, sizeof(str),
+ "DROP TABLE %s", dbtable);
+ printf("%s\n", str);
+ res = PQexec(conn, str);
+ if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
+ fprintf(stderr, "DROP TABLE command failed: %s\n",
+ PQresultErrorMessage(res));
+ PQclear(res);
+
+ snprintf(str, sizeof(str), "BEGIN");
+ printf("%s\n", str);
+ res = PQexec(conn, str);
+ if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) {
+ fprintf(stderr, "BEGIN command failed: %s\n",
+ PQresultErrorMessage(res));
+ PQclear(res);
+ closeandexit(1);
+ }
+ PQclear(res);
+
+ snprintf(str, sizeof(str),
+ "CREATE TABLE %s "
+ "(NAME TEXT, TTL INTEGER, RDTYPE TEXT, RDATA TEXT)",
+ dbtable);
+ printf("%s\n", str);
+ res = PQexec(conn, str);
+ if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) {
+ fprintf(stderr, "CREATE TABLE command failed: %s\n",
+ PQresultErrorMessage(res));
+ PQclear(res);
+ closeandexit(1);
+ }
+ PQclear(res);
+
+ dbiter = NULL;
+ result = dns_db_createiterator(db, 0, &dbiter);
+ check_result(result, "dns_db_createiterator()");
+
+ result = dns_dbiterator_first(dbiter);
+ check_result(result, "dns_dbiterator_first");
+
+ dns_fixedname_init(&fname);
+ name = dns_fixedname_name(&fname);
+ dns_rdataset_init(&rdataset);
+ dns_rdata_init(&rdata);
+
+ while (result == ISC_R_SUCCESS) {
+ node = NULL;
+ result = dns_dbiterator_current(dbiter, &node, name);
+ if (result == ISC_R_NOMORE)
+ break;
+ check_result(result, "dns_dbiterator_current");
+
+ rdsiter = NULL;
+ result = dns_db_allrdatasets(db, node, NULL, 0, &rdsiter);
+ check_result(result, "dns_db_allrdatasets");
+
+ result = dns_rdatasetiter_first(rdsiter);
+
+ while (result == ISC_R_SUCCESS) {
+ dns_rdatasetiter_current(rdsiter, &rdataset);
+ result = dns_rdataset_first(&rdataset);
+ check_result(result, "dns_rdataset_first");
+ while (result == ISC_R_SUCCESS) {
+ dns_rdataset_current(&rdataset, &rdata);
+ addrdata(name, rdataset.ttl, &rdata);
+ dns_rdata_reset(&rdata);
+ result = dns_rdataset_next(&rdataset);
+ }
+ dns_rdataset_disassociate(&rdataset);
+ result = dns_rdatasetiter_next(rdsiter);
+ }
+ dns_rdatasetiter_destroy(&rdsiter);
+ dns_db_detachnode(db, &node);
+ result = dns_dbiterator_next(dbiter);
+ }
+
+ snprintf(str, sizeof(str), "COMMIT TRANSACTION");
+ printf("%s\n", str);
+ res = PQexec(conn, str);
+ if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) {
+ fprintf(stderr, "COMMIT command failed: %s\n",
+ PQresultErrorMessage(res));
+ PQclear(res);
+ closeandexit(1);
+ }
+ PQclear(res);
+ dns_dbiterator_destroy(&dbiter);
+ dns_db_detach(&db);
+ isc_hash_destroy();
+ isc_entropy_detach(&ectx);
+ isc_mem_destroy(&mctx);
+ closeandexit(0);
+ exit(0);
+}
diff --git a/contrib/sdb/sqlite/README.sdb_sqlite b/contrib/sdb/sqlite/README.sdb_sqlite
new file mode 100644
index 0000000..36128e1
--- /dev/null
+++ b/contrib/sdb/sqlite/README.sdb_sqlite
@@ -0,0 +1,67 @@
+ SQLite BIND SDB driver
+
+The SQLite BIND SDB "driver" is intended as an alternative both to the
+pgsqldb and dirdb drivers, for situations that would like the management
+simplicity and convenience of single filesystem files, with the additional
+capability of SQL databases. It is also intended as an alternative to
+the standard dynamic DNS update capability in bind, which effectively
+requires use of DNSSEC keys for authorization and is limited to 'nsupdate'
+for updates. An sqlite database, by contrast, uses and requires only
+normal filesystem permissions, and may be updated however a typical SQLite
+database might be updated, e.g., via a web service with an SQLite backend.
+
+This driver is not considered suitable for very high volume public
+nameserver use, while likely useful for smaller private nameserver
+applications, whether or not in a production environment. It should
+generally be suitable wherever SQLite is preferable over larger database
+engines, and not suitable where SQLite is not preferable.
+
+Usage:
+
+o Use the named_sdb process ( put ENABLE_SDB=yes in /etc/sysconfig/named )
+
+o Edit your named.conf to contain a database zone, eg.:
+
+zone "mydomain.net." IN {
+ type master;
+ database "sqlite /etc/named.d/mydomain.db mydomain";
+ # ^- DB file ^-Table
+};
+
+o Create the database zone table
+ The table must contain the columns "name", "rdtype", and "rdata", and
+ is expected to contain a properly constructed zone. The program
+ "zone2sqlite" creates such a table.
+
+ zone2sqlite usage:
+
+ zone2sqlite origin zonefile dbfile dbtable
+
+ where
+ origin : zone origin, eg "mydomain.net."
+ zonefile : master zone database file, eg. mydomain.net.zone
+ dbfile : name of SQLite database file
+ dbtable : name of table in database
+
+---
+# mydomain.net.zone:
+$TTL 1H
+@ SOA localhost. root.localhost. ( 1
+ 3H
+ 1H
+ 1W
+ 1H )
+ NS localhost.
+host1 A 192.168.2.1
+host2 A 192.168.2.2
+host3 A 192.168.2.3
+host4 A 192.168.2.4
+host5 A 192.168.2.5
+host6 A 192.168.2.6
+host7 A 192.168.2.7
+---
+
+# zone2sqlite mydomain.net. mydomain.net.zone mydomain.net.db mydomain
+
+will create/update the 'mydomain' table in database file 'mydomain.net.db'.
+
diff --git a/contrib/sdb/sqlite/sqlitedb.c b/contrib/sdb/sqlite/sqlitedb.c
new file mode 100644
index 0000000..c9d0096
--- /dev/null
+++ b/contrib/sdb/sqlite/sqlitedb.c
@@ -0,0 +1,324 @@
+/*
+ * Copyright (C) 2007 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: sqlitedb.c,v 1.1 2007/03/05 05:30:22 marka Exp $ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <sqlite3.h>
+
+#include <isc/mem.h>
+#include <isc/print.h>
+#include <isc/result.h>
+#include <isc/util.h>
+
+#include <dns/sdb.h>
+#include <dns/result.h>
+
+#include <named/globals.h>
+
+#include "sqlitedb.h"
+
+/*
+ * A simple database driver that interfaces to a SQLite database.
+ *
+ * The table must contain the fields "name", "rdtype", and "rdata", and
+ * is expected to contain a properly constructed zone. The program "zonetodb"
+ * creates such a table.
+ */
+
+static dns_sdbimplementation_t *sqlitedb = NULL;
+
+typedef struct _dbinfo {
+ sqlite3 *db;
+ char *filename;
+ char *table;
+} dbinfo_t;
+
+
+static isc_result_t
+db_connect(dbinfo_t *dbi)
+{
+ if (sqlite3_open(dbi->filename, &dbi->db) == SQLITE_OK) {
+ return (ISC_R_SUCCESS);
+ } else {
+ /* a connection is returned even if the open fails */
+ sqlite3_close(dbi->db);
+ dbi->db = NULL;
+ return (ISC_R_FAILURE);
+ }
+}
+
+
+typedef struct _lookup_parm_t {
+ int i;
+ dns_sdblookup_t *lookup;
+ isc_result_t result;
+} lookup_parm_t;
+
+
+static int
+sqlitedb_lookup_cb(void *p, int cc, char **cv, char **cn)
+{
+ lookup_parm_t *parm = p;
+ dns_ttl_t ttl;
+ char *endp;
+
+ /* FIXME - check these(num/names); I'm assuming a mapping for now */
+ char *ttlstr = cv[0];
+ char *type = cv[1];
+ char *data = cv[2];
+
+ UNUSED(cc);
+ UNUSED(cn);
+
+ ttl = strtol(ttlstr, &endp, 10);
+ if (*endp) {
+ parm->result = DNS_R_BADTTL;
+ return 1;
+ }
+
+ parm->result = dns_sdb_putrr(parm->lookup, type, ttl, data);
+
+ if (parm->result != ISC_R_SUCCESS)
+ return 1;
+
+ (parm->i)++;
+
+ return 0;
+}
+
+
+static isc_result_t
+sqlitedb_lookup(const char *zone,
+ const char *name, void *dbdata,
+ dns_sdblookup_t *lookup)
+/*
+ * synchronous absolute name lookup
+ */
+{
+ dbinfo_t *dbi = (dbinfo_t *) dbdata;
+ char *sql;
+ lookup_parm_t parm = { 0, lookup, ISC_R_SUCCESS };
+ char *errmsg = NULL;
+ int result;
+
+ UNUSED(zone);
+
+ sql = sqlite3_mprintf(
+ "SELECT TTL,RDTYPE,RDATA FROM \"%q\" WHERE "
+ "lower(NAME) = lower('%q')",
+ dbi->table, name);
+
+ result = sqlite3_exec(dbi->db, sql,
+ &sqlitedb_lookup_cb, &parm,
+ &errmsg);
+ sqlite3_free(sql);
+
+ if (result != SQLITE_OK)
+ return (ISC_R_FAILURE);
+ if (parm.i == 0)
+ return (ISC_R_NOTFOUND);
+
+ return (ISC_R_SUCCESS);
+}
+
+
+typedef struct _allnodes_parm_t {
+ int i;
+ dns_sdballnodes_t *allnodes;
+ isc_result_t result;
+} allnodes_parm_t;
+
+
+static int
+sqlitedb_allnodes_cb(void *p, int cc, char **cv, char **cn)
+{
+ allnodes_parm_t *parm = p;
+ dns_ttl_t ttl;
+ char *endp;
+
+ /* FIXME - check these(num/names); I'm assuming a mapping for now */
+ char *ttlstr = cv[0];
+ char *name = cv[1];
+ char *type = cv[2];
+ char *data = cv[3];
+
+ UNUSED(cc);
+ UNUSED(cn);
+
+ ttl = strtol(ttlstr, &endp, 10);
+ if (*endp) {
+ parm->result = DNS_R_BADTTL;
+ return 1;
+ }
+
+ parm->result = dns_sdb_putnamedrr(parm->allnodes, name, type, ttl, data);
+
+ if (parm->result != ISC_R_SUCCESS)
+ return 1;
+
+ (parm->i)++;
+
+ return 0;
+}
+
+
+static isc_result_t
+sqlitedb_allnodes(const char *zone,
+ void *dbdata,
+ dns_sdballnodes_t *allnodes)
+{
+ dbinfo_t *dbi = (dbinfo_t *) dbdata;
+ char *sql;
+ allnodes_parm_t parm = { 0, allnodes, ISC_R_SUCCESS };
+ char *errmsg = NULL;
+ int result;
+
+ UNUSED(zone);
+
+ sql = sqlite3_mprintf(
+ "SELECT TTL,NAME,RDTYPE,RDATA FROM \"%q\" ORDER BY NAME",
+ dbi->table);
+
+ result = sqlite3_exec(dbi->db, sql,
+ &sqlitedb_allnodes_cb, &parm,
+ &errmsg);
+ sqlite3_free(sql);
+
+ if (result != SQLITE_OK)
+ return (ISC_R_FAILURE);
+ if (parm.i == 0)
+ return (ISC_R_NOTFOUND);
+
+ return (ISC_R_SUCCESS);
+}
+
+
+static void
+sqlitedb_destroy(const char *zone, void *driverdata, void **dbdata)
+{
+ dbinfo_t *dbi = *dbdata;
+
+ UNUSED(zone);
+ UNUSED(driverdata);
+
+ if (dbi->db != NULL)
+ sqlite3_close(dbi->db);
+ if (dbi->table != NULL)
+ isc_mem_free(ns_g_mctx, dbi->table);
+ if (dbi->filename != NULL)
+ isc_mem_free(ns_g_mctx, dbi->filename);
+
+ isc_mem_put(ns_g_mctx, dbi, sizeof(dbinfo_t));
+}
+
+
+#define STRDUP_OR_FAIL(target, source) \
+ do { \
+ target = isc_mem_strdup(ns_g_mctx, source); \
+ if (target == NULL) { \
+ result = ISC_R_NOMEMORY; \
+ goto cleanup; \
+ } \
+ } while (0);
+
+/*
+ * Create a connection to the database and save any necessary information
+ * in dbdata.
+ *
+ * argv[0] is the name of the database file
+ * argv[1] is the name of the table
+ */
+static isc_result_t
+sqlitedb_create(const char *zone,
+ int argc, char **argv,
+ void *driverdata, void **dbdata)
+{
+ dbinfo_t *dbi;
+ isc_result_t result;
+
+ UNUSED(zone);
+ UNUSED(driverdata);
+
+ if (argc < 2)
+ return (ISC_R_FAILURE);
+
+ dbi = isc_mem_get(ns_g_mctx, sizeof(dbinfo_t));
+ if (dbi == NULL)
+ return (ISC_R_NOMEMORY);
+ dbi->db = NULL;
+ dbi->filename = NULL;
+ dbi->table = NULL;
+
+ STRDUP_OR_FAIL(dbi->filename, argv[0]);
+ STRDUP_OR_FAIL(dbi->table, argv[1]);
+
+ result = db_connect(dbi);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+
+ *dbdata = dbi;
+ return (ISC_R_SUCCESS);
+
+cleanup:
+ sqlitedb_destroy(zone, driverdata, (void **)&dbi);
+ return (result);
+}
+
+
+/*
+ * Since the SQL database corresponds to a zone, the authority data should
+ * be returned by the lookup() function. Therefore the authority() function
+ * is NULL.
+ */
+static dns_sdbmethods_t sqlitedb_methods = {
+ sqlitedb_lookup,
+ NULL, /* authority */
+ sqlitedb_allnodes,
+ sqlitedb_create,
+ sqlitedb_destroy
+};
+
+
+/*
+ * Wrapper around dns_sdb_register().
+ */
+isc_result_t
+sqlitedb_init(void)
+{
+ unsigned int flags;
+ flags = 0;
+ return (dns_sdb_register("sqlite", &sqlitedb_methods, NULL, flags,
+ ns_g_mctx, &sqlitedb));
+}
+
+
+/*
+ * Wrapper around dns_sdb_unregister().
+ */
+void
+sqlitedb_clear(void)
+{
+ if (sqlitedb != NULL)
+ dns_sdb_unregister(&sqlitedb);
+}
diff --git a/contrib/sdb/sqlite/sqlitedb.h b/contrib/sdb/sqlite/sqlitedb.h
new file mode 100644
index 0000000..5d22d0e
--- /dev/null
+++ b/contrib/sdb/sqlite/sqlitedb.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2000-2002 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: sqlitedb.h,v 1.1 2007/03/05 05:30:22 marka Exp $ */
+
+#include <isc/types.h>
+
+isc_result_t sqlitedb_init(void);
+
+void sqlitedb_clear(void);
+
diff --git a/contrib/sdb/sqlite/zone2sqlite.c b/contrib/sdb/sqlite/zone2sqlite.c
new file mode 100644
index 0000000..abaf52b
--- /dev/null
+++ b/contrib/sdb/sqlite/zone2sqlite.c
@@ -0,0 +1,301 @@
+/*
+ * Copyright (C) 2007 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: zone2sqlite.c,v 1.2 2008/09/24 02:46:21 marka Exp $ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <isc/buffer.h>
+#include <isc/mem.h>
+#include <isc/print.h>
+#include <isc/result.h>
+
+#include <dns/db.h>
+#include <dns/dbiterator.h>
+#include <dns/fixedname.h>
+#include <dns/name.h>
+#include <dns/rdata.h>
+#include <dns/rdataset.h>
+#include <dns/rdatasetiter.h>
+#include <dns/rdatatype.h>
+#include <dns/result.h>
+
+#include <sqlite3.h>
+
+#ifndef UNUSED
+#define UNUSED(x) (x) = (x)
+#endif
+
+/*
+ * Generate an SQLite table from a zone.
+ */
+
+typedef struct _dbinfo {
+ sqlite3 *db;
+ char *filename;
+ char *table;
+} dbinfo_t;
+
+dbinfo_t dbi = { NULL, NULL, NULL };
+
+
+static void
+closeandexit(int status)
+{
+ if (dbi.db) {
+ sqlite3_close(dbi.db);
+ dbi.db = NULL;
+ }
+ exit(status);
+}
+
+static void
+check_result(isc_result_t result, const char *message)
+{
+ if (result != ISC_R_SUCCESS) {
+ fprintf(stderr, "%s: %s\n", message,
+ isc_result_totext(result));
+ closeandexit(1);
+ }
+}
+
+static isc_result_t
+db_connect(dbinfo_t *dbi)
+{
+ if (sqlite3_open(dbi->filename, &dbi->db) == SQLITE_OK) {
+ return (ISC_R_SUCCESS);
+ } else {
+ /* a connection is returned even if the open fails */
+ sqlite3_close(dbi->db);
+ dbi->db = NULL;
+ return (ISC_R_FAILURE);
+ }
+}
+
+static int
+add_rdata_cb(void *parm, int cc, char **cv, char **cn)
+{
+ UNUSED(parm);
+ UNUSED(cc);
+ UNUSED(cv);
+ UNUSED(cn);
+
+ return 0;
+}
+
+
+static void
+addrdata(dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata)
+{
+ unsigned char namearray[DNS_NAME_MAXTEXT + 1];
+ unsigned char typearray[20];
+ unsigned char dataarray[2048];
+ isc_buffer_t b;
+ isc_result_t result;
+ char *sql;
+ char *errmsg = NULL;
+ int res;
+
+ isc_buffer_init(&b, namearray, sizeof(namearray) - 1);
+ result = dns_name_totext(name, ISC_TRUE, &b);
+ check_result(result, "dns_name_totext");
+ namearray[isc_buffer_usedlength(&b)] = 0;
+
+ isc_buffer_init(&b, typearray, sizeof(typearray) - 1);
+ result = dns_rdatatype_totext(rdata->type, &b);
+ check_result(result, "dns_rdatatype_totext");
+ typearray[isc_buffer_usedlength(&b)] = 0;
+
+ isc_buffer_init(&b, dataarray, sizeof(dataarray) - 1);
+ result = dns_rdata_totext(rdata, NULL, &b);
+ check_result(result, "dns_rdata_totext");
+ dataarray[isc_buffer_usedlength(&b)] = 0;
+
+ sql = sqlite3_mprintf(
+ "INSERT INTO %q (NAME, TTL, RDTYPE, RDATA)"
+ " VALUES ('%q', %d, '%q', '%q') ",
+ dbi.table,
+ namearray, ttl, typearray, dataarray);
+ printf("%s\n", sql);
+ res = sqlite3_exec(dbi.db, sql, add_rdata_cb, NULL, &errmsg);
+ sqlite3_free(sql);
+
+ if (result != SQLITE_OK) {
+ fprintf(stderr, "INSERT failed: %s\n", errmsg);
+ closeandexit(1);
+ }
+}
+
+int
+main(int argc, char *argv[])
+{
+ char *sql;
+ int res;
+ char *errmsg = NULL;
+ char *porigin, *zonefile;
+ dns_fixedname_t forigin, fname;
+ dns_name_t *origin, *name;
+ dns_db_t *db = NULL;
+ dns_dbiterator_t *dbiter;
+ dns_dbnode_t *node;
+ dns_rdatasetiter_t *rdsiter;
+ dns_rdataset_t rdataset;
+ dns_rdata_t rdata = DNS_RDATA_INIT;
+ isc_mem_t *mctx = NULL;
+ isc_buffer_t b;
+ isc_result_t result;
+
+ if (argc != 5) {
+ printf("usage: %s <zone> <zonefile> <dbfile> <dbtable>\n", argv[0]);
+ exit(1);
+ }
+
+ porigin = argv[1];
+ zonefile = argv[2];
+
+ dbi.filename = argv[3];
+ dbi.table = argv[4];
+
+ dns_result_register();
+
+ mctx = NULL;
+ result = isc_mem_create(0, 0, &mctx);
+ check_result(result, "isc_mem_create");
+
+ isc_buffer_init(&b, porigin, strlen(porigin));
+ isc_buffer_add(&b, strlen(porigin));
+ dns_fixedname_init(&forigin);
+ origin = dns_fixedname_name(&forigin);
+ result = dns_name_fromtext(origin, &b, dns_rootname, ISC_FALSE, NULL);
+ check_result(result, "dns_name_fromtext");
+
+ db = NULL;
+ result = dns_db_create(mctx, "rbt", origin, dns_dbtype_zone,
+ dns_rdataclass_in, 0, NULL, &db);
+ check_result(result, "dns_db_create");
+
+ result = dns_db_load(db, zonefile);
+ if (result == DNS_R_SEENINCLUDE)
+ result = ISC_R_SUCCESS;
+ check_result(result, "dns_db_load");
+
+ printf("Connecting to '%s'\n", dbi.filename);
+
+ if ((result = db_connect(&dbi)) != ISC_R_SUCCESS) {
+ fprintf(stderr, "Connection to database '%s' failed\n",
+ dbi.filename);
+ closeandexit(1);
+ }
+
+ sql = sqlite3_mprintf("DROP TABLE %q ", dbi.table);
+ printf("%s\n", sql);
+ res = sqlite3_exec(dbi.db, sql, NULL, NULL, &errmsg);
+ sqlite3_free(sql);
+#if 0
+ if (res != SQLITE_OK) {
+ fprintf(stderr, "DROP TABLE %s failed: %s\n",
+ dbi.table, errmsg);
+ }
+#endif
+
+#if 0
+ sql = sqlite3_mprintf(sql, "BEGIN TRANSACTION");
+ printf("%s\n", sql);
+ res = sqlite3_exec(dbi.db, sql, NULL, NULL, &errmsg);
+ sqlite3_free(sql);
+ if (res != SQLITE_OK) {
+ fprintf(stderr, "BEGIN TRANSACTION failed: %s\n", errmsg);
+ closeandexit(1);
+ }
+#endif
+
+ sql = sqlite3_mprintf(
+ "CREATE TABLE %q "
+ "(NAME TEXT, TTL INTEGER, RDTYPE TEXT, RDATA TEXT) ",
+ dbi.table);
+ printf("%s\n", sql);
+ res = sqlite3_exec(dbi.db, sql, NULL, NULL, &errmsg);
+ sqlite3_free(sql);
+ if (res != SQLITE_OK) {
+ fprintf(stderr, "CREATE TABLE %s failed: %s\n",
+ dbi.table, errmsg);
+ closeandexit(1);
+ }
+
+ dbiter = NULL;
+ result = dns_db_createiterator(db, 0, &dbiter);
+ check_result(result, "dns_db_createiterator()");
+
+ result = dns_dbiterator_first(dbiter);
+ check_result(result, "dns_dbiterator_first");
+
+ dns_fixedname_init(&fname);
+ name = dns_fixedname_name(&fname);
+ dns_rdataset_init(&rdataset);
+ dns_rdata_init(&rdata);
+
+ while (result == ISC_R_SUCCESS) {
+ node = NULL;
+ result = dns_dbiterator_current(dbiter, &node, name);
+ if (result == ISC_R_NOMORE)
+ break;
+ check_result(result, "dns_dbiterator_current");
+
+ rdsiter = NULL;
+ result = dns_db_allrdatasets(db, node, NULL, 0, &rdsiter);
+ check_result(result, "dns_db_allrdatasets");
+
+ result = dns_rdatasetiter_first(rdsiter);
+
+ while (result == ISC_R_SUCCESS) {
+ dns_rdatasetiter_current(rdsiter, &rdataset);
+ result = dns_rdataset_first(&rdataset);
+ check_result(result, "dns_rdataset_first");
+ while (result == ISC_R_SUCCESS) {
+ dns_rdataset_current(&rdataset, &rdata);
+ addrdata(name, rdataset.ttl, &rdata);
+ dns_rdata_reset(&rdata);
+ result = dns_rdataset_next(&rdataset);
+ }
+ dns_rdataset_disassociate(&rdataset);
+ result = dns_rdatasetiter_next(rdsiter);
+ }
+ dns_rdatasetiter_destroy(&rdsiter);
+ dns_db_detachnode(db, &node);
+ result = dns_dbiterator_next(dbiter);
+ }
+
+#if 0
+ sql = sqlite3_mprintf(sql, "COMMIT TRANSACTION ");
+ printf("%s\n", sql);
+ res = sqlite3_exec(dbi.db, sql, NULL, NULL, &errmsg);
+ sqlite3_free(sql);
+ if (res != SQLITE_OK) {
+ fprintf(stderr, "COMMIT TRANSACTION failed: %s\n", errmsg);
+ closeandexit(1);
+ }
+#endif
+
+ dns_dbiterator_destroy(&dbiter);
+ dns_db_detach(&db);
+ isc_mem_destroy(&mctx);
+
+ closeandexit(0);
+
+ exit(0);
+}
diff --git a/contrib/sdb/tcl/lookup.tcl b/contrib/sdb/tcl/lookup.tcl
new file mode 100644
index 0000000..83a8e2a
--- /dev/null
+++ b/contrib/sdb/tcl/lookup.tcl
@@ -0,0 +1,51 @@
+# Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2000, 2001 Internet Software Consortium.
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+# $Id: lookup.tcl,v 1.10 2007/06/19 23:47:08 tbox Exp $
+
+#
+# Sample lookup procedure for tcldb
+#
+# This lookup procedure defines zones with identical SOA, NS, and MX
+# records at the apex and a single A record that varies from zone to
+# zone at the name "www".
+#
+# Something like this could be used by a web hosting company to serve
+# a number of domains without needing to create a separate master file
+# for each domain. Instead, all per-zone data (in this case, a single
+# IP address) specified in the named.conf file like this:
+#
+# zone "a.com." { type master; database "tcl 10.0.0.42"; };
+# zone "b.com." { type master; database "tcl 10.0.0.99"; };
+#
+# Since the tcldb driver doesn't support zone transfers, there should
+# be at least two identically configured master servers. In the
+# example below, they are assumed to be called ns1.isp.nil and
+# ns2.isp.nil.
+#
+
+proc lookup {zone name} {
+ global dbargs
+ switch -- $name {
+ @ { return [list \
+ {SOA 86400 "ns1.isp.nil. hostmaster.isp.nil. \
+ 1 3600 1800 1814400 3600"} \
+ {NS 86400 "ns1.isp.nil."} \
+ {NS 86400 "ns2.isp.nil."} \
+ {MX 86400 "10 mail.isp.nil."} ] }
+ www { return [list [list A 3600 $dbargs($zone)] ] }
+ }
+ return NXDOMAIN
+}
diff --git a/contrib/sdb/tcl/tcldb.c b/contrib/sdb/tcl/tcldb.c
new file mode 100644
index 0000000..de6f4c5
--- /dev/null
+++ b/contrib/sdb/tcl/tcldb.c
@@ -0,0 +1,232 @@
+/*
+ * Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000, 2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: tcldb.c,v 1.10 2007/06/19 23:47:10 tbox Exp $ */
+
+/*
+ * A simple database driver that calls a Tcl procedure to define
+ * the contents of the DNS namespace. The procedure is loaded
+ * from the file lookup.tcl; look at the comments there for
+ * more information.
+ */
+
+#include <config.h>
+
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+#include <isc/mem.h>
+#include <isc/print.h>
+#include <isc/result.h>
+#include <isc/util.h>
+
+#include <dns/log.h>
+#include <dns/sdb.h>
+
+#include <named/globals.h>
+
+#include <tcl.h>
+
+#include <tcldb.h>
+
+#define CHECK(op) \
+ do { result = (op); \
+ if (result != ISC_R_SUCCESS) return (result); \
+ } while (0)
+
+typedef struct tcldb_driver {
+ isc_mem_t *mctx;
+ Tcl_Interp *interp;
+} tcldb_driver_t;
+
+static tcldb_driver_t *the_driver = NULL;
+
+static dns_sdbimplementation_t *tcldb = NULL;
+
+static isc_result_t
+tcldb_driver_create(isc_mem_t *mctx, tcldb_driver_t **driverp) {
+ int tclres;
+ isc_result_t result = ISC_R_SUCCESS;
+ tcldb_driver_t *driver = isc_mem_get(mctx, sizeof(tcldb_driver_t));
+ if (driver == NULL)
+ return (ISC_R_NOMEMORY);
+ driver->mctx = mctx;
+ driver->interp = Tcl_CreateInterp();
+
+ tclres = Tcl_EvalFile(driver->interp, (char *) "lookup.tcl");
+ if (tclres != TCL_OK) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL,
+ DNS_LOGMODULE_SDB, ISC_LOG_ERROR,
+ "initializing tcldb: "
+ "loading 'lookup.tcl' failed: %s",
+ driver->interp->result);
+ result = ISC_R_FAILURE;
+ goto cleanup;
+ }
+ *driverp = driver;
+ return (ISC_R_SUCCESS);
+
+ cleanup:
+ isc_mem_put(mctx, driver, sizeof(tcldb_driver_t));
+ return (result);
+
+}
+
+static void
+tcldb_driver_destroy(tcldb_driver_t **driverp) {
+ tcldb_driver_t *driver = *driverp;
+ Tcl_DeleteInterp(driver->interp);
+ isc_mem_put(driver->mctx, driver, sizeof(tcldb_driver_t));
+}
+
+/*
+ * Perform a lookup, by invoking the Tcl procedure "lookup".
+ */
+static isc_result_t
+tcldb_lookup(const char *zone, const char *name, void *dbdata,
+ dns_sdblookup_t *lookup)
+{
+ isc_result_t result = ISC_R_SUCCESS;
+ int tclres;
+ int rrc; /* RR count */
+ char **rrv; /* RR vector */
+ int i;
+ char *cmdv[3];
+ char *cmd;
+
+ tcldb_driver_t *driver = (tcldb_driver_t *) dbdata;
+
+ cmdv[0] = "lookup";
+ cmdv[1] = zone;
+ cmdv[2] = name;
+ cmd = Tcl_Merge(3, cmdv);
+ tclres = Tcl_Eval(driver->interp, cmd);
+ Tcl_Free(cmd);
+
+ if (tclres != TCL_OK) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL,
+ DNS_LOGMODULE_SDB, ISC_LOG_ERROR,
+ "zone '%s': tcl lookup function failed: %s",
+ zone, driver->interp->result);
+ return (ISC_R_FAILURE);
+ }
+
+ if (strcmp(driver->interp->result, "NXDOMAIN") == 0) {
+ result = ISC_R_NOTFOUND;
+ goto fail;
+ }
+
+ tclres = Tcl_SplitList(driver->interp, driver->interp->result,
+ &rrc, &rrv);
+ if (tclres != TCL_OK)
+ goto malformed;
+
+ for (i = 0; i < rrc; i++) {
+ isc_result_t tmpres;
+ int fieldc; /* Field count */
+ char **fieldv; /* Field vector */
+ tclres = Tcl_SplitList(driver->interp, rrv[i],
+ &fieldc, &fieldv);
+ if (tclres != TCL_OK) {
+ tmpres = ISC_R_FAILURE;
+ goto failrr;
+ }
+ if (fieldc != 3)
+ goto malformed;
+ tmpres = dns_sdb_putrr(lookup, fieldv[0], atoi(fieldv[1]),
+ fieldv[2]);
+ Tcl_Free((char *) fieldv);
+ failrr:
+ if (tmpres != ISC_R_SUCCESS)
+ result = tmpres;
+ }
+ Tcl_Free((char *) rrv);
+ if (result == ISC_R_SUCCESS)
+ return (result);
+
+ malformed:
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL,
+ DNS_LOGMODULE_SDB, ISC_LOG_ERROR,
+ "zone '%s': "
+ "malformed return value from tcl lookup function: %s",
+ zone, driver->interp->result);
+ result = ISC_R_FAILURE;
+ fail:
+ return (result);
+}
+
+/*
+ * Set up per-zone state. In our case, the database arguments of the
+ * zone are collected into a Tcl list and assigned to an element of
+ * the global array "dbargs".
+ */
+static isc_result_t
+tcldb_create(const char *zone, int argc, char **argv,
+ void *driverdata, void **dbdata)
+{
+ tcldb_driver_t *driver = (tcldb_driver_t *) driverdata;
+
+ char *list = Tcl_Merge(argc, argv);
+
+ Tcl_SetVar2(driver->interp, (char *) "dbargs", (char *) zone, list, 0);
+
+ Tcl_Free(list);
+
+ *dbdata = driverdata;
+
+ return (ISC_R_SUCCESS);
+}
+
+/*
+ * This driver does not support zone transfer, so allnodes() is NULL.
+ */
+static dns_sdbmethods_t tcldb_methods = {
+ tcldb_lookup,
+ NULL, /* authority */
+ NULL, /* allnodes */
+ tcldb_create,
+ NULL /* destroy */
+};
+
+/*
+ * Initialize the tcldb driver.
+ */
+isc_result_t
+tcldb_init(void) {
+ isc_result_t result;
+ int flags = DNS_SDBFLAG_RELATIVEOWNER | DNS_SDBFLAG_RELATIVERDATA;
+
+ result = tcldb_driver_create(ns_g_mctx, &the_driver);
+ if (result != ISC_R_SUCCESS)
+ return (result);
+
+ return (dns_sdb_register("tcl", &tcldb_methods, the_driver, flags,
+ ns_g_mctx, &tcldb));
+}
+
+/*
+ * Wrapper around dns_sdb_unregister().
+ */
+void
+tcldb_clear(void) {
+ if (tcldb != NULL)
+ dns_sdb_unregister(&tcldb);
+ if (the_driver != NULL)
+ tcldb_driver_destroy(&the_driver);
+}
diff --git a/contrib/sdb/tcl/tcldb.h b/contrib/sdb/tcl/tcldb.h
new file mode 100644
index 0000000..f31639b
--- /dev/null
+++ b/contrib/sdb/tcl/tcldb.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000, 2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: tcldb.h,v 1.7 2007/06/19 23:47:10 tbox Exp $ */
+
+#include <isc/types.h>
+
+isc_result_t tcldb_init(void);
+
+void tcldb_clear(void);
+
diff --git a/contrib/sdb/time/timedb.c b/contrib/sdb/time/timedb.c
new file mode 100644
index 0000000..f6ddaa4
--- /dev/null
+++ b/contrib/sdb/time/timedb.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000, 2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: timedb.c,v 1.10 2007/06/19 23:47:10 tbox Exp $ */
+
+/*
+ * A simple database driver that enables the server to return the
+ * current time in a DNS record.
+ */
+
+#include <config.h>
+
+#include <string.h>
+#include <stdio.h>
+#include <time.h>
+
+#include <isc/print.h>
+#include <isc/result.h>
+#include <isc/util.h>
+
+#include <dns/sdb.h>
+
+#include <named/globals.h>
+
+#include "timedb.h"
+
+static dns_sdbimplementation_t *timedb = NULL;
+
+/*
+ * This database operates on relative names.
+ *
+ * "time" and "@" return the time in a TXT record.
+ * "clock" is a CNAME to "time"
+ * "current" is a DNAME to "@" (try time.current.time)
+ */
+static isc_result_t
+timedb_lookup(const char *zone, const char *name, void *dbdata,
+ dns_sdblookup_t *lookup)
+{
+ isc_result_t result;
+
+ UNUSED(zone);
+ UNUSED(dbdata);
+
+ if (strcmp(name, "@") == 0 || strcmp(name, "time") == 0) {
+ time_t now = time(NULL);
+ char buf[100];
+ int n;
+
+ /*
+ * Call ctime to create the string, put it in quotes, and
+ * remove the trailing newline.
+ */
+ n = snprintf(buf, sizeof(buf), "\"%s", ctime(&now));
+ if (n < 0)
+ return (ISC_R_FAILURE);
+ buf[n - 1] = '\"';
+ result = dns_sdb_putrr(lookup, "txt", 1, buf);
+ if (result != ISC_R_SUCCESS)
+ return (ISC_R_FAILURE);
+ } else if (strcmp(name, "clock") == 0) {
+ result = dns_sdb_putrr(lookup, "cname", 1, "time");
+ if (result != ISC_R_SUCCESS)
+ return (ISC_R_FAILURE);
+ } else if (strcmp(name, "current") == 0) {
+ result = dns_sdb_putrr(lookup, "dname", 1, "@");
+ if (result != ISC_R_SUCCESS)
+ return (ISC_R_FAILURE);
+ } else
+ return (ISC_R_NOTFOUND);
+
+ return (ISC_R_SUCCESS);
+}
+
+/*
+ * lookup() does not return SOA or NS records, so authority() must be defined.
+ */
+static isc_result_t
+timedb_authority(const char *zone, void *dbdata, dns_sdblookup_t *lookup) {
+ isc_result_t result;
+
+ UNUSED(zone);
+ UNUSED(dbdata);
+
+ result = dns_sdb_putsoa(lookup, "localhost.", "root.localhost.", 0);
+ if (result != ISC_R_SUCCESS)
+ return (ISC_R_FAILURE);
+
+ result = dns_sdb_putrr(lookup, "ns", 86400, "ns1.localdomain.");
+ if (result != ISC_R_SUCCESS)
+ return (ISC_R_FAILURE);
+ result = dns_sdb_putrr(lookup, "ns", 86400, "ns2.localdomain.");
+ if (result != ISC_R_SUCCESS)
+ return (ISC_R_FAILURE);
+
+ return (ISC_R_SUCCESS);
+}
+
+/*
+ * This zone does not support zone transfer, so allnodes() is NULL. There
+ * is no database specific data, so create() and destroy() are NULL.
+ */
+static dns_sdbmethods_t timedb_methods = {
+ timedb_lookup,
+ timedb_authority,
+ NULL, /* allnodes */
+ NULL, /* create */
+ NULL /* destroy */
+};
+
+/*
+ * Wrapper around dns_sdb_register().
+ */
+isc_result_t
+timedb_init(void) {
+ unsigned int flags;
+ flags = DNS_SDBFLAG_RELATIVEOWNER | DNS_SDBFLAG_RELATIVERDATA;
+ return (dns_sdb_register("time", &timedb_methods, NULL, flags,
+ ns_g_mctx, &timedb));
+}
+
+/*
+ * Wrapper around dns_sdb_unregister().
+ */
+void
+timedb_clear(void) {
+ if (timedb != NULL)
+ dns_sdb_unregister(&timedb);
+}
diff --git a/contrib/sdb/time/timedb.h b/contrib/sdb/time/timedb.h
new file mode 100644
index 0000000..ca8688a
--- /dev/null
+++ b/contrib/sdb/time/timedb.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000, 2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: timedb.h,v 1.5 2007/06/19 23:47:13 tbox Exp $ */
+
+#include <isc/types.h>
+
+isc_result_t timedb_init(void);
+
+void timedb_clear(void);
+
diff --git a/contrib/zkt/CHANGELOG b/contrib/zkt/CHANGELOG
new file mode 100644
index 0000000..40fb02e
--- /dev/null
+++ b/contrib/zkt/CHANGELOG
@@ -0,0 +1,446 @@
+zkt 0.97 --
+
+* bug LG_* logging level wasn't mapped to syslog level in lg_mesg().
+ gettock() in ncparse.c did not recognize C single line comments "//"
+ (Thanks to Frank Behrens for finding this out)
+
+* misc dist_and_reload () now calls the "Distribute_Cmd" twice:
+ First with argument "distribute" for signed zone file distribution,
+ second with argument "reload" to initiate a reload.
+ Again see example/flat/dist.sh for an example script.
+
+* bug full KSK rollover will (mostly) also work for dynamic zones
+ This is a hack and requires further investigation. Currently
+ it will not work if someone is using non standard zone file
+ names.
+
+* misc default ZSK lifetime set to 3 month
+
+* misc get_mtime() renamed to file_mtime()
+
+* func is_exec_ok() added and called in dist_and_reload ()
+
+* func New parameter "Distribute_Cmd" added for specifing a user
+ defined distribution (and reload) command (See example/flat/dist.sh).
+
+* misc Changed wording to be a bit more consistent to
+ draft-gudmundsson-life-of-dnskey-00.txt
+ - State of published key will be print as "pub" instead of "pre"
+ by dnssec-zkt.
+ - Option --pre-publish of dnssec-zkt changed to --published.
+ - Changed wording in all comments and log message from "pre-publish"
+ to "published".
+
+* func Highly experimental code to do a full automatic ksk rollover
+ in hierachical mode.
+ ksk_rollover() added in rollover.c; parameter change for ksk_status()
+
+* misc Changed name of "dnssec-soaserial" to "zkt-soaserial"
+
+* bug Fixed verbose logging error if -N or -D option was used
+
+* func Some LG_INFO messages added about key status change
+
+* func Remove of function to register a new ksk (zktr.[ch])
+
+* misc Changed licence from GNU GPLv2 to BSD licence
+
+* bug Fixed bug in logging of ZSK rollover
+
+* misc Changed tar file to zipped one and archive the files with
+ toplevel directory
+
+* bug Fixed use of uninitialized vars in zconf.c (line)
+
+* port Preparation for use of autoconf
+ - config.h renamed to config_zkt.h and change of include directives
+ - conditional include of config.h
+ - ./configure script is able to determine BIND utility path
+ (BIND_UTIL_PATH) and version (BIND_VERSION)
+ - compile time options are settable via configure script (--enable-xxx)
+ - For now, the configure script is not able to set the install dir.
+
+* bug ksk rollover phase2 did not trigger resigning of parent
+ (the parent file was copied to the parent directory only
+ after child zone resigning)
+
+* bug fixed bad notice message in zskstatus ()
+
+* func dnssec-zkt -Z print out syslog facility & level with
+ upper case letter and without quotation marks
+
+* func Syslog facility DAEMON added
+
+zkt 0.96 -- 19. June 2008
+
+* func Config file option "SIG_Parameter" added.
+
+* func Function verbmesg() added and used for verbose logging
+ to stdout and/or to syslog resp. file.
+ Config file parameter VerboseLog added to config file.
+
+* bug Option -O wasn't recognized by dnssec-signer
+
+* func Better support of initial setup of dynamic signed
+ zones (just create an empty "zone.db.dsigned" file
+ and run dnssec-signer with option -d).
+
+* func Improved error logging; incr_soa() errors are written
+ as clear text message instead of error number
+
+* func elog_mesg() function replaced by a more general
+ logging mechanism.
+ ErrorLog config parameter replaced by LogFile,
+ LogLevel and SyslogFacility, SyslogLevel parameter
+
+* func New function filesize() added
+
+* func dki_prt_trustedkey print out old key id if key
+ is revoked
+
+* func dki_new() writes gentime (GMT) and proposed key
+ lifetime (days) as comment into the *.key file
+
+* bug Doing some housekeeping
+
+zkt 0.95 -- 19. April 2008
+
+* misc This is not a public released version of zkt.
+
+* func All config file option are now settable via
+ commandline option -O (--option or --config-option)
+
+* misc Function fatal() now has an exit code of 127.
+ This is neccessary because values from 1 to 64 are
+ reflecting the number of errors occured.
+
+* func Errorlog functionality added
+ All dnssec-signer errors will be logged in the file
+ specified by the Errorlog config file parameter or
+ specified by the command line option -L (--errorlog).
+ If a directory is given, then the logging will occur
+ in a file within this directory which is named
+ like "zkt-<current-date>.log".
+ The dnssec-signer command has an exit code of 0 if
+ no error occured, an exit code of 127 on fatal errors,
+ an exit code from 1 to 63 reflecting the number of errors
+ occured, or an exit code of 64 if more than 63 errors
+ occured.
+
+* func dnssec-signer: Introducing long options
+
+* bug New skript added to example/views directory to
+ read in the right config file
+
+* func New option -f (--lifetime) and -F (--setlifetime)
+ added to dnssec-zkt.
+
+* func New option -e (--expire) added to dnssec-zkt.
+ (Seems to be that the dnssec-zkt command is a little
+ bit overloaded with options.)
+
+* func dki.c and zkt.c supports storage of key lifetime,
+ generation time and expiration time as a comment in the
+ .key file. With this, it's possible to change the default
+ lifetime without any impact on already used keys.
+
+zkt 0.94 -- 6. Dec 2007
+
+* bug Case mismatch of zone name and key file name prevent
+ dki_read() from reading the key.
+ Thanks to Alan Clegg for finding this out.
+ Added some additional error processing and convert
+ zone name to lower case.
+
+* misc Builtin default for KSK_randfile changed
+ from NULL to "/dev/urandom".
+
+* bug dnssec-signer has to use private keys for signing
+ even if the revoke bit is set.
+ To achieve this the file pattern K*.private is added
+ to the dnssec-signzone run.
+
+* bug Uninitialized variable "len" in sign_zone().
+
+* func Default config file is settable via environment
+ variable ZKT_CONFFILE
+
+* func Support of views added
+ Link dnssec-zkt to dnssec-zkt-<view> and
+ dnssec-signer to dnssec-signer-<view>.
+ Option -V and --view added to dnssec-zkt.
+ Option -V added to dnssec-signer.
+ View support added to parse_namedconf().
+
+zkt 0.93 -- 1. Nov 2007
+
+* func The ksk registration mechanism is disabled by
+ default (see REG_URL in config.h).
+
+* func Basic support for revoke flag added (RFC5011).
+ Semantic of option -R of dnssec-zkt changed.
+
+* func Undocumented option -S changed to lower case.
+ Pre-pulished KSK will be shown as "standby" key.
+ New Option -S (standby) for pre-publish KSK.
+
+* func New command dnssec-soaserial added.
+
+* bug dnssec-signer do not print the incremented serial
+ number anymore.
+ time2str() fixed bug in time format (HAS_STRFTIME=0).
+
+* port New build dependencies "solaris", "macos" and "help"
+ added to Makefile.
+
+zkt 0.92 -- 1. Oct 2007
+
+* func Parameter "Serialformat" in dnssec.conf added .
+ Now it is possible to use the unixtime format for
+ the SOA serial number. If you use BIND 9.4 or
+ greater in conjunction with this, than there is no
+ need for the special SOA serial formating in
+ the zonefile. (Thanks to Jakob Schlyter for the
+ -N option of dnssec-signzone and the suggestion to
+ add the unixtime support to zkt)
+
+* func Option --ksk-roll-stat added.
+
+* port Added macro HAS_GETOPT_LONG to support OS with
+ lack of getopt_long() (e.g. solaris).
+ Options -[01239] added.
+
+* misc Unused macro HAS_ULONG removed from config.h.
+ Deklaration of unsigned types moved from dki.h to
+ config.h (so it will be available in _all_ source
+ files). Thanks to Mans Nilsson.
+ Unused macro isblank() (ncparse.c) removed.
+
+* bug In dosigning(): freeze the dynamic zone _before_ copying
+ the zone file.
+
+zkt 0.91 -- 1. Apr 2007
+
+* doc --ksk-rollover option added to usage().
+
+* func some experimental code for dynamic zones added.
+ new functions added: copyzonefile(), dyn_update_freeze().
+ New option "-d" added.
+
+zkt 0.90 -- 6. Dec 2006
+
+* func CHECK_RESIGN interval added to config.h.
+ This is the dnssec-signer calling interval (at least 1 day or 86400 sec).
+
+* func new function dki_destroy() added; semantic of dk_remove()
+ changed to rename the key files instead of physical deletion.
+
+* doc Setup of new example directory (flat and hierarchical).
+
+* doc dnssec-zkt man page updated.
+ Added some comments in misc.c
+
+* misc function strtaint() renamed to str_untaint(),
+ dki_keycmp() renamed to dki_tagcmp().
+
+* func New parameter key_ttl added to dnssec.conf.
+ New func dki_prt_dnskeyttl () added.
+ Now dnskey.db is written with key_ttl value.
+
+* func dnssec-signer: In hierarchical mode sign_zone() copies the
+ parent-file (if such a file exist) instead of the
+ keyset-file to the parent directory.
+
+* func dnssec-zkt: Option --ksk-roll-phase[123] and function
+ ksk_rollover() added.
+
+* misc zconf: default values for sigvalidity, resign_int etc. changed,
+ new dnssec.conf example file created.
+
+* func dnssec-zkt: Long option support added.
+
+zkt 0.83 -- 11. Sep 2006
+
+* bug dosigning(): Fixed bug in the bug fixing of printing undefined
+ serial number if incr_serial() failed. (Thanks to Randy McCasskill).
+
+zkt 0.82 -- 8. Sep 2006
+
+* bug Use option -e for dnssec-keygen calls in dki_new(), because
+ an RSA exponent of 3 is vulnerable.
+
+* bug dosigning(): Fixed bug in printing undefined serial
+ number if incr_serial() failed.
+
+ an RSA exponent of 3 is vulnerable.
+
+* bug dosigning(): Fixed bug in printing undefined serial
+ number if incr_serial() failed.
+
+zkt 0.81 -- 13. July 2006
+
+* bug The function ceatekey() won't work with USE_TREE.
+ Size of MAX_DNAME increased.
+
+zkt 0.8 -- 09. July 2006
+
+* func Now a hierarchical directory structure with subdomains stored in
+ subfolders of the parent domain are allowed. Added copyfile(),
+ cmpfile() and new_keysetfiles() for that.
+
+* func Config parameter added to choose if the domain name is
+ right or left justified listed by dnssec-zkt (printkeyinfo).
+
+* func New class of key added ("sep"). A SEP key is a (public) key file
+ without the private counterpart. So we could use the key solely
+ as an secure entry point. (dki.h, dki_read).
+
+zkt 0.70 -- 15. Sep 2005
+
+* func Experimental code added to use a binary search tree instead of a
+ single linked list. This is mainly for performance improvement for large
+ sites. If you don't want to use it, set USE_TREE in config.h to zero.
+ In the first step only dnssec-zkt use the new data structure.
+ The tree is build over the domain names and each node is the starting point
+ of a linked list of keys.
+ As a result, it's not possible anymore to search on key tags only. You have
+ to specify the domain name plus the tag. :-(
+
+* func Function parseurl added.
+
+* func Experimental code to register a new ksk. Currently it's more like
+ a key announcement because of the lack of identification and
+ authentication.
+
+zkt 0.65 -- 22. Aug 2005
+
+* misc Rewrite of the domaincmp() function. Now it's round about 2 times faster.
+ After some additional changes and the compiler option -O3 the dnssec-zkt
+ on the ~ 12000 zones requires only a minute
+ $ time dnssec-zkt -z -r sec > /dev/null
+ real 0m58.287s
+ user 0m54.610s
+ sys 0m3.680s
+
+* func A keyset directory is introduced (experimental)
+ The parameter -d is added to the call of the dnssec-signzone command
+ if the config option KeySetDir is set.
+ As a result, all dsset-, keyset- and dlvset- files are stored in one directory.
+ The advantage is, that the chain of trust of all local subzone is build
+ automatically (This is the reason why we sort the zones with the child zones
+ first).
+ The disadvantage is that we store many files in single directory (3 files
+ per zone).
+
+zkt 0.64 -- 1. Aug 2005
+
+* bug The code for option -Z of dnssec-zkt should be executed before we read the
+ complete directory tree. This is usefull if we have a very deep directory
+ structure and the recursive flag is switched on.
+
+* func SIG_Pseudorand parameter added.
+
+* func ([KZ]SK)|(SIG)_randfile parameter added.
+
+* func measure the time used for signing of each zone.
+
+* bug function logflush() added to misc.c and called by dosigning().
+
+* misc some perfomance test made:
+ - Directory structure "sec/<firstletter>/domain" with round about 12200 domains
+ - One of the domain is a big one (~ 820000 RRs), the others are mostly very small ones
+ - We use a dsa with 704 bits as ksk and a rsamd5 with 512 bits as zsk on each domain.
+ - All test made on Sun Fire V440 with 4 CPU and 4x2GB main memory
+
+ # sequential signing of all zones
+ $ time dnssec-signer -v -v -f -D sec
+ real 434m (~ 7h 14min)
+ user 188
+ sys 175
+
+ # with option -p and -r /dev/urandom
+ $ time dnssec-signer -v -v -f -D sec > log
+ real 96m28.306s
+ user 290m41.980s
+ sys 6m13.790s
+
+ # one process for each firstletter subdirectory
+ $ time par_signer.sh
+ real 394m12.334s
+ user 295m58.390s
+ sys 786m42.479s
+
+ # with option -p and -r /dev/urandom
+ $ time par_signer.sh
+ real 78m49.323s
+ user 284m58.350s
+ sys 5m39.340s
+
+
+ $ time dnssec-zkt -z -r sec > /dev/null
+ real 2m5.722s
+ user 2m0.060s
+ sys 0m4.510s
+
+
+ # signing the big (820000 RR) domain only
+ $ time dnssec-signer -v -v -f -D sec/b/big-domain
+ real 196m23.165 (~ 3h 16min)
+ user 176m57.610
+ sys 167m27.570
+
+ # with option -p and -r /dev/urandom
+ $ time dnssec-signer -v -v -f -D sec/b/big-domain
+ real 49m53.152
+ user 173m59.520
+ sys 1m40.150
+
+zkt 0.63 -- 14. June 2005
+
+* bug allow TTL value in keyfiles (see TTL_IN_KEYFILES_ALLOWED
+ in dki_readfile()).
+
+* misc function strchop() added to misc.c.
+
+zkt 0.62 -- 13. May 2005
+
+* func dnssec-signer: Option -o added.
+ Now it works a little bit more like dnssec-signzone.
+
+* func strlist.c: prepstrlist and unprepstrlist functions get a
+ second parameter for the delimiter.
+
+* bug fixed some typos and inaccurate usage of symbolic constants.
+ Doing some housekeeping.
+
+zkt 0.61 -- 3. May 2005
+
+* bug local config file will not be mentioned if -N switch is used.
+
+zkt 0.6 -- 1. May 2005
+
+* doc dnssec-signer: man page added.
+
+* func dnssec-signer: Print out a warning message if ksk lifetime is exceeded.
+
+* func dnssec-signer: Remaining arguments will be interpreted as zone names
+ (in_strarr () added).
+
+* func dnssec-signer: Option -D added.
+
+
+zkt 0.51 -- 8. April 2005
+
+* func dnssec-signer: Option -N added.
+
+* func dnssec-signer: change of keystatus from pre-published to active
+ resets timestamp of key, thus age of active key counts 0.
+
+* bug prepstrlist: resulting string was not terminated with '\0'.
+
+* bug dnssec-signer: do signing if there are additional keys, or the
+ status of any key is changed (function check_keytimestamp).
+
+* func dnssec-zkt: -l <list> option added.
+
+* func dnssec-zkt: -p flag defaults to on in key creation mode (-C).
diff --git a/contrib/zkt/LICENSE b/contrib/zkt/LICENSE
new file mode 100644
index 0000000..1af01c7
--- /dev/null
+++ b/contrib/zkt/LICENSE
@@ -0,0 +1,30 @@
+Copyright (c) 2005 - 2008, Holger Zuleger HZnet. All rights reserved.
+
+This software is open source.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.
+
+Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+be used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/contrib/zkt/Makefile.in b/contrib/zkt/Makefile.in
new file mode 100644
index 0000000..197fd14
--- /dev/null
+++ b/contrib/zkt/Makefile.in
@@ -0,0 +1,151 @@
+#################################################################
+#
+# @(#) Makefile for dnssec zone key tool (c) Mar 2005 hoz
+#
+#################################################################
+
+INSTALL_DIR ?= $$HOME/bin
+
+CC ?= @CC@
+
+PROFILE = # -pg
+OPTIM = # -O3 -DNDEBUG
+
+#CFLAGS ?= @CFLAGS@ @DEFS@ -I@top_srcdir@
+CFLAGS += -g @DEFS@ -I@top_srcdir@
+CFLAGS += -Wall #-DDBG
+CFLAGS += -Wmissing-prototypes
+CFLAGS += $(PROFILE) $(OPTIM)
+LDFLAGS += $(PROFILE)
+
+PROJECT = @PACKAGE_TARNAME@
+VERSION = @PACKAGE_VERSION@
+
+HEADER = dki.h misc.h domaincmp.h zconf.h config_zkt.h \
+ config.h.in strlist.h zone.h zkt.h debug.h \
+ ncparse.h log.h rollover.h
+SRC_ALL = dki.c misc.c domaincmp.c zconf.c log.c
+OBJ_ALL = $(SRC_ALL:.c=.o)
+
+SRC_SIG = dnssec-signer.c zone.c ncparse.c rollover.c
+OBJ_SIG = $(SRC_SIG:.c=.o)
+MAN_SIG = dnssec-signer.8
+PROG_SIG= dnssec-signer
+
+SRC_ZKT = dnssec-zkt.c strlist.c zkt.c
+OBJ_ZKT = $(SRC_ZKT:.c=.o)
+MAN_ZKT = dnssec-zkt.8
+PROG_ZKT= dnssec-zkt
+
+SRC_SER = zkt-soaserial.c
+OBJ_SER = $(SRC_SER:.c=.o)
+#MAN_SER = zkt-soaserial.8
+PROG_SER= zkt-soaserial
+
+MAN = $(MAN_ZKT) $(MAN_SIG) #$(MAN_SER)
+OTHER = README README.logging TODO LICENSE CHANGELOG tags Makefile.in \
+ configure examples
+SAVE = $(HEADER) $(SRC_ALL) $(SRC_SIG) $(SRC_ZKT) $(SRC_SER) $(MAN) $(OTHER)
+MNTSAVE = $(SAVE) configure.ac config.h.in doc
+
+
+all: $(PROG_ZKT) $(PROG_SIG) $(PROG_SER)
+
+macos: ## for MAC OS
+macos:
+ $(MAKE) CFLAGS="$(CFLAGS) -D HAS_UTYPES=0" all
+
+solaris: ## for solaris
+solaris:
+ @$(MAKE) CFLAGS="$(CFLAGS) -D HAVE_GETOPT_LONG=0" all
+
+linux: ## for linux (default)
+linux:
+ @$(MAKE) all
+
+$(PROG_SIG): $(OBJ_SIG) $(OBJ_ALL) Makefile
+ $(CC) $(LDFLAGS) $(OBJ_SIG) $(OBJ_ALL) -o $(PROG_SIG)
+
+$(PROG_ZKT): $(OBJ_ZKT) $(OBJ_ALL) Makefile
+ $(CC) $(LDFLAGS) $(OBJ_ZKT) $(OBJ_ALL) -o $(PROG_ZKT)
+
+$(PROG_SER): $(OBJ_SER) Makefile
+ $(CC) $(LDFLAGS) $(OBJ_SER) -o $(PROG_SER)
+
+install: ## install binaries in INSTALL_DIR
+install: $(PROG_ZKT) $(PROG_SIG) $(PROG_SER)
+ cp $(PROG_ZKT) $(PROG_SIG) $(PROG_SER) $(INSTALL_DIR)
+
+tags: ## create tags file
+tags: $(SRC_ALL) $(SRC_SIG) $(SRC_ZKT) $(SRC_SER)
+ ctags $(SRC_ALL) $(SRC_SIG) $(SRC_ZKT) $(SRC_SER)
+
+clean: ## remove objectfiles and binaries
+clean:
+ rm -f $(OBJ_SIG) $(OBJ_ZKT) $(OBJ_SER) $(OBJ_ALL)
+
+dist: ## create tar file for distribution
+dist: $(PROJECT)-$(VERSION).tar.gz
+tar: ## create tar file for distribution
+tar: $(PROJECT)-$(VERSION).tar.gz
+
+maintain: ## create configure script
+maintain: configure
+
+mainttar: ## create tar file for maintenance
+mainttar: $(PROJECT)-maint-$(VERSION).tar.gz
+
+configure: configure.ac
+ autoconf && autoheader
+
+man: $(MAN_ZKT).html $(MAN_ZKT).pdf $(MAN_SIG).html $(MAN_SIG).pdf
+
+$(MAN_ZKT).html: $(MAN_ZKT)
+ groff -Thtml -man -mhtml $(MAN_ZKT) > $(MAN_ZKT).html
+$(MAN_ZKT).pdf: $(MAN_ZKT)
+ groff -Tps -man $(MAN_ZKT) | ps2pdf - $(MAN_ZKT).pdf
+$(MAN_SIG).html: $(MAN_SIG)
+ groff -Thtml -man -mhtml $(MAN_SIG) > $(MAN_SIG).html
+$(MAN_SIG).pdf: $(MAN_SIG)
+ groff -Tps -man $(MAN_SIG) | ps2pdf - $(MAN_SIG).pdf
+
+
+$(PROJECT)-$(VERSION).tar.gz: $(SAVE)
+ rm -f examples/hierarchical/log/zkt-*
+ ( \
+ distfiles=`ls -d $(SAVE) | sed 's|^|$(PROJECT)-$(VERSION)/|'` ;\
+ cd .. && tar czvf $(PROJECT)-$(VERSION)/$(PROJECT)-$(VERSION).tar.gz $$distfiles ;\
+ )
+
+$(PROJECT)-maint-$(VERSION).tar.gz: $(MNTSAVE)
+ ( \
+ distfiles=`ls -d $(SAVE) | sed 's|^|$(PROJECT)-$(VERSION)/|'` ;\
+ cd .. && tar czvf $(PROJECT)-$(VERSION)/$(PROJECT)-maint-$(VERSION).tar.gz $$distfiles ;\
+ )
+
+depend:
+ $(CC) -MM $(SRC_SIG) $(SRC_ZKT) $(SRC_SER) $(SRC_ALL)
+
+help:
+ @grep "^.*:[ ]*##" Makefile
+
+## all dependicies
+#:r !make depend
+#gcc -MM dnssec-signer.c zone.c ncparse.c rollover.c dnssec-zkt.c strlist.c zkt.c zkt-soaserial.c dki.c misc.c domaincmp.c zconf.c log.c
+dnssec-signer.o: dnssec-signer.c config_zkt.h zconf.h debug.h misc.h \
+ ncparse.h zone.h dki.h rollover.h log.h
+zone.o: zone.c config_zkt.h debug.h domaincmp.h misc.h zconf.h dki.h \
+ zone.h
+ncparse.o: ncparse.c debug.h misc.h zconf.h log.h ncparse.h
+rollover.o: rollover.c config_zkt.h zconf.h debug.h misc.h zone.h dki.h \
+ log.h rollover.h
+dnssec-zkt.o: dnssec-zkt.c config_zkt.h debug.h misc.h zconf.h strlist.h \
+ dki.h zkt.h
+strlist.o: strlist.c strlist.h
+zkt.o: zkt.c config_zkt.h dki.h misc.h zconf.h strlist.h zkt.h
+zkt-soaserial.o: zkt-soaserial.c config_zkt.h
+dki.o: dki.c config_zkt.h debug.h domaincmp.h misc.h zconf.h dki.h
+misc.o: misc.c config_zkt.h zconf.h log.h debug.h misc.h
+domaincmp.o: domaincmp.c domaincmp.h
+zconf.o: zconf.c config_zkt.h debug.h misc.h zconf.h dki.h
+log.o: log.c config_zkt.h misc.h zconf.h debug.h log.h
diff --git a/contrib/zkt/README b/contrib/zkt/README
new file mode 100644
index 0000000..0798932
--- /dev/null
+++ b/contrib/zkt/README
@@ -0,0 +1,44 @@
+#
+# README dnssec zone key tool
+#
+# (c) March 2005 - Aug 2008 by Holger Zuleger hznet
+# (c) for domaincmp Aug 2005 by Karle Boss & H. Zuleger (kaho)
+# (c) for zconf.c by Jeroen Masar & Holger Zuleger
+#
+
+For more information about the DNSSEC Zone Key Tool please
+have a look at "http://www.hznet.de/dns/zkt/"
+
+You can also subscribe to the zkt-users@sourceforge.net mailing list
+on the following website: https://lists.sourceforge.net/lists/listinfo/zkt-users
+
+The complete software stands under BSD licence (see LICENCE file)
+
+To build the software:
+a) Get the current version of zkt
+ $ wget http://www.hznet.de/dns/zkt/zkt-0.97.tar.gz
+
+b) Unpack
+ $ tar xzvf zkt-0.97.tar.gz
+
+c) Change to dir
+ $ cd zkt-0.97
+
+d) Run configure script
+ $ ./configure
+
+e) (optional) Edit config_zkt.h
+
+f) Compile
+ $ make
+ For MAC users: # this should not needed anymore
+ $ make macos
+ For Solaris: # this should not needed anymore
+ $ make solaris
+
+g) Install
+ $ make install # this will copy the binarys to $HOME/bin
+
+h) (optional) Install and modify the default dnssec.conf file
+ $ ./dnssec-zkt -c "" -Z > /var/named/dnssec.conf
+ $ vi /var/named/dnssec.conf
diff --git a/contrib/zkt/README.logging b/contrib/zkt/README.logging
new file mode 100644
index 0000000..f0f3f90
--- /dev/null
+++ b/contrib/zkt/README.logging
@@ -0,0 +1,99 @@
+#
+# README.logging
+#
+# Introduction into the new logging feature
+# available since v0.96
+#
+
+In previous version of dnssec-signer every message was written
+to the default stdout and stderr channels, and the logging itself
+was handled by a redirection of those chanels to the logger command
+or to a file.
+
+Now, since version v0.96, the dnssec-signer command is able to log all
+messages by itself. File and SYSLOG logging is supported.
+
+To enable the logging into a file channel, you have to specify
+the file or directory name via the commandline option -L (--logfile)
+or via the config file parameter "LogFile".
+ LogFile: ""|"<file>"|"<directory>" (default is "")
+If a file is specified, than each run of dnssec-signer will append the
+messages to tat file. If a directory is specified, than a file with a
+name of zkt-<ISOdate&timeUTC>.log" will be created on each dnssec-signer run.
+
+Logging into the syslog channel could be enabled via the config file
+parameter "SyslogFacility".
+ SyslogFacility: NONE|USER|DAEMON|LOCAL0|..|LOCAL7 (default is USER)
+
+For both channels, the log level could be independently set to one
+of six log levels:
+ LG_FATAL, LG_ERROR, LG_WARNING
+ LB_NOTICE, LG_INFO, LG_DEBUG
+
+The loglevel is settable via the config file parameter :
+ SyslogLevel: FATAL|ERROR|WARNING|NOTICE|INFO|DEBUG
+ (default is ERROR)
+and
+ LogLevel: FATAL|ERROR|WARNING|NOTICE|INFO|DEBUG
+ (default is NOTICE)
+
+All the log parameters are settable on the commandline via the generic
+option -O "optstring" (--config-option="opt").
+
+A verbose message output to stdout could be achieved by the commandline
+option -v (or -v -v).
+If you want to log the same messages with loglevel LG_DEBUG to a file or
+to syslog, you could enable this by setting the config file option
+"VerboseLog" to a value of 1 or 2.
+
+Current logging messages:
+ LG_FATAL: Not all of the fatal errors are logged
+ (e.g.: config file or command line option fatal errors are
+ not logged)
+ LG_ERROR: All error messages will be logged
+ LG_WARNING: KSK lifetime expiration
+ LG_NOTICE:
+ Start and stop of dnssec-signer
+ Re-signing events
+ Key rollover events
+ Zone reload resp. freeze/thaw of dynamic zone
+ LG_INFO: Currently none
+ planned:
+ Mesages for key generation and key status change
+ (e.g.: pre-publish -> activate; revoked -> removed etc.)
+ LG_DEBUG: all "verbose" (-v) and "very verbose" (-v -v) messages
+
+Some recomended and useful logging settings
+
+- The default setting
+ LogFile: ""
+ SyslogFacility: USER
+ SyslogLevel: NOTICE
+ VerboseLog: 0
+
+- Setting as in version v0.95
+ LogFile: "zkt-error.log" # or a directory for seperate logfiles
+ LogLevel: ERROR
+ SyslogFacility: NONE
+ VerboseLog: 0
+
+- Setting as in previous versions
+ LogFile: ""
+ SyslogFacility: NONE
+ VerboseLog: 0
+
+- Recommended setting for normal usage
+ LogFile: "zkt.log" # or a directory for seperate logfiles
+ LogLevel: ERROR
+ SyslogFacility: USER
+ SyslogLevel: NOTICE
+ VerboseLog: 0
+
+- Recommended setting for debugging
+ LogFile: "zkt.log" # or a directory for seperate logfiles
+ LogLevel: DEBUG
+ SyslogFacility: USER
+ SyslogLevel: NOTICE
+ VerboseLog: 2
+
+-
diff --git a/contrib/zkt/TODO b/contrib/zkt/TODO
new file mode 100644
index 0000000..fc53210
--- /dev/null
+++ b/contrib/zkt/TODO
@@ -0,0 +1,37 @@
+TODO list as of zkt-0.97
+
+general:
+ Renaming of the tools to zkt-* ?
+
+dnssec-zkt:
+ feat option to specify the key age as remaining lifetime
+ (Option -i inverse age ?) As of v0.95 the key lifetime
+ is stored at the key itself, so this could be possibly
+ implemented without big effort(?).
+
+dnssec-signer:
+ bug Distribute_Cmd will not work properly on dynamic zones
+
+ bug Automatic KSK rollover of dynamic zones will only work if the parent
+ uses the standard name for the signed zonefile (zonefile.db.signed).
+
+ bug Phase3 of manual ksk rollover do not trigger a resigning of the zone
+ (Key removal is not recognized by dosigning () function )
+
+ bug There is no online checking of the key material by design.
+ So the signer command checks the status of the key as they
+ are represented in the file system and not in the zone.
+ The dnssec maintainer is responsible for the lifeliness of the
+ data in the hosted domain.
+ In other words: It's highly recommended to use the
+ option -r when you use dnssec-signer on a production zone.
+ Then the time of propagation is (more or less) equal to the timestamp
+ of the zone.db.signed file.
+
+ bug The max_TTL and Key_TTL parameter should be set to the value found
+ in the zone. A mechanism for setting up a dnssec.conf file for the
+ zone specific TTL values is needed.
+
+dki:
+ feat Use dynamic memory for dname in dki_t
+
diff --git a/contrib/zkt/config.h.in b/contrib/zkt/config.h.in
new file mode 100644
index 0000000..fa6ef0f
--- /dev/null
+++ b/contrib/zkt/config.h.in
@@ -0,0 +1,217 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Path to BIND utilities */
+#undef BIND_UTIL_PATH
+
+/* BIND version as integer number without dots */
+#undef BIND_VERSION
+
+/* Define to 1 if the `closedir' function returns void instead of `int'. */
+#undef CLOSEDIR_VOID
+
+/* set path of config file (defaults to /var/named) */
+#undef CONFIG_PATH
+
+/* Define to 1 if you have the `alarm' function. */
+#undef HAVE_ALARM
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_DIRENT_H
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#undef HAVE_DOPRNT
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the <getopt.h> header file. */
+#undef HAVE_GETOPT_H
+
+/* Define to 1 if you have the `getopt_long' function. */
+#undef HAVE_GETOPT_LONG
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+ to 0 otherwise. */
+#undef HAVE_MALLOC
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+#undef HAVE_NDIR_H
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#undef HAVE_NETDB_H
+
+/* Define to 1 if you have the `setenv' function. */
+#undef HAVE_SETENV
+
+/* Define to 1 if you have the `socket' function. */
+#undef HAVE_SOCKET
+
+/* Define to 1 if `stat' has the bug that it succeeds when given the
+ zero-length file name argument. */
+#undef HAVE_STAT_EMPTY_STRING_BUG
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#undef HAVE_STRCASECMP
+
+/* Define to 1 if you have the `strchr' function. */
+#undef HAVE_STRCHR
+
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
+
+/* Define to 1 if you have the `strftime' function. */
+#undef HAVE_STRFTIME
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strncasecmp' function. */
+#undef HAVE_STRNCASECMP
+
+/* Define to 1 if you have the `strrchr' function. */
+#undef HAVE_STRRCHR
+
+/* Define to 1 if you have the <syslog.h> header file. */
+#undef HAVE_SYSLOG_H
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_SYS_DIR_H
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_SYS_NDIR_H
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the `tzset' function. */
+#undef HAVE_TZSET
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `utime' function. */
+#undef HAVE_UTIME
+
+/* Define to 1 if you have the <utime.h> header file. */
+#undef HAVE_UTIME_H
+
+/* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */
+#undef HAVE_UTIME_NULL
+
+/* Define to 1 if you have the `vprintf' function. */
+#undef HAVE_VPRINTF
+
+/* log with level */
+#undef LOG_WITH_LEVEL
+
+/* log with progname */
+#undef LOG_WITH_PROGNAME
+
+/* log with timestamp */
+#undef LOG_WITH_TIMESTAMP
+
+/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
+ slash. */
+#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* print age of year */
+#undef PRINT_AGE_OF_YEAR
+
+/* print out timezone */
+#undef PRINT_TIMEZONE
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+#undef TM_IN_SYS_TIME
+
+/* TTL in keyfiles allowed */
+#undef TTL_IN_KEYFILE_ALLOWED
+
+/* Use TREE data structure for dnssec-zkt */
+#undef USE_TREE
+
+/* ZKT version string */
+#undef ZKT_VERSION
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef gid_t
+
+/* Define to rpl_malloc if the replacement function should be used. */
+#undef malloc
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to `unsigned char' if <sys/types.h> does not define. */
+#undef uchar
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef uid_t
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef uint
+
+/* Define to `unsigned long' if <sys/types.h> does not define. */
+#undef ulong
+
+/* Define to `unsigned short' if <sys/types.h> does not define. */
+#undef ushort
diff --git a/contrib/zkt/config_zkt.h b/contrib/zkt/config_zkt.h
new file mode 100644
index 0000000..4c04844
--- /dev/null
+++ b/contrib/zkt/config_zkt.h
@@ -0,0 +1,121 @@
+/*****************************************************************
+**
+** @(#) config_zkt.h -- config options for ZKT
+**
+** Copyright (c) Aug 2005, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+#ifndef CONFIG_ZKT_H
+# define CONFIG_ZKT_H
+
+#ifndef HAS_TIMEGM
+# define HAS_TIMEGM 1
+#endif
+
+#ifndef HAS_UTYPES
+# define HAS_UTYPES 1
+#endif
+
+#ifndef LOG_FNAMETMPL
+# define LOG_FNAMETMPL "/zkt-%04d-%02d-%02dT%02d%02d%02dZ.log"
+#endif
+
+/* don't change anything below this */
+/* the values here are determined or settable via the ./configure script */
+
+#ifndef HAVE_GETOPT_LONG
+# define HAVE_GETOPT_LONG 1
+#endif
+
+#ifndef HAVE_STRFTIME
+# define HAVE_STRFTIME 1
+#endif
+
+#ifndef TTL_IN_KEYFILE_ALLOWED
+# define TTL_IN_KEYFILE_ALLOWED 1
+#endif
+
+#ifndef PRINT_TIMEZONE
+# define PRINT_TIMEZONE 0
+#endif
+
+#ifndef PRINT_AGE_WITH_YEAR
+# define PRINT_AGE_WITH_YEAR 0
+#endif
+
+#ifndef LOG_WITH_PROGNAME
+# define LOG_WITH_PROGNAME 0
+#endif
+
+#ifndef LOG_WITH_TIMESTAMP
+# define LOG_WITH_TIMESTAMP 1
+#endif
+
+#ifndef LOG_WITH_LEVEL
+# define LOG_WITH_LEVEL 1
+#endif
+
+#ifndef CONFIG_PATH
+# define CONFIG_PATH "/var/named/"
+#endif
+
+/* tree usage is setable by configure script parameter */
+#ifndef USE_TREE
+# define USE_TREE 1
+#endif
+
+/* BIND version and utility path will be set by ./configure script */
+#ifndef BIND_VERSION
+# define BIND_VERSION 942
+#endif
+
+#ifndef BIND_UTIL_PATH
+# define BIND_UTIL_PATH "/usr/local/sbin/"
+#endif
+
+#ifndef ZKT_VERSION
+# if defined(USE_TREE) && USE_TREE
+# define ZKT_VERSION "vT0.97 (c) Feb 2005 - Aug 2008 Holger Zuleger hznet.de"
+# else
+# define ZKT_VERSION "v0.97 (c) Feb 2005 - Aug 2008 Holger Zuleger hznet.de"
+# endif
+#endif
+
+
+#if !defined(HAS_UTYPES) || !HAS_UTYPES
+typedef unsigned long ulong;
+typedef unsigned int uint;
+typedef unsigned short ushort;
+typedef unsigned char uchar;
+#endif
+
+#endif
diff --git a/contrib/zkt/configure b/contrib/zkt/configure
new file mode 100755
index 0000000..178398f
--- /dev/null
+++ b/contrib/zkt/configure
@@ -0,0 +1,6838 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59 for ZKT 0.97.
+#
+# Report bugs to <Holger Zuleger hznet.de>.
+#
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete. It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME='ZKT'
+PACKAGE_TARNAME='zkt'
+PACKAGE_VERSION='0.97'
+PACKAGE_STRING='ZKT 0.97'
+PACKAGE_BUGREPORT='Holger Zuleger hznet.de'
+
+ac_unique_file="dnssec-zkt.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT SIGNZONE_PROG CPP EGREP LIBOBJS LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+ac_prev=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_option in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval "enable_$ac_feature=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_$ac_feature='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_$ac_package='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval "with_$ac_package=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+ localstatedir libdir includedir oldincludedir infodir mandir
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+ { (exit 1); exit 1; }; }
+ else
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+ fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures ZKT 0.97 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+ cat <<_ACEOF
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
+_ACEOF
+
+ cat <<\_ACEOF
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of ZKT 0.97:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-print-timezone print out timezone
+ --enable-print-age print age of year
+ --enable-log-progname log with progname
+ --disable-log-timestamp do not log with timestamp
+ --disable-log-level do not log with level
+ --disable-ttl-in-keyfiles
+ do not allow TTL values in keyfiles
+ --enable-configpath=PATH
+ set path of config file (defaults to /var/named)
+ --disable-tree use single linked list instead of binary tree data
+ structure for dnssec-zkt
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <Holger Zuleger hznet.de>.
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ ac_popdir=`pwd`
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d $ac_dir || continue
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+ cd $ac_dir
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f $ac_srcdir/configure.gnu; then
+ echo
+ $SHELL $ac_srcdir/configure.gnu --help=recursive
+ elif test -f $ac_srcdir/configure; then
+ echo
+ $SHELL $ac_srcdir/configure --help=recursive
+ elif test -f $ac_srcdir/configure.ac ||
+ test -f $ac_srcdir/configure.in; then
+ echo
+ $ac_configure --help
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi
+ cd $ac_popdir
+ done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+ cat <<\_ACEOF
+ZKT configure 0.97
+generated by GNU Autoconf 2.59
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by ZKT $as_me 0.97, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ # Get rid of the leading space.
+ ac_sep=" "
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+{
+ (set) 2>&1 |
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ sed -n \
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ ;;
+ *)
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+}
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ sed "/^$/d" confdefs.h | sort
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core &&
+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+ ' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
+ esac
+ fi
+else
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+ eval ac_new_val="\$ac_env_${ac_var}_value"
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+### Files to test to check if src dir contains the package
+
+ ac_config_headers="$ac_config_headers config.h"
+
+
+
+### Checks for programs.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_CC" && break
+done
+
+ CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
+ break;;
+ * )
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std1 is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std1. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ '' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+### find out the path to BIND utils and version
+# Extract the first word of "dnssec-signzone", so it can be a program name with args.
+set dummy dnssec-signzone; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_SIGNZONE_PROG+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $SIGNZONE_PROG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_SIGNZONE_PROG="$SIGNZONE_PROG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_SIGNZONE_PROG="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ ;;
+esac
+fi
+SIGNZONE_PROG=$ac_cv_path_SIGNZONE_PROG
+
+if test -n "$SIGNZONE_PROG"; then
+ echo "$as_me:$LINENO: result: $SIGNZONE_PROG" >&5
+echo "${ECHO_T}$SIGNZONE_PROG" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+bind_util_path=`dirname $SIGNZONE_PROG`
+if test -z "$SIGNZONE_PROG" ; then
+ { { echo "$as_me:$LINENO: error: *** 'BIND dnssec-signzone dnssec-keygen' missing, please install or fix your \$PATH ***" >&5
+echo "$as_me: error: *** 'BIND dnssec-signzone dnssec-keygen' missing, please install or fix your \$PATH ***" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+# define BIND_UTIL_PATH in config.h.in
+
+cat >>confdefs.h <<_ACEOF
+#define BIND_UTIL_PATH "$bind_util_path/"
+_ACEOF
+
+# define BIND_VERSION in config.h.in
+bind_version=`$SIGNZONE_PROG 2>&1 | grep Version: | tr -dc 0-9`
+
+cat >>confdefs.h <<_ACEOF
+#define BIND_VERSION $bind_version
+_ACEOF
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ exit(2);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+echo "$as_me:$LINENO: checking for uint" >&5
+echo $ECHO_N "checking for uint... $ECHO_C" >&6
+if test "${ac_cv_type_uint+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((uint *) 0)
+ return 0;
+if (sizeof (uint))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_uint=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uint=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uint" >&5
+echo "${ECHO_T}$ac_cv_type_uint" >&6
+if test $ac_cv_type_uint = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define uint unsigned int
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for ulong" >&5
+echo $ECHO_N "checking for ulong... $ECHO_C" >&6
+if test "${ac_cv_type_ulong+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((ulong *) 0)
+ return 0;
+if (sizeof (ulong))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_ulong=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_ulong=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_ulong" >&5
+echo "${ECHO_T}$ac_cv_type_ulong" >&6
+if test $ac_cv_type_ulong = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define ulong unsigned long
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for ushort" >&5
+echo $ECHO_N "checking for ushort... $ECHO_C" >&6
+if test "${ac_cv_type_ushort+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((ushort *) 0)
+ return 0;
+if (sizeof (ushort))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_ushort=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_ushort=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_ushort" >&5
+echo "${ECHO_T}$ac_cv_type_ushort" >&6
+if test $ac_cv_type_ushort = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define ushort unsigned short
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for uchar" >&5
+echo $ECHO_N "checking for uchar... $ECHO_C" >&6
+if test "${ac_cv_type_uchar+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((uchar *) 0)
+ return 0;
+if (sizeof (uchar))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_uchar=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uchar=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uchar" >&5
+echo "${ECHO_T}$ac_cv_type_uchar" >&6
+if test $ac_cv_type_uchar = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define uchar unsigned char
+_ACEOF
+
+fi
+
+
+### define configure arguments
+# Check whether --enable-printtimezone or --disable-printtimezone was given.
+if test "${enable_printtimezone+set}" = set; then
+ enableval="$enable_printtimezone"
+ printtimezone=$enableval
+fi;
+printtimezone=0
+test "$printtimezone" = yes && printtimezone=1
+
+cat >>confdefs.h <<_ACEOF
+#define PRINT_TIMEZONE $printtimezone
+_ACEOF
+
+
+# Check whether --enable-printyear or --disable-printyear was given.
+if test "${enable_printyear+set}" = set; then
+ enableval="$enable_printyear"
+ printyear=$enableval
+fi;
+printyear=0
+test "$printyear" = yes && printyear=1
+
+cat >>confdefs.h <<_ACEOF
+#define PRINT_AGE_OF_YEAR $printyear
+_ACEOF
+
+
+# Check whether --enable-logprogname or --disable-logprogname was given.
+if test "${enable_logprogname+set}" = set; then
+ enableval="$enable_logprogname"
+ logprogname=$enableval
+fi;
+logprogname=0
+test "$logprogname" = yes && logprogname=1
+
+cat >>confdefs.h <<_ACEOF
+#define LOG_WITH_PROGNAME $logprogname
+_ACEOF
+
+
+# Check whether --enable-logtimestamp or --disable-logtimestamp was given.
+if test "${enable_logtimestamp+set}" = set; then
+ enableval="$enable_logtimestamp"
+ logtimestamp=$enableval
+fi;
+logtimestamp=1
+test "$logtimestamp" = no && logtimestamp=0
+
+cat >>confdefs.h <<_ACEOF
+#define LOG_WITH_TIMESTAMP $logtimestamp
+_ACEOF
+
+
+# Check whether --enable-loglevel or --disable-loglevel was given.
+if test "${enable_loglevel+set}" = set; then
+ enableval="$enable_loglevel"
+ loglevel=$enableval
+fi;
+loglevel=1
+test "$loglevel" = no && loglevel=0
+
+cat >>confdefs.h <<_ACEOF
+#define LOG_WITH_LEVEL $loglevel
+_ACEOF
+
+
+# Check whether --enable-ttl_in_keyfile or --disable-ttl_in_keyfile was given.
+if test "${enable_ttl_in_keyfile+set}" = set; then
+ enableval="$enable_ttl_in_keyfile"
+ ttl_in_keyfile=$enableval
+fi;
+ttl_in_keyfile=1
+test "$ttl_in_keyfile" = no && ttl_in_keyfile=0
+
+cat >>confdefs.h <<_ACEOF
+#define TTL_IN_KEYFILE_ALLOWED $ttl_in_keyfile
+_ACEOF
+
+
+configpath="/var/named"
+# Check whether --enable-configpath or --disable-configpath was given.
+if test "${enable_configpath+set}" = set; then
+ enableval="$enable_configpath"
+ configpath=$enableval
+fi;
+case "$configpath" in
+yes)
+ configpath="/var/named"
+ ;;
+no)
+ configpath=""
+ ;;
+*)
+ ;;
+esac
+
+cat >>confdefs.h <<_ACEOF
+#define CONFIG_PATH "$configpath/"
+_ACEOF
+
+
+usetree=1
+t="T"
+# Check whether --enable-tree or --disable-tree was given.
+if test "${enable_tree+set}" = set; then
+ enableval="$enable_tree"
+ usetree=$enableval
+fi;
+if test "$usetree" = no
+then
+ usetree=0
+ t=""
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define USE_TREE $usetree
+_ACEOF
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define ZKT_VERSION "v$t$PACKAGE_VERSION (c) Feb 2005 - Aug 2008 Holger Zuleger hznet.de"
+_ACEOF
+
+
+### Checks for libraries.
+
+
+### Checks for header files.
+
+
+
+
+
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+ as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
+echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$ac_hdr>
+
+int
+main ()
+{
+if ((DIR *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
+_ACEOF
+
+ac_header_dirent=$ac_hdr; break
+fi
+
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+ echo "$as_me:$LINENO: checking for library containing opendir" >&5
+echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6
+if test "${ac_cv_search_opendir+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+ac_cv_search_opendir=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char opendir ();
+int
+main ()
+{
+opendir ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search_opendir="none required"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_opendir" = no; then
+ for ac_lib in dir; do
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char opendir ();
+int
+main ()
+{
+opendir ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search_opendir="-l$ac_lib"
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+echo "${ECHO_T}$ac_cv_search_opendir" >&6
+if test "$ac_cv_search_opendir" != no; then
+ test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS"
+
+fi
+
+else
+ echo "$as_me:$LINENO: checking for library containing opendir" >&5
+echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6
+if test "${ac_cv_search_opendir+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+ac_cv_search_opendir=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char opendir ();
+int
+main ()
+{
+opendir ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search_opendir="none required"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_opendir" = no; then
+ for ac_lib in x; do
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char opendir ();
+int
+main ()
+{
+opendir ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search_opendir="-l$ac_lib"
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+echo "${ECHO_T}$ac_cv_search_opendir" >&6
+if test "$ac_cv_search_opendir" != no; then
+ test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS"
+
+fi
+
+fi
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ exit(2);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+for ac_header in fcntl.h netdb.h stdlib.h getopt.h string.h strings.h sys/socket.h sys/time.h sys/types.h syslog.h unistd.h utime.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## -------------------------------------- ##
+## Report this to Holger Zuleger hznet.de ##
+## -------------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+### Checks for typedefs, structures, and compiler characteristics.
+echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
+if test "${ac_cv_c_const+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset x;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *ccp;
+ char **p;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ ccp = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++ccp;
+ p = (char**) ccp;
+ ccp = (char const *const *) p;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ }
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_const=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_const=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6
+if test "${ac_cv_type_size_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((size_t *) 0)
+ return 0;
+if (sizeof (size_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_size_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_size_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6
+if test $ac_cv_type_size_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
+if test "${ac_cv_header_time+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_time=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_time=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6
+if test $ac_cv_header_time = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TIME_WITH_SYS_TIME 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5
+echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6
+if test "${ac_cv_struct_tm+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <time.h>
+
+int
+main ()
+{
+struct tm *tp; tp->tm_sec;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_struct_tm=time.h
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_struct_tm=sys/time.h
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5
+echo "${ECHO_T}$ac_cv_struct_tm" >&6
+if test $ac_cv_struct_tm = sys/time.h; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TM_IN_SYS_TIME 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5
+echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6
+if test "${ac_cv_type_uid_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "uid_t" >/dev/null 2>&1; then
+ ac_cv_type_uid_t=yes
+else
+ ac_cv_type_uid_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5
+echo "${ECHO_T}$ac_cv_type_uid_t" >&6
+if test $ac_cv_type_uid_t = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define uid_t int
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define gid_t int
+_ACEOF
+
+fi
+
+
+
+### Checks for library functions.
+echo "$as_me:$LINENO: checking whether closedir returns void" >&5
+echo $ECHO_N "checking whether closedir returns void... $ECHO_C" >&6
+if test "${ac_cv_func_closedir_void+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_closedir_void=yes
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header_dirent>
+#ifndef __cplusplus
+int closedir ();
+#endif
+
+int
+main ()
+{
+exit (closedir (opendir (".")) != 0);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_closedir_void=no
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_closedir_void=yes
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_closedir_void" >&5
+echo "${ECHO_T}$ac_cv_func_closedir_void" >&6
+if test $ac_cv_func_closedir_void = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define CLOSEDIR_VOID 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for error_at_line" >&5
+echo $ECHO_N "checking for error_at_line... $ECHO_C" >&6
+if test "${ac_cv_lib_error_at_line+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+error_at_line (0, 0, "", 0, "");
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_error_at_line=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_error_at_line=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_error_at_line" >&5
+echo "${ECHO_T}$ac_cv_lib_error_at_line" >&6
+if test $ac_cv_lib_error_at_line = no; then
+ case $LIBOBJS in
+ "error.$ac_objext" | \
+ *" error.$ac_objext" | \
+ "error.$ac_objext "* | \
+ *" error.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS error.$ac_objext" ;;
+esac
+
+fi
+
+
+for ac_header in stdlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## -------------------------------------- ##
+## Report this to Holger Zuleger hznet.de ##
+## -------------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5
+echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6
+if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_malloc_0_nonnull=no
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if STDC_HEADERS || HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *malloc ();
+#endif
+
+int
+main ()
+{
+exit (malloc (0) ? 0 : 1);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_malloc_0_nonnull=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_malloc_0_nonnull=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5
+echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6
+if test $ac_cv_func_malloc_0_nonnull = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MALLOC 1
+_ACEOF
+
+else
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_MALLOC 0
+_ACEOF
+
+ case $LIBOBJS in
+ "malloc.$ac_objext" | \
+ *" malloc.$ac_objext" | \
+ "malloc.$ac_objext "* | \
+ *" malloc.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;;
+esac
+
+
+cat >>confdefs.h <<\_ACEOF
+#define malloc rpl_malloc
+_ACEOF
+
+fi
+
+
+
+
+
+
+for ac_header in stdlib.h sys/time.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## -------------------------------------- ##
+## Report this to Holger Zuleger hznet.de ##
+## -------------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_func in alarm
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+echo "$as_me:$LINENO: checking for working mktime" >&5
+echo $ECHO_N "checking for working mktime... $ECHO_C" >&6
+if test "${ac_cv_func_working_mktime+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_working_mktime=no
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Test program from Paul Eggert and Tony Leneis. */
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if !HAVE_ALARM
+# define alarm(X) /* empty */
+#endif
+
+/* Work around redefinition to rpl_putenv by other config tests. */
+#undef putenv
+
+static time_t time_t_max;
+static time_t time_t_min;
+
+/* Values we'll use to set the TZ environment variable. */
+static char *tz_strings[] = {
+ (char *) 0, "TZ=GMT0", "TZ=JST-9",
+ "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
+};
+#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
+
+/* Fail if mktime fails to convert a date in the spring-forward gap.
+ Based on a problem report from Andreas Jaeger. */
+static void
+spring_forward_gap ()
+{
+ /* glibc (up to about 1998-10-07) failed this test. */
+ struct tm tm;
+
+ /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
+ instead of "TZ=America/Vancouver" in order to detect the bug even
+ on systems that don't support the Olson extension, or don't have the
+ full zoneinfo tables installed. */
+ putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
+
+ tm.tm_year = 98;
+ tm.tm_mon = 3;
+ tm.tm_mday = 5;
+ tm.tm_hour = 2;
+ tm.tm_min = 0;
+ tm.tm_sec = 0;
+ tm.tm_isdst = -1;
+ if (mktime (&tm) == (time_t)-1)
+ exit (1);
+}
+
+static void
+mktime_test1 (now)
+ time_t now;
+{
+ struct tm *lt;
+ if ((lt = localtime (&now)) && mktime (lt) != now)
+ exit (1);
+}
+
+static void
+mktime_test (now)
+ time_t now;
+{
+ mktime_test1 (now);
+ mktime_test1 ((time_t) (time_t_max - now));
+ mktime_test1 ((time_t) (time_t_min + now));
+}
+
+static void
+irix_6_4_bug ()
+{
+ /* Based on code from Ariel Faigon. */
+ struct tm tm;
+ tm.tm_year = 96;
+ tm.tm_mon = 3;
+ tm.tm_mday = 0;
+ tm.tm_hour = 0;
+ tm.tm_min = 0;
+ tm.tm_sec = 0;
+ tm.tm_isdst = -1;
+ mktime (&tm);
+ if (tm.tm_mon != 2 || tm.tm_mday != 31)
+ exit (1);
+}
+
+static void
+bigtime_test (j)
+ int j;
+{
+ struct tm tm;
+ time_t now;
+ tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
+ now = mktime (&tm);
+ if (now != (time_t) -1)
+ {
+ struct tm *lt = localtime (&now);
+ if (! (lt
+ && lt->tm_year == tm.tm_year
+ && lt->tm_mon == tm.tm_mon
+ && lt->tm_mday == tm.tm_mday
+ && lt->tm_hour == tm.tm_hour
+ && lt->tm_min == tm.tm_min
+ && lt->tm_sec == tm.tm_sec
+ && lt->tm_yday == tm.tm_yday
+ && lt->tm_wday == tm.tm_wday
+ && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
+ == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
+ exit (1);
+ }
+}
+
+int
+main ()
+{
+ time_t t, delta;
+ int i, j;
+
+ /* This test makes some buggy mktime implementations loop.
+ Give up after 60 seconds; a mktime slower than that
+ isn't worth using anyway. */
+ alarm (60);
+
+ for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
+ continue;
+ time_t_max--;
+ if ((time_t) -1 < 0)
+ for (time_t_min = -1; (time_t) (time_t_min * 2) < 0; time_t_min *= 2)
+ continue;
+ delta = time_t_max / 997; /* a suitable prime number */
+ for (i = 0; i < N_STRINGS; i++)
+ {
+ if (tz_strings[i])
+ putenv (tz_strings[i]);
+
+ for (t = 0; t <= time_t_max - delta; t += delta)
+ mktime_test (t);
+ mktime_test ((time_t) 1);
+ mktime_test ((time_t) (60 * 60));
+ mktime_test ((time_t) (60 * 60 * 24));
+
+ for (j = 1; 0 < j; j *= 2)
+ bigtime_test (j);
+ bigtime_test (j - 1);
+ }
+ irix_6_4_bug ();
+ spring_forward_gap ();
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_working_mktime=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_working_mktime=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_working_mktime" >&5
+echo "${ECHO_T}$ac_cv_func_working_mktime" >&6
+if test $ac_cv_func_working_mktime = no; then
+ case $LIBOBJS in
+ "mktime.$ac_objext" | \
+ *" mktime.$ac_objext" | \
+ "mktime.$ac_objext "* | \
+ *" mktime.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS mktime.$ac_objext" ;;
+esac
+
+fi
+
+echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5
+echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6
+if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ rm -f conftest.sym conftest.file
+echo >conftest.file
+if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+struct stat sbuf;
+ /* Linux will dereference the symlink and fail.
+ That is better in the sense that it means we will not
+ have to compile and use the lstat wrapper. */
+ exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_lstat_dereferences_slashed_symlink=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_lstat_dereferences_slashed_symlink=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+else
+ # If the `ln -s' command failed, then we probably don't even
+ # have an lstat function.
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
+fi
+rm -f conftest.sym conftest.file
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5
+echo "${ECHO_T}$ac_cv_func_lstat_dereferences_slashed_symlink" >&6
+
+test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
+
+cat >>confdefs.h <<_ACEOF
+#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
+_ACEOF
+
+
+if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then
+ case $LIBOBJS in
+ "lstat.$ac_objext" | \
+ *" lstat.$ac_objext" | \
+ "lstat.$ac_objext "* | \
+ *" lstat.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;;
+esac
+
+fi
+
+echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5
+echo $ECHO_N "checking whether stat accepts an empty string... $ECHO_C" >&6
+if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_stat_empty_string_bug=yes
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+struct stat sbuf;
+ exit (stat ("", &sbuf) ? 1 : 0);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_stat_empty_string_bug=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_stat_empty_string_bug=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5
+echo "${ECHO_T}$ac_cv_func_stat_empty_string_bug" >&6
+if test $ac_cv_func_stat_empty_string_bug = yes; then
+ case $LIBOBJS in
+ "stat.$ac_objext" | \
+ *" stat.$ac_objext" | \
+ "stat.$ac_objext "* | \
+ *" stat.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;;
+esac
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STAT_EMPTY_STRING_BUG 1
+_ACEOF
+
+fi
+
+
+for ac_func in strftime
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+ # strftime is in -lintl on SCO UNIX.
+echo "$as_me:$LINENO: checking for strftime in -lintl" >&5
+echo $ECHO_N "checking for strftime in -lintl... $ECHO_C" >&6
+if test "${ac_cv_lib_intl_strftime+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lintl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char strftime ();
+int
+main ()
+{
+strftime ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_intl_strftime=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_intl_strftime=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5
+echo "${ECHO_T}$ac_cv_lib_intl_strftime" >&6
+if test $ac_cv_lib_intl_strftime = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRFTIME 1
+_ACEOF
+
+LIBS="-lintl $LIBS"
+fi
+
+fi
+done
+
+echo "$as_me:$LINENO: checking whether utime accepts a null argument" >&5
+echo $ECHO_N "checking whether utime accepts a null argument... $ECHO_C" >&6
+if test "${ac_cv_func_utime_null+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ rm -f conftest.data; >conftest.data
+# Sequent interprets utime(file, 0) to mean use start of epoch. Wrong.
+if test "$cross_compiling" = yes; then
+ ac_cv_func_utime_null=no
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+struct stat s, t;
+ exit (!(stat ("conftest.data", &s) == 0
+ && utime ("conftest.data", (long *)0) == 0
+ && stat ("conftest.data", &t) == 0
+ && t.st_mtime >= s.st_mtime
+ && t.st_mtime - s.st_mtime < 120));
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_utime_null=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_utime_null=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core *.core
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_utime_null" >&5
+echo "${ECHO_T}$ac_cv_func_utime_null" >&6
+if test $ac_cv_func_utime_null = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_UTIME_NULL 1
+_ACEOF
+
+fi
+rm -f conftest.data
+
+
+for ac_func in vprintf
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+echo "$as_me:$LINENO: checking for _doprnt" >&5
+echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6
+if test "${ac_cv_func__doprnt+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define _doprnt to an innocuous variant, in case <limits.h> declares _doprnt.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define _doprnt innocuous__doprnt
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char _doprnt (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef _doprnt
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char _doprnt ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub__doprnt) || defined (__stub____doprnt)
+choke me
+#else
+char (*f) () = _doprnt;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != _doprnt;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func__doprnt=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func__doprnt=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5
+echo "${ECHO_T}$ac_cv_func__doprnt" >&6
+if test $ac_cv_func__doprnt = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DOPRNT 1
+_ACEOF
+
+fi
+
+fi
+done
+
+
+# 2008-07-04 getopt_long added
+
+
+
+
+
+
+
+
+
+
+
+
+
+for ac_func in getopt_long gettimeofday memset setenv socket strcasecmp strchr strdup strerror strncasecmp strrchr tzset utime
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+ ac_config_files="$ac_config_files Makefile"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+ (set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+ if test -w $cache_file; then
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ cat confcache >$cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ ]*$//;
+}'
+fi
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_i=`echo "$ac_i" |
+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+ # 2. Add them.
+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling. Logging --version etc. is OK.
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by ZKT $as_me 0.97, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+ZKT config.status 0.97
+configured by $0, generated by GNU Autoconf 2.59,
+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "x$1" : 'x\([^=]*\)='`
+ ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ -*)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ *) # This is not an option, so the user has probably given explicit
+ # arguments.
+ ac_option=$1
+ ac_need_defaults=false;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --vers* | -V )
+ echo "$ac_cs_version"; exit 0 ;;
+ --he | --h)
+ # Conflict between --help and --header
+ { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1" ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./confstat$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@SIGNZONE_PROG@,$SIGNZONE_PROG,;t t
+s,@CPP@,$CPP,;t t
+s,@EGREP@,$EGREP,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+ cat >>$CONFIG_STATUS <<\_ACEOF
+ # Split the substitutions into bite-sized pieces for seds with
+ # small command number limits, like on Digital OSF/1 and HP-UX.
+ ac_max_sed_lines=48
+ ac_sed_frag=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_lines # Line after last line for current file.
+ ac_more_lines=:
+ ac_sed_cmds=
+ while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ else
+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ fi
+ if test ! -s $tmp/subs.frag; then
+ ac_more_lines=false
+ else
+ # The purpose of the label and of the branching condition is to
+ # speed up the sed processing (if there are no `@' at all, there
+ # is no need to browse any of the substitutions).
+ # These are the two extra sed commands mentioned above.
+ (echo ':t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+ fi
+ ac_sed_frag=`expr $ac_sed_frag + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_lines`
+ fi
+ done
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+ fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
+ esac
+
+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+
+
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ configure_input=
+ else
+ configure_input="$ac_file. "
+ fi
+ configure_input=$configure_input"Generated from `echo $ac_file_in |
+ sed 's,.*/,,'` by configure."
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo "$f";;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo "$f"
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo "$srcdir/$f"
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+ rm -f $tmp/stdin
+ if test x"$ac_file" != x-; then
+ mv $tmp/out $ac_file
+ else
+ cat $tmp/out
+ rm -f $tmp/out
+ fi
+
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_HEADER section.
+#
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='[ ].*$,\1#\2'
+ac_dC=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='$,\1#\2define\3'
+ac_uC=' '
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
+ esac
+
+ test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ # Do quote $f, to prevent DOS paths from being IFS'd.
+ echo "$f";;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo "$f"
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo "$srcdir/$f"
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+ # Remove the trailing spaces.
+ sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h. The first handles `#define'
+# templates, and the second `#undef' templates.
+# And first: Protect against being on the right side of a sed subst in
+# config.status. Protect against being in an unquoted here document
+# in config.status.
+rm -f conftest.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless. Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >>conftest.undefs <<\_ACEOF
+s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo ' :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+ # Write a limited-size here document to $tmp/defines.sed.
+ echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#define' lines.
+ echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f $tmp/defines.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+ rm -f conftest.defines
+ mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo ' fi # grep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.undefs >/dev/null
+do
+ # Write a limited-size here document to $tmp/undefs.sed.
+ echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#undef'
+ echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+ rm -f conftest.undefs
+ mv conftest.tail conftest.undefs
+done
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ echo "/* Generated by configure. */" >$tmp/config.h
+ else
+ echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
+ fi
+ cat $tmp/in >>$tmp/config.h
+ rm -f $tmp/in
+ if test x"$ac_file" != x-; then
+ if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+ { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ rm -f $ac_file
+ mv $tmp/config.h $ac_file
+ fi
+ else
+ cat $tmp/config.h
+ rm -f $tmp/config.h
+ fi
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+
diff --git a/contrib/zkt/debug.h b/contrib/zkt/debug.h
new file mode 100644
index 0000000..e0c47dc
--- /dev/null
+++ b/contrib/zkt/debug.h
@@ -0,0 +1,66 @@
+/*****************************************************************
+**
+** @(#) debug.h -- macros for debug messages
+**
+** compile with cc -DDBG to activate
+**
+** Copyright (c) Jan 2005, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+#ifndef DEBUG_H
+# define DEBUG_H
+
+# ifdef DBG
+# define dbg_line() fprintf (stderr, "DBG: %s(%d) reached\n", __FILE__, __LINE__)
+# define dbg_msg(msg) fprintf (stderr, "DBG: %s(%d) %s\n", __FILE__, __LINE__, msg)
+# define dbg_val0(text) fprintf (stderr, "DBG: %s(%d) %s", __FILE__, __LINE__, text)
+# define dbg_val1(fmt, var) dbg_val (fmt, var)
+# define dbg_val(fmt, var) fprintf (stderr, "DBG: %s(%d) " fmt, __FILE__, __LINE__, var)
+# define dbg_val2(fmt, v1, v2) fprintf (stderr, "DBG: %s(%d) " fmt, __FILE__, __LINE__, v1, v2)
+# define dbg_val3(fmt, v1, v2, v3) fprintf (stderr, "DBG: %s(%d) " fmt, __FILE__, __LINE__, v1, v2, v3)
+# define dbg_val4(fmt, v1, v2, v3, v4) fprintf (stderr, "DBG: %s(%d) " fmt, __FILE__, __LINE__, v1, v2, v3, v4)
+# define dbg_val5(fmt, v1, v2, v3, v4, v5) fprintf (stderr, "DBG: %s(%d) " fmt, __FILE__, __LINE__, v1, v2, v3, v4, v5)
+# define dbg_val6(fmt, v1, v2, v3, v4, v5, v6) fprintf (stderr, "DBG: %s(%d) " fmt, __FILE__, __LINE__, v1, v2, v3, v4, v5, v6)
+# else
+# define dbg_line()
+# define dbg_msg(msg)
+# define dbg_val0(text)
+# define dbg_val1(fmt, var)
+# define dbg_val(fmt, str)
+# define dbg_val2(fmt, v1, v2)
+# define dbg_val3(fmt, v1, v2, v3)
+# define dbg_val4(fmt, v1, v2, v3, v4)
+# define dbg_val5(fmt, v1, v2, v3, v4, v5)
+# define dbg_val6(fmt, v1, v2, v3, v4, v5, v6)
+# endif
+
+#endif
diff --git a/contrib/zkt/dki.c b/contrib/zkt/dki.c
new file mode 100644
index 0000000..81498ae
--- /dev/null
+++ b/contrib/zkt/dki.c
@@ -0,0 +1,1185 @@
+/*****************************************************************
+**
+** @(#) dki.c (c) Jan 2005 Holger Zuleger hznet.de
+**
+** A library for managing BIND dnssec key files.
+**
+** Copyright (c) Jan 2005, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+**
+*****************************************************************/
+
+# include <stdio.h>
+# include <string.h>
+# include <ctype.h> /* tolower(), ... */
+# include <unistd.h> /* link(), unlink(), ... */
+# include <stdlib.h>
+# include <sys/types.h>
+# include <sys/time.h>
+# include <sys/stat.h>
+# include <dirent.h>
+# include <assert.h>
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+# include "config_zkt.h"
+# include "debug.h"
+# include "domaincmp.h"
+# include "misc.h"
+# include "zconf.h"
+#define extern
+# include "dki.h"
+#undef extern
+
+/*****************************************************************
+** private (static) function declaration and definition
+*****************************************************************/
+static char dki_estr[255+1];
+
+static dki_t *dki_alloc ()
+{
+ dki_estr[0] = '\0';
+ dki_t *dkp = malloc (sizeof (dki_t));
+
+ if ( (dkp = malloc (sizeof (dki_t))) )
+ {
+ memset (dkp, 0, sizeof (dki_t));
+ return dkp;
+ }
+
+ snprintf (dki_estr, sizeof (dki_estr),
+ "dki_alloc: Out of memory");
+ return NULL;
+}
+
+static int dki_readfile (FILE *fp, dki_t *dkp)
+{
+ int algo, flags, type;
+ int c;
+ char *p;
+ char buf[4095+1];
+ char tag[25+1];
+ char val[14+1]; /* e.g. "YYYYMMDDhhmmss" | "60d" */
+
+ assert (dkp != NULL);
+ assert (fp != NULL);
+
+ while ( (c = getc (fp)) == ';' ) /* line start with comment ? */
+ {
+ tag[0] = val[0] = '\0';
+ if ( (c = getc (fp)) == '%' ) /* special comment? */
+ {
+ while ( (c = getc (fp)) == ' ' || c == '\t' )
+ ;
+ ungetc (c, fp);
+ /* then try to read in the creation, expire and lifetime */
+ if ( fscanf (fp, "%25[a-zA-Z]=%14s", tag, val) == 2 )
+ {
+ dbg_val2 ("dki_readfile: tag=%s val=%s \n", tag, val);
+ switch ( tolower (tag[0]) )
+ {
+ case 'g': dkp->gentime = timestr2time (val); break;
+ case 'e': dkp->exptime = timestr2time (val); break;
+ case 'l': dkp->lifetime = atoi (val) * DAYSEC; break;
+ }
+ }
+ }
+ else
+ ungetc (c, fp);
+ while ( (c = getc (fp)) != EOF && c != '\n' ) /* eat up rest of the line */
+ ;
+ }
+ ungetc (c, fp); /* push back last char */
+
+ if ( fscanf (fp, "%4095s", buf) != 1 ) /* read label */
+ return -1;
+
+ if ( strcmp (buf, dkp->name) != 0 )
+ return -2;
+
+#if defined(TTL_IN_KEYFILE_ALLOWED) && TTL_IN_KEYFILE_ALLOWED
+ /* skip optional TTL value */
+ while ( (c = getc (fp)) != EOF && isspace (c) ) /* skip spaces */
+ ;
+ if ( isdigit (c) ) /* skip ttl */
+ fscanf (fp, "%*d");
+ else
+ ungetc (c, fp); /* oops, no ttl */
+#endif
+
+ if ( (c = fscanf (fp, " IN DNSKEY %d %d %d", &flags, &type, &algo)) != 3 &&
+ (c = fscanf (fp, "KEY %d %d %d", &flags, &type, &algo)) != 3 )
+ return -3;
+ if ( type != 3 || algo != dkp->algo )
+ return -4; /* no DNSKEY or algorithm mismatch */
+ if ( ((flags >> 8) & 0xFF) != 01 )
+ return -5; /* no ZONE key */
+ dkp->flags = flags;
+
+ if ( fgets (buf, sizeof buf, fp) == NULL || buf[0] == '\0' )
+ return -6;
+ p = buf + strlen (buf);
+ *--p = '\0'; /* delete trailing \n */
+ /* delete leading ws */
+ for ( p = buf; *p && isspace (*p); p++ )
+ ;
+
+ dkp->pubkey = strdup (p);
+
+ return 0;
+}
+
+static int dki_writeinfo (const dki_t *dkp, const char *path)
+{
+ FILE *fp;
+
+ assert (dkp != NULL);
+ assert (path != NULL && path[0] != '\0');
+
+ if ( (fp = fopen (path, "w")) == NULL )
+ return 0;
+ dbg_val1 ("dki_writeinfo %s\n", path);
+ if ( dki_prt_dnskey_raw (dkp, fp) == 0 )
+ return 0;
+ fclose (fp);
+ touch (path, dkp->time); /* restore time of key file */
+
+ return 1;
+}
+
+static int dki_setstat (dki_t *dkp, int status, int preserve_time);
+
+/*****************************************************************
+** public function definition
+*****************************************************************/
+
+/*****************************************************************
+** dki_free ()
+*****************************************************************/
+void dki_free (dki_t *dkp)
+{
+ assert (dkp != NULL);
+
+ if ( dkp->pubkey )
+ free (dkp->pubkey);
+ free (dkp);
+}
+
+/*****************************************************************
+** dki_freelist ()
+*****************************************************************/
+void dki_freelist (dki_t **listp)
+{
+ dki_t *curr;
+ dki_t *next;
+
+ assert (listp != NULL);
+
+ curr = *listp;
+ while ( curr )
+ {
+ next = curr->next;
+ dki_free (curr);
+ curr = next;
+ }
+ if ( *listp )
+ *listp = NULL;
+}
+
+#if defined(USE_TREE) && USE_TREE
+/*****************************************************************
+** dki_tfree ()
+*****************************************************************/
+void dki_tfree (dki_t **tree)
+{
+ assert (tree != NULL);
+ // TODO: tdestroy is a GNU extension
+ // tdestroy (*tree, dki_free);
+}
+#endif
+
+/*****************************************************************
+** dki_new ()
+** create new keyfile
+** allocate memory for new dki key and init with keyfile
+*****************************************************************/
+dki_t *dki_new (const char *dir, const char *name, int ksk, int algo, int bitsize, const char *rfile, int lf_days)
+{
+ char cmdline[511+1];
+ char fname[254+1];
+ char randfile[254+1];
+ FILE *fp;
+ int len;
+ char *flag = "";
+ char *expflag = "";
+ dki_t *new;
+
+ if ( ksk )
+ flag = "-f KSK";
+
+ randfile[0] = '\0';
+ if ( rfile && *rfile )
+ snprintf (randfile, sizeof (randfile), "-r %.250s ", rfile);
+
+ if ( algo == DK_ALGO_RSA || algo == DK_ALGO_RSASHA1 )
+ expflag = "-e ";
+
+ if ( dir && *dir )
+ snprintf (cmdline, sizeof (cmdline), "cd %s ; %s %s%s-n ZONE -a %s -b %d %s %s",
+ dir, KEYGENCMD, randfile, expflag, dki_algo2str(algo), bitsize, flag, name);
+ else
+ snprintf (cmdline, sizeof (cmdline), "%s %s%s-n ZONE -a %s -b %d %s %s",
+ KEYGENCMD, randfile, expflag, dki_algo2str(algo), bitsize, flag, name);
+
+ dbg_msg (cmdline);
+
+ if ( (fp = popen (cmdline, "r")) == NULL || fgets (fname, sizeof fname, fp) == NULL )
+ return NULL;
+ pclose (fp);
+
+ len = strlen (fname) - 1;
+ if ( len >= 0 && fname[len] == '\n' )
+ fname[len] = '\0';
+
+ new = dki_read (dir, fname);
+ if ( new )
+ dki_setlifetime (new, lf_days); /* sets gentime + proposed lifetime */
+
+ return new;
+}
+
+/*****************************************************************
+** dki_read ()
+** read key from file 'filename' (independed of the extension)
+*****************************************************************/
+dki_t *dki_read (const char *dirname, const char *filename)
+{
+ dki_t *dkp;
+ FILE *fp;
+ struct stat st;
+ int len;
+ int err;
+ char fname[MAX_FNAMESIZE+1];
+ char path[MAX_PATHSIZE+1];
+
+ dki_estr[0] = '\0';
+ if ( (dkp = dki_alloc ()) == NULL )
+ return (NULL);
+
+ len = sizeof (fname) - 1;
+ fname[len] = '\0';
+ strncpy (fname, filename, len);
+
+ len = strlen (fname); /* delete extension */
+ if ( len > 4 && strcmp (&fname[len - 4], DKI_KEY_FILEEXT) == 0 )
+ fname[len - 4] = '\0';
+ else if ( len > 10 && strcmp (&fname[len - 10], DKI_PUB_FILEEXT) == 0 )
+ fname[len - 10] = '\0';
+ else if ( len > 8 && strcmp (&fname[len - 8], DKI_ACT_FILEEXT) == 0 )
+ fname[len - 8] = '\0';
+ else if ( len > 12 && strcmp (&fname[len - 12], DKI_DEP_FILEEXT) == 0 )
+ fname[len - 12] = '\0';
+ dbg_line ();
+
+ assert (strlen (dirname)+1 < sizeof (dkp->dname));
+ strcpy (dkp->dname, dirname);
+
+ assert (strlen (fname)+1 < sizeof (dkp->fname));
+ strcpy (dkp->fname, fname);
+ dbg_line ();
+ if ( sscanf (fname, "K%254[^+]+%hd+%d", dkp->name, &dkp->algo, &dkp->tag) != 3 )
+ {
+ snprintf (dki_estr, sizeof (dki_estr),
+ "dki_read: Filename don't match expected format (%s)", fname);
+ return (NULL);
+ }
+
+ pathname (path, sizeof (path), dkp->dname, dkp->fname, DKI_KEY_FILEEXT);
+ dbg_val ("dki_read: path \"%s\"\n", path);
+ if ( (fp = fopen (path, "r")) == NULL )
+ {
+ snprintf (dki_estr, sizeof (dki_estr),
+ "dki_read: Can\'t open file \"%s\" for reading", path);
+ return (NULL);
+ }
+
+ dbg_line ();
+ if ( (err = dki_readfile (fp, dkp)) != 0 )
+ {
+ dbg_line ();
+ snprintf (dki_estr, sizeof (dki_estr),
+ "dki_read: Can\'t read key from file %s (errno %d)", path, err);
+ fclose (fp);
+ return (NULL);
+ }
+
+ dbg_line ();
+ if ( fstat (fileno(fp), &st) )
+ {
+ snprintf (dki_estr, sizeof (dki_estr),
+ "dki_read: Can\'t stat file %s", fname);
+ return (NULL);
+ }
+ dkp->time = st.st_mtime;
+
+ dbg_line ();
+ pathname (path, sizeof (path), dkp->dname, dkp->fname, DKI_ACT_FILEEXT);
+ if ( fileexist (path) )
+ {
+ if ( dki_isrevoked (dkp) )
+ dkp->status = DKI_REV;
+ else
+ dkp->status = DKI_ACT;
+ }
+ else
+ {
+ pathname (path, sizeof (path), dkp->dname, dkp->fname, DKI_PUB_FILEEXT);
+ if ( fileexist (path) )
+ dkp->status = DKI_PUB;
+ else
+ {
+ pathname (path, sizeof (path), dkp->dname, dkp->fname, DKI_DEP_FILEEXT);
+ if ( fileexist (path) )
+ dkp->status = DKI_DEP;
+ else
+ dkp->status = DKI_SEP;
+ }
+ }
+
+ dbg_line ();
+ fclose (fp);
+
+ dbg_line ();
+ return dkp;
+}
+
+/*****************************************************************
+** dki_readdir ()
+** read key files from directory 'dir' and, if recursive is
+** true, from all directorys below that.
+*****************************************************************/
+int dki_readdir (const char *dir, dki_t **listp, int recursive)
+{
+ dki_t *dkp;
+ DIR *dirp;
+ struct dirent *dentp;
+ char path[MAX_PATHSIZE+1];
+
+ dbg_val ("directory: opendir(%s)\n", dir);
+ if ( (dirp = opendir (dir)) == NULL )
+ return 0;
+
+ while ( (dentp = readdir (dirp)) != NULL )
+ {
+ if ( is_dotfile (dentp->d_name) )
+ continue;
+
+ dbg_val ("directory: check %s\n", dentp->d_name);
+ pathname (path, sizeof (path), dir, dentp->d_name, NULL);
+ if ( is_directory (path) && recursive )
+ {
+ dbg_val ("directory: recursive %s\n", path);
+ dki_readdir (path, listp, recursive);
+ }
+ else if ( is_keyfilename (dentp->d_name) )
+ if ( (dkp = dki_read (dir, dentp->d_name)) )
+ dki_add (listp, dkp);
+ }
+ closedir (dirp);
+ return 1;
+}
+
+/*****************************************************************
+** dki_setstatus_preservetime ()
+** set status of key and change extension to
+** ".published", ".private" or ".depreciated"
+*****************************************************************/
+int dki_setstatus_preservetime (dki_t *dkp, int status)
+{
+ return dki_setstat (dkp, status, 1);
+}
+
+/*****************************************************************
+** dki_setstatus ()
+** set status of key and change extension to
+** ".published", ".private" or ".depreciated"
+*****************************************************************/
+int dki_setstatus (dki_t *dkp, int status)
+{
+ return dki_setstat (dkp, status, 0);
+}
+
+/*****************************************************************
+** dki_setstat ()
+** low level function of dki_setstatus and dki_setstatus_preservetime
+*****************************************************************/
+static int dki_setstat (dki_t *dkp, int status, int preserve_time)
+{
+ char frompath[MAX_PATHSIZE+1];
+ char topath[MAX_PATHSIZE+1];
+ time_t totime;
+ time_t currtime;
+
+ if ( dkp == NULL )
+ return 0;
+
+ currtime = time (NULL);
+ status = tolower (status);
+ switch ( dkp->status ) /* look at old status */
+ {
+ case 'r':
+ if ( status == 'r' )
+ return 1;
+ break;
+ case 'a':
+ if ( status == 'a' )
+ return 1;
+ pathname (frompath, sizeof (frompath), dkp->dname, dkp->fname, DKI_ACT_FILEEXT);
+ break;
+ case 'd':
+ if ( status == 'd' )
+ return 1;
+ pathname (frompath, sizeof (frompath), dkp->dname, dkp->fname, DKI_DEP_FILEEXT);
+ break;
+ case 'p': /* or 's' */
+ if ( status == 'p' || status == 's' )
+ return 1;
+ pathname (frompath, sizeof (frompath), dkp->dname, dkp->fname, DKI_PUB_FILEEXT);
+ break;
+ default:
+ /* TODO: set error code */
+ return 0;
+ }
+
+ dbg_val ("dki_setstat: \"%s\"\n", frompath);
+ dbg_val ("dki_setstat: to status \"%c\"\n", status);
+
+ /* a state change could result in different things: */
+ /* 1) write a new keyfile when the REVOKE bit is set or unset */
+ if ( status == 'r' || (status == 'a' && dki_isrevoked (dkp)) )
+ {
+ pathname (topath, sizeof (topath), dkp->dname, dkp->fname, DKI_KEY_FILEEXT);
+
+ if ( status == 'r' )
+ dki_setflag (dkp, DK_FLAG_REVOKE); /* set REVOKE bit */
+ else
+ dki_unsetflag (dkp, DK_FLAG_REVOKE); /* clear REVOKE bit */
+
+
+ dki_writeinfo (dkp, topath); /* ..and write it to the key file */
+
+ if ( !preserve_time )
+ touch (topath, time (NULL));
+
+ return 0;
+ }
+
+
+ /* 2) change the filename of the private key in all other cases */
+ totime = 0L;
+ if ( preserve_time )
+ totime = file_mtime (frompath); /* get original timestamp */
+ topath[0] = '\0';
+ switch ( status )
+ {
+ case 'a':
+ pathname (topath, sizeof (topath), dkp->dname, dkp->fname, DKI_ACT_FILEEXT);
+ break;
+ case 'd':
+ pathname (topath, sizeof (topath), dkp->dname, dkp->fname, DKI_DEP_FILEEXT);
+ break;
+ case 's': /* standby means a "published KSK" */
+ if ( !dki_isksk (dkp) )
+ return 2;
+ status = 'p';
+ /* fall through */
+ case 'p':
+ pathname (topath, sizeof (topath), dkp->dname, dkp->fname, DKI_PUB_FILEEXT);
+ break;
+ }
+
+ if ( topath[0] )
+ {
+ dbg_val ("dki_setstat: to \"%s\"\n", topath);
+ if ( link (frompath, topath) == 0 )
+ unlink (frompath);
+ dkp->status = status;
+ if ( !totime )
+ totime = time (NULL); /* set .key file to current time */
+ pathname (topath, sizeof (topath), dkp->dname, dkp->fname, DKI_KEY_FILEEXT);
+ touch (topath, totime); /* store/restore time of status change */
+ }
+
+ return 0;
+}
+
+/*****************************************************************
+** dki_remove ()
+** rename files associated with key, so that the keys are not
+** recognized by the zkt tools e.g.
+** Kdo.ma.in.+001+12345.key ==> kdo.ma.in.+001+12345.key
+** (second one starts with a lower case 'k')
+*****************************************************************/
+dki_t *dki_remove (dki_t *dkp)
+{
+ char path[MAX_PATHSIZE+1];
+ char newpath[MAX_PATHSIZE+1];
+ char newfile[MAX_FNAMESIZE+1];
+ dki_t *next;
+ const char **pext;
+ static const char *ext[] = {
+ DKI_KEY_FILEEXT, DKI_PUB_FILEEXT,
+ DKI_ACT_FILEEXT, DKI_DEP_FILEEXT,
+ NULL
+ };
+
+ if ( dkp == NULL )
+ return NULL;
+
+ strncpy (newfile, dkp->fname, sizeof (newfile));
+ *newfile = tolower (*newfile);
+ for ( pext = ext; *pext; pext++ )
+ {
+ pathname (path, sizeof (path), dkp->dname, dkp->fname, *pext);
+ if ( fileexist (path) )
+ {
+ pathname (newpath, sizeof (newpath), dkp->dname, newfile, *pext);
+
+ dbg_val2 ("dki_remove: %s ==> %s \n", path, newpath);
+ rename (path, newpath);
+ }
+ }
+ next = dkp->next;
+ dki_free (dkp);
+
+ return next;
+}
+
+/*****************************************************************
+** dki_destroy ()
+** delete files associated with key and free allocated memory
+*****************************************************************/
+dki_t *dki_destroy (dki_t *dkp)
+{
+ char path[MAX_PATHSIZE+1];
+ dki_t *next;
+ const char **pext;
+ static const char *ext[] = {
+ DKI_KEY_FILEEXT, DKI_PUB_FILEEXT,
+ DKI_ACT_FILEEXT, DKI_DEP_FILEEXT,
+ NULL
+ };
+
+ if ( dkp == NULL )
+ return NULL;
+
+ for ( pext = ext; *pext; pext++ )
+ {
+ pathname (path, sizeof (path), dkp->dname, dkp->fname, *pext);
+ if ( fileexist (path) )
+ {
+ dbg_val ("dki_remove: %s \n", path);
+ unlink (path);
+ }
+ }
+ next = dkp->next;
+ dki_free (dkp);
+
+ return next;
+}
+
+/*****************************************************************
+** dki_algo2str ()
+** return a string describing the key algorithm
+*****************************************************************/
+char *dki_algo2str (int algo)
+{
+ switch ( algo )
+ {
+ case DK_ALGO_RSA: return ("RSAMD5");
+ case DK_ALGO_DH: return ("DH");
+ case DK_ALGO_DSA: return ("DSA");
+ case DK_ALGO_EC: return ("EC");
+ case DK_ALGO_RSASHA1: return ("RSASHA1");
+ }
+ return ("unknown");
+}
+
+/*****************************************************************
+** dki_geterrstr ()
+** return error string
+*****************************************************************/
+const char *dki_geterrstr ()
+{
+ return dki_estr;
+}
+
+/*****************************************************************
+** dki_prt_dnskey ()
+*****************************************************************/
+int dki_prt_dnskey (const dki_t *dkp, FILE *fp)
+{
+ return dki_prt_dnskeyttl (dkp, fp, 0);
+}
+
+/*****************************************************************
+** dki_prt_dnskeyttl ()
+*****************************************************************/
+int dki_prt_dnskeyttl (const dki_t *dkp, FILE *fp, int ttl)
+{
+ char *p;
+
+ dki_estr[0] = '\0';
+ if ( dkp == NULL )
+ return 0;
+
+ fprintf (fp, "%s ", dkp->name);
+ if ( ttl > 0 )
+ fprintf (fp, "%d ", ttl);
+ fprintf (fp, "IN DNSKEY ");
+ fprintf (fp, "%d 3 %d (", dkp->flags, dkp->algo);
+ fprintf (fp, "\n\t\t\t");
+ for ( p = dkp->pubkey; *p ; p++ )
+ if ( *p == ' ' )
+ fprintf (fp, "\n\t\t\t");
+ else
+ putc (*p, fp);
+ fprintf (fp, "\n\t\t");
+ if ( dki_isrevoked (dkp) )
+ fprintf (fp, ") ; key id = %u (original key id = %u)", (dkp->tag + 128) % 65535, dkp->tag);
+ else
+ fprintf (fp, ") ; key id = %u", dkp->tag);
+ fprintf (fp, "\n");
+
+ return 1;
+}
+
+/*****************************************************************
+** dki_prt_dnskey_raw ()
+*****************************************************************/
+int dki_prt_dnskey_raw (const dki_t *dkp, FILE *fp)
+{
+ int days;
+
+ dki_estr[0] = '\0';
+ if ( dkp == NULL )
+ return 0;
+
+ if ( dkp->gentime )
+ fprintf (fp, ";%%\tgenerationtime=%s\n", time2isostr (dkp->gentime, 's'));
+ if ( (days = dki_lifetimedays (dkp)) )
+ fprintf (fp, ";%%\tlifetime=%dd\n", days);
+ if ( dkp->exptime )
+ fprintf (fp, ";%%\texpirationtime=%s\n", time2isostr (dkp->exptime, 's'));
+
+ fprintf (fp, "%s ", dkp->name);
+#if 0
+ if ( ttl > 0 )
+ fprintf (fp, "%d ", ttl);
+#endif
+ fprintf (fp, "IN DNSKEY ");
+ fprintf (fp, "%d 3 %d ", dkp->flags, dkp->algo);
+ fprintf (fp, "%s\n", dkp->pubkey);
+
+ return 1;
+}
+
+/*****************************************************************
+** dki_prt_comment ()
+*****************************************************************/
+int dki_prt_comment (const dki_t *dkp, FILE *fp)
+{
+ int len = 0;
+
+ dki_estr[0] = '\0';
+ if ( dkp == NULL )
+ return len;
+ len += fprintf (fp, "; %s ", dkp->name);
+ len += fprintf (fp, "tag=%u ", dkp->tag);
+ len += fprintf (fp, "algo=%s ", dki_algo2str(dkp->algo));
+ len += fprintf (fp, "generated %s\n", time2str (dkp->time, 's'));
+
+ return len;
+}
+
+/*****************************************************************
+** dki_prt_trustedkey ()
+*****************************************************************/
+int dki_prt_trustedkey (const dki_t *dkp, FILE *fp)
+{
+ char *p;
+ int spaces;
+ int len = 0;
+
+ dki_estr[0] = '\0';
+ if ( dkp == NULL )
+ return len;
+ len += fprintf (fp, "\"%s\" ", dkp->name);
+ spaces = 22 - (strlen (dkp->name) + 3);
+ len += fprintf (fp, "%*s", spaces > 0 ? spaces : 0 , " ");
+ len += fprintf (fp, "%d 3 %d ", dkp->flags, dkp->algo);
+ if ( spaces < 0 )
+ len += fprintf (fp, "\n\t\t\t%7s", " ");
+ len += fprintf (fp, "\"");
+ for ( p = dkp->pubkey; *p ; p++ )
+ if ( *p == ' ' )
+ len += fprintf (fp, "\n\t\t\t\t");
+ else
+ putc (*p, fp), len += 1;
+
+ if ( dki_isrevoked (dkp) )
+ len += fprintf (fp, "\" ; # key id = %u (original key id = %u)\n\n", (dkp->tag + 128) % 65535, dkp->tag);
+ else
+ len += fprintf (fp, "\" ; # key id = %u\n\n", dkp->tag);
+ return len;
+}
+
+
+/*****************************************************************
+** dki_cmp () return <0 | 0 | >0
+*****************************************************************/
+int dki_cmp (const dki_t *a, const dki_t *b)
+{
+ int res;
+
+ dki_estr[0] = '\0';
+ if ( a == NULL ) return -1;
+ if ( b == NULL ) return 1;
+
+ /* sort by domain name, */
+ if ( (res = domaincmp (a->name, b->name)) != 0 )
+ return res;
+
+ /* then by key type, */
+ if ( (res = dki_isksk (b) - dki_isksk (a)) != 0 )
+ return res;
+
+ /* and last by creation time, */
+ return (ulong)a->time - (ulong)b->time;
+}
+
+#if defined(USE_TREE) && USE_TREE
+/*****************************************************************
+** dki_allcmp () return <0 | 0 | >0
+*****************************************************************/
+int dki_allcmp (const dki_t *a, const dki_t *b)
+{
+ int res;
+
+ dki_estr[0] = '\0';
+ if ( a == NULL ) return -1;
+ if ( b == NULL ) return 1;
+
+// fprintf (stderr, "dki_allcmp %s, %s)\n", a->name, b->name);
+ /* sort by domain name, */
+ if ( (res = domaincmp (a->name, b->name)) != 0 )
+ return res;
+
+ /* then by key type, */
+ if ( (res = dki_isksk (b) - dki_isksk (a)) != 0 )
+ return res;
+
+ /* creation time, */
+ if ( (res = (ulong)a->time - (ulong)b->time) != 0 )
+ return res;
+
+ /* and last by tag */
+ return a->tag - b->tag;
+}
+
+/*****************************************************************
+** dki_namecmp () return <0 | 0 | >0
+*****************************************************************/
+int dki_namecmp (const dki_t *a, const dki_t *b)
+{
+ dki_estr[0] = '\0';
+ if ( a == NULL ) return -1;
+ if ( b == NULL ) return 1;
+
+ return domaincmp (a->name, b->name);
+}
+/*****************************************************************
+** dki_tagcmp () return <0 | 0 | >0
+*****************************************************************/
+int dki_tagcmp (const dki_t *a, const dki_t *b)
+{
+ dki_estr[0] = '\0';
+ if ( a == NULL ) return -1;
+ if ( b == NULL ) return 1;
+
+ return a->tag - b->tag;
+}
+#endif
+
+/*****************************************************************
+** dki_timecmp ()
+*****************************************************************/
+int dki_timecmp (const dki_t *a, const dki_t *b)
+{
+ dki_estr[0] = '\0';
+ if ( a == NULL ) return -1;
+ if ( b == NULL ) return 1;
+
+ return ((ulong)a->time - (ulong)b->time);
+}
+
+/*****************************************************************
+** dki_time () return the timestamp of the key
+*****************************************************************/
+time_t dki_time (const dki_t *dkp)
+{
+ dki_estr[0] = '\0';
+ assert (dkp != NULL);
+ return (dkp->time);
+}
+
+/*****************************************************************
+** dki_exptime () return the expiration timestamp of the key
+*****************************************************************/
+time_t dki_exptime (const dki_t *dkp)
+{
+ dki_estr[0] = '\0';
+ assert (dkp != NULL);
+ return (dkp->exptime);
+}
+
+/*****************************************************************
+** dki_lifetime (dkp) return the lifetime of the key in sec!
+*****************************************************************/
+time_t dki_lifetime (const dki_t *dkp)
+{
+ dki_estr[0] = '\0';
+ assert (dkp != NULL);
+ return (dkp->lifetime);
+}
+
+/*****************************************************************
+** dki_lifetimedays (dkp) return the lifetime of the key in days!
+*****************************************************************/
+ushort dki_lifetimedays (const dki_t *dkp)
+{
+ dki_estr[0] = '\0';
+ assert (dkp != NULL);
+ return (dkp->lifetime / DAYSEC);
+}
+
+/*****************************************************************
+** dki_gentime (dkp) return the generation timestamp of the key
+*****************************************************************/
+time_t dki_gentime (const dki_t *dkp)
+{
+ dki_estr[0] = '\0';
+ assert (dkp != NULL);
+ return (dkp->gentime > 0L ? dkp->gentime: dkp->time);
+}
+
+/*****************************************************************
+** dki_setlifetime (dkp, int days)
+** set the lifetime in days (and also the gentime if not set)
+** return the old lifetime of the key in days!
+*****************************************************************/
+ushort dki_setlifetime (dki_t *dkp, int days)
+{
+ ulong lifetsec;
+ char path[MAX_PATHSIZE+1];
+
+ dki_estr[0] = '\0';
+ assert (dkp != NULL);
+
+ lifetsec = dkp->lifetime; /* old lifetime */
+ dkp->lifetime = days * DAYSEC; /* set new lifetime */
+
+ dbg_val1 ("dki_setlifetime (%d)\n", days);
+ if ( lifetsec == 0 ) /* initial setup (old lifetime was zero)? */
+ dkp->gentime = dkp->time;
+
+ pathname (path, sizeof (path), dkp->dname, dkp->fname, DKI_KEY_FILEEXT);
+ dki_writeinfo (dkp, path);
+
+ return (lifetsec / DAYSEC);
+}
+
+/*****************************************************************
+** dki_setexptime (dkp, time_t sec)
+** set the expiration time of the key in seconds since the epoch
+** return the old exptime
+*****************************************************************/
+time_t dki_setexptime (dki_t *dkp, time_t sec)
+{
+ char path[MAX_PATHSIZE+1];
+ time_t oldexptime;
+
+ dki_estr[0] = '\0';
+ assert (dkp != NULL);
+
+ dbg_val1 ("dki_setexptime (%ld)\n", sec);
+ oldexptime = dkp->exptime;
+ dkp->exptime = sec;
+
+ pathname (path, sizeof (path), dkp->dname, dkp->fname, DKI_KEY_FILEEXT);
+ dki_writeinfo (dkp, path);
+
+#if 0 /* not necessary ? */
+ touch (path, time (NULL));
+#endif
+ return (oldexptime);
+}
+
+/*****************************************************************
+** dki_age () return age of key in seconds since 'curr'
+*****************************************************************/
+int dki_age (const dki_t *dkp, time_t curr)
+{
+ dki_estr[0] = '\0';
+ assert (dkp != NULL);
+ return ((ulong)curr - (ulong)dkp->time);
+}
+
+/*****************************************************************
+** dki_getflag () return the flags field of a key
+*****************************************************************/
+dk_flag_t dki_getflag (const dki_t *dkp, time_t curr)
+{
+ dki_estr[0] = '\0';
+ return dkp->flags;
+}
+
+/*****************************************************************
+** dki_setflag () set a flag of a key
+*****************************************************************/
+dk_flag_t dki_setflag (dki_t *dkp, dk_flag_t flag)
+{
+ dki_estr[0] = '\0';
+ return dkp->flags |= (ushort)flag;
+}
+
+/*****************************************************************
+** dki_unsetflag () unset a flag of a key
+*****************************************************************/
+dk_flag_t dki_unsetflag (dki_t *dkp, dk_flag_t flag)
+{
+ dki_estr[0] = '\0';
+ return dkp->flags &= ~((ushort)flag);
+}
+
+/*****************************************************************
+** dki_isksk ()
+*****************************************************************/
+int dki_isksk (const dki_t *dkp)
+{
+ dki_estr[0] = '\0';
+ assert (dkp != NULL);
+ return (dkp->flags & DK_FLAG_KSK) == DK_FLAG_KSK;
+}
+
+/*****************************************************************
+** dki_isrevoked ()
+*****************************************************************/
+int dki_isrevoked (const dki_t *dkp)
+{
+ dki_estr[0] = '\0';
+ assert (dkp != NULL);
+ return (dkp->flags & DK_FLAG_REVOKE) == DK_FLAG_REVOKE;
+}
+
+/*****************************************************************
+** dki_isdepreciated ()
+*****************************************************************/
+int dki_isdepreciated (const dki_t *dkp)
+{
+ dki_estr[0] = '\0';
+ return dki_status (dkp) == DKI_DEPRECIATED;
+}
+
+/*****************************************************************
+** dki_isactive ()
+*****************************************************************/
+int dki_isactive (const dki_t *dkp)
+{
+ dki_estr[0] = '\0';
+ return dki_status (dkp) == DKI_ACTIVE;
+}
+
+/*****************************************************************
+** dki_ispublished ()
+*****************************************************************/
+int dki_ispublished (const dki_t *dkp)
+{
+ dki_estr[0] = '\0';
+ return dki_status (dkp) == DKI_PUBLISHED;
+}
+
+
+/*****************************************************************
+** dki_status () return key status
+*****************************************************************/
+dk_status_t dki_status (const dki_t *dkp)
+{
+ dki_estr[0] = '\0';
+ assert (dkp != NULL);
+ return (dkp->status);
+}
+
+/*****************************************************************
+** dki_statusstr () return key status as string
+*****************************************************************/
+const char *dki_statusstr (const dki_t *dkp)
+{
+ dki_estr[0] = '\0';
+ assert (dkp != NULL);
+ switch ( dkp->status )
+ {
+ case DKI_ACT: return "active";
+ case DKI_PUB: if ( dki_isksk (dkp) )
+ return "standby";
+ else
+ return "published";
+ case DKI_DEP: return "depreciated";
+ case DKI_REV: return "revoked";
+ case DKI_SEP: return "sep";
+ }
+ return "unknown";
+}
+
+/*****************************************************************
+** dki_add () add a key to the given list
+*****************************************************************/
+dki_t *dki_add (dki_t **list, dki_t *new)
+{
+ dki_t *curr;
+ dki_t *last;
+
+ dki_estr[0] = '\0';
+ if ( list == NULL )
+ return NULL;
+ if ( new == NULL )
+ return *list;
+
+ last = curr = *list;
+ while ( curr && dki_cmp (curr, new) < 0 )
+ {
+ last = curr;
+ curr = curr->next;
+ }
+
+ if ( curr == *list ) /* add node at start of list */
+ *list = new;
+ else /* add node at end or between two nodes */
+ last->next = new;
+ new->next = curr;
+
+ return *list;
+}
+
+/*****************************************************************
+** dki_search () search a key with the given tag, or the first
+** occurence of a key with the given name
+*****************************************************************/
+const dki_t *dki_search (const dki_t *list, int tag, const char *name)
+{
+ const dki_t *curr;
+
+ dki_estr[0] = '\0';
+ curr = list;
+ if ( tag )
+ while ( curr && (tag != curr->tag ||
+ (name && *name && strcmp (name, curr->name) != 0)) )
+ curr = curr->next;
+ else if ( name && *name )
+ while ( curr && strcmp (name, curr->name) != 0 )
+ curr = curr->next;
+ else
+ curr = NULL;
+
+ return curr;
+}
+
+#if defined(USE_TREE) && USE_TREE
+/*****************************************************************
+** dki_tadd () add a key to the given tree
+*****************************************************************/
+dki_t *dki_tadd (dki_t **tree, dki_t *new)
+{
+ dki_t **p;
+
+ dki_estr[0] = '\0';
+ p = tsearch (new, tree, dki_namecmp);
+ if ( *p == new )
+ dbg_val ("dki_tadd: New entry %s added\n", new->name);
+ else
+ {
+ dbg_val ("dki_tadd: New key added to %s\n", new->name);
+ dki_add (p, new);
+ }
+
+ return *p;
+}
+
+/*****************************************************************
+** dki_tsearch () search a key with the given tag, or the first
+** occurence of a key with the given name
+*****************************************************************/
+const dki_t *dki_tsearch (const dki_t *tree, int tag, const char *name)
+{
+ dki_t search;
+ dki_t **p;
+
+ dki_estr[0] = '\0';
+ search.tag = tag;
+ snprintf (search.name, sizeof (search.name), "%s", name);
+ p = tfind (&search, &tree, dki_namecmp);
+ if ( p == NULL )
+ return NULL;
+
+ return dki_search (*p, tag, name);
+}
+#endif
+
+/*****************************************************************
+** dki_find () find the n'th ksk or zsk key with given status
+*****************************************************************/
+const dki_t *dki_find (const dki_t *list, int ksk, int status, int no)
+{
+ const dki_t *dkp;
+ const dki_t *last;
+
+ dki_estr[0] = '\0';
+ last = NULL;
+ for ( dkp = list; no > 0 && dkp; dkp = dkp->next )
+ if ( dki_isksk (dkp) == ksk && dki_status (dkp) == status )
+ {
+ no--;
+ last = dkp;
+ }
+
+ return last;
+}
diff --git a/contrib/zkt/dki.h b/contrib/zkt/dki.h
new file mode 100644
index 0000000..548ce68
--- /dev/null
+++ b/contrib/zkt/dki.h
@@ -0,0 +1,185 @@
+/*****************************************************************
+**
+** @(#) dki.h -- Header file for DNSsec Key info/manipulation
+**
+** Copyright (c) July 2004 - Jan 2005, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+#ifndef DKI_H
+# define DKI_H
+
+# ifndef TYPES_H
+# include <sys/types.h>
+# include <stdio.h>
+# include <time.h>
+# endif
+
+# define MAX_LABELSIZE (255)
+# define MAX_FNAMESIZE (1+255+2+3+1+5+1+11)
+ /* Kdomain.+ALG+KEYID.type */
+ /* domain == FQDN (max 255) */
+ /* ALG == 3; KEYID == 5 chars */
+ /* type == key||published|private|depreciated == 11 chars */
+//# define MAX_DNAMESIZE (254)
+# define MAX_DNAMESIZE (1023)
+ /* /path/name / filename */
+# define MAX_PATHSIZE (MAX_DNAMESIZE + 1 + MAX_FNAMESIZE)
+
+/* algorithm types */
+# define DK_ALGO_RSA 1 /* RFC2537 */
+# define DK_ALGO_DH 2 /* RFC2539 */
+# define DK_ALGO_DSA 3 /* RFC2536 (mandatory) */
+# define DK_ALGO_EC 4 /* */
+# define DK_ALGO_RSASHA1 5 /* RFC3110 */
+
+/* protocol types */
+# define DK_PROTO_DNS 3
+
+/* flag bits */
+typedef enum { /* 11 1111 */
+ /* 0123 4567 8901 2345 */
+ DK_FLAG_KSK= 01, /* 0000 0000 0000 0001 Bit 15 RFC4034/RFC3757 */
+ DK_FLAG_REVOKE= 0200, /* 0000 0000 1000 0000 Bit 8 RFC5011 */
+ DK_FLAG_ZONE= 0400, /* 0000 0001 0000 0000 Bit 7 RFC4034 */
+} dk_flag_t;
+
+/* status types */
+typedef enum {
+ DKI_SEP= 'e',
+ DKI_SECUREENTRYPOINT= 'e',
+ DKI_PUB= 'p',
+ DKI_PUBLISHED= 'p',
+ DKI_ACT= 'a',
+ DKI_ACTIVE= 'a',
+ DKI_DEP= 'd',
+ DKI_DEPRECIATED= 'd',
+ DKI_REV= 'r',
+ DKI_REVOKED= 'r',
+} dk_status_t;
+
+# define DKI_KEY_FILEEXT ".key"
+# define DKI_PUB_FILEEXT ".published"
+# define DKI_ACT_FILEEXT ".private"
+# define DKI_DEP_FILEEXT ".depreciated"
+
+# define DKI_KSK 1
+# define DKI_ZSK 0
+
+typedef struct dki {
+ char dname[MAX_DNAMESIZE+1]; /* directory */
+ char fname[MAX_FNAMESIZE+1]; /* file name without extension */
+ char name[MAX_LABELSIZE+1]; /* domain name or label */
+ ushort algo; /* key algorithm */
+ ushort proto; /* must be 3 (DNSSEC) */
+ dk_flag_t flags; /* ZONE, optional SEP or REVOKE flag */
+ time_t time; /* key file time */
+ time_t gentime; /* key generation time (will be set on key generation and never changed) */
+ time_t exptime; /* time the key was expired (0L if not) */
+ ulong lifetime; /* proposed key life time at time of generation */
+ uint tag; /* key id */
+ dk_status_t status; /* key exist (".key") and name of private */
+ /* key file is ".published", ".private" */
+ /* or ".depreciated" */
+ char *pubkey; /* base64 public key */
+ struct dki *next; /* ptr to next entry in list */
+} dki_t;
+
+#if defined(USE_TREE) && USE_TREE
+/*
+ * Instead of including <search.h>, which contains horrible false function
+ * declarations, we declared it for our usage (Yes, these functions return
+ * the adress of a pointer variable)
+ */
+typedef enum
+{
+ /* we change the naming to the new, and more predictive one, used by Knuth */
+ PREORDER, /* preorder, */
+ INORDER, /* postorder, */
+ POSTORDER, /* endorder, */
+ LEAF /* leaf */
+}
+VISIT;
+
+dki_t **tsearch (const dki_t *dkp, dki_t **tree, int(*compar)(const dki_t *, const dki_t *));
+dki_t **tfind (const dki_t *dkp, const dki_t **tree, int(*compar)(const dki_t *, const dki_t *));
+dki_t **tdelete (const dki_t *dkp, dki_t **tree, int(*compar)(const dki_t *, const dki_t *));
+void twalk (const dki_t *root, void (*action)(const dki_t **nodep, VISIT which, int depth));
+
+extern void dki_tfree (dki_t **tree);
+extern dki_t *dki_tadd (dki_t **tree, dki_t *new);
+extern int dki_tagcmp (const dki_t *a, const dki_t *b);
+extern int dki_namecmp (const dki_t *a, const dki_t *b);
+extern int dki_allcmp (const dki_t *a, const dki_t *b);
+#endif
+
+extern dki_t *dki_read (const char *dir, const char *fname);
+extern int dki_readdir (const char *dir, dki_t **listp, int recursive);
+extern int dki_prt_trustedkey (const dki_t *dkp, FILE *fp);
+extern int dki_prt_dnskey (const dki_t *dkp, FILE *fp);
+extern int dki_prt_dnskeyttl (const dki_t *dkp, FILE *fp, int ttl);
+extern int dki_prt_dnskey_raw (const dki_t *dkp, FILE *fp);
+extern int dki_prt_comment (const dki_t *dkp, FILE *fp);
+extern int dki_cmp (const dki_t *a, const dki_t *b);
+extern int dki_timecmp (const dki_t *a, const dki_t *b);
+extern int dki_age (const dki_t *dkp, time_t curr);
+extern dk_flag_t dki_getflag (const dki_t *dkp, time_t curr);
+extern dk_flag_t dki_setflag (dki_t *dkp, dk_flag_t flag);
+extern dk_flag_t dki_unsetflag (dki_t *dkp, dk_flag_t flag);
+extern dk_status_t dki_status (const dki_t *dkp);
+extern const char *dki_statusstr (const dki_t *dkp);
+extern int dki_isksk (const dki_t *dkp);
+extern int dki_isdepreciated (const dki_t *dkp);
+extern int dki_isrevoked (const dki_t *dkp);
+extern int dki_isactive (const dki_t *dkp);
+extern int dki_ispublished (const dki_t *dkp);
+extern time_t dki_time (const dki_t *dkp);
+extern time_t dki_exptime (const dki_t *dkp);
+extern time_t dki_gentime (const dki_t *dkp);
+extern time_t dki_lifetime (const dki_t *dkp);
+extern ushort dki_lifetimedays (const dki_t *dkp);
+extern ushort dki_setlifetime (dki_t *dkp, int days);
+extern time_t dki_setexptime (dki_t *dkp, time_t sec);
+extern dki_t *dki_new (const char *dir, const char *name, int ksk, int algo, int bitsize, const char *rfile, int lf_days);
+extern dki_t *dki_remove (dki_t *dkp);
+extern dki_t *dki_destroy (dki_t *dkp);
+extern int dki_setstatus (dki_t *dkp, int status);
+extern int dki_setstatus_preservetime (dki_t *dkp, int status);
+extern dki_t *dki_add (dki_t **dkp, dki_t *new);
+extern const dki_t *dki_tsearch (const dki_t *tree, int tag, const char *name);
+extern const dki_t *dki_search (const dki_t *list, int tag, const char *name);
+extern const dki_t *dki_find (const dki_t *list, int ksk, int status, int first);
+extern void dki_free (dki_t *dkp);
+extern void dki_freelist (dki_t **listp);
+extern char *dki_algo2str (int algo);
+extern const char *dki_geterrstr (void);
+
+#endif
diff --git a/contrib/zkt/dnssec-signer.8 b/contrib/zkt/dnssec-signer.8
new file mode 100644
index 0000000..07c3c6c
--- /dev/null
+++ b/contrib/zkt/dnssec-signer.8
@@ -0,0 +1,436 @@
+.TH dnssec-signer 8 "June 27, 2008" "ZKT 0.96" ""
+\" turn off hyphenation
+.\" if n .nh
+.nh
+.SH NAME
+dnssec-signer \(em Secure DNS zone signing tool
+
+.SH SYNOPSYS
+.na
+.B dnssec-signer
+.RB [ \-L|--logfile
+.IR "file" ]
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.RB [ \-fhnr ]
+.RB [ \-v
+.RB [ \-v ]]
+.B \-N
+.I "named.conf"
+.RI [ zone
+.RI "" ... ]
+.br
+.B dnssec-signer
+.RB [ \-L|--logfile
+.IR "file" ]
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.RB [ \-fhnr ]
+.RB [ \-v
+.RB [ \-v ]]
+.RB [ \-D
+.IR "directory" ]
+.RI [ zone
+.RI "" ... ]
+.br
+.B dnssec-signer
+.RB [ \-L|--logfile
+.IR "file" ]
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.RB [ \-fhnr ]
+.RB [ \-v
+.RB [ \-v ]]
+.B \-o
+.IR "origin"
+.RI [ zonefile ]
+
+.SH DESCRIPTION
+The
+.I dnssec-signer
+command is a wrapper around
+.I dnssec-signzone(8)
+and
+.I dnssec-keygen(8)
+to sign a zone and manage the necessary zone keys.
+It's able to increment the serial number before signing the zone
+and can trigger
+.I named(8)
+to reload the signed zone file.
+The command controls several secure zones and, if started in regular
+intervals via
+.IR cron(8) ,
+can do all that stuff automatically.
+.PP
+In the most useful usage scenario the command will be called with option
+.B \-N
+to read the secure zones out of the given
+.I named.conf
+file.
+If you have a configuration file with views, you have to use option
+-V viewname or --view viewname to specify the name of the view.
+Alternatively you could link the executable file to a second name like
+.I dnssec-signer-viewname
+and use that command to specify the name of the view.
+All master zone statements will be scanned for filenames
+ending with ".signed".
+These zones will be checked if the necessary zone- and key signing keys
+are existent and fresh enough to be used in the signing process.
+If some out-dated keys where found, new keying material will be generated via
+the
+.I dnssec-keygen(8)
+command and the old ones will be marked as depreciated.
+So the command do anything needed for a zone key rollover as defined by [2].
+.PP
+If the resigning interval is reached or any new key must be announced,
+the serial number of the zone will be incremented and the
+.I dnssec-signzone(8)
+command will be evoked to sign the zone.
+After that, if the option
+.B \-r
+is given, the
+.I rndc(8)
+command will be called to reload the zone on the
+nameserver.
+.PP
+In the second form of the command it's possible to specify a directory
+tree with the option
+.B \-D
+.IR dir .
+Every secure zone found in a subdirectory below
+.I dir
+will be signed.
+However, it's also possible to reduce the signing to those
+zones given as arguments.
+In directory mode the pre-requisite is, that the directory name is
+exactly (including the trailing dot) the same as the zone name.
+.PP
+In the last form of the command, the functionality is more or less the same
+as the
+.I dnssec-signzone (8)
+command.
+The parameter specify the zone file name and the option
+.B \-o
+takes the name of the zone.
+.PP
+If neither
+.B \-N
+nor
+.B \-D
+nor
+.B \-o
+is given, then the default directory specified in the
+.I dnssec.conf
+file by the parameter
+.I zonedir
+will be used as the top level directory.
+
+.SH OPTIONS
+.TP
+.BI \-L " file|dir" ", \-\-logfile=" file|dir
+Specify the name of a log file or a directory where
+logfiles are created with a name like
+.fam C
+.\"# define LOG_FNAMETMPL "/zkt-%04d-%02d-%02dT%02d%02d%02dZ.log"
+.RI zkt- YYYY-MM-DD T hhmmss Z.log .
+.fam T
+.\" \&.
+If the argument is not an absolute path name and a zone directory
+is specified in the config file, this will prepend the given name.
+This option is also settable in the dnssec.conf file via the parameter
+.BI LogFile .
+.br
+The default is no file logging, but error logging to syslog with facility
+.BI USER
+at level
+.BI ERROR
+is enabled by default.
+These parameters are settable via the config file parameter
+.BI "SyslogFacility:" ,
+.BI "SyslogLevel:" ,
+.BI "LogFile:"
+and
+.BI "Loglevel" .
+.br
+There is an additional parameter
+.BI VerboseLog:
+which specifies the verbosity (0|1|2) of messages that will be logged
+with level
+.BI DEBUG
+to file and syslog.
+
+.TP
+.BI \-V " view" ", \-\-view=" view
+Try to read the default configuration out of a file named
+.I dnssec-<view>.conf .
+Instead of specifying the \-V or --view option every time,
+it's also possible to create a hard or softlink to the
+executable file with an additional name like
+.I dnssec-zkt-<view> .
+.TP
+.BI \-c " file" ", \-\-config=" file
+Read configuration values out of the specified file.
+Otherwise the default config file is read or build-in defaults
+will be used.
+.TP
+.BI \-O " optstr" ", \-\-config-option=" optstr
+Set any config file option via the commandline.
+Several config file options could be specified at the argument string
+but have to be delimited by semicolon (or newline).
+.TP
+.BR \-f ", " \-\-force
+Force a resigning of the zone, regardless if the resigning interval
+is reached, or any new keys must be announced.
+.TP
+.BR \-n ", " \-\-noexec
+Don't execute the
+.I dnssec-signzone(8)
+command.
+Currently this option is of very limited usage.
+.TP
+.BR \-r ", " \-\-reload
+Reload the zone via
+.I rndc(8)
+after successful signing.
+In a production environment it's recommended to use this option
+to be sure that a freshly signed zone will be immediately propagated.
+However, that's only feasable if the named runs on the signing
+machine, which is not recommended.
+Otherwise the signed zonefile must be copied to the production
+server before reloading the zone.
+If this is the case, the parameter
+.I propagation
+in the
+.I dnssec.conf
+file must be set to a reasonable value.
+.TP
+.BR \-v ", " \-\-verbose
+Verbose mode (recommended).
+A second
+.B \-v
+will be a little more verbose.
+.TP
+.BR \-h ", " \-\-help
+Print out the online help.
+
+.SH SAMPLE USAGE
+.TP
+.fam C
+.B "dnssec-signer \-N /var/named/named.conf \-r \-v \-v
+.fam T
+Sign all secure zones found in the named.conf file and, if necessary,
+trigger a reload of the zone.
+Print some explanatory remarks on stdout.
+.TP
+.fam C
+.B "dnssec-signer \-D zonedir/example.net. \-f \-v \-v
+.fam T
+Force the signing of the zone found in the directory
+.I zonedir/example.net .
+Do not reload the zone.
+.TP
+.fam C
+.B "dnssec-signer \-D zonedir \-f \-v \-v example.net.
+.fam T
+Same as above.
+.TP
+.fam C
+.B "dnssec-signer \-f \-v \-v example.net.
+.fam T
+Same as above if the
+.I dnssec.conf
+file contains the path of the parent directory of the
+.I example.net
+zone.
+.TP
+.fam C
+.B "dnssec-signer \-f \-v \-v \-o example.net. zone.db
+.fam T
+Same as above if we are in the directory containing the
+.I example.net
+files.
+.TP
+.fam C
+.B "dnssec-signer \-\-config-option='ResignInterval 1d; Sigvalidity 28h; \e
+.B ZSK_lifetime 2d;' \-v \-v \-o example.net. zone.db
+.fam T
+.br
+Sign the example.net zone but overwrite some config file values with the parameters
+given on the commandline.
+
+.SH Zone setup and initial preparation
+.TP
+Create a separate directory for every secure zone.
+.br
+This is useful because there are many additional files needed to
+secure a zone.
+Besides the zone file
+.RI ( zone.db ),
+there is a signed zone file
+.RI ( zone.db.signed),
+a minimum of four files containing the keying material,
+a file called
+.I dnskey.db
+with the current used keys,
+and the
+.I dsset-
+and
+.IR keyset- files
+created by the
+.I dnssec-signzone(8)
+command.
+So in summary there is a minimum of nine files used per secure zone.
+For every additional key there are two extra files and
+every delegated subzone creates also two or three files.
+.TP
+Name the directory just like the zone.
+.br
+That's only needed if you want to use the dnssec-signer command in
+directory mode
+.RB ( \-D ).
+Then the name of the zone will be parsed out of the directory name.
+.TP
+Change the name of the zone file to \fIzone.db\fP
+Otherwise you have to set the name via the
+.I dnssec.conf
+parameter
+.IR zonefile ,
+or you have to use the option
+.B \-o
+to name the zone and specify the zone file as argument.
+.TP
+Add the name of the signed zonefile to the \fInamed.conf\fP file
+The filename is the name of the zone file with the
+extension
+.IR .signed .
+Create an empty file with the name
+.IB zonefile .signed
+in the zone directory.
+.TP
+Include the keyfile in the zone.
+The name of the keyfile is settable by the
+.I dnssec.conf
+parameter
+.I keyfile .
+The default is
+.I dnskey.db .
+.br
+.if t \{\
+.nf
+.fam C
+ ...
+ IN NS ns1.example.net.
+ IN NS ns2.example.net.
+$INCLUDE dnskey.db
+ ...
+.fi
+.fam T
+.\}
+.TP
+Control the format of the SOA-Record
+For automatic incrementation of the serial number, the SOA-Record
+must be formated, so that the serial number is on a single line and
+left justified in a field of at least 10 spaces!
+.if t \{\
+.fam C
+.fi 0
+@ IN SOA ns1.example.net. hostmaster.example.net. (
+ 60 ; Serial
+ 43200 ; Refresh
+ 1800 ; Retry
+ 2W ; Expire
+ 7200 ); Minimum
+.fi
+.fam T
+.\}
+If you use a BIND Verison of 9.4 or greater and
+use the unixtime format for the serial number (See parameter
+Serialformat in
+.IR dnssec.conf )
+than this is not necessary.
+.TP
+Try to sign the zone
+If the current working directory is the directory of the zone
+.IR example.net ,
+use the command
+.fam C
+.nf
+.sp 0.5
+ $ dnssec-signer \-D .. \-v \-v example.net
+ $ dnssec-signer \-o example.net.
+.sp 0.5
+.fi
+.fam T
+to create the initial keying material and a signed zone file.
+Then try to load the file on the name server.
+
+.SH ENVIRONMENT VARIABLES
+.TP
+ZKT_CONFFILE
+Specifies the name of the default global configuration files.
+
+.SH FILES
+.TP
+.I /var/named/dnssec.conf
+Built-in default global configuration file.
+The name of the default global config file is settable via
+the environment variable ZKT_CONFFILE.
+Use
+.I dnssec-zkt(8)
+with option
+.B \-Z
+to create an initial config file.
+.TP
+.I /var/named/dnssec-<view>.conf
+View specific global configuration file.
+.TP
+.I ./dnssec.conf
+Local configuration file.
+.TP
+.I dnskey.db
+The file contains the currently used key and zone signing keys.
+It will be created by
+.IR dnsssec-signer(8) .
+The name of the file is settable via the dnssec configuration
+file (parameter
+.IR keyfile ).
+.TP
+.I zone.db
+This is the zone file.
+The name of the file is settable via the dnssec configuration
+file (parameter
+.IR zonefile ).
+
+.SH BUGS
+.PP
+The zone name given as an argument must be ending with a dot.
+.PP
+The named.conf parser is a little bit rudimental and not
+very well tested.
+
+.SH AUTHOR
+Holger Zuleger
+
+.SH COPYRIGHT
+Copyright (c) 2005 \- 2008 by Holger Zuleger.
+Licensed under the GPL 2. There is NO warranty; not even for MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.
+.\"--------------------------------------------------
+.SH SEE ALSO
+dnssec-keygen(8), dnssec-signzone(8), rndc(8), named.conf(5), dnssec-zkt(8)
+.br
+RFC4033, RFC4034, RFC4035
+.br
+[1] DNSSEC HOWTO Tutorial by Olaf Kolkman, RIPE NCC
+.br
+(http://www.nlnetlabs.nl/dnssec_howto/)
+.br
+[2] RFC4641 "DNSSEC Operational Practices" by Miek Gieben and Olaf Kolkman
+.br
+(http://www.ietf.org/rfc/rfc4641.txt)
diff --git a/contrib/zkt/dnssec-signer.c b/contrib/zkt/dnssec-signer.c
new file mode 100644
index 0000000..5b2b8f6
--- /dev/null
+++ b/contrib/zkt/dnssec-signer.c
@@ -0,0 +1,1002 @@
+/*****************************************************************
+**
+** @(#) dnssec-signer.c (c) Jan 2005 Holger Zuleger hznet.de
+**
+** A wrapper around the BIND dnssec-signzone command which is able
+** to resign a zone if neccessary and doing a zone or key signing key rollover.
+**
+** Copyright (c) 2005 - 2008, Holger Zuleger HZnet. All rights reserved.
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+
+# include <stdio.h>
+# include <string.h>
+# include <stdlib.h>
+# include <assert.h>
+# include <dirent.h>
+# include <errno.h>
+# include <unistd.h>
+# include <ctype.h>
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+# include "config_zkt.h"
+#if defined(HAVE_GETOPT_LONG) && HAVE_GETOPT_LONG
+# include <getopt.h>
+#endif
+# include "zconf.h"
+# include "debug.h"
+# include "misc.h"
+# include "ncparse.h"
+# include "zone.h"
+# include "dki.h"
+# include "rollover.h"
+# include "log.h"
+
+#if defined(BIND_VERSION) && BIND_VERSION >= 940
+# define short_options "c:L:V:D:N:o:O:dfHhnrv"
+#else
+# define short_options "c:L:V:D:N:o:O:fHhnrv"
+#endif
+#if defined(HAVE_GETOPT_LONG) && HAVE_GETOPT_LONG
+static struct option long_options[] = {
+ {"reload", no_argument, NULL, 'r'},
+ {"force", no_argument, NULL, 'f'},
+ {"noexec", no_argument, NULL, 'n'},
+ {"verbose", no_argument, NULL, 'v'},
+ {"directory", no_argument, NULL, 'd'},
+ {"config", required_argument, NULL, 'c'},
+ {"option", required_argument, NULL, 'O'},
+ {"config-option", required_argument, NULL, 'O'},
+ {"logfile", required_argument, NULL, 'L' },
+ {"view", required_argument, NULL, 'V' },
+ {"directory", required_argument, NULL, 'D'},
+ {"named-conf", required_argument, NULL, 'N'},
+ {"origin", required_argument, NULL, 'o'},
+#if defined(BIND_VERSION) && BIND_VERSION >= 940
+ {"dynamic", no_argument, NULL, 'd' },
+#endif
+ {"help", no_argument, NULL, 'h'},
+ {0, 0, 0, 0}
+};
+#endif
+
+
+/** function declaration **/
+static void usage (char *mesg, zconf_t *conf);
+static int add2zonelist (const char *dir, const char *view, const char *zone, const char *file);
+static int parsedir (const char *dir, zone_t **zp, const zconf_t *conf);
+static int dosigning (zone_t *zonelist, zone_t *zp);
+static int check_keydb_timestamp (dki_t *keylist, time_t reftime);
+static int new_keysetfiles (const char *dir, time_t zone_signing_time);
+static int writekeyfile (const char *fname, const dki_t *list, int key_ttl);
+static int sign_zone (const char *dir, const char *domain, const char *file, const zconf_t *conf);
+static int dyn_update_freeze (const char *domain, const zconf_t *z, int freeze);
+static int reload_zone (const char *domain, const zconf_t *z);
+static int dist_and_reload (const zone_t *zp);
+static void register_key (dki_t *listp, const zconf_t *z);
+static void copy_keyset (const char *dir, const char *domain, const zconf_t *conf);
+
+/** global command line options **/
+extern int optopt;
+extern int opterr;
+extern int optind;
+extern char *optarg;
+const char *progname;
+const char *viewname = NULL;
+const char *logfile = NULL;
+const char *origin = NULL;
+const char *namedconf = NULL;
+const char *dirname = NULL;
+static int verbose = 0;
+static int force = 0;
+static int reloadflag = 0;
+static int noexec = 0;
+static int dynamic_zone = 0; /* dynamic zone ? */
+static zone_t *zonelist = NULL; /* must be static global because add2zonelist use it */
+static zconf_t *config;
+
+int main (int argc, char *const argv[])
+{
+ int c;
+ int errcnt;
+ int opt_index;
+ char errstr[255+1];
+ char *p;
+ const char *defconfname;
+ zone_t *zp;
+
+ progname = *argv;
+ if ( (p = strrchr (progname, '/')) )
+ progname = ++p;
+ viewname = getnameappendix (progname, "dnssec-signer");
+
+ defconfname = getdefconfname (viewname);
+ config = loadconfig ("", (zconf_t *)NULL); /* load built in config */
+ if ( fileexist (defconfname) ) /* load default config file */
+ config = loadconfig (defconfname, config);
+ if ( config == NULL )
+ fatal ("Couldn't load config: Out of memory\n");
+
+ zonelist = NULL;
+ opterr = 0;
+#if defined(HAVE_GETOPT_LONG) && HAVE_GETOPT_LONG
+ while ( (c = getopt_long (argc, argv, short_options, long_options, &opt_index)) != -1 )
+#else
+ while ( (c = getopt (argc, argv, short_options)) != -1 )
+#endif
+ {
+ switch ( c )
+ {
+ case 'V': /* view name */
+ viewname = optarg;
+ defconfname = getdefconfname (viewname);
+ if ( fileexist (defconfname) ) /* load default config file */
+ config = loadconfig (defconfname, config);
+ if ( config == NULL )
+ fatal ("Out of memory\n");
+ break;
+ case 'c': /* load config from file */
+ config = loadconfig (optarg, config);
+ if ( config == NULL )
+ fatal ("Out of memory\n");
+ break;
+ case 'O': /* load config option from commandline */
+ config = loadconfig_fromstr (optarg, config);
+ if ( config == NULL )
+ fatal ("Out of memory\n");
+ break;
+ case 'o':
+ origin = optarg;
+ break;
+ case 'N':
+ namedconf = optarg;
+ break;
+ case 'D':
+ dirname = optarg;
+ break;
+ case 'L': /* error log file|directory */
+ logfile = optarg;
+ break;
+ case 'f':
+ force++;
+ break;
+ case 'H':
+ case 'h':
+ usage (NULL, config);
+ break;
+#if defined(BIND_VERSION) && BIND_VERSION >= 940
+ case 'd':
+ dynamic_zone = 1;
+ /* dynamic zone requires a name server reload... */
+ reloadflag = 0; /* ...but "rndc thaw" reloads the zone anyway */
+ break;
+#endif
+ case 'n':
+ noexec = 1;
+ break;
+ case 'r':
+ reloadflag = 1;
+ break;
+ case 'v':
+ verbose++;
+ break;
+ case '?':
+ if ( isprint (optopt) )
+ snprintf (errstr, sizeof(errstr),
+ "Unknown option \"-%c\".\n", optopt);
+ else
+ snprintf (errstr, sizeof (errstr),
+ "Unknown option char \\x%x.\n", optopt);
+ usage (errstr, config);
+ break;
+ default:
+ abort();
+ }
+ }
+ dbg_line();
+
+ /* store some of the commandline parameter in the config structure */
+ setconfigpar (config, "--view", viewname);
+ setconfigpar (config, "-v", &verbose);
+ if ( logfile == NULL )
+ logfile = config->logfile;
+
+ if ( lg_open (progname, config->syslogfacility, config->sysloglevel, config->zonedir, logfile, config->loglevel) < -1 )
+ fatal ("Couldn't open logfile %s in dir %s\n", logfile, config->zonedir);
+
+#if defined(DBG) && DBG
+ for ( zp = zonelist; zp; zp = zp->next )
+ zone_print ("in main: ", zp);
+#endif
+ lg_args (LG_NOTICE, argc, argv);
+
+ if ( origin ) /* option -o ? */
+ {
+ if ( (argc - optind) <= 0 ) /* no arguments left ? */
+ zone_readdir (".", origin, NULL, &zonelist, config, dynamic_zone);
+ else
+ zone_readdir (".", origin, argv[optind], &zonelist, config, dynamic_zone);
+
+ /* anyway, "delete" all (remaining) arguments */
+ optind = argc;
+
+ /* complain if nothing could read in */
+ if ( zonelist == NULL )
+ {
+ lg_mesg (LG_FATAL, "\"%s\": couldn't read", origin);
+ fatal ("Couldn't read zone \"%s\"\n", origin);
+ }
+ }
+ if ( namedconf ) /* option -N ? */
+ {
+ char dir[255+1];
+
+ memset (dir, '\0', sizeof (dir));
+ if ( config->zonedir )
+ strncpy (dir, config->zonedir, sizeof(dir));
+ if ( !parse_namedconf (namedconf, dir, sizeof (dir), add2zonelist) )
+ fatal ("Can't read file %s as namedconf file\n", namedconf);
+ if ( zonelist == NULL )
+ fatal ("No signed zone found in file %s\n", namedconf);
+ }
+ if ( dirname ) /* option -D ? */
+ {
+ if ( !parsedir (dirname, &zonelist, config) )
+ fatal ("Can't read directory tree %s\n", dirname);
+ if ( zonelist == NULL )
+ fatal ("No signed zone found in directory tree %s\n", dirname);
+ }
+
+ /* none of the above: read current directory tree */
+ if ( zonelist == NULL )
+ parsedir (config->zonedir, &zonelist, config);
+
+ for ( zp = zonelist; zp; zp = zp->next )
+ if ( in_strarr (zp->zone, &argv[optind], argc - optind) )
+ {
+ dosigning (zonelist, zp);
+ verbmesg (1, zp->conf, "\n");
+ }
+
+ zone_freelist (&zonelist);
+
+ errcnt = lg_geterrcnt ();
+ lg_mesg (LG_NOTICE, "end of run: %d error%s occured", errcnt, errcnt == 1 ? "" : "s");
+ lg_close ();
+
+ return errcnt < 64 ? errcnt : 64;
+}
+
+# define sopt_usage(mesg, value) fprintf (stderr, mesg, value)
+#if defined(HAVE_GETOPT_LONG) && HAVE_GETOPT_LONG
+# define lopt_usage(mesg, value) fprintf (stderr, mesg, value)
+# define loptstr(lstr, sstr) lstr
+#else
+# define lopt_usage(mesg, value)
+# define loptstr(lstr, sstr) sstr
+#endif
+static void usage (char *mesg, zconf_t *conf)
+{
+ fprintf (stderr, "%s version %s\n", progname, ZKT_VERSION);
+ fprintf (stderr, "\n");
+
+ fprintf (stderr, "usage: %s [-c file] [-O optstr] ", progname);
+ fprintf (stderr, "[-D directorytree] ");
+ fprintf (stderr, "[-fhnr] [-v [-v]] [zone ...]\n");
+
+ fprintf (stderr, "usage: %s [-c file] [-O optstr] ", progname);
+ fprintf (stderr, "-N named.conf ");
+ fprintf (stderr, "[-fhnr] [-v [-v]] [zone ...]\n");
+
+ fprintf (stderr, "usage: %s [-c file] [-O optstr] ", progname);
+ fprintf (stderr, "-o origin ");
+ fprintf (stderr, "[-fhnr] [-v [-v]] [zonefile.signed]\n");
+
+ fprintf (stderr, "\t-c file%s", loptstr (", --config=file\n", ""));
+ fprintf (stderr, "\t\t read config from <file> instead of %s\n", CONFIG_FILE);
+ fprintf (stderr, "\t-O optstr%s", loptstr (", --config-option=\"optstr\"\n", ""));
+ fprintf (stderr, "\t\t set config options on the commandline\n");
+ fprintf (stderr, "\t-L file|dir%s", loptstr (", --logfile=file|dir\n", ""));
+ fprintf (stderr, "\t\t specify file or directory for the log output\n");
+ fprintf (stderr, "\t-D dir%s", loptstr (", --directory=dir\n", ""));
+ fprintf (stderr, "\t\t parse the given directory tree for a list of secure zones \n");
+ fprintf (stderr, "\t-N file%s", loptstr (", --named-conf=file\n", ""));
+ fprintf (stderr, "\t\t get the list of secure zones out of the named like config file \n");
+ fprintf (stderr, "\t-o zone%s", loptstr (", --origin=zone", ""));
+ fprintf (stderr, "\tspecify the name of the zone \n");
+ fprintf (stderr, "\t\t The file to sign should be given as an argument (default is \"%s.signed\")\n", conf->zonefile);
+ fprintf (stderr, "\t-h%s\t print this help\n", loptstr (", --help", "\t"));
+ fprintf (stderr, "\t-f%s\t force re-signing\n", loptstr (", --force", "\t"));
+ fprintf (stderr, "\t-n%s\t no execution of external signing command\n", loptstr (", --noexec", "\t"));
+ // fprintf (stderr, "\t-r%s\t reload zone via <rndc reload zone> (or via the external distribution command)\n", loptstr (", --reload", "\t"));
+ fprintf (stderr, "\t-r%s\t reload zone via %s\n", loptstr (", --reload", "\t"), conf->dist_cmd ? conf->dist_cmd: "rndc");
+ fprintf (stderr, "\t-v%s\t be verbose (use twice to be very verbose)\n", loptstr (", --verbose", "\t"));
+
+ fprintf (stderr, "\t[zone]\t sign only those zones given as argument\n");
+
+ fprintf (stderr, "\n");
+ fprintf (stderr, "\tif neither -D nor -N nor -o is given, the directory tree specified\n");
+ fprintf (stderr, "\tin the dnssec config file (\"%s\") will be parsed\n", conf->zonedir);
+
+ if ( mesg && *mesg )
+ fprintf (stderr, "%s\n", mesg);
+ exit (127);
+}
+
+/** fill zonelist with infos coming out of named.conf **/
+static int add2zonelist (const char *dir, const char *view, const char *zone, const char *file)
+{
+#ifdef DBG
+ fprintf (stderr, "printzone ");
+ fprintf (stderr, "view \"%s\" " , view);
+ fprintf (stderr, "zone \"%s\" " , zone);
+ fprintf (stderr, "file ");
+ if ( dir && *dir )
+ fprintf (stderr, "%s/", dir);
+ fprintf (stderr, "%s", file);
+ fprintf (stderr, "\n");
+#endif
+ dbg_line ();
+ if ( view[0] != '\0' ) /* view found in named.conf */
+ {
+ if ( viewname == NULL || viewname[0] == '\0' ) /* viewname wasn't set on startup ? */
+ {
+ dbg_line ();
+ error ("zone \"%s\" in view \"%s\" found in name server config, but no matching view was set on startup\n", zone, view);
+ lg_mesg (LG_ERROR, "\"%s\" in view \"%s\" found in name server config, but no matching view was set on startup", zone, view);
+ return 0;
+ }
+ dbg_line ();
+ if ( strcmp (viewname, view) != 0 ) /* zone is _not_ in current view */
+ return 0;
+ }
+ return zone_readdir (dir, zone, file, &zonelist, config, dynamic_zone);
+}
+
+static int parsedir (const char *dir, zone_t **zp, const zconf_t *conf)
+{
+ DIR *dirp;
+ struct dirent *dentp;
+ char path[MAX_PATHSIZE+1];
+
+ dbg_val ("parsedir: (%s)\n", dir);
+ if ( !is_directory (dir) )
+ return 0;
+
+ dbg_line ();
+ zone_readdir (dir, NULL, NULL, zp, conf, dynamic_zone);
+
+ dbg_val ("parsedir: opendir(%s)\n", dir);
+ if ( (dirp = opendir (dir)) == NULL )
+ return 0;
+
+ while ( (dentp = readdir (dirp)) != NULL )
+ {
+ if ( is_dotfile (dentp->d_name) )
+ continue;
+
+ pathname (path, sizeof (path), dir, dentp->d_name, NULL);
+ if ( !is_directory (path) )
+ continue;
+
+ dbg_val ("parsedir: recursive %s\n", path);
+ parsedir (path, zp, conf);
+ }
+ closedir (dirp);
+ return 1;
+}
+
+static int dosigning (zone_t *zonelist, zone_t *zp)
+{
+ char path[MAX_PATHSIZE+1];
+ int err;
+ int newkey;
+ int newkeysetfile;
+ int use_unixtime;
+ time_t currtime;
+ time_t zfile_time;
+ time_t zfilesig_time;
+ char mesg[255+1];
+
+ verbmesg (1, zp->conf, "parsing zone \"%s\" in dir \"%s\"\n", zp->zone, zp->dir);
+
+ pathname (path, sizeof (path), zp->dir, zp->sfile, NULL);
+ dbg_val("parsezonedir fileexist (%s)\n", path);
+ if ( !fileexist (path) )
+ {
+ error ("Not a secure zone directory (%s)!\n", zp->dir);
+ lg_mesg (LG_ERROR, "\"%s\": not a secure zone directory (%s)!", zp->zone, zp->dir);
+ return 1;
+ }
+ zfilesig_time = file_mtime (path);
+
+ pathname (path, sizeof (path), zp->dir, zp->file, NULL);
+ dbg_val("parsezonedir fileexist (%s)\n", path);
+ if ( !fileexist (path) )
+ {
+ error ("No zone file found (%s)!\n", path);
+ lg_mesg (LG_ERROR, "\"%s\": no zone file found (%s)!", zp->zone, path);
+ return 2;
+ }
+
+ zfile_time = file_mtime (path);
+ currtime = time (NULL);
+
+ /* check rfc5011 key signing keys, create new one if neccessary */
+ dbg_msg("parsezonedir check rfc 5011 ksk ");
+ newkey = ksk5011status (&zp->keys, zp->dir, zp->zone, zp->conf);
+ if ( (newkey & 02) != 02 ) /* not a rfc 5011 zone ? */
+ {
+ verbmesg (2, zp->conf, "\t\t->not a rfc5011 zone, looking for a regular ksk rollover\n");
+ /* check key signing keys, create new one if neccessary */
+ dbg_msg("parsezonedir check ksk ");
+ newkey |= kskstatus (zonelist, zp);
+ }
+ else
+ newkey &= ~02; /* reset bit 2 */
+
+ /* check age of zone keys, probably retire (depreciate) or remove old keys */
+ dbg_msg("parsezonedir check zsk ");
+ newkey += zskstatus (&zp->keys, zp->dir, zp->zone, zp->conf);
+
+ /* check age of "dnskey.db" file against age of keyfiles */
+ pathname (path, sizeof (path), zp->dir, zp->conf->keyfile, NULL);
+ dbg_val("parsezonedir check_keydb_timestamp (%s)\n", path);
+ if ( !newkey )
+ newkey = check_keydb_timestamp (zp->keys, file_mtime (path));
+
+ /* if we work in subdir mode, check if there is a new keyset- file */
+ newkeysetfile = 0;
+ if ( !newkey && zp->conf->keysetdir && strcmp (zp->conf->keysetdir, "..") == 0 )
+ newkeysetfile = new_keysetfiles (zp->dir, zfilesig_time);
+
+ /**
+ ** Check if it is time to do a re-sign. This is the case if
+ ** a) the command line flag -f is set, or
+ ** b) new keys are generated, or
+ ** c) we found a new KSK of a delegated domain, or
+ ** d) the "dnskey.db" file is newer than "zone.db"
+ ** e) the "zone.db" is newer than "zone.db.signed" or
+ ** f) "zone.db.signed" is older than the re-sign interval
+ **/
+ mesg[0] = '\0';
+ if ( force )
+ snprintf (mesg, sizeof(mesg), "Option -f");
+ else if ( newkey )
+ snprintf (mesg, sizeof(mesg), "New zone key");
+ else if ( newkeysetfile )
+ snprintf (mesg, sizeof(mesg), "Modified KSK in delegated domain");
+ else if ( file_mtime (path) > zfilesig_time )
+ snprintf (mesg, sizeof(mesg), "Modified keys");
+ else if ( zfile_time > zfilesig_time )
+ snprintf (mesg, sizeof(mesg), "Zone file edited");
+ else if ( (currtime - zfilesig_time) > zp->conf->resign - (OFFSET) )
+ snprintf (mesg, sizeof(mesg), "re-signing interval (%s) reached",
+ str_delspace (age2str (zp->conf->resign)));
+ else if ( dynamic_zone )
+ snprintf (mesg, sizeof(mesg), "dynamic zone");
+
+ if ( *mesg )
+ verbmesg (1, zp->conf, "\tRe-signing necessary: %s\n", mesg);
+ else
+ verbmesg (1, zp->conf, "\tRe-signing not necessary!\n");
+
+ if ( *mesg )
+ lg_mesg (LG_NOTICE, "\"%s\": re-signing triggered: %s", zp->zone, mesg);
+
+ dbg_line ();
+ if ( !(force || newkey || newkeysetfile || zfile_time > zfilesig_time ||
+ file_mtime (path) > zfilesig_time ||
+ (currtime - zfilesig_time) > zp->conf->resign - (OFFSET) || dynamic_zone) )
+ {
+ verbmesg (2, zp->conf, "\tCheck if there is a parent file to copy\n");
+ if ( zp->conf->keysetdir && strcmp (zp->conf->keysetdir, "..") == 0 )
+ copy_keyset (zp->dir, zp->zone, zp->conf); /* copy the parent- file if it exist */
+ return 0; /* nothing to do */
+ }
+
+ /* let's start signing the zone */
+ dbg_line ();
+
+ /* create new "dnskey.db" file */
+ pathname (path, sizeof (path), zp->dir, zp->conf->keyfile, NULL);
+ verbmesg (1, zp->conf, "\tWriting key file \"%s\"\n", path);
+ if ( !writekeyfile (path, zp->keys, zp->conf->key_ttl) )
+ {
+ error ("Can't create keyfile %s \n", path);
+ lg_mesg (LG_ERROR, "\"%s\": can't create keyfile %s", zp->zone , path);
+ }
+
+ err = 1;
+ use_unixtime = ( zp->conf->serialform == Unixtime );
+ dbg_val1 ("Use unixtime = %d\n", use_unixtime);
+#if defined(BIND_VERSION) && BIND_VERSION >= 940
+ if ( !dynamic_zone && !use_unixtime ) /* increment serial no in static zone files */
+#else
+ if ( !dynamic_zone ) /* increment serial no in static zone files */
+#endif
+ {
+ pathname (path, sizeof (path), zp->dir, zp->file, NULL);
+ err = 0;
+ if ( noexec == 0 )
+ {
+ if ( (err = inc_serial (path, use_unixtime)) < 0 )
+ {
+ error ("could not increment serialno of domain %s in file %s: %s!\n",
+ zp->zone, path, inc_errstr (err));
+ lg_mesg (LG_ERROR,
+ "zone \"%s\": couldn't increment serialno in file %s: %s",
+ zp->zone, path, inc_errstr (err));
+ }
+ else
+ verbmesg (1, zp->conf, "\tIncrementing serial number in file \"%s\"\n", path);
+ }
+ else
+ verbmesg (1, zp->conf, "\tIncrementing serial number in file \"%s\"\n", path);
+ }
+
+ /* at last, sign the zone file */
+ if ( err > 0 )
+ {
+ time_t timer;
+
+ verbmesg (1, zp->conf, "\tSigning zone \"%s\"\n", zp->zone);
+ logflush ();
+
+ /* dynamic zones uses incremental signing, so we have to */
+ /* prepare the old (signed) file as new input file */
+ if ( dynamic_zone )
+ {
+ char zfile[MAX_PATHSIZE+1];
+
+ dyn_update_freeze (zp->zone, zp->conf, 1); /* freeze dynamic zone ! */
+
+ pathname (zfile, sizeof (zfile), zp->dir, zp->file, NULL);
+ pathname (path, sizeof (path), zp->dir, zp->sfile, NULL);
+ if ( filesize (path) == 0L ) /* initial signing request */
+ {
+ verbmesg (1, zp->conf, "\tDynamic Zone signing: Initial signing request: Add DNSKEYs to zonefile\n");
+ copyfile (zfile, path, zp->conf->keyfile);
+ }
+ verbmesg (1, zp->conf, "\tDynamic Zone signing: copy old signed zone file %s to new input file %s\n",
+ path, zfile);
+ if ( newkey ) /* if we have new keys, they should be added to the zone file */
+ copyzonefile (path, zfile, zp->conf->keyfile);
+ else /* else we can do a simple file copy */
+ copyfile (path, zfile, NULL);
+ }
+
+ timer = start_timer ();
+ if ( (err = sign_zone (zp->dir, zp->zone, zp->file, zp->conf)) < 0 )
+ {
+ error ("Signing of zone %s failed (%d)!\n", zp->zone, err);
+ lg_mesg (LG_ERROR, "\"%s\": signing failed!", zp->zone);
+ }
+ timer = stop_timer (timer);
+
+ if ( dynamic_zone )
+ dyn_update_freeze (zp->zone, zp->conf, 0); /* thaw dynamic zone file */
+
+ {
+ const char *tstr = str_delspace (age2str (timer));
+
+ if ( !tstr || *tstr == '\0' )
+ tstr = "0s";
+ verbmesg (1, zp->conf, "\tSigning completed after %s.\n", tstr);
+ }
+ }
+
+ copy_keyset (zp->dir, zp->zone, zp->conf);
+
+ if ( err >= 0 && reloadflag )
+ {
+ if ( zp->conf->dist_cmd )
+ dist_and_reload (zp);
+ else
+ reload_zone (zp->zone, zp->conf);
+
+ register_key (zp->keys, zp->conf);
+ }
+
+ return err;
+}
+
+static void register_key (dki_t *list, const zconf_t *z)
+{
+ dki_t *dkp;
+ time_t currtime;
+ time_t age;
+
+ assert ( list != NULL );
+ assert ( z != NULL );
+
+ currtime = time (NULL);
+ for ( dkp = list; dkp && dki_isksk (dkp); dkp = dkp->next )
+ {
+ age = dki_age (dkp, currtime);
+#if 0
+ /* announce "new" and active key signing keys */
+ if ( REG_URL && *REG_URL && dki_status (dkp) == DKI_ACT && age <= z->resign * 4 )
+ {
+ if ( verbose )
+ logmesg ("\tRegister new KSK with tag %d for domain %s\n",
+ dkp->tag, dkp->name);
+ }
+#endif
+ }
+}
+
+/*
+ * This function is not working with symbolic links to keyset- files,
+ * because file_mtime() returns the mtime of the underlying file, and *not*
+ * that of the symlink file.
+ * This is bad, because the keyset-file will be newly generated by dnssec-signzone
+ * on every re-signing call.
+ * Instead, in the case of a hierarchical directory structure, we copy the file
+ * (and so we change the timestamp) only if it was modified after the last
+ * generation (checked with cmpfile(), see func sign_zone()).
+ */
+# define KEYSET_FILE_PFX "keyset-"
+static int new_keysetfiles (const char *dir, time_t zone_signing_time)
+{
+ DIR *dirp;
+ struct dirent *dentp;
+ char path[MAX_PATHSIZE+1];
+ int newkeysetfile;
+
+ if ( (dirp = opendir (dir)) == NULL )
+ return 0;
+
+ newkeysetfile = 0;
+ dbg_val2 ("new_keysetfile (%s, %s)\n", dir, time2str (zone_signing_time, 's'));
+ while ( !newkeysetfile && (dentp = readdir (dirp)) != NULL )
+ {
+ if ( strncmp (dentp->d_name, KEYSET_FILE_PFX, strlen (KEYSET_FILE_PFX)) != 0 )
+ continue;
+
+ pathname (path, sizeof (path), dir, dentp->d_name, NULL);
+ dbg_val2 ("newkeysetfile timestamp of %s = %s\n", path, time2str (file_mtime(path), 's'));
+ if ( file_mtime (path) > zone_signing_time )
+ newkeysetfile = 1;
+ }
+ closedir (dirp);
+
+ return newkeysetfile;
+}
+
+static int check_keydb_timestamp (dki_t *keylist, time_t reftime)
+{
+ dki_t *key;
+
+ assert ( keylist != NULL );
+ if ( reftime == 0 )
+ return 1;
+
+ for ( key = keylist; key; key = key->next )
+ if ( dki_time (key) > reftime )
+ return 1;
+
+ return 0;
+}
+
+static int writekeyfile (const char *fname, const dki_t *list, int key_ttl)
+{
+ FILE *fp;
+ const dki_t *dkp;
+ time_t curr = time (NULL);
+ int ksk;
+
+ if ( (fp = fopen (fname, "w")) == NULL )
+ return 0;
+ fprintf (fp, ";\n");
+ fprintf (fp, ";\t!!! Don\'t edit this file by hand.\n");
+ fprintf (fp, ";\t!!! It will be generated by %s.\n", progname);
+ fprintf (fp, ";\n");
+ fprintf (fp, ";\t Last generation time %s\n", time2str (curr, 's'));
+ fprintf (fp, ";\n");
+
+ fprintf (fp, "\n");
+ fprintf (fp, "; *** List of Key Signing Keys ***\n");
+ ksk = 1;
+ for ( dkp = list; dkp; dkp = dkp->next )
+ {
+ if ( ksk && !dki_isksk (dkp) )
+ {
+ fprintf (fp, "; *** List of Zone Signing Keys ***\n");
+ ksk = 0;
+ }
+ dki_prt_comment (dkp, fp);
+ dki_prt_dnskeyttl (dkp, fp, key_ttl);
+ putc ('\n', fp);
+ }
+
+ fclose (fp);
+ return 1;
+}
+
+static int sign_zone (const char *dir, const char *domain, const char *file, const zconf_t *conf)
+{
+ char cmd[1023+1];
+ char str[1023+1];
+ char rparam[254+1];
+ char keysetdir[254+1];
+ const char *gends;
+ const char *pseudo;
+ const char *param;
+ int len;
+ FILE *fp;
+
+ assert (conf != NULL);
+ assert (domain != NULL);
+
+ len = 0;
+ str[0] = '\0';
+ if ( conf->lookaside && conf->lookaside[0] )
+ len = snprintf (str, sizeof (str), "-l %.250s", conf->lookaside);
+
+ dbg_line();
+#if defined(BIND_VERSION) && BIND_VERSION >= 940
+ if ( !dynamic_zone && conf->serialform == Unixtime )
+ snprintf (str+len, sizeof (str) - len, " -N unixtime");
+#endif
+
+ gends = "";
+ if ( conf->sig_gends )
+ gends = "-g ";
+
+ pseudo = "";
+ if ( conf->sig_pseudo )
+ pseudo = "-p ";
+
+ param = "";
+ if ( conf->sig_param && conf->sig_param[0] )
+ param = conf->sig_param;
+
+ dbg_line();
+ rparam[0] = '\0';
+ if ( conf->sig_random && conf->sig_random[0] )
+ snprintf (rparam, sizeof (rparam), "-r %.250s ", conf->sig_random);
+
+ dbg_line();
+ keysetdir[0] = '\0';
+ if ( conf->keysetdir && conf->keysetdir[0] && strcmp (conf->keysetdir, "..") != 0 )
+ snprintf (keysetdir, sizeof (keysetdir), "-d %.250s ", conf->keysetdir);
+
+ if ( dir == NULL || *dir == '\0' )
+ dir = ".";
+
+ dbg_line();
+#if defined(BIND_VERSION) && BIND_VERSION >= 940
+ if ( dynamic_zone )
+ snprintf (cmd, sizeof (cmd), "cd %s; %s %s %s%s%s%s-o %s -e +%d %s -N increment -f %s.dsigned %s K*.private",
+ dir, SIGNCMD, param, gends, pseudo, rparam, keysetdir, domain, conf->sigvalidity, str, file, file);
+ else
+#endif
+ snprintf (cmd, sizeof (cmd), "cd %s; %s %s %s%s%s%s-o %s -e +%d %s %s K*.private",
+ dir, SIGNCMD, param, gends, pseudo, rparam, keysetdir, domain, conf->sigvalidity, str, file);
+ verbmesg (2, conf, "\t Run cmd \"%s\"\n", cmd);
+ *str = '\0';
+ if ( noexec == 0 )
+ {
+ if ( (fp = popen (cmd, "r")) == NULL || fgets (str, sizeof str, fp) == NULL )
+ return -1;
+ pclose (fp);
+ }
+
+ dbg_line();
+ verbmesg (2, conf, "\t Cmd dnssec-signzone return: \"%s\"\n", str_chop (str, '\n'));
+
+ return 0;
+}
+
+static void copy_keyset (const char *dir, const char *domain, const zconf_t *conf)
+{
+ char fromfile[1024];
+ char tofile[1024];
+ int ret;
+
+ /* propagate "keyset"-file to parent dir */
+ if ( conf->keysetdir && strcmp (conf->keysetdir, "..") == 0 )
+ {
+ /* check if special parent-file exist (ksk rollover) */
+ snprintf (fromfile, sizeof (fromfile), "%s/parent-%s", dir, domain);
+ if ( !fileexist (fromfile) ) /* use "normal" keyset-file */
+ snprintf (fromfile, sizeof (fromfile), "%s/keyset-%s", dir, domain);
+
+ /* verbmesg (2, conf, "\t check \"%s\" against parent dir\n", fromfile); */
+ snprintf (tofile, sizeof (tofile), "%s/../keyset-%s", dir, domain);
+ if ( cmpfile (fromfile, tofile) != 0 )
+ {
+ verbmesg (2, conf, "\t copy \"%s\" to parent dir\n", fromfile);
+ if ( (ret = copyfile (fromfile, tofile, NULL)) != 0 )
+ {
+ error ("Couldn't copy \"%s\" to parent dir (%d:%s)\n",
+ fromfile, ret, strerror(errno));
+ lg_mesg (LG_ERROR, "\%s\": can't copy \"%s\" to parent dir (%d:%s)",
+ domain, fromfile, ret, strerror(errno));
+ }
+ }
+ }
+}
+
+static int dyn_update_freeze (const char *domain, const zconf_t *z, int freeze)
+{
+ char cmdline[254+1];
+ char str[254+1];
+ char *action;
+ FILE *fp;
+
+ assert (z != NULL);
+ if ( freeze )
+ action = "freeze";
+ else
+ action = "thaw";
+
+ if ( z->view )
+ snprintf (str, sizeof (str), "\"%s\" in view \"%s\"", domain, z->view);
+ else
+ snprintf (str, sizeof (str), "\"%s\"", domain);
+
+ lg_mesg (LG_NOTICE, "%s: %s dynamic zone", str, action);
+ verbmesg (1, z, "\t%s dynamic zone %s\n", action, str);
+
+ if ( z->view )
+ snprintf (cmdline, sizeof (cmdline), "%s %s %s IN %s", RELOADCMD, action, domain, z->view);
+ else
+ snprintf (cmdline, sizeof (cmdline), "%s %s %s", RELOADCMD, action, domain);
+
+ verbmesg (2, z, "\t Run cmd \"%s\"\n", cmdline);
+ *str = '\0';
+ if ( noexec == 0 )
+ {
+ if ( (fp = popen (cmdline, "r")) == NULL || fgets (str, sizeof str, fp) == NULL )
+ return -1;
+ pclose (fp);
+ }
+
+ verbmesg (2, z, "\t rndc %s return: \"%s\"\n", action, str_chop (str, '\n'));
+
+ return 0;
+}
+
+/*****************************************************************
+** distribute and reload a zone via "distribute_command"
+*****************************************************************/
+static int dist_and_reload (const zone_t *zp)
+{
+ char path[MAX_PATHSIZE+1];
+ char cmdline[254+1];
+ char zone[254+1];
+ char str[254+1];
+ FILE *fp;
+
+ assert (zp != NULL);
+ assert (zp->conf->dist_cmd != NULL);
+
+ if ( !is_exec_ok (zp->conf->dist_cmd) )
+ {
+ char *mesg;
+
+ if ( getuid () == 0 )
+ mesg = "\tDistribution command %s not run as root\n";
+ else
+ mesg = "\tDistribution command %s not run due to strange file mode settings\n";
+
+ verbmesg (1, zp->conf, mesg, zp->conf->dist_cmd);
+ lg_mesg (LG_ERROR, "exec of distribution command %s disabled due to security reasons", zp->conf->dist_cmd);
+
+ return -1;
+ }
+
+ if ( zp->conf->view )
+ snprintf (zone, sizeof (zone), "\"%s\" in view \"%s\"", zp->zone, zp->conf->view);
+ else
+ snprintf (zone, sizeof (zone), "\"%s\"", zp->zone);
+
+
+ pathname (path, sizeof (path), zp->dir, zp->sfile, NULL);
+
+ lg_mesg (LG_NOTICE, "%s: distribution triggered", zone);
+ verbmesg (1, zp->conf, "\tDistribute zone %s\n", zone);
+ if ( zp->conf->view )
+ snprintf (cmdline, sizeof (cmdline), "%s distribute %s %s %s", zp->conf->dist_cmd, zp->zone, path, zp->conf->view);
+ else
+ snprintf (cmdline, sizeof (cmdline), "%s distribute %s %s", zp->conf->dist_cmd, zp->zone, path);
+
+ *str = '\0';
+ if ( noexec == 0 )
+ {
+ verbmesg (2, zp->conf, "\t Run cmd \"%s\"\n", cmdline);
+ if ( (fp = popen (cmdline, "r")) == NULL || fgets (str, sizeof str, fp) == NULL )
+ return -2;
+ pclose (fp);
+ verbmesg (2, zp->conf, "\t %s distribute return: \"%s\"\n", zp->conf->dist_cmd, str_chop (str, '\n'));
+ }
+
+
+ lg_mesg (LG_NOTICE, "%s: reload triggered", zone);
+ verbmesg (1, zp->conf, "\tReload zone %s\n", zone);
+ if ( zp->conf->view )
+ snprintf (cmdline, sizeof (cmdline), "%s reload %s %s %s", zp->conf->dist_cmd, zp->zone, path, zp->conf->view);
+ else
+ snprintf (cmdline, sizeof (cmdline), "%s reload %s %s", zp->conf->dist_cmd, zp->zone, path);
+
+ *str = '\0';
+ if ( noexec == 0 )
+ {
+ verbmesg (2, zp->conf, "\t Run cmd \"%s\"\n", cmdline);
+ if ( (fp = popen (cmdline, "r")) == NULL || fgets (str, sizeof str, fp) == NULL )
+ return -2;
+ pclose (fp);
+ verbmesg (2, zp->conf, "\t %s reload return: \"%s\"\n", zp->conf->dist_cmd, str_chop (str, '\n'));
+ }
+
+ return 0;
+}
+
+/*****************************************************************
+** reload a zone via "rndc"
+*****************************************************************/
+static int reload_zone (const char *domain, const zconf_t *z)
+{
+ char cmdline[254+1];
+ char str[254+1];
+ FILE *fp;
+
+ assert (z != NULL);
+ // fprintf (stderr, "reload_zone %d :%s: :%s:\n", z->verbosity, domain, z->view);
+ if ( z->view )
+ snprintf (str, sizeof (str), "\"%s\" in view \"%s\"", domain, z->view);
+ else
+ snprintf (str, sizeof (str), "\"%s\"", domain);
+
+ lg_mesg (LG_NOTICE, "%s: reload triggered", str);
+ verbmesg (1, z, "\tReload zone %s\n", str);
+
+ if ( z->view )
+ snprintf (cmdline, sizeof (cmdline), "%s reload %s IN %s", RELOADCMD, domain, z->view);
+ else
+ snprintf (cmdline, sizeof (cmdline), "%s reload %s", RELOADCMD, domain);
+
+ *str = '\0';
+ if ( noexec == 0 )
+ {
+ verbmesg (2, z, "\t Run cmd \"%s\"\n", cmdline);
+ if ( (fp = popen (cmdline, "r")) == NULL || fgets (str, sizeof str, fp) == NULL )
+ return -1;
+ pclose (fp);
+ verbmesg (2, z, "\t rndc reload return: \"%s\"\n", str_chop (str, '\n'));
+ }
+
+ return 0;
+}
diff --git a/contrib/zkt/dnssec-zkt.8 b/contrib/zkt/dnssec-zkt.8
new file mode 100644
index 0000000..b53f8bb
--- /dev/null
+++ b/contrib/zkt/dnssec-zkt.8
@@ -0,0 +1,481 @@
+.TH dnssec-zkt 8 "July 27, 2008" "ZKT 0.97" ""
+\" turn off hyphenation
+.\" if n .nh
+.nh
+.SH NAME
+dnssec-zkt \(em Secure DNS zone key tool
+
+.SH SYNOPSYS
+.na
+.B dnssec-zkt
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.RB [ \-l
+.IR "list" ]
+.RB [ \-adefhkLrptz ]
+.RI [{ keyfile | dir }
+.RI "" ... ]
+
+.B dnssec-zkt
+.BR \-C <label>
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.RB [ \-krpz ]
+.RI [{ keyfile | dir }
+.RI "" ... ]
+.br
+.B dnssec-zkt
+.BR \-\-create= <label>
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.RB [ \-krpz ]
+.RI [{ keyfile | dir }
+.RI "" ... ]
+
+.B dnssec-zkt
+.BR \- { P | A | D | R } <keytag>
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.RB [ \-r ]
+.RI [{ keyfile | dir }
+.RI "" ... ]
+.br
+.B dnssec-zkt
+.BR \-\-published= <keytag>
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.RB [ \-r ]
+.RI [{ keyfile | dir }
+.RI "" ... ]
+.br
+.B dnssec-zkt
+.BR \-\-active= <keytag>
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.RB [ \-r ]
+.RI [{ keyfile | dir }
+.RI "" ... ]
+.br
+.B dnssec-zkt
+.BR \-\-depreciate= <keytag>
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.RB [ \-r ]
+.RI [{ keyfile | dir }
+.RI "" ... ]
+.br
+.B dnssec-zkt
+.BR \-\-rename= <keytag>
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.RB [ \-r ]
+.RI [{ keyfile | dir }
+.RI "" ... ]
+
+.B dnssec-zkt
+.BR \-\-destroy= <keytag>
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.RB [ \-r ]
+.RI [{ keyfile | dir }
+.RI "" ... ]
+
+.B dnssec-zkt
+.B \-T
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.RB [ \-l
+.IR "list" ]
+.RB [ \-hr ]
+.RI [{ keyfile | dir }
+.RI "" ... ]
+.br
+.B dnssec-zkt
+.B \-\-list-trustedkeys
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.RB [ \-l
+.IR "list" ]
+.RB [ \-hr ]
+.RI [{ keyfile | dir }
+.RI "" ... ]
+
+.B dnssec-zkt
+.B \-K
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.RB [ \-l
+.IR "list" ]
+.RB [ \-hkzr ]
+.RI [{ keyfile | dir }
+.RI "" ... ]
+.br
+.B dnssec-zkt
+.B \-\-list-dnskeys
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.RB [ \-l
+.IR "list" ]
+.RB [ \-hkzr ]
+.RI [{ keyfile | dir }
+.RI "" ... ]
+
+.B dnssec-zkt
+.B \-Z
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.br
+.B dnssec-zkt
+.B \-\-zone-config
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+
+.B dnssec-zkt
+.B \-9 | \-\-ksk-rollover
+.br
+.B dnssec-zkt
+.B \-1 | \-\-ksk-roll-phase1
+.I "do.ma.in."
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.br
+.B dnssec-zkt
+.B \-2 | \-\-ksk-roll-phase2
+.I "do.ma.in."
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.br
+.B dnssec-zkt
+.B \-3 | \-\-ksk-roll-phase3
+.I do.ma.in.
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.br
+.B dnssec-zkt
+.B \-0 | \-\-ksk-roll-stat
+.I do.ma.in.
+.RB [ \-V|--view
+.IR "view" ]
+.RB [ \-c
+.IR "file" ]
+.br
+.ad
+
+.SH DESCRIPTION
+The
+.I dnssec-zkt
+command is a wrapper around
+.I dnssec-keygen(8)
+to assist in dnssec zone key management.
+.PP
+In the common usage the command prints out information about
+all dnssec (zone) keys found in the given (or predefined default) directory.
+It's also possible to specify keyfiles (K*.key) as arguments.
+With option
+.B \-r
+subdirectories will be searched recursively, and all dnssec keys found
+will be listed sorted by domain name, key type and generation time.
+In that mode the use of the
+.B \-p
+option may be helpful to find the location of the keyfile in the directory tree.
+.PP
+Other forms of the command print out keys in a format suitable for
+a trusted-key section or as a DNSKEY resource record.
+.PP
+The command is also useful in dns key management.
+It allows key livetime monitoring and status change.
+
+.SH GENERAL OPTIONS
+.TP
+.BI \-V " view" ", \-\-view=" view
+Try to read the default configuration out of a file named
+.I dnssec-<view>.conf .
+Instead of specifying the \-V or --view option every time,
+it's also possible to create a hard or softlink to the
+executable file to give it an additional name like
+.I dnssec-zkt-<view> .
+.TP
+.BI \-c " file" ", \-\-config=" file
+Read default values from the specified config file.
+Otherwise the default config file is read or build in defaults
+will be used.
+.TP
+.BI \-O " optstr" ", \-\-config-option=" optstr
+Set any config file option via the commandline.
+Several config file options could be specified at the argument string
+but have to be delimited by semicolon (or newline).
+.TP
+.BI \-l " list"
+Print out information solely about domains given in the comma or space separated
+list.
+Take care of, that every domain name has a trailing dot.
+.TP
+.BR \-d ", " \-\-directory
+Skip directory arguments.
+This will be useful in combination with wildcard arguments
+to prevent dnsssec-zkt to list all keys found in subdirectories.
+For example "dnssec-zkt -d *" will print out a list of all keys only found in
+the current directory.
+Maybe it's easier to use "dnssec-zkt ." instead (without -r set).
+The option works similar to the \-d option of
+.IR ls(1) .
+.TP
+.BR \-L ", " \-\-left-justify
+Print out the domain name left justified.
+.TP
+.BR \-k ", " \-\-ksk
+Select and print key signing keys only (default depends on command mode).
+.TP
+.BR \-z ", " \-\-zsk
+Select and print zone signing keys only (default depends on command mode).
+.TP
+.BR \-r ", " \-\-recursive
+Recursive mode (default is off).
+.br
+Also settable in the dnssec.conf file (Parameter: Recursive).
+.TP
+.BR \-p ", " \-\-path
+Print pathname in listing mode.
+In -C mode, don't create the new key in the same directory as (already existing)
+keys with the same label.
+.TP
+.BR \-a ", " \-\-age
+Print age of key in weeks, days, hours, minutes and seconds (default is off).
+.br
+Also settable in the dnssec.conf file (Parameter: PrintAge).
+.TP
+.BR \-f ", " \-\-lifetime
+Print the key lifetime.
+.TP
+.BR \-F ", " \-\-setlifetime
+Set the key lifetime of all the selected keys.
+Use option -k, -z, -l or the file and dir argument for key selection.
+.TP
+.BR \-e ", " \-\-exptime
+Print the key expiration time.
+.TP
+.BR \-t ", " \-\-time
+Print the key generation time (default is on).
+.br
+Also settable in the dnssec.conf file (Parameter: PrintTime).
+.TP
+.B \-h
+No header or trusted-key section header and trailer in -T mode
+.PP
+
+.SH COMMAND OPTIONS
+.TP
+.BR \-H ", " \-\-help
+Print out the online help.
+.TP
+.BR \-T ", " \-\-list-trustedkeys
+List all key signing keys as a
+.I named.conf
+trusted-key section.
+Use
+.B \-h
+to supress the section header/trailer.
+.TP
+.BR \-K ", " \-\-list-dnskeys
+List the public part of all the keys in DNSKEY resource record format.
+Use
+.B \-h
+to suppress comment lines.
+.TP
+.BI \-C " zone" ", \-\-create=" zone
+Create a new zone signing key for the given zone.
+Add option
+.B \-k
+to create a key signing key.
+The key algorithm and key length will be examined from built-in default values
+or from the parameter settings in the
+.I dnssec.conf
+file.
+.br
+The keyfile will be created in the current directory if
+the
+.B \-p
+option is specified.
+.TP
+.BI \-R " keyid" ", \-\-revoke=" keyid
+Revoke the key signing key with the given keyid.
+A revoked key has bit 8 in the flags filed set (see RFC5011).
+The keyid is the numeric keytag with an optionally added zone name separated by a colon.
+.TP
+.BI \-\-rename=" keyid
+Rename the key files of the key with the given keyid
+(Look at key file names starting with an lower 'k').
+The keyid is the numeric keytag with an optionally added zone name separated by a colon.
+.TP
+.BI \-\-destroy= keyid
+Deletes the key with the given keyid.
+The keyid is the numeric keytag with an optionally added zone name separated by a colon.
+Beware that this deletes both private and public keyfiles, thus the key is
+unrecoverable lost.
+.TP
+.BI \-P|A|D " keyid," " \-\-published=" keyid, " \-\-active=" keyid, " \-\-depreciated=" keyid
+Change the status of the given dnssec key to
+published
+.RB ( \-P ),
+active
+.RB ( \-A )
+or depreciated
+.RB ( \-D ).
+The
+.I keyid
+is the numeric keytag with an optionally added zone name separated by a colon.
+Setting the status to "published" or "depreciate" will change the filename
+of the private key file to ".published" or ".depreciated" respectivly.
+This prevents the usage of the key as a signing key by the use of
+.IR dnssec-signzone(8) .
+The time of status change will be stored in the 'mtime' field of the corresponding
+".key" file.
+Key activation via option
+.B \-A
+will restore the original timestamp and file name (".private").
+.TP
+.BR \-Z ", " \-\-zone-config
+Write all config parameters to stdout.
+The output is suitable as a template for the
+.I dnssec.conf
+file, so the easiest way to create a
+.I dnssec.conf
+file is to redirect the standard output of the above command.
+Pay attention not to overwrite an existing file.
+.TP
+.BI \-\-ksk-roll-phase[123] " do.ma.in."
+Initiate a key signing key rollover of the specified domain.
+This feature is currently in experimental status and is mainly for the use
+in an hierachical environment.
+Use --ksk-rollover for a little more detailed description.
+
+
+.SH SAMPLE USAGE
+.TP
+.fam C
+.B "dnssec-zkt \-r .
+.fam T
+Print out a list of all zone keys found below the current directory.
+.TP
+.fam C
+.B "dnssec-zkt \-Z \-c """"
+.fam T
+Print out the compiled in default parameters.
+.TP
+.fam C
+.B "dnssec-zkt \-C example.net \-k \-r ./zonedir
+.fam T
+Create a new key signing key for the zone "example.net".
+Store the key in the same directory below "zonedir" where the other
+"example.net" keys live.
+.TP
+.fam C
+.B "dnssec-zkt \-T ./zonedir/example.net
+.fam T
+Print out a trusted-key section containing the key signing keys of "example.net".
+.TP
+.fam C
+.B "dnssec-zkt \-D 123245 \-r .
+.fam T
+Depreciate the key with tag "12345" below the current directory,
+.TP
+.fam C
+.B "dnssec-zkt --view intern
+Print out a list of all zone keys found below the directory where all
+the zones of view intern live.
+There should be a seperate dnssec config file
+.I dnssec-intern.conf
+with a directory option to take affect of this.
+.TP
+.fam C
+.B "dnssec-zkt-intern
+.fam T
+Same as above.
+The binary file
+.I dnssec-zkt
+have linked to
+.I dnssec-zkt-intern .
+
+.SH ENVIRONMENT VARIABLES
+.TP
+ZKT_CONFFILE
+Specifies the name of the default global configuration files.
+
+.SH FILES
+.TP
+.I /var/named/dnssec.conf
+Built-in default global configuration file.
+The name of the default global config file is settable via
+the environment variable ZKT_CONFFILE.
+.TP
+.I /var/named/dnssec-<view>.conf
+View specific global configuration file.
+.TP
+.I ./dnssec.conf
+Local configuration file (only used in
+.B \-C
+mode).
+
+.SH BUGS
+.PP
+Some of the general options will not be meaningful in all of the command modes.
+.br
+The option
+.B \-l
+and the ksk rollover options
+insist on domain names ending with a dot.
+.PP
+
+.SH AUTHOR
+Holger Zuleger
+
+.SH COPYRIGHT
+Copyright (c) 2005 \- 2007 by Holger Zuleger.
+Licensed under the GPL 2. There is NO warranty; not even for MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.
+.\"--------------------------------------------------
+.SH SEE ALSO
+dnssec-keygen(8), dnssec-signzone(8), rndc(8), named.conf(5), dnssec-signer(8),
+.br
+RFC4641
+"DNSSEC Operational Practices" by Miek Gieben and Olaf Kolkman,
+.br
+DNSSEC HOWTO Tutorial by Olaf Kolkman, RIPE NCC
+.br
+(http://www.nlnetlabs.nl/dnssec_howto/)
diff --git a/contrib/zkt/dnssec-zkt.c b/contrib/zkt/dnssec-zkt.c
new file mode 100644
index 0000000..803cbc3
--- /dev/null
+++ b/contrib/zkt/dnssec-zkt.c
@@ -0,0 +1,823 @@
+/*****************************************************************
+**
+** @(#) dnssec-zkt.c (c) Jan 2005 Holger Zuleger hznet.de
+**
+** Secure DNS zone key tool
+** A wrapper command around the BIND dnssec-keygen utility
+**
+** Copyright (c) 2005 - 2008, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+
+# include <stdio.h>
+# include <stdlib.h> /* abort(), exit(), ... */
+# include <string.h>
+# include <dirent.h>
+# include <assert.h>
+# include <unistd.h>
+# include <ctype.h>
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+# include "config_zkt.h"
+#if defined(HAVE_GETOPT_LONG) && HAVE_GETOPT_LONG
+# include <getopt.h>
+#endif
+
+# include "debug.h"
+# include "misc.h"
+# include "strlist.h"
+# include "zconf.h"
+# include "dki.h"
+# include "zkt.h"
+
+extern int optopt;
+extern int opterr;
+extern int optind;
+extern char *optarg;
+const char *progname;
+
+char *labellist = NULL;
+
+int headerflag = 1;
+int ageflag = 0;
+int lifetime = 0;
+int lifetimeflag = 0;
+int timeflag = 1;
+int exptimeflag = 0;
+int pathflag = 0;
+int kskflag = 1;
+int zskflag = 1;
+int ljustflag = 0;
+
+static int dirflag = 0;
+static int recflag = RECURSIVE;
+static int trustedkeyflag = 0;
+static char *kskdomain = "";
+static const char *view = "";
+
+# define short_options ":0:1:2:3:9A:C:D:P:S:R:HKTs:ZV:afF:c:O:dhkLl:prtez"
+#if defined(HAVE_GETOPT_LONG) && HAVE_GETOPT_LONG
+static struct option long_options[] = {
+ {"ksk-rollover", no_argument, NULL, '9'},
+ {"ksk-status", required_argument, NULL, '0'},
+ {"ksk-roll-status", required_argument, NULL, '0'},
+ {"ksk-newkey", required_argument, NULL, '1'},
+ {"ksk-publish", required_argument, NULL, '2'},
+ {"ksk-delkey", required_argument, NULL, '3'},
+ {"ksk-roll-phase1", required_argument, NULL, '1'},
+ {"ksk-roll-phase2", required_argument, NULL, '2'},
+ {"ksk-roll-phase3", required_argument, NULL, '3'},
+ {"list-dnskeys", no_argument, NULL, 'K'},
+ {"list-trustedkeys", no_argument, NULL, 'T'},
+ {"ksk", no_argument, NULL, 'k'},
+ {"zsk", no_argument, NULL, 'z'},
+ {"age", no_argument, NULL, 'a'},
+ {"lifetime", no_argument, NULL, 'f'},
+ {"time", no_argument, NULL, 't'},
+ {"expire", no_argument, NULL, 'e'},
+ {"recursive", no_argument, NULL, 'r'},
+ {"zone-config", no_argument, NULL, 'Z'},
+ {"leftjust", no_argument, NULL, 'L'},
+ {"path", no_argument, NULL, 'p'},
+ {"nohead", no_argument, NULL, 'h'},
+ {"directory", no_argument, NULL, 'd'},
+ {"config", required_argument, NULL, 'c'},
+ {"option", required_argument, NULL, 'O'},
+ {"config-option", required_argument, NULL, 'O'},
+ {"published", required_argument, NULL, 'P'},
+ {"standby", required_argument, NULL, 'S'},
+ {"active", required_argument, NULL, 'A'},
+ {"depreciated", required_argument, NULL, 'D'},
+ {"create", required_argument, NULL, 'C'},
+ {"revoke", required_argument, NULL, 'R'},
+ {"remove", required_argument, NULL, 19 },
+ {"destroy", required_argument, NULL, 20 },
+ {"setlifetime", required_argument, NULL, 'F' },
+ {"view", required_argument, NULL, 'V' },
+ {"help", no_argument, NULL, 'H'},
+ {0, 0, 0, 0}
+};
+#endif
+
+static int parsedirectory (const char *dir, dki_t **listp);
+static void parsefile (const char *file, dki_t **listp);
+static void createkey (const char *keyname, const dki_t *list, const zconf_t *conf);
+static void ksk_roll (const char *keyname, int phase, const dki_t *list, const zconf_t *conf);
+static int create_parent_file (const char *fname, int phase, int ttl, const dki_t *dkp);
+static void usage (char *mesg, zconf_t *cp);
+static const char *parsetag (const char *str, int *tagp);
+
+static void setglobalflags (zconf_t *config)
+{
+ recflag = config->recursive;
+ ageflag = config->printage;
+ timeflag = config->printtime;
+ ljustflag = config->ljust;
+}
+
+int main (int argc, char *argv[])
+{
+ dki_t *data = NULL;
+ dki_t *dkp;
+ int c;
+ int opt_index;
+ int action;
+ const char *file;
+ const char *defconfname = NULL;
+ char *p;
+ char str[254+1];
+ const char *keyname = NULL;
+ int searchtag;
+ zconf_t *config;
+
+ progname = *argv;
+ if ( (p = strrchr (progname, '/')) )
+ progname = ++p;
+ view = getnameappendix (progname, "dnssec-zkt");
+
+ defconfname = getdefconfname (view);
+ config = loadconfig ("", (zconf_t *)NULL); /* load built in config */
+ if ( fileexist (defconfname) ) /* load default config file */
+ config = loadconfig (defconfname, config);
+ if ( config == NULL )
+ fatal ("Out of memory\n");
+ setglobalflags (config);
+
+ opterr = 0;
+ opt_index = 0;
+ action = 0;
+#if defined(HAVE_GETOPT_LONG) && HAVE_GETOPT_LONG
+ while ( (c = getopt_long (argc, argv, short_options, long_options, &opt_index)) != -1 )
+#else
+ while ( (c = getopt (argc, argv, short_options)) != -1 )
+#endif
+ {
+ switch ( c )
+ {
+ case '9': /* ksk rollover help */
+ ksk_roll ("help", c - '0', NULL, NULL);
+ exit (1);
+ case '1': /* ksk rollover: create new key */
+ case '2': /* ksk rollover: publish DS */
+ case '3': /* ksk rollover: delete old key */
+ case '0': /* ksk rollover: show current status */
+ action = c;
+ if ( !optarg )
+ usage ("ksk rollover requires an domain argument", config);
+ kskdomain = str_tolowerdup (optarg);
+ break;
+ case 'T':
+ trustedkeyflag = 1;
+ zskflag = pathflag = 0;
+ /* fall through */
+ case 'H':
+ case 'K':
+ case 'Z':
+ action = c;
+ break;
+ case 'C':
+ pathflag = !pathflag;
+ /* fall through */
+ case 'P':
+ case 'S':
+ case 'A':
+ case 'D':
+ case 'R':
+ case 's':
+ case 19:
+ case 20:
+ if ( (keyname = parsetag (optarg, &searchtag)) != NULL )
+ {
+ int len = strlen (keyname);
+ if ( len > 0 && keyname[len-1] != '.' )
+ {
+ snprintf (str, sizeof(str), "%s.", keyname);
+ keyname = str;
+ }
+ }
+ keyname = str_tolowerdup (keyname);
+ action = c;
+ break;
+ case 'a': /* age */
+ ageflag = !ageflag;
+ break;
+ case 'f': /* key lifetime */
+ lifetimeflag = !lifetimeflag;
+ break;
+ case 'F': /* set key lifetime */
+ lifetime = atoi (optarg);
+ lifetimeflag = 1; /* set some flags for more informative output */
+ exptimeflag = 1;
+ timeflag = 1;
+ action = c;
+ break;
+ case 'V': /* view name */
+ view = optarg;
+ defconfname = getdefconfname (view);
+ if ( fileexist (defconfname) ) /* load default config file */
+ config = loadconfig (defconfname, config);
+ if ( config == NULL )
+ fatal ("Out of memory\n");
+ setglobalflags (config);
+ break;
+ case 'c':
+ config = loadconfig (optarg, config);
+ setglobalflags (config);
+ checkconfig (config);
+ break;
+ case 'O': /* read option from commandline */
+ config = loadconfig_fromstr (optarg, config);
+ setglobalflags (config);
+ checkconfig (config);
+ break;
+ case 'd': /* ignore directory arg */
+ dirflag = 1;
+ break;
+ case 'h': /* print no headline */
+ headerflag = 0;
+ break;
+ case 'k': /* ksk only */
+ zskflag = 0;
+ break;
+ case 'L': /* ljust */
+ ljustflag = !ljustflag;
+ break;
+ case 'l': /* label list */
+ labellist = prepstrlist (optarg, LISTDELIM);
+ if ( labellist == NULL )
+ fatal ("Out of memory\n");
+ break;
+ case 'p': /* print path */
+ pathflag = 1;
+ break;
+ case 'r': /* switch recursive flag */
+ recflag = !recflag;
+ break;
+ case 't': /* time */
+ timeflag = !timeflag;
+ break;
+ case 'e': /* expire time */
+ exptimeflag = !exptimeflag;
+ break;
+ case 'z': /* zsk only */
+ kskflag = 0;
+ break;
+ case ':':
+ snprintf (str, sizeof(str), "option \"-%c\" requires an argument.\n",
+ optopt);
+ usage (str, config);
+ break;
+ case '?':
+ if ( isprint (optopt) )
+ snprintf (str, sizeof(str), "Unknown option \"-%c\".\n",
+ optopt);
+ else
+ snprintf (str, sizeof (str), "Unknown option char \\x%x.\n",
+ optopt);
+ usage (str, config);
+ break;
+ default:
+ abort();
+ }
+ }
+
+ /* it's better to do this before we read the whole directory tree */
+ if ( action == 'Z' )
+ {
+ printconfig ("stdout", config);
+ return 0;
+ }
+
+ if ( kskflag == 0 && zskflag == 0 )
+ kskflag = zskflag = 1;
+
+ c = optind;
+ do {
+ if ( c >= argc ) /* no args left */
+ file = config->zonedir; /* use default directory */
+ else
+ file = argv[c++];
+
+ if ( is_directory (file) )
+ parsedirectory (file, &data);
+ else
+ parsefile (file, &data);
+
+ } while ( c < argc ); /* for all arguments */
+
+ switch ( action )
+ {
+ case 'H':
+ usage ("", config);
+ case 'C':
+ createkey (keyname, data, config);
+ break;
+ case 'P':
+ case 'S':
+ case 'A':
+ case 'D':
+ if ( (dkp = (dki_t*)zkt_search (data, searchtag, keyname)) == NULL )
+ fatal ("Key with tag %u not found\n", searchtag);
+ else if ( dkp == (void *) 01 )
+ fatal ("Key with tag %u found multiple times\n", searchtag);
+ if ( (c = dki_setstatus_preservetime (dkp, action)) != 0 )
+ fatal ("Couldn't change status of key %u: %d\n", searchtag, c);
+ break;
+ case 19: /* remove (rename) key file */
+ if ( (dkp = (dki_t *)zkt_search (data, searchtag, keyname)) == NULL )
+ fatal ("Key with tag %u not found\n", searchtag);
+ else if ( dkp == (void *) 01 )
+ fatal ("Key with tag %u found multiple times\n", searchtag);
+ dki_remove (dkp);
+ break;
+ case 20: /* destroy the key (remove the files!) */
+ if ( (dkp = (dki_t *)zkt_search (data, searchtag, keyname)) == NULL )
+ fatal ("Key with tag %u not found\n", searchtag);
+ else if ( dkp == (void *) 01 )
+ fatal ("Key with tag %u found multiple times\n", searchtag);
+ dki_destroy (dkp);
+ break;
+ case 'R':
+ if ( (dkp = (dki_t *)zkt_search (data, searchtag, keyname)) == NULL )
+ fatal ("Key with tag %u not found\n", searchtag);
+ else if ( dkp == (void *) 01 )
+ fatal ("Key with tag %u found multiple times\n", searchtag);
+ if ( (c = dki_setstatus (dkp, action)) != 0 )
+ fatal ("Couldn't change status of key %u: %d\n", searchtag, c);
+ break;
+ case 's':
+ if ( (dkp = (dki_t *)zkt_search (data, searchtag, keyname)) == NULL )
+ fatal ("Key with tag %u not found\n", searchtag);
+ else if ( dkp == (void *) 01 )
+ fatal ("Key with tag %u found multiple times\n", searchtag);
+ dki_prt_dnskey (dkp, stdout);
+ break;
+ case 'K':
+ zkt_list_dnskeys (data);
+ break;
+ case 'T':
+ zkt_list_trustedkeys (data);
+ break;
+ case '1': /* ksk rollover new key */
+ case '2': /* ksk rollover publish DS */
+ case '3': /* ksk rollover delete old key */
+ case '0': /* ksk rollover status */
+ ksk_roll (kskdomain, action - '0', data, config);
+ break;
+ case 'F':
+ zkt_setkeylifetime (data);
+ /* fall through */
+ default:
+ zkt_list_keys (data);
+ }
+
+ return 0;
+}
+
+# define sopt_usage(mesg, value) fprintf (stderr, mesg, value)
+#if defined(HAVE_GETOPT_LONG) && HAVE_GETOPT_LONG
+# define lopt_usage(mesg, value) fprintf (stderr, mesg, value)
+# define loptstr(lstr, sstr) lstr
+#else
+# define lopt_usage(mesg, value)
+# define loptstr(lstr, sstr) sstr
+#endif
+static void usage (char *mesg, zconf_t *cp)
+{
+ fprintf (stderr, "Secure DNS Zone Key Tool %s\n", ZKT_VERSION);
+ fprintf (stderr, "\n");
+ fprintf (stderr, "Show zone config parameter as %s file\n", LOCALCONF_FILE);
+ sopt_usage ("\tusage: %s -Z\n", progname);
+ lopt_usage ("\tusage: %s --zone-config\n", progname);
+ fprintf (stderr, "\n");
+ fprintf (stderr, "List keys in current or given directory (-r for recursive mode)\n");
+ sopt_usage ("\tusage: %s [-dhatkzpr] [-c config] [file|dir ...]\n", progname);
+ fprintf (stderr, "\n");
+ fprintf (stderr, "List public part of keys in DNSKEY RR format\n");
+ sopt_usage ("\tusage: %s -K [-dhkzr] [-c config] [file|dir ...]\n", progname);
+ lopt_usage ("\tusage: %s --list-dnskeys [-dhkzr] [-c config] [file|dir ...]\n", progname);
+ fprintf (stderr, "\n");
+ fprintf (stderr, "List keys (output is suitable for trusted-keys section)\n");
+ sopt_usage ("\tusage: %s -T [-dhzr] [-c config] [file|dir ...]\n", progname);
+ lopt_usage ("\tusage: %s --list-trustedkeys [-dhzr] [-c config] [file|dir ...]\n", progname);
+ fprintf (stderr, "\n");
+ fprintf (stderr, "Create a new key \n");
+ sopt_usage ("\tusage: %s -C <name> [-k] [-dpr] [-c config] [dir ...]\n", progname);
+ lopt_usage ("\tusage: %s --create=<name> [-k] [-dpr] [-c config] [dir ...]\n", progname);
+ fprintf (stderr, "\t\tKSK (use -k): %s %d bits\n", dki_algo2str (cp->k_algo), cp->k_bits);
+ fprintf (stderr, "\t\tZSK (default): %s %d bits\n", dki_algo2str (cp->z_algo), cp->z_bits);
+ fprintf (stderr, "\n");
+ fprintf (stderr, "Change key status of specified key to published, active or depreciated\n");
+ fprintf (stderr, "\t(<keyspec> := tag | tag:name) \n");
+ sopt_usage ("\tusage: %s -P|-A|-D <keyspec> [-dr] [-c config] [dir ...]\n", progname);
+ lopt_usage ("\tusage: %s --published=<keyspec> [-dr] [-c config] [dir ...]\n", progname);
+ lopt_usage ("\tusage: %s --active=<keyspec> [-dr] [-c config] [dir ...]\n", progname);
+ lopt_usage ("\tusage: %s --depreciated=<keyspec> [-dr] [-c config] [dir ...]\n", progname);
+ fprintf (stderr, "\n");
+ fprintf (stderr, "Revoke specified key (<keyspec> := tag | tag:name) \n");
+ sopt_usage ("\tusage: %s -R <keyspec> [-dr] [-c config] [dir ...]\n", progname);
+ lopt_usage ("\tusage: %s --revoke=<keyspec> [-dr] [-c config] [dir ...]\n", progname);
+ fprintf (stderr, "\n");
+ fprintf (stderr, "Remove (rename) or destroy (delete) specified key (<keyspec> := tag | tag:name) \n");
+ lopt_usage ("\tusage: %s --remove=<keyspec> [-dr] [-c config] [dir ...]\n", progname);
+ lopt_usage ("\tusage: %s --destroy=<keyspec> [-dr] [-c config] [dir ...]\n", progname);
+ fprintf (stderr, "\n");
+ fprintf (stderr, "Initiate a semi-automated KSK rollover");
+ fprintf (stderr, "('%s -9%s' prints out a short description)\n", progname, loptstr ("|--ksk-rollover", ""));
+ sopt_usage ("\tusage: %s {-1} do.ma.in.\n", progname);
+ lopt_usage ("\tusage: %s {--ksk-roll-phase1|--ksk-newkey} do.ma.in.\n", progname);
+ sopt_usage ("\tusage: %s {-2} do.ma.in.\n", progname);
+ lopt_usage ("\tusage: %s {--ksk-roll-phase2|--ksk-publish} do.ma.in.\n", progname);
+ sopt_usage ("\tusage: %s {-3} do.ma.in.\n", progname);
+ lopt_usage ("\tusage: %s {--ksk-roll-phase3|--ksk-delkey} do.ma.in.\n", progname);
+ sopt_usage ("\tusage: %s {-0} do.ma.in.\n", progname);
+ lopt_usage ("\tusage: %s {--ksk-roll-status|--ksk-status} do.ma.in.\n", progname);
+ fprintf (stderr, "\n");
+
+ fprintf (stderr, "\n");
+ fprintf (stderr, "General options \n");
+ fprintf (stderr, "\t-c file%s", loptstr (", --config=file\n", ""));
+ fprintf (stderr, "\t\t read config from <file> instead of %s\n", CONFIG_FILE);
+ fprintf (stderr, "\t-O optstr%s", loptstr (", --config-option=\"optstr\"\n", ""));
+ fprintf (stderr, "\t\t read config options from commandline\n");
+ fprintf (stderr, "\t-h%s\t no headline or trusted-key section header/trailer in -T mode\n", loptstr (", --nohead", "\t"));
+ fprintf (stderr, "\t-d%s\t skip directory arguments\n", loptstr (", --directory", "\t"));
+ fprintf (stderr, "\t-L%s\t print the domain name left justified (default: %s)\n", loptstr (", --leftjust", "\t"), ljustflag ? "on": "off");
+ fprintf (stderr, "\t-l list\t\t print out only zone keys out of the given domain list\n");
+ fprintf (stderr, "\t-p%s\t show path of keyfile / create key in current directory\n", loptstr (", --path", "\t"));
+ fprintf (stderr, "\t-r%s\t recursive mode on/off (default: %s)\n", loptstr(", --recursive", "\t"), recflag ? "on": "off");
+ fprintf (stderr, "\t-a%s\t print age of key (default: %s)\n", loptstr (", --age", "\t"), ageflag ? "on": "off");
+ fprintf (stderr, "\t-t%s\t print key generation time (default: %s)\n", loptstr (", --time", "\t"),
+ timeflag ? "on": "off");
+ fprintf (stderr, "\t-e%s\t print key expiration time\n", loptstr (", --expire", "\t"));
+ fprintf (stderr, "\t-f%s\t print key lifetime\n", loptstr (", --lifetime", "\t"));
+ fprintf (stderr, "\t-F days%s=days\t set key lifetime\n", loptstr (", --setlifetime", "\t"));
+ fprintf (stderr, "\t-k%s\t key signing keys only\n", loptstr (", --ksk", "\t"));
+ fprintf (stderr, "\t-z%s\t zone signing keys only\n", loptstr (", --zsk", "\t"));
+ if ( mesg && *mesg )
+ fprintf (stderr, "%s\n", mesg);
+ exit (1);
+}
+
+static void createkey (const char *keyname, const dki_t *list, const zconf_t *conf)
+{
+ const char *dir = "";
+ dki_t *dkp;
+
+ if ( keyname == NULL || *keyname == '\0' )
+ fatal ("Create key: no keyname!");
+
+ dbg_val2 ("createkey: keyname %s, pathflag = %d\n", keyname, pathflag);
+ /* search for already existent key to get the directory name */
+ if ( pathflag && (dkp = (dki_t *)zkt_search (list, 0, keyname)) != NULL )
+ {
+ char path[MAX_PATHSIZE+1];
+ zconf_t localconf;
+
+ dir = dkp->dname;
+ pathname (path, sizeof (path), dir, LOCALCONF_FILE, NULL);
+ if ( fileexist (path) ) /* load local config file */
+ {
+ dbg_val ("Load local config file \"%s\"\n", path);
+ memcpy (&localconf, conf, sizeof (zconf_t));
+ conf = loadconfig (path, &localconf);
+ }
+ }
+
+ if ( zskflag )
+ dkp = dki_new (dir, keyname, DKI_ZSK, conf->z_algo, conf->z_bits, conf->z_random, conf->z_life / DAYSEC);
+ else
+ dkp = dki_new (dir, keyname, DKI_KSK, conf->k_algo, conf->k_bits, conf->k_random, conf->k_life / DAYSEC);
+ if ( dkp == NULL )
+ fatal ("Can't create key %s: %s!\n", keyname, dki_geterrstr ());
+
+ /* create a new key always in state published, which means "standby" for ksk */
+ dki_setstatus (dkp, DKI_PUB);
+}
+
+static int get_parent_phase (const char *file)
+{
+ FILE *fp;
+ int phase;
+
+ if ( (fp = fopen (file, "r")) == NULL )
+ return -1;
+
+ phase = 0;
+ if ( fscanf (fp, "; KSK rollover phase%d", &phase) != 1 )
+ phase = 0;
+
+ fclose (fp);
+ return phase;
+}
+
+static void ksk_roll (const char *keyname, int phase, const dki_t *list, const zconf_t *conf)
+{
+ char path[MAX_PATHSIZE+1];
+ zconf_t localconf;
+ const char *dir;
+ dki_t *keylist;
+ dki_t *dkp;
+ dki_t *standby;
+ int parent_exist;
+ int parent_age;
+ int parent_phase;
+ int parent_propagation;
+ int key_ttl;
+ int ksk;
+
+ if ( phase == 9 ) /* usage */
+ {
+ fprintf (stderr, "A KSK rollover requires three consecutive steps:\n");
+ fprintf (stderr, "\n");
+ fprintf (stderr, "-1%s", loptstr ("|--ksk-roll-phase1 (--ksk-newkey)\n", ""));
+ fprintf (stderr, "\t Create a new KSK.\n");
+ fprintf (stderr, "\t This step also creates a parent-<domain> file which contains only\n");
+ fprintf (stderr, "\t the _old_ key. This file will be copied in hierarchical mode\n");
+ fprintf (stderr, "\t by dnssec-signer to the parent directory as keyset-<domain> file.\n");
+ fprintf (stderr, "\t Wait until the new keyset is propagated, before going to the next step.\n");
+ fprintf (stderr, "\n");
+ fprintf (stderr, "-2%s", loptstr ("|--ksk-roll-phase2 (--ksk-publish)\n", ""));
+ fprintf (stderr, "\t This step creates a parent-<domain> file with the _new_ key only.\n");
+ fprintf (stderr, "\t Please send this file immediately to the parent (In hierarchical\n");
+ fprintf (stderr, "\t mode this will be done automatically by the dnssec-signer command).\n");
+ fprintf (stderr, "\t Then wait until the new DS is generated by the parent and propagated\n");
+ fprintf (stderr, "\t to all the parent name server, plus the old DS TTL before going to step three.\n");
+ fprintf (stderr, "\n");
+ fprintf (stderr, "-3%s", loptstr ("|--ksk-roll-phase3 (--ksk-delkey)\n", ""));
+ fprintf (stderr, "\t Remove (rename) the old KSK and the parent-<domain> file.\n");
+ fprintf (stderr, "\t You have to manually delete the old KSK (look at file names beginning\n");
+ fprintf (stderr, "\t with an lower 'k').\n");
+ fprintf (stderr, "\n");
+ fprintf (stderr, "-0%s", loptstr ("|--ksk-roll-stat (--ksk-status)\n", ""));
+ fprintf (stderr, "\t Show the current KSK rollover state of a domain.\n");
+
+ fprintf (stderr, "\n");
+
+ return;
+ }
+
+ if ( keyname == NULL || *keyname == '\0' )
+ fatal ("ksk rollover: no domain!");
+
+ dbg_val2 ("ksk_roll: keyname %s, phase = %d\n", keyname, phase);
+
+ /* search for already existent key to get the directory name */
+ if ( (keylist = (dki_t *)zkt_search (list, 0, keyname)) == NULL )
+ fatal ("ksk rollover: domain %s not found!\n", keyname);
+ dkp = keylist;
+
+ /* try to read local config file */
+ dir = dkp->dname;
+ pathname (path, sizeof (path), dir, LOCALCONF_FILE, NULL);
+ if ( fileexist (path) ) /* load local config file */
+ {
+ dbg_val ("Load local config file \"%s\"\n", path);
+ memcpy (&localconf, conf, sizeof (zconf_t));
+ conf = loadconfig (path, &localconf);
+ }
+ key_ttl = conf->key_ttl;
+
+ /* check if parent-file already exist */
+ pathname (path, sizeof (path), dir, "parent-", keyname);
+ parent_phase = parent_age = 0;
+ if ( (parent_exist = fileexist (path)) != 0 )
+ {
+ parent_phase = get_parent_phase (path);
+ parent_age = file_age (path);
+ }
+ // parent_propagation = 2 * DAYSEC;
+ parent_propagation = 5 * MINSEC;
+
+ ksk = 0; /* count active(!) key signing keys */
+ standby = NULL; /* find standby key if available */
+ for ( dkp = keylist; dkp; dkp = dkp->next )
+ if ( dki_isksk (dkp) )
+ {
+ if ( dki_status (dkp) == DKI_ACT )
+ ksk++;
+ else if ( dki_status (dkp) == DKI_PUB )
+ standby = dkp;
+ }
+
+ switch ( phase )
+ {
+ case 0: /* print status (debug) */
+ fprintf (stdout, "ksk_rollover:\n");
+ fprintf (stdout, "\t domain = %s\n", keyname);
+ fprintf (stdout, "\t phase = %d\n", parent_phase);
+ fprintf (stdout, "\t parent_file %s %s\n", path, parent_exist ? "exist": "not exist");
+ if ( parent_exist )
+ fprintf (stdout, "\t age of parent_file %d %s\n", parent_age, str_delspace (age2str (parent_age)));
+ fprintf (stdout, "\t # of active key signing keys %d\n", ksk);
+ fprintf (stdout, "\t parent_propagation %d %s\n", parent_propagation, str_delspace (age2str (parent_propagation)));
+ fprintf (stdout, "\t keys ttl %d %s\n", key_ttl, age2str (key_ttl));
+
+ for ( dkp = keylist; dkp; dkp = dkp->next )
+ {
+ /* TODO: Nur zum testen */
+ dki_prt_dnskey (dkp, stdout);
+ }
+ break;
+ case 1:
+ if ( parent_exist || ksk > 1 )
+ fatal ("Can\'t create new ksk because there is already an ksk rollover in progress\n");
+
+ fprintf (stdout, "create new ksk \n");
+ dkp = dki_new (dir, keyname, DKI_KSK, conf->k_algo, conf->k_bits, conf->k_random, conf->k_life / DAYSEC);
+ if ( dkp == NULL )
+ fatal ("Can't create key %s: %s!\n", keyname, dki_geterrstr ());
+ if ( standby )
+ {
+ dki_setstatus (standby, DKI_ACT); /* activate standby key */
+ dki_setstatus (dkp, DKI_PUB); /* new key will be the new standby */
+ }
+
+ // dkp = keylist; /* use old key to create the parent file */
+ if ( (dkp = (dki_t *)dki_find (keylist, 1, 'a', 1)) == NULL ) /* find the oldest active ksk to create the parent file */
+ fatal ("ksk_rollover phase1: Couldn't find the old active key\n");
+ if ( !create_parent_file (path, phase, key_ttl, dkp) )
+ fatal ("Couldn't create parentfile %s\n", path);
+ break;
+
+ case 2:
+ if ( ksk < 2 )
+ fatal ("Can\'t publish new key because no one exist\n");
+ if ( !parent_exist )
+ fatal ("More than one KSK but no parent file found!\n");
+ if ( parent_phase != 1 )
+ fatal ("Parent file exists but is in wrong state (phase = %d)\n", parent_phase);
+ if ( parent_age < conf->proptime + key_ttl )
+ fatal ("ksk_rollover (phase2): you have to wait for the propagation of the new KSK (at least %dsec or %s)\n",
+ conf->proptime + key_ttl - parent_age,
+ str_delspace (age2str (conf->proptime + key_ttl - parent_age)));
+
+ fprintf (stdout, "save new ksk in parent file\n");
+ dkp = keylist->next; /* set dkp to new ksk */
+ if ( !create_parent_file (path, phase, key_ttl, dkp) )
+ fatal ("Couldn't create parentfile %s\n", path);
+ break;
+ case 3:
+ if ( !parent_exist || ksk < 2 )
+ fatal ("ksk-delkey only allowed after ksk-publish\n");
+ if ( parent_phase != 2 )
+ fatal ("Parent file exists but is in wrong state (phase = %d)\n", parent_phase);
+ if ( parent_age < parent_propagation + key_ttl )
+ fatal ("ksk_rollover (phase3): you have to wait for DS propagation (at least %dsec or %s)\n",
+ parent_propagation + key_ttl - parent_age,
+ str_delspace (age2str (parent_propagation + key_ttl - parent_age)));
+ /* remove the parentfile */
+ fprintf (stdout, "remove parentfile \n");
+ unlink (path);
+ /* remove or rename the old key */
+ fprintf (stdout, "old ksk renamed \n");
+ dkp = keylist; /* set dkp to old ksk */
+ dki_remove (dkp);
+ break;
+ default: assert (phase == 1 || phase == 2 || phase == 3);
+ }
+}
+
+/*****************************************************************
+** create_parent_file ()
+*****************************************************************/
+static int create_parent_file (const char *fname, int phase, int ttl, const dki_t *dkp)
+{
+ FILE *fp;
+
+ assert ( fname != NULL );
+
+ if ( dkp == NULL || (phase != 1 && phase != 2) )
+ return 0;
+
+ if ( (fp = fopen (fname, "w")) == NULL )
+ fatal ("can\'t create new parentfile \"%s\"\n", fname);
+
+ if ( phase == 1 )
+ fprintf (fp, "; KSK rollover phase1 (old key)\n");
+ else
+ fprintf (fp, "; KSK rollover phase2 (new key)\n");
+
+ dki_prt_dnskeyttl (dkp, fp, ttl);
+ fclose (fp);
+
+ return phase;
+}
+
+static int parsedirectory (const char *dir, dki_t **listp)
+{
+ dki_t *dkp;
+ DIR *dirp;
+ struct dirent *dentp;
+ char path[MAX_PATHSIZE+1];
+
+ if ( dirflag )
+ return 0;
+
+ dbg_val ("directory: opendir(%s)\n", dir);
+ if ( (dirp = opendir (dir)) == NULL )
+ return 0;
+
+ while ( (dentp = readdir (dirp)) != NULL )
+ {
+ if ( is_dotfile (dentp->d_name) )
+ continue;
+
+ dbg_val ("directory: check %s\n", dentp->d_name);
+ pathname (path, sizeof (path), dir, dentp->d_name, NULL);
+ if ( is_directory (path) && recflag )
+ {
+ dbg_val ("directory: recursive %s\n", path);
+ parsedirectory (path, listp);
+ }
+ else if ( is_keyfilename (dentp->d_name) )
+ if ( (dkp = dki_read (dir, dentp->d_name)) )
+ {
+ // fprintf (stderr, "parsedir: tssearch (%d %s)\n", dkp, dkp->name);
+#if defined (USE_TREE) && USE_TREE
+ dki_tadd (listp, dkp);
+#else
+ dki_add (listp, dkp);
+#endif
+ }
+ }
+ closedir (dirp);
+ return 1;
+}
+
+static void parsefile (const char *file, dki_t **listp)
+{
+ char path[MAX_PATHSIZE+1];
+ dki_t *dkp;
+
+ /* file arg contains path ? ... */
+ file = splitpath (path, sizeof (path), file); /* ... then split of */
+
+ if ( is_keyfilename (file) ) /* plain file name looks like DNS key file ? */
+ {
+ if ( (dkp = dki_read (path, file)) ) /* read DNS key file ... */
+#if defined (USE_TREE) && USE_TREE
+ dki_tadd (listp, dkp); /* ... and add to tree */
+#else
+ dki_add (listp, dkp); /* ... and add to list */
+#endif
+ else
+ error ("error parsing %s: (%s)\n", file, dki_geterrstr());
+ }
+}
+
+static const char *parsetag (const char *str, int *tagp)
+{
+ const char *p;
+
+ *tagp = 0;
+ while ( isspace (*str) ) /* skip leading ws */
+ str++;
+
+ p = str;
+ if ( isdigit (*p) ) /* keytag starts with digit */
+ {
+ sscanf (p, "%u", tagp); /* read keytag as number */
+ do /* eat up to the end of the number */
+ p++;
+ while ( isdigit (*p) );
+
+ if ( *p == ':' ) /* label follows ? */
+ return p+1; /* return that */
+ if ( *p == '\0' )
+ return NULL; /* no label */
+ }
+ return str; /* return as label string if not a numeric keytag */
+}
+
diff --git a/contrib/zkt/domaincmp.c b/contrib/zkt/domaincmp.c
new file mode 100644
index 0000000..7d2486f
--- /dev/null
+++ b/contrib/zkt/domaincmp.c
@@ -0,0 +1,190 @@
+/*****************************************************************
+**
+** @(#) domaincmp.c -- compare two domain names
+**
+** Copyright (c) Aug 2005, Karle Boss, Holger Zuleger (kaho).
+** All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Karle Boss or Holger Zuleger (kaho) nor the
+** names of its contributors may be used to endorse or promote products
+** derived from this software without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+# include <stdio.h>
+# include <string.h>
+# include <assert.h>
+# include <ctype.h>
+#define extern
+# include "domaincmp.h"
+#undef extern
+
+
+#define goto_labelstart(str, p) while ( (p) > (str) && *((p)-1) != '.' ) \
+ (p)--
+
+/*****************************************************************
+** int domaincmp (a, b)
+** compare a and b as fqdns.
+** return <0 | 0 | >0 as in strcmp
+** A subdomain is less than the corresponding parent domain,
+** thus domaincmp ("z.example.net", "example.net") return < 0 !!
+*****************************************************************/
+int domaincmp (const char *a, const char *b)
+{
+ register const char *pa;
+ register const char *pb;
+
+ if ( a == NULL ) return -1;
+ if ( b == NULL ) return 1;
+
+ if ( *a == '.' ) /* skip a leading dot */
+ a++;
+ if ( *b == '.' ) /* same at the other string */
+ b++;
+
+ /* let pa and pb point to the last non dot char */
+ pa = a + strlen (a);
+ do
+ pa--;
+ while ( pa > a && *pa == '.' );
+
+ pb = b + strlen (b);
+ do
+ pb--;
+ while ( pb > b && *pb == '.' );
+
+ /* cmp both domains starting at the end */
+ while ( *pa == *pb && pa > a && pb > b )
+ pa--, pb--;
+
+ if ( *pa != *pb ) /* both domains are different ? */
+ {
+ if ( *pa == '.' )
+ pa++; /* set to beginning of next label */
+ else
+ goto_labelstart (a, pa); /* find begin of current label */
+ if ( *pb == '.' )
+ pb++; /* set to beginning of next label */
+ else
+ goto_labelstart (b, pb); /* find begin of current label */
+ }
+ else /* maybe one of them has a subdomain */
+ {
+ if ( pa > a )
+ if ( pa[-1] == '.' )
+ return -1;
+ else
+ goto_labelstart (a, pa);
+ else if ( pb > b )
+ if ( pb[-1] == '.' )
+ return 1;
+ else
+ goto_labelstart (b, pb);
+ else
+ return 0; /* both are at the beginning, so they are equal */
+ }
+
+ /* both domains are definitly unequal */
+ while ( *pa == *pb ) /* so we have to look at the point where they differ */
+ pa++, pb++;
+
+ return *pa - *pb;
+}
+
+#ifdef DOMAINCMP_TEST
+static struct {
+ char *a;
+ char *b;
+ int res;
+} ex[] = {
+ { ".", ".", 0 },
+ { "test", "", 1 },
+ { "", "test2", -1 },
+ { "", "", 0 },
+ { "de", "de", 0 },
+ { ".de", "de", 0 },
+ { "de.", "de.", 0 },
+ { ".de", ".de", 0 },
+ { ".de.", ".de.", 0 },
+ { ".de", "zde", -1 },
+ { ".de", "ade", 1 },
+ { "zde", ".de", 1 },
+ { "ade", ".de", -1 },
+ { "a.de", ".de", -1 },
+ { ".de", "a.de", 1 },
+ { "a.de", "b.de", -1 },
+ { "a.de.", "b.de", -1 },
+ { "a.de", "b.de.", -1 },
+ { "a.de", "a.de.", 0 },
+ { "aa.de", "b.de", -1 },
+ { "ba.de", "b.de", 1 },
+ { "a.de", "a.dk", -1 },
+ { "anna.example.de", "anna.example.de", 0 },
+ { "anna.example.de", "annamirl.example.de", -1 },
+ { "anna.example.de", "ann.example.de", 1 },
+ { "example.de.", "xy.example.de.", 1 },
+ { "example.de.", "ab.example.de.", 1 },
+ { "example.de", "ab.example.de", 1 },
+ { "ab.example.de", "example.de", -1 },
+ { "ab.mast.de", "axt.de", 1 },
+ { "ab.mast.de", "obt.de", -1 },
+ { "abc.example.de.", "xy.example.de.", -1 },
+ { NULL, NULL, 0 }
+};
+
+const char *progname;
+main (int argc, char *argv[])
+{
+
+ int expect;
+ int res;
+ int c;
+ int i;
+
+ progname = *argv;
+
+ for ( i = 0; ex[i].a; i++ )
+ {
+ expect = ex[i].res;
+ if ( expect < 0 )
+ c = '<';
+ else if ( expect > 0 )
+ c = '>';
+ else
+ c = '=';
+ printf ("%-20s %-20s ==> %c 0 ", ex[i].a, ex[i].b, c);
+ fflush (stdout);
+ res = domaincmp (ex[i].a, ex[i].b);
+ printf ("%3d ", res);
+ if ( res < 0 && expect < 0 || res > 0 && expect > 0 || res == 0 && expect == 0 )
+ puts ("ok");
+ else
+ puts ("not ok");
+ }
+}
+#endif
diff --git a/contrib/zkt/domaincmp.h b/contrib/zkt/domaincmp.h
new file mode 100644
index 0000000..7051f54
--- /dev/null
+++ b/contrib/zkt/domaincmp.h
@@ -0,0 +1,40 @@
+/*****************************************************************
+**
+** @(#) domaincmp.h -- compare two domain names
+**
+** Copyright (c) Aug 2005, Karle Boss (kaho). All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+#ifndef DOMAINCMP_H
+# define DOMAINCMP_H
+extern int domaincmp (const char *a, const char *b);
+#endif
diff --git a/contrib/zkt/examples/dnskey.db b/contrib/zkt/examples/dnskey.db
new file mode 100644
index 0000000..2822e6a
--- /dev/null
+++ b/contrib/zkt/examples/dnskey.db
@@ -0,0 +1,24 @@
+;
+; !!! Don't edit this file by hand.
+; !!! It will be generated by dnssec-signer.
+;
+; Last generation time Jun 24 2008 09:58:34
+;
+
+; *** List of Key Signing Keys ***
+; example.net. tag=31674 algo=RSASHA1 generated Jun 24 2008 09:58:34
+example.net. 14400 IN DNSKEY 257 3 5 (
+ BQEAAAABC23icFZAD3DFBLoEw7DWKl8Hig7azmEbpXHYyAV98l+QQaTA
+ b98Ob3YbrVJ9IU8E0KBFb5iYpHobxowPsI8FjUH2oL/7PfhtN1E3NlL6
+ Uhbo8Umf6H0UULEsUTlTT8dnX+ikjAr8bN71YJP7BXlszezsFHuMEspN
+ dOPyMr93230+R2KTEzC2H4CQzSRIr5xXSIq8kkrJ3miGjTyj5awvXfJ+
+ eQ==
+ ) ; key id = 31674
+
+; *** List of Zone Signing Keys ***
+; example.net. tag=33755 algo=RSASHA1 generated Jun 24 2008 09:58:34
+example.net. 14400 IN DNSKEY 256 3 5 (
+ BQEAAAABzN8pvZb5GSy8AozXt4L8HK/x59TQjh9IaZS+mIyyuHDX2iaF
+ UigOqHixIJtDLD1r/MfelgJ/Mh6+vCu+XmMQuw==
+ ) ; key id = 33755
+
diff --git a/contrib/zkt/examples/dnssec-signer.sh b/contrib/zkt/examples/dnssec-signer.sh
new file mode 100755
index 0000000..ee4bfc0
--- /dev/null
+++ b/contrib/zkt/examples/dnssec-signer.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+#
+# Shell script to start the dnssec-signer
+# command out of the example directory
+#
+
+if test ! -f dnssec.conf
+then
+ echo Please start this skript out of the flat or hierarchical sub directory
+ exit 1
+fi
+ZKT_CONFFILE=`pwd`/dnssec.conf ../../dnssec-signer "$@"
diff --git a/contrib/zkt/examples/dnssec-zkt.sh b/contrib/zkt/examples/dnssec-zkt.sh
new file mode 100755
index 0000000..f3976ce
--- /dev/null
+++ b/contrib/zkt/examples/dnssec-zkt.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+#
+# Shell script to start the dnssec-zkt command
+# out of the example directory
+#
+
+if test ! -f dnssec.conf
+then
+ echo Please start this skript out of the flat or hierarchical sub directory
+ exit 1
+fi
+ZKT_CONFFILE=`pwd`/dnssec.conf ../../dnssec-zkt "$@"
diff --git a/contrib/zkt/examples/flat/dist.sh b/contrib/zkt/examples/flat/dist.sh
new file mode 100755
index 0000000..c112f55
--- /dev/null
+++ b/contrib/zkt/examples/flat/dist.sh
@@ -0,0 +1,70 @@
+#################################################################
+#
+# @(#) dist.sh -- distribute and reload command for dnssec-signer
+#
+# (c) Jul 2008 Holger Zuleger hznet.de
+#
+# This shell script will be run by dnssec-signer as a distribution
+# and reload command if:
+#
+# a) the dnssec.conf file parameter Distribute_Cmd: points
+# to this file
+# and
+# b) the user running the dnssec-signer command is not
+# root (uid==0)
+# and
+# c) the owner of this shell script is the same as the
+# running user and the access rights don't allow writing
+# for anyone except the owner
+# or
+# d) the group of this shell script is the same as the
+# running user and the access rights don't allow writing
+# for anyone except the group
+#
+#################################################################
+
+# set path to rndc and scp
+PATH="/bin:/usr/bin:/usr/local/sbin"
+
+# remote server and directory
+server=localhost # fqdn of remote name server
+dir=/var/named # zone directory on remote name server
+
+progname=$0
+usage()
+{
+ echo "usage: $progname distribute|reload <domain> <path_to_zonefile> [<viewname>]" 1>&2
+ test $# -gt 0 && echo $* 1>&2
+ exit 1
+}
+
+if test $# -lt 3
+then
+ usage
+fi
+action="$1"
+domain="$2"
+zonefile="$3"
+view=""
+test $# -gt 3 && view="$4"
+
+case $action in
+distribute)
+ if test -n "$view"
+ then
+ echo "scp $zonefile $server:$dir/$view/$domain/"
+ : scp $zonefile $server:$dir/$view/$domain/
+ else
+ echo "scp $zonefile $server:$dir/$domain/"
+ : scp $zonefile $server:$dir/$domain/
+ fi
+ ;;
+reload)
+ echo "rndc $action $zone $view"
+ : rndc $action $zone $view
+ ;;
+*)
+ usage "illegal action $action"
+ ;;
+esac
+
diff --git a/contrib/zkt/examples/flat/dnssec.conf b/contrib/zkt/examples/flat/dnssec.conf
new file mode 100644
index 0000000..2bd9c58
--- /dev/null
+++ b/contrib/zkt/examples/flat/dnssec.conf
@@ -0,0 +1,41 @@
+#
+# @(#) dnssec.conf vT0.96 (c) Feb 2005 - May 2008 Holger Zuleger hznet.de
+#
+
+# dnssec-zkt options
+Zonedir: "."
+Recursive: True
+PrintTime: False
+PrintAge: True
+LeftJustify: False
+
+# zone specific values
+ResignInterval: 2d # (172800 seconds)
+Sigvalidity: 6d # (518400 seconds)
+Max_TTL: 8h # (28800 seconds)
+Propagation: 5m # (300 seconds)
+KEY_TTL: 1h # (3600 seconds)
+Serialformat: incremental
+
+# signing key parameters
+KSK_lifetime: 60d # (5184000 seconds)
+KSK_algo: RSASHA1 # (Algorithm ID 5)
+KSK_bits: 1300
+KSK_randfile: "/dev/urandom"
+ZSK_lifetime: 2w # (1209600 seconds)
+ZSK_algo: RSASHA1 # (Algorithm ID 5)
+ZSK_bits: 512
+ZSK_randfile: "/dev/urandom"
+
+# dnssec-signer options
+LogFile: "zkt.log"
+LogLevel: debug
+SyslogFacility: USER
+SyslogLevel: notice
+VerboseLog: 2
+Keyfile: "dnskey.db"
+Zonefile: "zone.db"
+KeySetDir: "../keysets"
+DLV_Domain: ""
+Sig_Pseudorand: True
+Distribute_Cmd: "./dist.sh"
diff --git a/contrib/zkt/examples/flat/dyn.example.net./Kdyn.example.net.+003+42138.key b/contrib/zkt/examples/flat/dyn.example.net./Kdyn.example.net.+003+42138.key
new file mode 100644
index 0000000..6a64c44
--- /dev/null
+++ b/contrib/zkt/examples/flat/dyn.example.net./Kdyn.example.net.+003+42138.key
@@ -0,0 +1,3 @@
+;% generationtime=20080609224426
+;% lifetime=60d
+dyn.example.net. IN DNSKEY 257 3 3 CNtFdVrUUJ9MPDyzGoPm+tSKUgnX4bble5+VNGd4RjwWpEDj8RhEAhQ7 LybJzr0wtHXT2Q/KS55xARkUtcH2TVO/ayMupa30pM38rd8uF38sm+AB KLEvCbPjaLZyW+s10di8nLp1aAxKFFfAEfXkIhl3Wm5g9CvjrMlrxAOf Ny/jtz4v+asIr6/d992V80G9wMKMvTMQoCr4Sp9s2JubW79i4RBVWgHH JMmtyqq+SqEkPhZvsTuo2sXgIH9vRS3XgfkGtw/KyTUM29bhZ2eB+Ldq +bggp1gbBDiSsxZPjxciizI/mCzXWbq8BdfZ6LsddMjAolJwCtaPCD4e 4infmw+YSxjGau+YGgI0Cc0uItzQmNNpSoejM3IWGV+SN/YuPJIzw8wi xDfO6kCNiPsW45Fvq31148cAvUvwiqYPQ3fONeOTdQjsJWLLdLTApVEH 10kjAGfa30Tm92lQhhG5ovWrWCMbFlw4Lbvlon+X2snWPNut0a1Pz4Wd clDcmNU8dxi1lFvGbcJ0E4qBoJVBIzDh4HX1
diff --git a/contrib/zkt/examples/flat/dyn.example.net./Kdyn.example.net.+003+42138.private b/contrib/zkt/examples/flat/dyn.example.net./Kdyn.example.net.+003+42138.private
new file mode 100644
index 0000000..4f7ec3d
--- /dev/null
+++ b/contrib/zkt/examples/flat/dyn.example.net./Kdyn.example.net.+003+42138.private
@@ -0,0 +1,7 @@
+Private-key-format: v1.2
+Algorithm: 3 (DSA)
+Prime(p): 4bble5+VNGd4RjwWpEDj8RhEAhQ7LybJzr0wtHXT2Q/KS55xARkUtcH2TVO/ayMupa30pM38rd8uF38sm+ABKLEvCbPjaLZyW+s10di8nLp1aAxKFFfAEfXkIhl3Wm5g9CvjrMlrxAOfNy/jtz4v+asIr6/d992V80G9wMKMvTM=
+Subprime(q): 20V1WtRQn0w8PLMag+b61IpSCdc=
+Base(g): EKAq+EqfbNibm1u/YuEQVVoBxyTJrcqqvkqhJD4Wb7E7qNrF4CB/b0Ut14H5BrcPysk1DNvW4Wdngfi3avm4IKdYGwQ4krMWT48XIosyP5gs11m6vAXX2ei7HXTIwKJScArWjwg+HuIp35sPmEsYxmrvmBoCNAnNLiLc0JjTaUo=
+Private_value(x): xY/GSk3U4oHIsvUiAs/9/n+6ttk=
+Public_value(y): h6MzchYZX5I39i48kjPDzCLEN87qQI2I+xbjkW+rfXXjxwC9S/CKpg9Dd84145N1COwlYst0tMClUQfXSSMAZ9rfROb3aVCGEbmi9atYIxsWXDgtu+Wif5faydY8263RrU/PhZ1yUNyY1Tx3GLWUW8ZtwnQTioGglUEjMOHgdfU=
diff --git a/contrib/zkt/examples/flat/dyn.example.net./Kdyn.example.net.+005+01355.key b/contrib/zkt/examples/flat/dyn.example.net./Kdyn.example.net.+005+01355.key
new file mode 100644
index 0000000..d129398
--- /dev/null
+++ b/contrib/zkt/examples/flat/dyn.example.net./Kdyn.example.net.+005+01355.key
@@ -0,0 +1,3 @@
+;% generationtime=20080609224426
+;% lifetime=14d
+dyn.example.net. IN DNSKEY 256 3 5 BQEAAAAB1hmOomNafbJ3H76e8V4qmFvlFWQuIkM+jbh+s79ZpErpCR7w BS5TswdoTeglX9UjP0D6hLmHfTcsdHQLLeMidQ==
diff --git a/contrib/zkt/examples/flat/dyn.example.net./Kdyn.example.net.+005+01355.private b/contrib/zkt/examples/flat/dyn.example.net./Kdyn.example.net.+005+01355.private
new file mode 100644
index 0000000..3692946
--- /dev/null
+++ b/contrib/zkt/examples/flat/dyn.example.net./Kdyn.example.net.+005+01355.private
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 5 (RSASHA1)
+Modulus: 1hmOomNafbJ3H76e8V4qmFvlFWQuIkM+jbh+s79ZpErpCR7wBS5TswdoTeglX9UjP0D6hLmHfTcsdHQLLeMidQ==
+PublicExponent: AQAAAAE=
+PrivateExponent: dAiTob6wk4h5l6frfh49NAzd3RBsVRxqqCsMao52fJvlK06wmOb9PkqOaEMTDroJEGgN6zD/sWcGPK7nYwDMHQ==
+Prime1: 731n5xPK9UQqQsQtattcC4MxtL6+OP1CyLy8e2tsd/8=
+Prime2: 5NwPUBy32o2zzpw4TDH3omB6yk0fmFItJx4ek3RaBYs=
+Exponent1: jzq6en2c8SwS5uQwY3/vFY549HMSTxP58kyS/GJ9hqE=
+Exponent2: y52KLCquniy3EwUypKRkPZPftjBoqZkXeQLXSk4b850=
+Coefficient: vHnxG4D4n+IKETXrutOFT+iREDDcfj6GpYubIP/goZc=
diff --git a/contrib/zkt/examples/flat/dyn.example.net./dnskey.db b/contrib/zkt/examples/flat/dyn.example.net./dnskey.db
new file mode 100644
index 0000000..e0f978e
--- /dev/null
+++ b/contrib/zkt/examples/flat/dyn.example.net./dnskey.db
@@ -0,0 +1,29 @@
+;
+; !!! Don't edit this file by hand.
+; !!! It will be generated by dnssec-signer.
+;
+; Last generation time Jun 12 2008 18:28:38
+;
+
+; *** List of Key Signing Keys ***
+; dyn.example.net. tag=42138 algo=DSA generated Jun 10 2008 00:44:26
+dyn.example.net. 14400 IN DNSKEY 257 3 3 (
+ CNtFdVrUUJ9MPDyzGoPm+tSKUgnX4bble5+VNGd4RjwWpEDj8RhEAhQ7
+ LybJzr0wtHXT2Q/KS55xARkUtcH2TVO/ayMupa30pM38rd8uF38sm+AB
+ KLEvCbPjaLZyW+s10di8nLp1aAxKFFfAEfXkIhl3Wm5g9CvjrMlrxAOf
+ Ny/jtz4v+asIr6/d992V80G9wMKMvTMQoCr4Sp9s2JubW79i4RBVWgHH
+ JMmtyqq+SqEkPhZvsTuo2sXgIH9vRS3XgfkGtw/KyTUM29bhZ2eB+Ldq
+ +bggp1gbBDiSsxZPjxciizI/mCzXWbq8BdfZ6LsddMjAolJwCtaPCD4e
+ 4infmw+YSxjGau+YGgI0Cc0uItzQmNNpSoejM3IWGV+SN/YuPJIzw8wi
+ xDfO6kCNiPsW45Fvq31148cAvUvwiqYPQ3fONeOTdQjsJWLLdLTApVEH
+ 10kjAGfa30Tm92lQhhG5ovWrWCMbFlw4Lbvlon+X2snWPNut0a1Pz4Wd
+ clDcmNU8dxi1lFvGbcJ0E4qBoJVBIzDh4HX1
+ ) ; key id = 42138
+
+; *** List of Zone Signing Keys ***
+; dyn.example.net. tag=1355 algo=RSASHA1 generated Jun 10 2008 00:44:26
+dyn.example.net. 14400 IN DNSKEY 256 3 5 (
+ BQEAAAAB1hmOomNafbJ3H76e8V4qmFvlFWQuIkM+jbh+s79ZpErpCR7w
+ BS5TswdoTeglX9UjP0D6hLmHfTcsdHQLLeMidQ==
+ ) ; key id = 1355
+
diff --git a/contrib/zkt/examples/flat/dyn.example.net./dnssec.conf b/contrib/zkt/examples/flat/dyn.example.net./dnssec.conf
new file mode 100644
index 0000000..0998fda
--- /dev/null
+++ b/contrib/zkt/examples/flat/dyn.example.net./dnssec.conf
@@ -0,0 +1,5 @@
+# signing key parameters
+KSK_lifetime: 60d # (5184000 seconds)
+KSK_algo: DSA
+KSK_bits: 1024
+KSK_randfile: "/dev/urandom"
diff --git a/contrib/zkt/examples/flat/dyn.example.net./dsset-dyn.example.net. b/contrib/zkt/examples/flat/dyn.example.net./dsset-dyn.example.net.
new file mode 100644
index 0000000..f94666a
--- /dev/null
+++ b/contrib/zkt/examples/flat/dyn.example.net./dsset-dyn.example.net.
@@ -0,0 +1,2 @@
+dyn.example.net. IN DS 42138 3 1 0F49FCDB683D1903F69B6779DB55CA3472974879
+dyn.example.net. IN DS 42138 3 2 94AC94BFE3AFA17F7485F5F741274074FF2E26A360D776D8884F2689 CCED34C6
diff --git a/contrib/zkt/examples/flat/dyn.example.net./keyset-dyn.example.net. b/contrib/zkt/examples/flat/dyn.example.net./keyset-dyn.example.net.
new file mode 100644
index 0000000..002217b
--- /dev/null
+++ b/contrib/zkt/examples/flat/dyn.example.net./keyset-dyn.example.net.
@@ -0,0 +1,18 @@
+$ORIGIN .
+dyn.example.net 7200 IN DNSKEY 257 3 3 (
+ CNtFdVrUUJ9MPDyzGoPm+tSKUgnX4bble5+V
+ NGd4RjwWpEDj8RhEAhQ7LybJzr0wtHXT2Q/K
+ S55xARkUtcH2TVO/ayMupa30pM38rd8uF38s
+ m+ABKLEvCbPjaLZyW+s10di8nLp1aAxKFFfA
+ EfXkIhl3Wm5g9CvjrMlrxAOfNy/jtz4v+asI
+ r6/d992V80G9wMKMvTMQoCr4Sp9s2JubW79i
+ 4RBVWgHHJMmtyqq+SqEkPhZvsTuo2sXgIH9v
+ RS3XgfkGtw/KyTUM29bhZ2eB+Ldq+bggp1gb
+ BDiSsxZPjxciizI/mCzXWbq8BdfZ6LsddMjA
+ olJwCtaPCD4e4infmw+YSxjGau+YGgI0Cc0u
+ ItzQmNNpSoejM3IWGV+SN/YuPJIzw8wixDfO
+ 6kCNiPsW45Fvq31148cAvUvwiqYPQ3fONeOT
+ dQjsJWLLdLTApVEH10kjAGfa30Tm92lQhhG5
+ ovWrWCMbFlw4Lbvlon+X2snWPNut0a1Pz4Wd
+ clDcmNU8dxi1lFvGbcJ0E4qBoJVBIzDh4HX1
+ ) ; key id = 42138
diff --git a/contrib/zkt/examples/flat/dyn.example.net./zone.db b/contrib/zkt/examples/flat/dyn.example.net./zone.db
new file mode 100644
index 0000000..ee557b8
--- /dev/null
+++ b/contrib/zkt/examples/flat/dyn.example.net./zone.db
@@ -0,0 +1,136 @@
+; File written on Thu Jun 12 18:28:34 2008
+; dnssec_signzone version 9.5.0
+dyn.example.net. 7200 IN SOA ns1.example.net. hostmaster.example.net. (
+ 7 ; serial
+ 43200 ; refresh (12 hours)
+ 1800 ; retry (30 minutes)
+ 1209600 ; expire (2 weeks)
+ 7200 ; minimum (2 hours)
+ )
+ 7200 RRSIG SOA 5 3 7200 20080622152834 (
+ 20080612152834 1355 dyn.example.net.
+ h8oKA1I7aC378Cll7LdhM2XZzrtsoxOdPaas
+ SMAd5Ok2zobl8i4nTpxUzmJE27U+yEeOJkf+
+ SXgsy934gAaYLw== )
+ 7200 NS ns1.example.net.
+ 7200 NS ns2.example.net.
+ 7200 RRSIG NS 5 3 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ xuEEg3kN7hAVIwdQ8l8lmeEzNhrtz5Ow1PQK
+ Sm3KTIxXI8RLcqZgc4pMlCWq+gWwxekvxJwz
+ lU0C+J4VPkA8pA== )
+ 7200 NSEC localhost.dyn.example.net. NS SOA RRSIG NSEC DNSKEY
+ 7200 RRSIG NSEC 5 3 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ XFDBfmcN874qUtNsGwD9Ir0QAzjYMw3BI40I
+ HFEOkTBJouhQ8RBpR6YqgWpkLqg1khvES5DH
+ +6XuqA8u/xPmbw== )
+ 3600 DNSKEY 256 3 5 (
+ BQEAAAAB1hmOomNafbJ3H76e8V4qmFvlFWQu
+ IkM+jbh+s79ZpErpCR7wBS5TswdoTeglX9Uj
+ P0D6hLmHfTcsdHQLLeMidQ==
+ ) ; key id = 1355
+ 3600 DNSKEY 257 3 3 (
+ CNtFdVrUUJ9MPDyzGoPm+tSKUgnX4bble5+V
+ NGd4RjwWpEDj8RhEAhQ7LybJzr0wtHXT2Q/K
+ S55xARkUtcH2TVO/ayMupa30pM38rd8uF38s
+ m+ABKLEvCbPjaLZyW+s10di8nLp1aAxKFFfA
+ EfXkIhl3Wm5g9CvjrMlrxAOfNy/jtz4v+asI
+ r6/d992V80G9wMKMvTMQoCr4Sp9s2JubW79i
+ 4RBVWgHHJMmtyqq+SqEkPhZvsTuo2sXgIH9v
+ RS3XgfkGtw/KyTUM29bhZ2eB+Ldq+bggp1gb
+ BDiSsxZPjxciizI/mCzXWbq8BdfZ6LsddMjA
+ olJwCtaPCD4e4infmw+YSxjGau+YGgI0Cc0u
+ ItzQmNNpSoejM3IWGV+SN/YuPJIzw8wixDfO
+ 6kCNiPsW45Fvq31148cAvUvwiqYPQ3fONeOT
+ dQjsJWLLdLTApVEH10kjAGfa30Tm92lQhhG5
+ ovWrWCMbFlw4Lbvlon+X2snWPNut0a1Pz4Wd
+ clDcmNU8dxi1lFvGbcJ0E4qBoJVBIzDh4HX1
+ ) ; key id = 42138
+ 3600 RRSIG DNSKEY 3 3 3600 20080615214426 (
+ 20080609214426 42138 dyn.example.net.
+ CIIuZ4cbwEWxoPGO6KDcLRO4Z3y0i2VhXy+5
+ 1X+nmHSkpcKJrUty/wY= )
+ 3600 RRSIG DNSKEY 5 3 3600 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ xGL6ZjA7v2RjPj7BnYjCvsgMRm/Z94j4c5K4
+ 7twJsUZ0AO/mURIpdbCigDfFJuK2fy/8X4Vi
+ 9K8P4EgCcj52Jw== )
+localhost.dyn.example.net. 7200 IN A 127.0.0.1
+ 7200 RRSIG A 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ s+RvcycC8aAYgRcR5qBdVXhpRxBMTFS5Q0Pk
+ FN7OAdfmJ/3nV7+ehu0eOZ2ZjO2Pm4ZFcSM1
+ Sm1ttNxSTe2M8A== )
+ 7200 NSEC ns1.dyn.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ ZhXlmS/WJPbIiXwLKzNFOxw7RU3owfTA8vEM
+ +/SDZO/7+aVSj5IgbsUs3qLAuFrMN8BFEAWt
+ AqArf+M3STbO9g== )
+ns1.dyn.example.net. 7200 IN A 1.0.0.5
+ 7200 RRSIG A 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ gPY1vUcxdWRJ1YbFMg/8rgoPZwta6rFrxQZl
+ KbyBNctNmlbXxeynP6j3qjwq9dydzbNt+sjO
+ TdWtXSZIlU2JKQ== )
+ 7200 AAAA 2001:db8::53
+ 7200 RRSIG AAAA 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ Y/PZmvaKPq4CqDvdG7eA2sxlnCPeNKHkZOB4
+ eDvK1x+q/WfTs3BDd3+g4zlG5nMC+NRSlXeO
+ Q4Pxd2rI9ud1hA== )
+ 7200 NSEC ns2.dyn.example.net. A AAAA RRSIG NSEC
+ 7200 RRSIG NSEC 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ pLgxecgjqGdhVmCcUl59FljWsnC4bjkslUdt
+ 0etzeGD1SNGUqhFcW10EgZE4Y9pXwvLvw68R
+ sj80tqtN0NHi/Q== )
+ns2.dyn.example.net. 7200 IN A 1.2.0.6
+ 7200 RRSIG A 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ pHtJzfj0HU/AkLE70xT0UG8M/Gvvsia61TnC
+ UrxR/61uQk1X4Vy2+oPA14Yb2QJ7ZHG5D1cn
+ LrVtjyQbfimbOA== )
+ 7200 NSEC x.dyn.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ vjPL9Mb6oUyg9y8m+BpVpTRpac9+WJxu8FHd
+ Xv4xk67NN+L+Zpukm0D8LSOrk4hZk0X5JkLD
+ Pz/gpH280yQJFA== )
+x.dyn.example.net. 7200 IN A 1.2.3.4
+ 7200 RRSIG A 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ tFyv0gmTKt8/IXdH9VA1H1ymBQ8EIviN2xbC
+ P8vzWZbay3Az2GPObYmaHKb1dm+Sq1dQUJsb
+ jn6fdB+T2Zs9Pw== )
+ 7200 NSEC y.dyn.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ bWhiuA+4V86k/bfw7XQ7qDHwxTwbTyN+2gu5
+ MeYQA/WeHdb+3QUOYr6aERRJlbD4q431d4f7
+ 0sIwBMHOsDjTSA== )
+y.dyn.example.net. 7200 IN A 1.2.3.5
+ 7200 RRSIG A 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ KQbZCcMcXWwGUyHyubt0VRhrpgiOel/0rQpF
+ 18PyCNIAUIdRra1+Tj12ZaCBT2x5fu+/rtki
+ qA5CzWo8HIPwmA== )
+ 7200 NSEC z.dyn.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ e/zPTQ1WxvSJymZ/QSyPYFRYpc8gScTbwfXY
+ mSyhQGyn1FjfLodAvyicNYbKF/oxR7IaXKLn
+ lO6C9gQ+Iu9wyw== )
+z.dyn.example.net. 7200 IN A 1.2.3.6
+ 7200 RRSIG A 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ hv9KA2BS+b97KSebN4h/nrP8cU4FUASHdsZj
+ E2GMTf1aV3gpUyPf8LizKhLbUo/LF0bO3CpJ
+ rWBT4VggwE8blQ== )
+ 7200 NSEC dyn.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ r8f5dzQcdnn8gvr0jiExt/n4IUCVKID9Nahx
+ XMDPLrA7ZH7omol+hKz6wlumYmjphlP2mHUU
+ TNZYnWKCkD3hAQ== )
diff --git a/contrib/zkt/examples/flat/dyn.example.net./zone.db.dsigned b/contrib/zkt/examples/flat/dyn.example.net./zone.db.dsigned
new file mode 100644
index 0000000..9e4c5c8
--- /dev/null
+++ b/contrib/zkt/examples/flat/dyn.example.net./zone.db.dsigned
@@ -0,0 +1,136 @@
+; File written on Thu Jun 12 18:28:39 2008
+; dnssec_signzone version 9.5.0
+dyn.example.net. 7200 IN SOA ns1.example.net. hostmaster.example.net. (
+ 8 ; serial
+ 43200 ; refresh (12 hours)
+ 1800 ; retry (30 minutes)
+ 1209600 ; expire (2 weeks)
+ 7200 ; minimum (2 hours)
+ )
+ 7200 RRSIG SOA 5 3 7200 20080622152838 (
+ 20080612152838 1355 dyn.example.net.
+ GXyAKsmJ3D+pFic86kQxw+ASoAeGwuGj2rY+
+ fby0HR5ud3i/Iq857ZlluDbQbg1EKZuar0l5
+ e7HwrB59bxKAuw== )
+ 7200 NS ns1.example.net.
+ 7200 NS ns2.example.net.
+ 7200 RRSIG NS 5 3 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ xuEEg3kN7hAVIwdQ8l8lmeEzNhrtz5Ow1PQK
+ Sm3KTIxXI8RLcqZgc4pMlCWq+gWwxekvxJwz
+ lU0C+J4VPkA8pA== )
+ 7200 NSEC localhost.dyn.example.net. NS SOA RRSIG NSEC DNSKEY
+ 7200 RRSIG NSEC 5 3 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ XFDBfmcN874qUtNsGwD9Ir0QAzjYMw3BI40I
+ HFEOkTBJouhQ8RBpR6YqgWpkLqg1khvES5DH
+ +6XuqA8u/xPmbw== )
+ 3600 DNSKEY 256 3 5 (
+ BQEAAAAB1hmOomNafbJ3H76e8V4qmFvlFWQu
+ IkM+jbh+s79ZpErpCR7wBS5TswdoTeglX9Uj
+ P0D6hLmHfTcsdHQLLeMidQ==
+ ) ; key id = 1355
+ 3600 DNSKEY 257 3 3 (
+ CNtFdVrUUJ9MPDyzGoPm+tSKUgnX4bble5+V
+ NGd4RjwWpEDj8RhEAhQ7LybJzr0wtHXT2Q/K
+ S55xARkUtcH2TVO/ayMupa30pM38rd8uF38s
+ m+ABKLEvCbPjaLZyW+s10di8nLp1aAxKFFfA
+ EfXkIhl3Wm5g9CvjrMlrxAOfNy/jtz4v+asI
+ r6/d992V80G9wMKMvTMQoCr4Sp9s2JubW79i
+ 4RBVWgHHJMmtyqq+SqEkPhZvsTuo2sXgIH9v
+ RS3XgfkGtw/KyTUM29bhZ2eB+Ldq+bggp1gb
+ BDiSsxZPjxciizI/mCzXWbq8BdfZ6LsddMjA
+ olJwCtaPCD4e4infmw+YSxjGau+YGgI0Cc0u
+ ItzQmNNpSoejM3IWGV+SN/YuPJIzw8wixDfO
+ 6kCNiPsW45Fvq31148cAvUvwiqYPQ3fONeOT
+ dQjsJWLLdLTApVEH10kjAGfa30Tm92lQhhG5
+ ovWrWCMbFlw4Lbvlon+X2snWPNut0a1Pz4Wd
+ clDcmNU8dxi1lFvGbcJ0E4qBoJVBIzDh4HX1
+ ) ; key id = 42138
+ 3600 RRSIG DNSKEY 3 3 3600 20080615214426 (
+ 20080609214426 42138 dyn.example.net.
+ CIIuZ4cbwEWxoPGO6KDcLRO4Z3y0i2VhXy+5
+ 1X+nmHSkpcKJrUty/wY= )
+ 3600 RRSIG DNSKEY 5 3 3600 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ xGL6ZjA7v2RjPj7BnYjCvsgMRm/Z94j4c5K4
+ 7twJsUZ0AO/mURIpdbCigDfFJuK2fy/8X4Vi
+ 9K8P4EgCcj52Jw== )
+localhost.dyn.example.net. 7200 IN A 127.0.0.1
+ 7200 RRSIG A 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ s+RvcycC8aAYgRcR5qBdVXhpRxBMTFS5Q0Pk
+ FN7OAdfmJ/3nV7+ehu0eOZ2ZjO2Pm4ZFcSM1
+ Sm1ttNxSTe2M8A== )
+ 7200 NSEC ns1.dyn.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ ZhXlmS/WJPbIiXwLKzNFOxw7RU3owfTA8vEM
+ +/SDZO/7+aVSj5IgbsUs3qLAuFrMN8BFEAWt
+ AqArf+M3STbO9g== )
+ns1.dyn.example.net. 7200 IN A 1.0.0.5
+ 7200 RRSIG A 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ gPY1vUcxdWRJ1YbFMg/8rgoPZwta6rFrxQZl
+ KbyBNctNmlbXxeynP6j3qjwq9dydzbNt+sjO
+ TdWtXSZIlU2JKQ== )
+ 7200 AAAA 2001:db8::53
+ 7200 RRSIG AAAA 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ Y/PZmvaKPq4CqDvdG7eA2sxlnCPeNKHkZOB4
+ eDvK1x+q/WfTs3BDd3+g4zlG5nMC+NRSlXeO
+ Q4Pxd2rI9ud1hA== )
+ 7200 NSEC ns2.dyn.example.net. A AAAA RRSIG NSEC
+ 7200 RRSIG NSEC 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ pLgxecgjqGdhVmCcUl59FljWsnC4bjkslUdt
+ 0etzeGD1SNGUqhFcW10EgZE4Y9pXwvLvw68R
+ sj80tqtN0NHi/Q== )
+ns2.dyn.example.net. 7200 IN A 1.2.0.6
+ 7200 RRSIG A 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ pHtJzfj0HU/AkLE70xT0UG8M/Gvvsia61TnC
+ UrxR/61uQk1X4Vy2+oPA14Yb2QJ7ZHG5D1cn
+ LrVtjyQbfimbOA== )
+ 7200 NSEC x.dyn.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ vjPL9Mb6oUyg9y8m+BpVpTRpac9+WJxu8FHd
+ Xv4xk67NN+L+Zpukm0D8LSOrk4hZk0X5JkLD
+ Pz/gpH280yQJFA== )
+x.dyn.example.net. 7200 IN A 1.2.3.4
+ 7200 RRSIG A 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ tFyv0gmTKt8/IXdH9VA1H1ymBQ8EIviN2xbC
+ P8vzWZbay3Az2GPObYmaHKb1dm+Sq1dQUJsb
+ jn6fdB+T2Zs9Pw== )
+ 7200 NSEC y.dyn.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ bWhiuA+4V86k/bfw7XQ7qDHwxTwbTyN+2gu5
+ MeYQA/WeHdb+3QUOYr6aERRJlbD4q431d4f7
+ 0sIwBMHOsDjTSA== )
+y.dyn.example.net. 7200 IN A 1.2.3.5
+ 7200 RRSIG A 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ KQbZCcMcXWwGUyHyubt0VRhrpgiOel/0rQpF
+ 18PyCNIAUIdRra1+Tj12ZaCBT2x5fu+/rtki
+ qA5CzWo8HIPwmA== )
+ 7200 NSEC z.dyn.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ e/zPTQ1WxvSJymZ/QSyPYFRYpc8gScTbwfXY
+ mSyhQGyn1FjfLodAvyicNYbKF/oxR7IaXKLn
+ lO6C9gQ+Iu9wyw== )
+z.dyn.example.net. 7200 IN A 1.2.3.6
+ 7200 RRSIG A 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ hv9KA2BS+b97KSebN4h/nrP8cU4FUASHdsZj
+ E2GMTf1aV3gpUyPf8LizKhLbUo/LF0bO3CpJ
+ rWBT4VggwE8blQ== )
+ 7200 NSEC dyn.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 4 7200 20080615214426 (
+ 20080609214426 1355 dyn.example.net.
+ r8f5dzQcdnn8gvr0jiExt/n4IUCVKID9Nahx
+ XMDPLrA7ZH7omol+hKz6wlumYmjphlP2mHUU
+ TNZYnWKCkD3hAQ== )
diff --git a/contrib/zkt/examples/flat/dyn.example.net./zone.org b/contrib/zkt/examples/flat/dyn.example.net./zone.org
new file mode 100644
index 0000000..c536fc8
--- /dev/null
+++ b/contrib/zkt/examples/flat/dyn.example.net./zone.org
@@ -0,0 +1,30 @@
+;-----------------------------------------------------------------
+;
+; @(#) dyn.example.net/zone.org
+;
+;-----------------------------------------------------------------
+
+$TTL 7200
+
+@ IN SOA ns1.example.net. hostmaster.example.net. (
+ 1 ; Serial
+ 43200 ; Refresh
+ 1800 ; Retry
+ 2W ; Expire
+ 7200 ) ; Minimum
+
+ IN NS ns1.example.net.
+ IN NS ns2.example.net.
+
+ns1 IN A 1.0.0.5
+ IN AAAA 2001:db8::53
+ns2 IN A 1.2.0.6
+
+localhost IN A 127.0.0.1
+
+x IN A 1.2.3.4
+y IN A 1.2.3.5
+z IN A 1.2.3.6
+
+$INCLUDE dnskey.db
+
diff --git a/contrib/zkt/examples/flat/example.net./Kexample.net.+005+01764.key b/contrib/zkt/examples/flat/example.net./Kexample.net.+005+01764.key
new file mode 100644
index 0000000..bd273d3
--- /dev/null
+++ b/contrib/zkt/examples/flat/example.net./Kexample.net.+005+01764.key
@@ -0,0 +1,3 @@
+;% generationtime=20080506212634
+;% lifetime=60d
+example.net. IN DNSKEY 257 3 5 BQEAAAABDUi2uSUlDjESbnrnY5wd8+pXxhYVY4wCi2UVjhcehvIb2bF8 VJH2Q9/0ubQR1vQ2VJhsGUj3A7bdTfbMETPxKkZaDpc9lCYrm0z5HDrs lyx4bSb4JX/iCyhgYZXrTVb9WyLXjUtmDUktDjZgsyVshFHVJShBUSj+ YpnfQkndGViDAbJRycXDYEF1hCNmTK3KsR1JS9dXMKI3WidH+B9rLlBU 8w==
diff --git a/contrib/zkt/examples/flat/example.net./Kexample.net.+005+01764.published b/contrib/zkt/examples/flat/example.net./Kexample.net.+005+01764.published
new file mode 100644
index 0000000..42b8b80
--- /dev/null
+++ b/contrib/zkt/examples/flat/example.net./Kexample.net.+005+01764.published
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 5 (RSASHA1)
+Modulus: DUi2uSUlDjESbnrnY5wd8+pXxhYVY4wCi2UVjhcehvIb2bF8VJH2Q9/0ubQR1vQ2VJhsGUj3A7bdTfbMETPxKkZaDpc9lCYrm0z5HDrslyx4bSb4JX/iCyhgYZXrTVb9WyLXjUtmDUktDjZgsyVshFHVJShBUSj+YpnfQkndGViDAbJRycXDYEF1hCNmTK3KsR1JS9dXMKI3WidH+B9rLlBU8w==
+PublicExponent: AQAAAAE=
+PrivateExponent: AzPR74ljfqsl7qB92XeCowR3igYQrN59a2Z8VGB1PegjagkBltDzudzYyDKpvqdigjeFLL54f1MN5JCPo4J2Q6Ij49LAQ5GsXiEd/FWlwR+UztOcW/uZ3W6DNIwuMbSY7ruZmpv/zVPpyeY1PVXgCsJlX2Zj/Wt8QHASHp5rUugGQSPQfVSQ/mBdDXMZw2tEb3b10quziCmKuHegopRYeuNXwQ==
+Prime1: A+5jXfxmP0Mfnjr4m8BPrPkDyokgFXZB3dXibxeZqp4ypcwpXeO0xTf1FjSZeIOi2RJOzpym914IYa3wPx4zbxmsGeozr1hTIWE+6Xuz0qjE0w==
+Prime2: A2EOffOaSvEoTUf/0dF8Z9/dYxIrE9HBbXRjgrlPc+WoG57lCkjxe/KO5Eclg9o5nrTFcsxpsjrdxOAcIcyTIHsXW8YgxDAb1mFJ0V6tBsabYQ==
+Exponent1: vmRAN3zHGTV28Oj4gslB/xA58sDyieCkDrpGaGChsPo7yUPOEeZQ8ep/FDnQoZLhLCn6XkKcN4D99Yo3JxVECBJOHZp8HrFsfF9BzpXk2yH9
+Exponent2: Aj8x3YdZJ0/KzwX2m6G2qZ5WktmkDITa+XHxvSashqlBm2niBCRFN5kNQNhkIO5ZAFWKEPuHSB5BZWTzgj8jeB8mRoYtbPlJom4KbNtCiZ6BYQ==
+Coefficient: A87WfUPUBfYDuSAu6kcHLAyr0OnqoXnMeXSgyq28CJXdh3Vg39Al8me07wWeRDjMzfpZGdKEhxyvVIS8WhY3du0FYoGI5YhJMqaYq3XjwLfpsQ==
diff --git a/contrib/zkt/examples/flat/example.net./Kexample.net.+005+41151.key b/contrib/zkt/examples/flat/example.net./Kexample.net.+005+41151.key
new file mode 100644
index 0000000..d72baa9
--- /dev/null
+++ b/contrib/zkt/examples/flat/example.net./Kexample.net.+005+41151.key
@@ -0,0 +1,3 @@
+;% generationtime=20080420205422
+;% lifetime=60d
+example.net. IN DNSKEY 257 3 5 BQEAAAABDAnSCbSyScZdP2M6OQTbTGvZRD5avmDYgAwXv0EsnNautYn7 kzDGwY3oVTXWDTdII+syK0pt0unjUn2ActoXtyFzIk61VRKDroANM9/W O0PO/y50vNIGMJUL1TiMR6jCp23eSxQ39/1A+BeiU+fMjoJK0/Yc7hbM HWwD8myU0IEX8R2iVUTXNPNbmUV2M836Eu5SRLIVTc7P4vjKT1YYVnoQ qw==
diff --git a/contrib/zkt/examples/flat/example.net./Kexample.net.+005+41151.private b/contrib/zkt/examples/flat/example.net./Kexample.net.+005+41151.private
new file mode 100644
index 0000000..554cd12
--- /dev/null
+++ b/contrib/zkt/examples/flat/example.net./Kexample.net.+005+41151.private
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 5 (RSASHA1)
+Modulus: DAnSCbSyScZdP2M6OQTbTGvZRD5avmDYgAwXv0EsnNautYn7kzDGwY3oVTXWDTdII+syK0pt0unjUn2ActoXtyFzIk61VRKDroANM9/WO0PO/y50vNIGMJUL1TiMR6jCp23eSxQ39/1A+BeiU+fMjoJK0/Yc7hbMHWwD8myU0IEX8R2iVUTXNPNbmUV2M836Eu5SRLIVTc7P4vjKT1YYVnoQqw==
+PublicExponent: AQAAAAE=
+PrivateExponent: CJPcx+j7bWxMzKCl395v2PxQRYc/YurHU25oJL9i+B/bkxC8sRzSrTe4rRW61vhtAE3R6+CGz1336igirbEWKjHbPyBg42QHu2OCHWcKv4jq8k9yvtYGb9rKVvSUj4HAfZolr130loWW+CNp5soQQcJG0qxP+YkdI/Z+GDQ9kDbn80+r3wtCtVzjhoq0RoUSH3UnKUbs+DvacQmvepMLcM3PgQ==
+Prime1: A413lN4gpI+7Imn2Krm4CGyRCBoNwFa2PSr1ZQN195W5enKVZAkKg+49G7hoduMgjW2RAzwoJp0/4cGPx5nugSv93QT/mTMhYupL9KdGKcYUIQ==
+Prime2: A2N7TbYY1Q67CsoqHPvogKEP0XtlN421eF+88Yu/YnAZ3Ikd1nMad7rO1bVWptabsNuw0JFkpOmrS3u/GvaWmKCNGBlGjF/XlKr8Bh63V/zLSw==
+Exponent1: Aa0C6ssN8NTZIKsoGJEJLVbb9uB48nXtaMq2FxFARogrnmY0Gi/n8AWFc+ulPvAzJhhrjWF3VW38GcuPe3Ss8l3fpAbAexEnrJHOXxKLlOgmwQ==
+Exponent2: j78LKeDXSgTL5WmsffdJHSRe32GfaX6SgTF0BKzKVRuNIiOf7vHjzkDn4gdcTsMLTSNVp/Zj4vkWMkfJNq+AqosHpBFvhmd+boUG4Xde4jSp
+Coefficient: A1RWhKCgowdNAWs9OF3Q5CBBzC2Fq6O0CspJJD3cmNTEQVbxEbzSWyW7S1NsBgp+6de/HQ72IFtEAL9ChSy6pXWx27PGK6wE89rGbfaJ9Y2gzQ==
diff --git a/contrib/zkt/examples/flat/example.net./Kexample.net.+005+41300.key b/contrib/zkt/examples/flat/example.net./Kexample.net.+005+41300.key
new file mode 100644
index 0000000..235a5df
--- /dev/null
+++ b/contrib/zkt/examples/flat/example.net./Kexample.net.+005+41300.key
@@ -0,0 +1,3 @@
+;% generationtime=20080721221039
+;% lifetime=14d
+example.net. IN DNSKEY 256 3 5 BQEAAAABz+XkYpKYKuMPi7jA8Y/qfzDuGKdGVadO1kBAK6UnrK+WbxP3 LjoOtWm13QuS8fHsuZipXs2ouT2S9dhdEArKfw==
diff --git a/contrib/zkt/examples/flat/example.net./Kexample.net.+005+41300.private b/contrib/zkt/examples/flat/example.net./Kexample.net.+005+41300.private
new file mode 100644
index 0000000..b5041c0
--- /dev/null
+++ b/contrib/zkt/examples/flat/example.net./Kexample.net.+005+41300.private
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 5 (RSASHA1)
+Modulus: z+XkYpKYKuMPi7jA8Y/qfzDuGKdGVadO1kBAK6UnrK+WbxP3LjoOtWm13QuS8fHsuZipXs2ouT2S9dhdEArKfw==
+PublicExponent: AQAAAAE=
+PrivateExponent: MF8+pDySZKCy1bZvgH9me1xf6cMd7V7FYgIWqRTSGuGpRWdtnIoltaBWjj2UlCshJYiwT0Y5g3obAsorqBC3wQ==
+Prime1: 6M83fhmfDJmatbG+texk1m/E7Aj8yOTLommXQYC/18M=
+Prime2: 5JtrNfEt434OYY/aIFo+LpKQ4YHmni1IODDoP9sHkpU=
+Exponent1: nCZRKBmE9YucwPIw6E1yLiAJ87fqm9IGNLez0kmtV+0=
+Exponent2: 4rEtpIoEBRymA2/iJbg+UmyCd1MKp5Mx4WhFTv1KOS0=
+Coefficient: v0eWAC3cl0XllkeNGaq5thp02OnHsxVU8Xwtss3dCMw=
diff --git a/contrib/zkt/examples/flat/example.net./dnskey.db b/contrib/zkt/examples/flat/example.net./dnskey.db
new file mode 100644
index 0000000..6bd2ba0
--- /dev/null
+++ b/contrib/zkt/examples/flat/example.net./dnskey.db
@@ -0,0 +1,33 @@
+;
+; !!! Don't edit this file by hand.
+; !!! It will be generated by dnssec-signer.
+;
+; Last generation time Jul 31 2008 00:25:53
+;
+
+; *** List of Key Signing Keys ***
+; example.net. tag=1764 algo=RSASHA1 generated Jun 19 2008 00:32:22
+example.net. 3600 IN DNSKEY 257 3 5 (
+ BQEAAAABDUi2uSUlDjESbnrnY5wd8+pXxhYVY4wCi2UVjhcehvIb2bF8
+ VJH2Q9/0ubQR1vQ2VJhsGUj3A7bdTfbMETPxKkZaDpc9lCYrm0z5HDrs
+ lyx4bSb4JX/iCyhgYZXrTVb9WyLXjUtmDUktDjZgsyVshFHVJShBUSj+
+ YpnfQkndGViDAbJRycXDYEF1hCNmTK3KsR1JS9dXMKI3WidH+B9rLlBU
+ 8w==
+ ) ; key id = 1764
+
+; example.net. tag=41151 algo=RSASHA1 generated Jun 19 2008 00:32:22
+example.net. 3600 IN DNSKEY 257 3 5 (
+ BQEAAAABDAnSCbSyScZdP2M6OQTbTGvZRD5avmDYgAwXv0EsnNautYn7
+ kzDGwY3oVTXWDTdII+syK0pt0unjUn2ActoXtyFzIk61VRKDroANM9/W
+ O0PO/y50vNIGMJUL1TiMR6jCp23eSxQ39/1A+BeiU+fMjoJK0/Yc7hbM
+ HWwD8myU0IEX8R2iVUTXNPNbmUV2M836Eu5SRLIVTc7P4vjKT1YYVnoQ
+ qw==
+ ) ; key id = 41151
+
+; *** List of Zone Signing Keys ***
+; example.net. tag=41300 algo=RSASHA1 generated Jul 24 2008 00:13:57
+example.net. 3600 IN DNSKEY 256 3 5 (
+ BQEAAAABz+XkYpKYKuMPi7jA8Y/qfzDuGKdGVadO1kBAK6UnrK+WbxP3
+ LjoOtWm13QuS8fHsuZipXs2ouT2S9dhdEArKfw==
+ ) ; key id = 41300
+
diff --git a/contrib/zkt/examples/flat/example.net./dsset-example.net. b/contrib/zkt/examples/flat/example.net./dsset-example.net.
new file mode 100644
index 0000000..d4a01ed
--- /dev/null
+++ b/contrib/zkt/examples/flat/example.net./dsset-example.net.
@@ -0,0 +1,4 @@
+example.net. IN DS 1764 5 1 A6F060DDE8DE45CA7FD1C21E2F39C477F214795F
+example.net. IN DS 1764 5 2 B7109245C60ACEDD1630E145477FDF574D5BD9CABE530AAC6D7192DB 7FBFAA3F
+example.net. IN DS 41151 5 1 BBB692EA07571E412F9385A618C1CAD9BFC1469A
+example.net. IN DS 41151 5 2 4D22B44C3DC09BD9EEADFFB917EFCE8E45F22E89FF0C096CD14F4405 CA1CAE3F
diff --git a/contrib/zkt/examples/flat/example.net./kexample.net.+005+14829.key b/contrib/zkt/examples/flat/example.net./kexample.net.+005+14829.key
new file mode 100644
index 0000000..fdf427b
--- /dev/null
+++ b/contrib/zkt/examples/flat/example.net./kexample.net.+005+14829.key
@@ -0,0 +1,4 @@
+;% generationtime=20080415164557
+;% lifetime=20d
+;% expirationtime=20080506212633
+example.net. IN DNSKEY 385 3 5 BQEAAAABCrDt76ODmeteohszxggclH3vAXO/NXOnXjOzIivP5LaUL4/U uAtafg5JXypl/nCUVap9FG0K1ebCCBCMJaPCoi7pIgD5EgFzHPnxZo2w GvtmWYwK3MaBP4U8YzwpVbGpJIBAW+IZyM89LD6b2cvkJL5YEviPNfMp rMTLo7BOMVjMBpG2IuULOHq7dzyIe/ym/RXKuuYc5AVtHCBBfGKU/Wzn 0Q==
diff --git a/contrib/zkt/examples/flat/example.net./kexample.net.+005+14829.private b/contrib/zkt/examples/flat/example.net./kexample.net.+005+14829.private
new file mode 100644
index 0000000..1018561
--- /dev/null
+++ b/contrib/zkt/examples/flat/example.net./kexample.net.+005+14829.private
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 5 (RSASHA1)
+Modulus: CrDt76ODmeteohszxggclH3vAXO/NXOnXjOzIivP5LaUL4/UuAtafg5JXypl/nCUVap9FG0K1ebCCBCMJaPCoi7pIgD5EgFzHPnxZo2wGvtmWYwK3MaBP4U8YzwpVbGpJIBAW+IZyM89LD6b2cvkJL5YEviPNfMprMTLo7BOMVjMBpG2IuULOHq7dzyIe/ym/RXKuuYc5AVtHCBBfGKU/Wzn0Q==
+PublicExponent: AQAAAAE=
+PrivateExponent: CWC6hC61oQC954Dcu2Z0NNmLk6Wnr33yh7VCuT7kh5fSOgA6Fm0qQgH+nvW2sv9fpy8JB4WBaa/CnysKkLwjDBFcWkrMw7wDR0KAiixe8bjXCZUy95x2t3B/o23jQtS/ejJgaSSOJFioRcPoT5sv9mm6QCe3ir3g9+3n4COrzf0DY1oGfDLzuhrYDT/AM5MuEjSamlblTPHHsKlI3UCl+AHDLQ==
+Prime1: A3ZcDeyxt/SDgmgg4Yk7v66MbFU4GWreYp4/MYhEDsE4jA0cqEY28cAoN8FyPCB1H1t10IVqOs7/LSKrWdXMUKUv57DPMHJp539Wx2HYLmVIfw==
+Prime2: AxZ8J01/Sbij24nloiVsDJdjFTAVApr4S6n/QRdBkWumQTLexnQ1ErcTEVc3Fn0po04ZToIO5JNINrWNdAuNiaHYLuiD4pkkHuSAmTajbVsnrw==
+Exponent1: Iw7WPWd3zZeJ/b3zQcQtSosUXUWFy430aEsQWimMnibFm+qOVpsjhRkTHW/yZp227Y4sVb/ZhzCZWFGr6qWe0sdHIv5Yx6SkvIxv4rUiHdOL
+Exponent2: AhiPWhKq+Iyy/HRZuWpIAalUZ7yE7FeHWFQYQLocatTCnY91VsgNxRLXRwcci6mflhIVoLBDHJal7x4SCRq0Xbze5PeMlMUhsDQdCT+QYTgCRw==
+Coefficient: Auw2b1lPzp3gWxpnDNZWeuiwGcWTd9fNfN/4kBrCbulFngYTNVBpqathFqdwtojYXHfM2HZDKHqmZVZgON+FfxvauGvTDWO6MTBxUleeBlLmcg==
diff --git a/contrib/zkt/examples/flat/example.net./keyset-example.net. b/contrib/zkt/examples/flat/example.net./keyset-example.net.
new file mode 100644
index 0000000..c832578
--- /dev/null
+++ b/contrib/zkt/examples/flat/example.net./keyset-example.net.
@@ -0,0 +1,19 @@
+$ORIGIN .
+example.net 7200 IN DNSKEY 257 3 5 (
+ BQEAAAABDAnSCbSyScZdP2M6OQTbTGvZRD5a
+ vmDYgAwXv0EsnNautYn7kzDGwY3oVTXWDTdI
+ I+syK0pt0unjUn2ActoXtyFzIk61VRKDroAN
+ M9/WO0PO/y50vNIGMJUL1TiMR6jCp23eSxQ3
+ 9/1A+BeiU+fMjoJK0/Yc7hbMHWwD8myU0IEX
+ 8R2iVUTXNPNbmUV2M836Eu5SRLIVTc7P4vjK
+ T1YYVnoQqw==
+ ) ; key id = 41151
+ 7200 IN DNSKEY 257 3 5 (
+ BQEAAAABDUi2uSUlDjESbnrnY5wd8+pXxhYV
+ Y4wCi2UVjhcehvIb2bF8VJH2Q9/0ubQR1vQ2
+ VJhsGUj3A7bdTfbMETPxKkZaDpc9lCYrm0z5
+ HDrslyx4bSb4JX/iCyhgYZXrTVb9WyLXjUtm
+ DUktDjZgsyVshFHVJShBUSj+YpnfQkndGViD
+ AbJRycXDYEF1hCNmTK3KsR1JS9dXMKI3WidH
+ +B9rLlBU8w==
+ ) ; key id = 1764
diff --git a/contrib/zkt/examples/flat/example.net./zone.db b/contrib/zkt/examples/flat/example.net./zone.db
new file mode 100644
index 0000000..42ad067
--- /dev/null
+++ b/contrib/zkt/examples/flat/example.net./zone.db
@@ -0,0 +1,43 @@
+;-----------------------------------------------------------------
+;
+; @(#) example.net/zone.db
+;
+;-----------------------------------------------------------------
+
+$TTL 7200
+
+; Be sure that the serial number below is left
+; justified in a field of at least 10 chars!!
+; 0123456789;
+; It's also possible to use the date form e.g. 2005040101
+@ IN SOA ns1.example.net. hostmaster.example.net. (
+ 306 ; Serial
+ 43200 ; Refresh
+ 1800 ; Retry
+ 2W ; Expire
+ 7200 ) ; Minimum
+
+ IN NS ns1.example.net.
+ IN NS ns2.example.net.
+
+ns1 IN A 1.0.0.5
+ IN AAAA 2001:db8::53
+ns2 IN A 1.2.0.6
+
+localhost IN A 127.0.0.1
+
+a IN A 1.2.3.1
+b IN MX 10 a
+;c IN A 1.2.3.2
+d IN A 1.2.3.3
+ IN AAAA 2001:0db8::3
+
+; Delegation to secure zone; The DS resource record will
+; be added by dnssec-signzone automatically if the
+; keyset-sub.example.net file is present (run dnssec-signzone
+; with option -g or use the dnssec-signer tool) ;-)
+sub IN NS ns1.example.net.
+
+; this file will have all the zone keys
+$INCLUDE dnskey.db
+
diff --git a/contrib/zkt/examples/flat/example.net./zone.db.signed b/contrib/zkt/examples/flat/example.net./zone.db.signed
new file mode 100644
index 0000000..b10d122
--- /dev/null
+++ b/contrib/zkt/examples/flat/example.net./zone.db.signed
@@ -0,0 +1,166 @@
+; File written on Thu Jul 31 00:25:53 2008
+; dnssec_signzone version 9.5.1b1
+example.net. 7200 IN SOA ns1.example.net. hostmaster.example.net. (
+ 306 ; serial
+ 43200 ; refresh (12 hours)
+ 1800 ; retry (30 minutes)
+ 1209600 ; expire (2 weeks)
+ 7200 ; minimum (2 hours)
+ )
+ 7200 RRSIG SOA 5 2 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ eRpET793mGv1lKjHoaL/woHNxqFx8mFg1LlT
+ x3ISMuUH7BJCHI4urjNMIJCOKwTeDsstlmvt
+ llflqikDp8uLmQ== )
+ 7200 NS ns1.example.net.
+ 7200 NS ns2.example.net.
+ 7200 RRSIG NS 5 2 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ t7lt/MCYy2plJXQXeZFapUjzkhtYi0NIa4/i
+ sJInZYv78nT2981zrlYCX5UKswGy6VAchtgu
+ WDdVL5V3nirNiA== )
+ 7200 NSEC a.example.net. NS SOA RRSIG NSEC DNSKEY
+ 7200 RRSIG NSEC 5 2 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ TNq3FKjB7brjHQDD1vReNNddof1UmsAOdioU
+ vL1alQJa1zXVpL9Yl2NUbtuV3kKVpxxLAZM4
+ 8fjJ1uPzW3KVJQ== )
+ 3600 DNSKEY 256 3 5 (
+ BQEAAAABz+XkYpKYKuMPi7jA8Y/qfzDuGKdG
+ VadO1kBAK6UnrK+WbxP3LjoOtWm13QuS8fHs
+ uZipXs2ouT2S9dhdEArKfw==
+ ) ; key id = 41300
+ 3600 DNSKEY 257 3 5 (
+ BQEAAAABDAnSCbSyScZdP2M6OQTbTGvZRD5a
+ vmDYgAwXv0EsnNautYn7kzDGwY3oVTXWDTdI
+ I+syK0pt0unjUn2ActoXtyFzIk61VRKDroAN
+ M9/WO0PO/y50vNIGMJUL1TiMR6jCp23eSxQ3
+ 9/1A+BeiU+fMjoJK0/Yc7hbMHWwD8myU0IEX
+ 8R2iVUTXNPNbmUV2M836Eu5SRLIVTc7P4vjK
+ T1YYVnoQqw==
+ ) ; key id = 41151
+ 3600 DNSKEY 257 3 5 (
+ BQEAAAABDUi2uSUlDjESbnrnY5wd8+pXxhYV
+ Y4wCi2UVjhcehvIb2bF8VJH2Q9/0ubQR1vQ2
+ VJhsGUj3A7bdTfbMETPxKkZaDpc9lCYrm0z5
+ HDrslyx4bSb4JX/iCyhgYZXrTVb9WyLXjUtm
+ DUktDjZgsyVshFHVJShBUSj+YpnfQkndGViD
+ AbJRycXDYEF1hCNmTK3KsR1JS9dXMKI3WidH
+ +B9rLlBU8w==
+ ) ; key id = 1764
+ 3600 RRSIG DNSKEY 5 2 3600 20080805212553 (
+ 20080730212553 41151 example.net.
+ AoLzL97D0rw8R5leKTNH7XuKyLPUdmX2nmfb
+ Q9RV9mV1mcM7cV37C8nNp1xNqY91frjCiUtd
+ PjFa95U2B1ZVU6j2CgWzPLRidRTU/aKJy2MZ
+ dwkAx4P6MGXemCwi5xGY1JLP3WTtdW1ERBjE
+ tgOT8mOOA8pDk+1S2zUAGbT4WGLx09hf16n+
+ b9YR+mNVyEyJ8qJGvWm6U8niyhHOZWFj6QkL
+ Tw== )
+ 3600 RRSIG DNSKEY 5 2 3600 20080805212553 (
+ 20080730212553 41300 example.net.
+ up151hyvd84qGvWxziVwgzuLHvZ9os27gqSU
+ hMeplk+Q2coXShZ219zSQKfZHRYRQF0Hujwi
+ FSHnJW5dlBhMow== )
+a.example.net. 7200 IN A 1.2.3.1
+ 7200 RRSIG A 5 3 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ EOJulnvULgDyx+WXIPkkoAcBot3lKKIHplAM
+ aa2K3QIXak75/IxCh+K/yUpqgsbeU0wHJakd
+ vo0cFjkPvCCrHA== )
+ 7200 NSEC b.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ Vb+ZkjqQ+TzXmhsVEE1490F6O3Mww5z0GiO/
+ 1CtMb+qfUNS0RavmHVnm5rBYs3WyQmG04vQr
+ 2MS4wJguPpznEg== )
+b.example.net. 7200 IN MX 10 a.example.net.
+ 7200 RRSIG MX 5 3 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ RG6GDR1HAKQeG6TaWbIlp97FYZSp8Xf7ySxi
+ Q+OJaPw209RmlNFySWt/HQ6XiwPQ3OJUU9KJ
+ V1VbEaZnFVXu2Q== )
+ 7200 NSEC d.example.net. MX RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ MxxrqKlQWoN1PgC6g/VkzTQYRFZpeJfjtm9L
+ jbnNPVNUJoRFA2knURkrTB4nmQc6k9bms9Na
+ G1yt/jdFB699yg== )
+d.example.net. 7200 IN A 1.2.3.3
+ 7200 RRSIG A 5 3 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ LHAxOSR8B+5D4nPxGn3zr4w8E+sSffCRbiqS
+ 8Giafiugn+FKRRO+QrCBytSF/YBmwfuz7uQF
+ Xqk7op11oye7fA== )
+ 7200 AAAA 2001:db8::3
+ 7200 RRSIG AAAA 5 3 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ VkBfSCLQGwOsCdzJTCgNenXpIHQ1OfOHhqib
+ 2UHf/kPtCRxONFQUcKfTC10XSbnOJ7oWcyVC
+ sJOAIxxNQOefZg== )
+ 7200 NSEC localhost.example.net. A AAAA RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ e9HXw+0oV/wa8dobs1lstE68JgCzdlmnGUAh
+ /0878kn5nyoLBaFEW3u6LU1E1YY277Ox2jZD
+ X51lgVvrlOsMaw== )
+localhost.example.net. 7200 IN A 127.0.0.1
+ 7200 RRSIG A 5 3 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ cx0NJFy0/RjCjhlU1X3S0na2q9hMyHmvFLhv
+ zLk+LqSaK1rHW4GNCCsGlNxQIb9uJjQJuUq1
+ U9ZdHxUEqeRRtQ== )
+ 7200 NSEC ns1.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ nDPwYL/05NLxkY4iuyzH8ASiBq8FcY0uNQAg
+ F+bjdtm1xt1uyqTROl5JQ1P3SUb/EuoxCMII
+ hS9tIVb0spHDuQ== )
+ns1.example.net. 7200 IN A 1.0.0.5
+ 7200 RRSIG A 5 3 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ swMfIxbBfSCr4ACCa3dJ8d0gtoHD7Z0L0sTp
+ TFEZ9miQFFN9zxKHGRpk6fBjkiMI3bSAMbtM
+ bBUOTYWJIMT50g== )
+ 7200 AAAA 2001:db8::53
+ 7200 RRSIG AAAA 5 3 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ w+weJuOzg5fQ15RGdNQ/7Gf4DxkcKq4Drx0l
+ CZ16TKV3/fR8ROCzIP9HulPsNJtEFK+J+CbM
+ 5P5ZMXieZrh+xQ== )
+ 7200 NSEC ns2.example.net. A AAAA RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ xe9q0umSSgBNQ5H0yLSQ9tONsw2hORQpxMGT
+ rrfxEcPm86SLMM40dithZQeajNucRlmuadKX
+ HREpYT/DVVBT0A== )
+ns2.example.net. 7200 IN A 1.2.0.6
+ 7200 RRSIG A 5 3 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ gOU5QjhdfwBBNHi5uQOs53GoxU7eiSt9I/yk
+ 06EzlFU2gJ+1cmhYKqrSZM7XC7/c5I61AZDS
+ 2LaOiuqMIPm8Hw== )
+ 7200 NSEC sub.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ dT90BIfl/AJ6gVSbrU0TiOacE5ZffS4N4B5+
+ HQzwNup6HfL7ZwBEO/vhKJjSgwd+Oetfc76+
+ /l+dJFZ8FtdZTA== )
+sub.example.net. 7200 IN NS ns1.example.net.
+ 7200 DS 54876 5 1 (
+ CAB6127E303A8A8D7D5A29AE05DB60F4C506
+ 0B10 )
+ 7200 DS 54876 5 2 (
+ 7C8CAF1844479F3600213173BB5D1E2A4414
+ 3D63B6E0B3E10D8C5310ADF84D30 )
+ 7200 RRSIG DS 5 3 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ DjNb5DNaKyPMWJgfiLxXbw/BhuxxKd58tHv+
+ TQqrp6STx8jZRWNsigEh4QTyx8lyYcAPaYEt
+ X6JnkVWr89s82A== )
+ 7200 NSEC example.net. NS DS RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080805212553 (
+ 20080730212553 41300 example.net.
+ kDm+cYjtem6aZSTTsLdSQZnJJVfASXdIsrom
+ fViO1QIHNSZodbtWT9cqMvhMhmQ1rO5GVRGg
+ KaG0bEo8TpOAUw== )
diff --git a/contrib/zkt/examples/flat/keysets/dlvset-sub.example.net. b/contrib/zkt/examples/flat/keysets/dlvset-sub.example.net.
new file mode 100644
index 0000000..8e00719
--- /dev/null
+++ b/contrib/zkt/examples/flat/keysets/dlvset-sub.example.net.
@@ -0,0 +1,2 @@
+sub.example.net.dlv.trusted-keys.de. IN DLV 54876 5 1 CAB6127E303A8A8D7D5A29AE05DB60F4C5060B10
+sub.example.net.dlv.trusted-keys.de. IN DLV 54876 5 2 7C8CAF1844479F3600213173BB5D1E2A44143D63B6E0B3E10D8C5310 ADF84D30
diff --git a/contrib/zkt/examples/flat/keysets/dsset-dyn.example.net. b/contrib/zkt/examples/flat/keysets/dsset-dyn.example.net.
new file mode 100644
index 0000000..f94666a
--- /dev/null
+++ b/contrib/zkt/examples/flat/keysets/dsset-dyn.example.net.
@@ -0,0 +1,2 @@
+dyn.example.net. IN DS 42138 3 1 0F49FCDB683D1903F69B6779DB55CA3472974879
+dyn.example.net. IN DS 42138 3 2 94AC94BFE3AFA17F7485F5F741274074FF2E26A360D776D8884F2689 CCED34C6
diff --git a/contrib/zkt/examples/flat/keysets/dsset-example.net. b/contrib/zkt/examples/flat/keysets/dsset-example.net.
new file mode 100644
index 0000000..d4a01ed
--- /dev/null
+++ b/contrib/zkt/examples/flat/keysets/dsset-example.net.
@@ -0,0 +1,4 @@
+example.net. IN DS 1764 5 1 A6F060DDE8DE45CA7FD1C21E2F39C477F214795F
+example.net. IN DS 1764 5 2 B7109245C60ACEDD1630E145477FDF574D5BD9CABE530AAC6D7192DB 7FBFAA3F
+example.net. IN DS 41151 5 1 BBB692EA07571E412F9385A618C1CAD9BFC1469A
+example.net. IN DS 41151 5 2 4D22B44C3DC09BD9EEADFFB917EFCE8E45F22E89FF0C096CD14F4405 CA1CAE3F
diff --git a/contrib/zkt/examples/flat/keysets/dsset-sub.example.net. b/contrib/zkt/examples/flat/keysets/dsset-sub.example.net.
new file mode 100644
index 0000000..9bed62a
--- /dev/null
+++ b/contrib/zkt/examples/flat/keysets/dsset-sub.example.net.
@@ -0,0 +1,2 @@
+sub.example.net. IN DS 54876 5 1 CAB6127E303A8A8D7D5A29AE05DB60F4C5060B10
+sub.example.net. IN DS 54876 5 2 7C8CAF1844479F3600213173BB5D1E2A44143D63B6E0B3E10D8C5310 ADF84D30
diff --git a/contrib/zkt/examples/flat/keysets/keyset-dyn.example.net. b/contrib/zkt/examples/flat/keysets/keyset-dyn.example.net.
new file mode 100644
index 0000000..002217b
--- /dev/null
+++ b/contrib/zkt/examples/flat/keysets/keyset-dyn.example.net.
@@ -0,0 +1,18 @@
+$ORIGIN .
+dyn.example.net 7200 IN DNSKEY 257 3 3 (
+ CNtFdVrUUJ9MPDyzGoPm+tSKUgnX4bble5+V
+ NGd4RjwWpEDj8RhEAhQ7LybJzr0wtHXT2Q/K
+ S55xARkUtcH2TVO/ayMupa30pM38rd8uF38s
+ m+ABKLEvCbPjaLZyW+s10di8nLp1aAxKFFfA
+ EfXkIhl3Wm5g9CvjrMlrxAOfNy/jtz4v+asI
+ r6/d992V80G9wMKMvTMQoCr4Sp9s2JubW79i
+ 4RBVWgHHJMmtyqq+SqEkPhZvsTuo2sXgIH9v
+ RS3XgfkGtw/KyTUM29bhZ2eB+Ldq+bggp1gb
+ BDiSsxZPjxciizI/mCzXWbq8BdfZ6LsddMjA
+ olJwCtaPCD4e4infmw+YSxjGau+YGgI0Cc0u
+ ItzQmNNpSoejM3IWGV+SN/YuPJIzw8wixDfO
+ 6kCNiPsW45Fvq31148cAvUvwiqYPQ3fONeOT
+ dQjsJWLLdLTApVEH10kjAGfa30Tm92lQhhG5
+ ovWrWCMbFlw4Lbvlon+X2snWPNut0a1Pz4Wd
+ clDcmNU8dxi1lFvGbcJ0E4qBoJVBIzDh4HX1
+ ) ; key id = 42138
diff --git a/contrib/zkt/examples/flat/keysets/keyset-example.net. b/contrib/zkt/examples/flat/keysets/keyset-example.net.
new file mode 100644
index 0000000..c832578
--- /dev/null
+++ b/contrib/zkt/examples/flat/keysets/keyset-example.net.
@@ -0,0 +1,19 @@
+$ORIGIN .
+example.net 7200 IN DNSKEY 257 3 5 (
+ BQEAAAABDAnSCbSyScZdP2M6OQTbTGvZRD5a
+ vmDYgAwXv0EsnNautYn7kzDGwY3oVTXWDTdI
+ I+syK0pt0unjUn2ActoXtyFzIk61VRKDroAN
+ M9/WO0PO/y50vNIGMJUL1TiMR6jCp23eSxQ3
+ 9/1A+BeiU+fMjoJK0/Yc7hbMHWwD8myU0IEX
+ 8R2iVUTXNPNbmUV2M836Eu5SRLIVTc7P4vjK
+ T1YYVnoQqw==
+ ) ; key id = 41151
+ 7200 IN DNSKEY 257 3 5 (
+ BQEAAAABDUi2uSUlDjESbnrnY5wd8+pXxhYV
+ Y4wCi2UVjhcehvIb2bF8VJH2Q9/0ubQR1vQ2
+ VJhsGUj3A7bdTfbMETPxKkZaDpc9lCYrm0z5
+ HDrslyx4bSb4JX/iCyhgYZXrTVb9WyLXjUtm
+ DUktDjZgsyVshFHVJShBUSj+YpnfQkndGViD
+ AbJRycXDYEF1hCNmTK3KsR1JS9dXMKI3WidH
+ +B9rLlBU8w==
+ ) ; key id = 1764
diff --git a/contrib/zkt/examples/flat/keysets/keyset-sub.example.net. b/contrib/zkt/examples/flat/keysets/keyset-sub.example.net.
new file mode 100644
index 0000000..77aacd6
--- /dev/null
+++ b/contrib/zkt/examples/flat/keysets/keyset-sub.example.net.
@@ -0,0 +1,8 @@
+$ORIGIN .
+sub.example.net 7200 IN DNSKEY 257 3 5 (
+ AQOjGNN0/hLA20+W2qo0sktVActYKf1Opnx+
+ bmkWSrsmJHMBHlT8hL507pGTmDoyH0Ae9+3M
+ ZSTBL1S+HhA12B0htiTp8IbtN/gZOBbwD36c
+ BpPe72uDQoUy/TdSn1HLtoqUSMTB+saqCTZW
+ CfIEqcbHRn0T6PhgqLyCvLzbZ/avYw==
+ ) ; key id = 54876
diff --git a/contrib/zkt/examples/flat/named.conf b/contrib/zkt/examples/flat/named.conf
new file mode 100644
index 0000000..0e8551c
--- /dev/null
+++ b/contrib/zkt/examples/flat/named.conf
@@ -0,0 +1,99 @@
+/*****************************************************************
+**
+** #(@) named.conf (c) 6. May 2004 (hoz)
+**
+*****************************************************************/
+
+/*****************************************************************
+** logging options
+*****************************************************************/
+logging {
+ channel "named-log" {
+ file "/var/log/named" versions 3 size 2m;
+ print-time yes;
+ print-category yes;
+ print-severity yes;
+ severity info;
+ };
+ channel "resolver-log" {
+ file "/var/log/named";
+ print-time yes;
+ print-category yes;
+ print-severity yes;
+ severity debug 1;
+ };
+ channel "dnssec-log" {
+# file "/var/log/named-dnssec" ;
+ file "/var/log/named" ;
+ print-time yes;
+ print-category yes;
+ print-severity yes;
+ severity debug 3;
+ };
+ category "dnssec" { "dnssec-log"; };
+ category "default" { "named-log"; };
+ category "resolver" { "resolver-log"; };
+ category "client" { "resolver-log"; };
+ category "queries" { "resolver-log"; };
+};
+
+/*****************************************************************
+** name server options
+*****************************************************************/
+options {
+ directory ".";
+
+ dump-file "/var/log/named_dump.db";
+ statistics-file "/var/log/named.stats";
+
+ listen-on-v6 { any; };
+
+ query-source address * port 53;
+ transfer-source * port 53;
+ notify-source * port 53;
+
+ recursion yes;
+ dnssec-enable yes;
+ edns-udp-size 4096;
+
+# dnssec-lookaside "." trust-anchor "trusted-keys.de.";
+
+ querylog yes;
+
+};
+
+/*****************************************************************
+** include shared secrets...
+*****************************************************************/
+/** for control sessions ... **/
+controls {
+ inet 127.0.0.1
+ allow { localhost; };
+ inet ::1
+ allow { localhost; };
+};
+
+/*****************************************************************
+** ... and trusted_keys
+*****************************************************************/
+# include "trusted-keys.conf" ;
+
+/*****************************************************************
+** root server hints and required 127 stuff
+*****************************************************************/
+zone "." in {
+ type hint;
+ file "root.hint";
+};
+
+zone "localhost" in {
+ type master;
+ file "localhost.zone";
+};
+
+zone "0.0.127.in-addr.ARPA" in {
+ type master;
+ file "127.0.0.zone";
+};
+
+include "zone.conf";
diff --git a/contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+001+04254.key b/contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+001+04254.key
new file mode 100644
index 0000000..a255a7b
--- /dev/null
+++ b/contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+001+04254.key
@@ -0,0 +1,3 @@
+;% generationtime=20080725213107
+;% lifetime=3d
+sub.example.net. IN DNSKEY 256 3 1 BQEAAAAB4Z/siqZTvCFKzaOrB8+HHTlR9is+/+/Sem6gxhZt/vpWkNMy aSpAT8LjR7nNHr9vNYsJ2KCQtY2dUFjT5BCeqQ==
diff --git a/contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+001+04254.private b/contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+001+04254.private
new file mode 100644
index 0000000..e636e05
--- /dev/null
+++ b/contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+001+04254.private
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 1 (RSA)
+Modulus: 4Z/siqZTvCFKzaOrB8+HHTlR9is+/+/Sem6gxhZt/vpWkNMyaSpAT8LjR7nNHr9vNYsJ2KCQtY2dUFjT5BCeqQ==
+PublicExponent: AQAAAAE=
+PrivateExponent: fcaPYDDCumWIaPKV7FY0JB/PofSCo8amWw5u+eXFxh149WE5PeXYOOS2+x41keA5Z1PhYme4Ma5rcCMRN7n+sQ==
+Prime1: /RbDZdmt2zlsChJiLR+Brweas6L1jnzUsJFm78HlSnM=
+Prime2: 5DhKYbovzYbkIFhp1b9lt22+ymAU8LOGvFXdfb1y33M=
+Exponent1: yw61YMxuJGzEAgxVmlAm6oEH0WaaJ5T1PvZGut1xCU0=
+Exponent2: wYNtwOUtI0UQWQF1ZCBiVsquBIkPvI5eR2GQypHaK08=
+Coefficient: NqkVvrZjnJ/jVWDEykJ2XYuslJOIJPi1+7+sTUyBhPU=
diff --git a/contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+001+56744.key b/contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+001+56744.key
new file mode 100644
index 0000000..4e7c3e5
--- /dev/null
+++ b/contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+001+56744.key
@@ -0,0 +1,3 @@
+;% generationtime=20080730222553
+;% lifetime=3d
+sub.example.net. IN DNSKEY 256 3 1 BQEAAAABxZS/DJA1BUdYVj5cOmMMnA5W/SHlkb4sEZkca3uIqV4gTzgv guftN+M1ZgwyPwarn7DQR1Eb92uW3ALxwN2o6w==
diff --git a/contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+001+56744.published b/contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+001+56744.published
new file mode 100644
index 0000000..2a3ae65
--- /dev/null
+++ b/contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+001+56744.published
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 1 (RSA)
+Modulus: xZS/DJA1BUdYVj5cOmMMnA5W/SHlkb4sEZkca3uIqV4gTzgvguftN+M1ZgwyPwarn7DQR1Eb92uW3ALxwN2o6w==
+PublicExponent: AQAAAAE=
+PrivateExponent: aSglUr7DxsGNZMOhyoyN6W0xGps+JGfI3ErXbewlvflVSFSHrA19x0OafvR6eFzqmzKKGIyZBJkYT5NHqKIG6Q==
+Prime1: 4yqINEZm3xDdHGyv31umolirJtS4X2teORhzWDE/r6U=
+Prime2: 3qjiidKP41FSrOsXXgkj3XBi+OAH0cpVBZxCuP+ykU8=
+Exponent1: p8nyeR3ldgpw7A6tebr6okucM6324S5LPOWlC8ygxp0=
+Exponent2: a1qTrKaBO6pN7UI/mHimSYLoevjQBWeX8jB0tmG0NIc=
+Coefficient: NB2eeh6Z+a9qMf1w5UY2z9ME+ZyYtvRbYZSkedB4Q4Y=
diff --git a/contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+005+54876.key b/contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+005+54876.key
new file mode 100644
index 0000000..21098f8
--- /dev/null
+++ b/contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+005+54876.key
@@ -0,0 +1 @@
+sub.example.net. IN DNSKEY 257 3 5 AQOjGNN0/hLA20+W2qo0sktVActYKf1Opnx+bmkWSrsmJHMBHlT8hL50 7pGTmDoyH0Ae9+3MZSTBL1S+HhA12B0htiTp8IbtN/gZOBbwD36cBpPe 72uDQoUy/TdSn1HLtoqUSMTB+saqCTZWCfIEqcbHRn0T6PhgqLyCvLzb Z/avYw==
diff --git a/contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+005+54876.private b/contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+005+54876.private
new file mode 100644
index 0000000..ad5b363
--- /dev/null
+++ b/contrib/zkt/examples/flat/sub.example.net./Ksub.example.net.+005+54876.private
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 5 (RSASHA1)
+Modulus: oxjTdP4SwNtPltqqNLJLVQHLWCn9TqZ8fm5pFkq7JiRzAR5U/IS+dO6Rk5g6Mh9AHvftzGUkwS9Uvh4QNdgdIbYk6fCG7Tf4GTgW8A9+nAaT3u9rg0KFMv03Up9Ry7aKlEjEwfrGqgk2VgnyBKnGx0Z9E+j4YKi8gry822f2r2M=
+PublicExponent: Aw==
+PrivateExponent: bLs3o1QMgJI1DzxxeHbc41aHkBv+NG79qZ7wuYcnbsL3VhQ4qFh++J8Lt7rRdr+AFKVJMu4YgMo4fr61eTq+FWije4t8PrILH6qzNdwCqOLsQYyKRUODTPsE+2BU6TZVBsBOBPlpJP9hTBj1DCoUTE6y8Evkkmf4C4Y6U7frF/s=
+Prime1: 1t2pJC/eQzdhrLR4qHlaaT6vPmBC+7eNPg8zjdZDA03TKMd/V4kw6XtB6QYQZRi/CXg7JjoLr3dpUgyMY0l8tw==
+Prime2: wlIHexyw6bAIC1WmnQFESPLNXjvYYYiyRqCmAPwq4b02/4g7LR/BoKkh+3xiBY+VxvhwUOd5XVEIIVjRcMyOtQ==
+Exponent1: jz5wwsqULM+WcyL7GvuRm38ffurXUnpeKV93s+QsrN6MxdpU5QYgm6eBRgQK7hB/W6V8xCaydPpGNrMIQjD9zw==
+Exponent2: gYwE/L3LRnVasjkZvgDYMKHePtKQQQXMLxXEAKgcln4kqlrSHhUrwHDBUlLsA7UOhKWgNe+mPjYFa5CLoIhfIw==
+Coefficient: DWng17udd0Q2STNt5gshQ6PjNQxEQmQMnCwltkosf8rJhl/rQuYULz0elnWhADcMBDYw7Y6Kb7xjpL4FdR0YnA==
diff --git a/contrib/zkt/examples/flat/sub.example.net./dlvset-sub.example.net. b/contrib/zkt/examples/flat/sub.example.net./dlvset-sub.example.net.
new file mode 100644
index 0000000..8e00719
--- /dev/null
+++ b/contrib/zkt/examples/flat/sub.example.net./dlvset-sub.example.net.
@@ -0,0 +1,2 @@
+sub.example.net.dlv.trusted-keys.de. IN DLV 54876 5 1 CAB6127E303A8A8D7D5A29AE05DB60F4C5060B10
+sub.example.net.dlv.trusted-keys.de. IN DLV 54876 5 2 7C8CAF1844479F3600213173BB5D1E2A44143D63B6E0B3E10D8C5310 ADF84D30
diff --git a/contrib/zkt/examples/flat/sub.example.net./dnskey.db b/contrib/zkt/examples/flat/sub.example.net./dnskey.db
new file mode 100644
index 0000000..396e7d3
--- /dev/null
+++ b/contrib/zkt/examples/flat/sub.example.net./dnskey.db
@@ -0,0 +1,29 @@
+;
+; !!! Don't edit this file by hand.
+; !!! It will be generated by dnssec-signer.
+;
+; Last generation time Jul 31 2008 13:19:17
+;
+
+; *** List of Key Signing Keys ***
+; sub.example.net. tag=54876 algo=RSASHA1 generated Jun 19 2008 00:32:22
+sub.example.net. 3600 IN DNSKEY 257 3 5 (
+ AQOjGNN0/hLA20+W2qo0sktVActYKf1Opnx+bmkWSrsmJHMBHlT8hL50
+ 7pGTmDoyH0Ae9+3MZSTBL1S+HhA12B0htiTp8IbtN/gZOBbwD36cBpPe
+ 72uDQoUy/TdSn1HLtoqUSMTB+saqCTZWCfIEqcbHRn0T6PhgqLyCvLzb
+ Z/avYw==
+ ) ; key id = 54876
+
+; *** List of Zone Signing Keys ***
+; sub.example.net. tag=4254 algo=RSAMD5 generated Jul 31 2008 00:25:52
+sub.example.net. 3600 IN DNSKEY 256 3 1 (
+ BQEAAAAB4Z/siqZTvCFKzaOrB8+HHTlR9is+/+/Sem6gxhZt/vpWkNMy
+ aSpAT8LjR7nNHr9vNYsJ2KCQtY2dUFjT5BCeqQ==
+ ) ; key id = 4254
+
+; sub.example.net. tag=56744 algo=RSAMD5 generated Jul 31 2008 00:25:53
+sub.example.net. 3600 IN DNSKEY 256 3 1 (
+ BQEAAAABxZS/DJA1BUdYVj5cOmMMnA5W/SHlkb4sEZkca3uIqV4gTzgv
+ guftN+M1ZgwyPwarn7DQR1Eb92uW3ALxwN2o6w==
+ ) ; key id = 56744
+
diff --git a/contrib/zkt/examples/flat/sub.example.net./dnssec.conf b/contrib/zkt/examples/flat/sub.example.net./dnssec.conf
new file mode 100644
index 0000000..4a045ad
--- /dev/null
+++ b/contrib/zkt/examples/flat/sub.example.net./dnssec.conf
@@ -0,0 +1,14 @@
+
+resigninterval 1d
+sigvalidity 2d
+max_ttl 90s
+
+Serialformat: unixtime
+ksk_algo RSASHA1
+ksk_bits 1024
+
+zsk_lifetime 3d
+zsk_algo RSAMD5
+zsk_bits 512
+
+dlv_domain "dlv.trusted-keys.de"
diff --git a/contrib/zkt/examples/flat/sub.example.net./zone.db b/contrib/zkt/examples/flat/sub.example.net./zone.db
new file mode 100644
index 0000000..c9ec01e
--- /dev/null
+++ b/contrib/zkt/examples/flat/sub.example.net./zone.db
@@ -0,0 +1,25 @@
+;-----------------------------------------------------------------
+;
+; @(#) sec.example.net/zone.db
+;
+;-----------------------------------------------------------------
+
+$TTL 7200
+
+@ IN SOA ns1.example.net. hostmaster.example.net. (
+ 0 ; Serial
+ 86400 ; Refresh (RIPE recommendation if NOTIFY is used)
+ 1800 ; Retry
+ 2W ; Expire
+ 7200 ) ; Minimum
+
+
+ IN NS ns1.example.net.
+
+$INCLUDE dnskey.db
+
+localhost IN A 127.0.0.1
+
+a IN A 1.2.3.4
+b IN A 1.2.3.5
+c IN A 1.2.3.6
diff --git a/contrib/zkt/examples/flat/sub.example.net./zone.db.signed b/contrib/zkt/examples/flat/sub.example.net./zone.db.signed
new file mode 100644
index 0000000..0560d2b
--- /dev/null
+++ b/contrib/zkt/examples/flat/sub.example.net./zone.db.signed
@@ -0,0 +1,103 @@
+; File written on Thu Jul 31 13:19:17 2008
+; dnssec_signzone version 9.5.1b1
+sub.example.net. 7200 IN SOA ns1.example.net. hostmaster.example.net. (
+ 1217503157 ; serial
+ 86400 ; refresh (1 day)
+ 1800 ; retry (30 minutes)
+ 1209600 ; expire (2 weeks)
+ 7200 ; minimum (2 hours)
+ )
+ 7200 RRSIG SOA 1 3 7200 20080802101917 (
+ 20080731101917 4254 sub.example.net.
+ pAevIprv5lPMcSSR4l0cGzaYTY2pG3HsT6z9
+ RkSwssWSyyMxRqgYCuR2gErA1THGJNPlT8Qa
+ 9bvrMVOXpd0Q1g== )
+ 7200 NS ns1.example.net.
+ 7200 RRSIG NS 1 3 7200 20080802101917 (
+ 20080731101917 4254 sub.example.net.
+ zB0f/bN5fvezT404pT+ArKVIW2QHKzTC2osb
+ k2sUpJiuhKtdJBx1kfBNmyaIuFaZsLtWacJn
+ 1S/A2bV4S3No7Q== )
+ 7200 NSEC a.sub.example.net. NS SOA RRSIG NSEC DNSKEY
+ 7200 RRSIG NSEC 1 3 7200 20080802101917 (
+ 20080731101917 4254 sub.example.net.
+ ElgI6LCNWdDWM3OKh4vNDN9EiSns1bpnmOPK
+ TmAPb/tStfHfmNOuwBleW6irtDexizZcZFl8
+ feRHQBEYFpgvhA== )
+ 3600 DNSKEY 256 3 1 (
+ BQEAAAABxZS/DJA1BUdYVj5cOmMMnA5W/SHl
+ kb4sEZkca3uIqV4gTzgvguftN+M1ZgwyPwar
+ n7DQR1Eb92uW3ALxwN2o6w==
+ ) ; key id = 56744
+ 3600 DNSKEY 256 3 1 (
+ BQEAAAAB4Z/siqZTvCFKzaOrB8+HHTlR9is+
+ /+/Sem6gxhZt/vpWkNMyaSpAT8LjR7nNHr9v
+ NYsJ2KCQtY2dUFjT5BCeqQ==
+ ) ; key id = 4254
+ 3600 DNSKEY 257 3 5 (
+ AQOjGNN0/hLA20+W2qo0sktVActYKf1Opnx+
+ bmkWSrsmJHMBHlT8hL507pGTmDoyH0Ae9+3M
+ ZSTBL1S+HhA12B0htiTp8IbtN/gZOBbwD36c
+ BpPe72uDQoUy/TdSn1HLtoqUSMTB+saqCTZW
+ CfIEqcbHRn0T6PhgqLyCvLzbZ/avYw==
+ ) ; key id = 54876
+ 3600 RRSIG DNSKEY 1 3 3600 20080802101917 (
+ 20080731101917 4254 sub.example.net.
+ ASLViHuAWYqnzkZ4i6eywTuKvHyk93xsQBba
+ 4VjRCKc93KzvkWUA6SgOcwGvuRuAGCGb60VT
+ UW2clZMFj/Fy6g== )
+ 3600 RRSIG DNSKEY 5 3 3600 20080802101917 (
+ 20080731101917 54876 sub.example.net.
+ B2w2YAkeV2vx159FnG+B/H36Vnx8L1WwHt3E
+ 0YV1yYj2s5ZV6B6Gq34Ahm6y+zs7TsVxeYpO
+ OCoYCck/D+ehpuHOzZRR7xS2Rz/xLIvfASAK
+ 7NT/aIOlNPWH6I1J3ZAwhfAwF680KEFHPksv
+ oFMHe/OpIq7x/a4NdMn3yIWbFtg= )
+a.sub.example.net. 7200 IN A 1.2.3.4
+ 7200 RRSIG A 1 4 7200 20080802101917 (
+ 20080731101917 4254 sub.example.net.
+ 1bTDrFSMIV8H8HTfEFQiG7dqYGr3a8UvK5fQ
+ owoh0VJuG4+DCUZU8edUSwnzMW8Yza4Ev0j+
+ M4ESPnoKxli7YQ== )
+ 7200 NSEC b.sub.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 1 4 7200 20080802101917 (
+ 20080731101917 4254 sub.example.net.
+ nmJGbJWWaChlNmTTk5TgWEYRETeSJFiCoYHv
+ USKfEwLn13LfKk/lRZJarWIkDh7mxoismPOt
+ 2ODgeGLhUTap7A== )
+b.sub.example.net. 7200 IN A 1.2.3.5
+ 7200 RRSIG A 1 4 7200 20080802101917 (
+ 20080731101917 4254 sub.example.net.
+ ojTCQ+aB8WClC7ncJsVGaN5RY6lczR7/Q0uz
+ bydmXQBjGUdF/GsuJvhR26mVbPzJNmF7uDNN
+ S0Et3ivWZSAVOg== )
+ 7200 NSEC c.sub.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 1 4 7200 20080802101917 (
+ 20080731101917 4254 sub.example.net.
+ a6adIifDPjibbLme8dVzcKymxSARsIs2pz7B
+ jHXl0NCH9tmPBc/cBnjHxnSaes3QVDeok04k
+ +SzjVQtJfxUDsA== )
+c.sub.example.net. 7200 IN A 1.2.3.6
+ 7200 RRSIG A 1 4 7200 20080802101917 (
+ 20080731101917 4254 sub.example.net.
+ ZeYTG7C6eEXhcHaBS4oIcwWGA5NayJs9aqhb
+ eWLRoZ75LxgIxhMQYU6A22PQf+zIWLADd0ID
+ z5HLpC+KbfpJxw== )
+ 7200 NSEC localhost.sub.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 1 4 7200 20080802101917 (
+ 20080731101917 4254 sub.example.net.
+ IypmujoPBPhfEJqJdst5ZBazYfrr5l8nzrIh
+ a6xQYUDcw8aI96rVxn0pjeeiGBHuge2HbAAh
+ 4AnYjZlHjfe+MA== )
+localhost.sub.example.net. 7200 IN A 127.0.0.1
+ 7200 RRSIG A 1 4 7200 20080802101917 (
+ 20080731101917 4254 sub.example.net.
+ o8kEv5q2Xus/jL8w8gB/M3VSvz7eTP67u38T
+ X+JO2yRn7W8gIxPo46yYfgr3qB7WXYD8jB8Y
+ vw4b+pdoWMi0+g== )
+ 7200 NSEC sub.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 1 4 7200 20080802101917 (
+ 20080731101917 4254 sub.example.net.
+ XbQQpoL8oV9kgpIKHyX2KoCmtMm2Wub1lVu9
+ PP0RM4QO5bpWls0ify3KgNiAg0g6qV86UQIr
+ SgFnqsd6YTxxpw== )
diff --git a/contrib/zkt/examples/flat/zkt.log b/contrib/zkt/examples/flat/zkt.log
new file mode 100644
index 0000000..9276f94
--- /dev/null
+++ b/contrib/zkt/examples/flat/zkt.log
@@ -0,0 +1,2501 @@
+2008-06-10 00:36:45.086: warning: zone "sub.example.net.": lifetime of key signing key 54876 exceeded
+2008-06-10 00:37:09.073: warning: zone "sub.example.net.": lifetime of key signing key 54876 exceeded
+2008-06-10 00:37:09.074: error: zone "example.net.": couldn't increment serialno in file ./example.net./zone.db: not enough space left for serialno
+2008-06-10 00:37:24.586: warning: zone "sub.example.net.": lifetime of key signing key 54876 exceeded
+2008-06-10 00:37:24.588: error: zone "example.net.": couldn't increment serialno in file ./example.net./zone.db: not enough space left for serialno
+2008-06-10 00:38:02.499: warning: zone "sub.example.net.": lifetime of key signing key 54876 exceeded
+2008-06-10 00:38:14.016: warning: zone "sub.example.net.": lifetime of key signing key 54876 exceeded
+2008-06-10 00:38:14.018: error: zone "example.net.": couldn't increment serialno in file ./example.net./zone.db: couldn't find serialnumber in zone file
+2008-06-10 00:38:40.235: warning: zone "sub.example.net.": lifetime of key signing key 54876 exceeded
+2008-06-10 00:38:40.236: error: zone "example.net.": couldn't increment serialno in file ./example.net./zone.db: unexpected end of file
+2008-06-10 00:38:49.975: warning: zone "sub.example.net.": lifetime of key signing key 54876 exceeded
+2008-06-11 13:47:16.909: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded ()
+2008-06-11 13:51:06.959: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded -16781202()
+2008-06-11 13:54:29.680: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded (27w5d5h30m5s)
+2008-06-11 13:56:36.990: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w5d5h32m12s
+2008-06-11 22:39:48.053: notice: running as ../../dnssec-signer -v -v
+2008-06-11 22:39:48.056: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w5d14h15m24s
+2008-06-11 22:39:48.056: notice: "sub.example.net.": lifetime of zone signing key 44833 exceeded since 2h30m54s: ZSK rollover done
+2008-06-11 22:39:48.143: notice: "sub.example.net.": re-signing triggered: New zone key
+2008-06-11 22:39:48.617: notice: end of run: 0 errors occured
+2008-06-11 22:41:14.103: notice: running as ../../dnssec-signer -v -v
+2008-06-11 22:41:14.106: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w5d14h16m50s
+2008-06-11 22:41:14.106: notice: end of run: 0 errors occured
+2008-06-11 22:48:18.445: notice: running as ../../dnssec-signer -v -v
+2008-06-11 22:48:18.448: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w5d14h23m54s
+2008-06-11 22:48:18.448: notice: "sub.example.net.": re-signing triggered: New zone key
+2008-06-11 22:48:19.087: notice: end of run: 0 errors occured
+2008-06-11 22:56:53.295: notice: running as ../../dnssec-signer -v -v
+2008-06-11 22:56:53.297: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w5d14h32m29s
+2008-06-11 22:56:53.297: notice: end of run: 0 errors occured
+2008-06-11 23:01:41.451: notice: running as ../../dnssec-signer -v -v
+2008-06-11 23:01:41.454: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w5d14h37m17s
+2008-06-11 23:01:41.454: notice: end of run: 0 errors occured
+2008-06-11 23:04:25.909: notice: running as ../../dnssec-signer -c dnssec.conf -v -v
+2008-06-11 23:04:25.911: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w5d14h40m1s
+2008-06-11 23:04:25.911: notice: end of run: 0 errors occured
+2008-06-12 13:06:54.007: notice: running as ../../dnssec-signer -v -v
+2008-06-12 13:06:54.055: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d4h42m30s
+2008-06-12 13:06:54.056: notice: end of run: 0 errors occured
+2008-06-12 13:07:45.126: notice: running as ../../dnssec-signer -v -v
+2008-06-12 13:07:45.129: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+
+2008-06-12 13:07:45.129: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d4h43m21s
+2008-06-12 13:07:45.130: debug: parsing zone "example.net." in dir "./example.net."
+
+2008-06-12 13:07:45.130: notice: end of run: 0 errors occured
+2008-06-12 13:22:02.251: notice: running as ../../dnssec-signer -v -v
+2008-06-12 13:22:02.253: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+
+2008-06-12 13:22:02.253: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d4h57m38s
+2008-06-12 13:22:02.253: debug: parsing zone "example.net." in dir "./example.net."
+
+2008-06-12 13:22:02.253: notice: end of run: 0 errors occured
+2008-06-12 13:24:37.956: notice: running as ../../dnssec-signer -v -v
+2008-06-12 13:24:37.958: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-12 13:24:37.958: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d5h13s
+2008-06-12 13:24:37.958: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-12 13:24:37.958: notice: end of run: 0 errors occured
+2008-06-12 13:25:32.993: notice: running as ../../dnssec-signer --config-option verboselog: 0; -v -v
+2008-06-12 13:25:32.997: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d5h1m8s
+2008-06-12 13:25:32.997: notice: end of run: 0 errors occured
+2008-06-12 13:26:49.861: notice: running as ../../dnssec-signer -O verboselog: 0; -v -v
+2008-06-12 13:26:49.864: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d5h2m25s
+2008-06-12 13:26:49.864: notice: end of run: 0 errors occured
+2008-06-12 16:28:01.977: notice: running as ../../dnssec-signer --config-option verboselog: 0; -v -v
+2008-06-12 16:28:01.979: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d8h3m37s
+2008-06-12 16:28:01.979: notice: end of run: 0 errors occured
+2008-06-12 16:28:13.626: notice: running as ../../dnssec-signer --config-option verboselog: 0; -v
+2008-06-12 16:28:13.629: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d8h3m49s
+2008-06-12 16:28:13.630: notice: end of run: 0 errors occured
+2008-06-12 16:28:30.318: notice: running as ../../dnssec-signer --config-option verboselog: 0; -v -v
+2008-06-12 16:28:30.320: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d8h4m6s
+2008-06-12 16:28:30.320: notice: end of run: 0 errors occured
+2008-06-12 16:34:06.968: notice: running as ../../dnssec-signer -v -v
+2008-06-12 16:34:06.971: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-12 16:34:06.971: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d8h9m42s
+2008-06-12 16:34:06.972: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-12 16:34:06.972: notice: end of run: 0 errors occured
+2008-06-12 16:34:15.816: notice: running as ../../dnssec-signer
+2008-06-12 16:34:15.818: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-12 16:34:15.818: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d8h9m51s
+2008-06-12 16:34:15.818: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-12 16:34:15.818: notice: end of run: 0 errors occured
+2008-06-12 16:35:27.777: notice: running as ../../dnssec-signer --config-option verboselog: 0; -v -v
+2008-06-12 16:35:27.780: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d8h11m3s
+2008-06-12 16:35:27.780: notice: end of run: 0 errors occured
+2008-06-12 16:44:56.266: notice: running as ../../dnssec-signer -v -v
+2008-06-12 16:44:56.269: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-12 16:44:56.269: debug: ->ksk5011status returns 0
+2008-06-12 16:44:56.269: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d8h20m32s
+2008-06-12 16:44:56.269: debug: Re-signing not necessary!
+2008-06-12 16:44:56.269: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-12 16:44:56.269: debug: ->ksk5011status returns 2
+2008-06-12 16:44:56.269: debug: Re-signing not necessary!
+2008-06-12 16:44:56.270: notice: end of run: 0 errors occured
+2008-06-12 16:49:23.380: notice: running as ../../dnssec-signer -v -v
+2008-06-12 16:49:23.385: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-12 16:49:23.385: debug: ->ksk5011status returns 0
+2008-06-12 16:49:23.386: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d8h24m59s
+2008-06-12 16:49:23.386: debug: Re-signing not necessary!
+2008-06-12 16:49:23.386: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-12 16:49:23.386: debug: ->ksk5011status returns 2
+2008-06-12 16:49:23.386: debug: Re-signing not necessary!
+2008-06-12 16:49:23.386: notice: end of run: 0 errors occured
+2008-06-12 16:49:28.284: notice: running as ../../dnssec-signer -r -v -v
+2008-06-12 16:49:28.288: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-12 16:49:28.288: debug: ->ksk5011status returns 0
+2008-06-12 16:49:28.288: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d8h25m4s
+2008-06-12 16:49:28.288: debug: Re-signing not necessary!
+2008-06-12 16:49:28.288: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-12 16:49:28.288: debug: ->ksk5011status returns 2
+2008-06-12 16:49:28.288: debug: Re-signing not necessary!
+2008-06-12 16:49:28.288: notice: end of run: 0 errors occured
+2008-06-12 16:49:32.079: notice: running as ../../dnssec-signer -f -v -v
+2008-06-12 16:49:32.081: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-12 16:49:32.081: debug: ->ksk5011status returns 0
+2008-06-12 16:49:32.081: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d8h25m8s
+2008-06-12 16:49:32.082: debug: Re-signing necessary: Option -f
+2008-06-12 16:49:32.082: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-06-12 16:49:32.082: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-06-12 16:49:32.082: debug: Signing zone "sub.example.net."
+2008-06-12 16:49:32.082: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -p -d ../keysets -o sub.example.net. -e +172800 -g -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-06-12 16:49:32.222: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-12 16:49:32.222: debug: Signing completed after 0s.
+2008-06-12 16:49:32.222: debug:
+2008-06-12 16:49:32.222: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-12 16:49:32.222: debug: ->ksk5011status returns 2
+2008-06-12 16:49:32.223: debug: Re-signing necessary: Option -f
+2008-06-12 16:49:32.223: notice: "example.net.": re-signing triggered: Option -f
+2008-06-12 16:49:32.223: debug: Writing key file "./example.net./dnskey.db"
+2008-06-12 16:49:32.223: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-06-12 16:49:32.223: debug: Signing zone "example.net."
+2008-06-12 16:49:32.223: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -p -d ../keysets -o example.net. -e +518400 -g zone.db K*.private"
+2008-06-12 16:49:32.335: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-12 16:49:32.335: debug: Signing completed after 0s.
+2008-06-12 16:49:32.335: debug:
+2008-06-12 16:49:32.335: notice: end of run: 0 errors occured
+2008-06-12 17:02:15.076: notice: running as ../../dnssec-signer -f -v -v
+2008-06-12 17:02:15.078: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-12 17:02:15.078: debug: Check RFC5011 status
+2008-06-12 17:02:15.078: debug: ->ksk5011status returns 0
+2008-06-12 17:02:15.078: debug: Check ksk status
+2008-06-12 17:02:15.078: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d8h37m51s
+2008-06-12 17:02:15.078: debug: Re-signing necessary: Option -f
+2008-06-12 17:02:15.078: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-06-12 17:02:15.078: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-06-12 17:02:15.079: debug: Signing zone "sub.example.net."
+2008-06-12 17:02:15.079: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -p -d ../keysets -o sub.example.net. -e +172800 -g -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-06-12 17:02:15.254: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-12 17:02:15.254: debug: Signing completed after 0s.
+2008-06-12 17:02:15.254: debug:
+2008-06-12 17:02:15.254: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-12 17:02:15.255: debug: Check RFC5011 status
+2008-06-12 17:02:15.255: debug: ->ksk5011status returns 2
+2008-06-12 17:02:15.255: debug: Re-signing necessary: Option -f
+2008-06-12 17:02:15.255: notice: "example.net.": re-signing triggered: Option -f
+2008-06-12 17:02:15.255: debug: Writing key file "./example.net./dnskey.db"
+2008-06-12 17:02:15.255: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-06-12 17:02:15.255: debug: Signing zone "example.net."
+2008-06-12 17:02:15.255: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -p -d ../keysets -o example.net. -e +518400 -g zone.db K*.private"
+2008-06-12 17:02:15.368: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-12 17:02:15.368: debug: Signing completed after 0s.
+2008-06-12 17:02:15.368: debug:
+2008-06-12 17:02:15.368: notice: end of run: 0 errors occured
+2008-06-12 17:43:50.388: notice: running as ../../dnssec-signer -f -f
+2008-06-12 17:43:50.390: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-12 17:43:50.390: debug: Check RFC5011 status
+2008-06-12 17:43:50.390: debug: ->ksk5011status returns 0
+2008-06-12 17:43:50.390: debug: Check ksk status
+2008-06-12 17:43:50.390: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d9h19m26s
+2008-06-12 17:43:50.390: debug: Re-signing necessary: Option -f
+2008-06-12 17:43:50.390: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-06-12 17:43:50.390: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-06-12 17:43:50.390: debug: Signing zone "sub.example.net."
+2008-06-12 17:43:50.390: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -p -d ../keysets -o sub.example.net. -e +172800 -g -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-06-12 17:43:50.533: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-12 17:43:50.533: debug: Signing completed after 0s.
+2008-06-12 17:43:50.533: debug:
+2008-06-12 17:43:50.533: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-12 17:43:50.533: debug: Check RFC5011 status
+2008-06-12 17:43:50.533: debug: ->ksk5011status returns 2
+2008-06-12 17:43:50.533: debug: Re-signing necessary: Option -f
+2008-06-12 17:43:50.533: notice: "example.net.": re-signing triggered: Option -f
+2008-06-12 17:43:50.533: debug: Writing key file "./example.net./dnskey.db"
+2008-06-12 17:43:50.534: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-06-12 17:43:50.534: debug: Signing zone "example.net."
+2008-06-12 17:43:50.534: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -p -d ../keysets -o example.net. -e +518400 -g zone.db K*.private"
+2008-06-12 17:43:50.645: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-12 17:43:50.645: debug: Signing completed after 0s.
+2008-06-12 17:43:50.645: debug:
+2008-06-12 17:43:50.645: notice: end of run: 0 errors occured
+2008-06-12 17:49:43.188: notice: running as ../../dnssec-signer -O verboselog: 2 -v -v
+2008-06-12 17:49:43.190: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-12 17:49:43.190: debug: Check RFC5011 status
+2008-06-12 17:49:43.190: debug: ->ksk5011status returns 0
+2008-06-12 17:49:43.190: debug: Check ksk status
+2008-06-12 17:49:43.190: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d9h25m19s
+2008-06-12 17:49:43.190: debug: Re-signing not necessary!
+2008-06-12 17:49:43.190: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-12 17:49:43.190: debug: Check RFC5011 status
+2008-06-12 17:49:43.190: debug: ->ksk5011status returns 2
+2008-06-12 17:49:43.190: debug: Re-signing not necessary!
+2008-06-12 17:49:43.190: notice: end of run: 0 errors occured
+2008-06-12 17:50:09.325: notice: running as ../../dnssec-signer -v -v
+2008-06-12 17:50:09.327: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-12 17:50:09.327: debug: Check RFC5011 status
+2008-06-12 17:50:09.327: debug: ->ksk5011status returns 0
+2008-06-12 17:50:09.327: debug: Check ksk status
+2008-06-12 17:50:09.327: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d9h25m45s
+2008-06-12 17:50:09.327: debug: Re-signing not necessary!
+2008-06-12 17:50:09.327: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-12 17:50:09.327: debug: Check RFC5011 status
+2008-06-12 17:50:09.327: debug: ->ksk5011status returns 2
+2008-06-12 17:50:09.327: debug: Re-signing not necessary!
+2008-06-12 17:50:09.327: notice: end of run: 0 errors occured
+2008-06-12 17:52:29.309: notice: running as ../../dnssec-signer -v -v
+2008-06-12 17:52:29.311: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-12 17:52:29.312: debug: Check RFC5011 status
+2008-06-12 17:52:29.312: debug: ->ksk5011status returns 0
+2008-06-12 17:52:29.312: debug: Check ksk status
+2008-06-12 17:52:29.312: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d9h28m5s
+2008-06-12 17:52:29.312: debug: Re-signing not necessary!
+2008-06-12 17:52:29.312: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-12 17:52:29.313: debug: Check RFC5011 status
+2008-06-12 17:52:29.313: debug: ->ksk5011status returns 2
+2008-06-12 17:52:29.313: debug: Re-signing not necessary!
+2008-06-12 17:52:29.313: notice: end of run: 0 errors occured
+2008-06-12 18:24:57.405: notice: running as ../../dnssec-signer -v -v
+2008-06-12 18:24:57.409: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-12 18:24:57.409: debug: Check RFC5011 status
+2008-06-12 18:24:57.409: debug: ->ksk5011status returns 0
+2008-06-12 18:24:57.409: debug: Check ksk status
+2008-06-12 18:24:57.409: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 27w6d10h33s
+2008-06-12 18:24:57.409: debug: Re-signing not necessary!
+2008-06-12 18:24:57.409: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-12 18:24:57.409: debug: Check RFC5011 status
+2008-06-12 18:24:57.409: debug: ->ksk5011status returns 2
+2008-06-12 18:24:57.410: debug: Re-signing not necessary!
+2008-06-12 18:24:57.410: notice: end of run: 0 errors occured
+2008-06-16 23:12:32.309: notice:
+2008-06-16 23:12:32.309: notice: running as ../../dnssec-signer -v -v
+2008-06-16 23:12:32.654: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-16 23:12:32.654: debug: Check RFC5011 status
+2008-06-16 23:12:32.654: debug: ->ksk5011status returns 0
+2008-06-16 23:12:32.654: debug: Check ksk status
+2008-06-16 23:12:32.654: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 28w3d14h48m8s
+2008-06-16 23:12:32.654: debug: Lifetime(259200 +/-150 sec) of active key 44833 exceeded (433964 sec)
+2008-06-16 23:12:32.654: debug: ->depreciate it
+2008-06-16 23:12:32.654: debug: ->activate pre-publish key 55267
+2008-06-16 23:12:32.654: notice: "sub.example.net.": lifetime of zone signing key 55267 exceeded since 2d32m44s: ZSK rollover done
+2008-06-16 23:12:32.654: debug: New pre-publish key needed
+2008-06-16 23:12:32.790: debug: ->creating new pre-publish key 56149
+2008-06-16 23:12:32.791: debug: Re-signing necessary: New zone key
+2008-06-16 23:12:32.791: notice: "sub.example.net.": re-signing triggered: New zone key
+2008-06-16 23:12:32.791: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-06-16 23:12:32.792: debug: Signing zone "sub.example.net."
+2008-06-16 23:12:32.792: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -p -d ../keysets -o sub.example.net. -e +172800 -g -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-06-16 23:12:33.022: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-16 23:12:33.022: debug: Signing completed after 1s.
+2008-06-16 23:12:33.022: debug:
+2008-06-16 23:12:33.023: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-16 23:12:33.023: debug: Check RFC5011 status
+2008-06-16 23:12:33.023: debug: ->ksk5011status returns 2
+2008-06-16 23:12:33.023: debug: Re-signing necessary: re-signing interval (2d) reached
+2008-06-16 23:12:33.023: notice: "example.net.": re-signing triggered: re-signing interval (2d) reached
+2008-06-16 23:12:33.023: debug: Writing key file "./example.net./dnskey.db"
+2008-06-16 23:12:33.024: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-06-16 23:12:33.024: debug: Signing zone "example.net."
+2008-06-16 23:12:33.024: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -p -d ../keysets -o example.net. -e +518400 -g zone.db K*.private"
+2008-06-16 23:12:33.169: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-16 23:12:33.170: debug: Signing completed after 0s.
+2008-06-16 23:12:33.170: debug:
+2008-06-16 23:12:33.170: notice: end of run: 0 errors occured
+2008-06-16 23:13:24.119: notice: ===> running as ../../dnssec-signer -v -v <===
+2008-06-16 23:13:24.121: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-16 23:13:24.121: debug: Check RFC5011 status
+2008-06-16 23:13:24.121: debug: ->ksk5011status returns 0
+2008-06-16 23:13:24.121: debug: Check ksk status
+2008-06-16 23:13:24.121: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 28w3d14h49m
+2008-06-16 23:13:24.121: debug: Re-signing not necessary!
+2008-06-16 23:13:24.121: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-16 23:13:24.121: debug: Check RFC5011 status
+2008-06-16 23:13:24.121: debug: ->ksk5011status returns 2
+2008-06-16 23:13:24.121: debug: Re-signing not necessary!
+2008-06-16 23:13:24.121: notice: end of run: 0 errors occured
+2008-06-16 23:13:56.970: notice: =====> running as ../../dnssec-signer -v -v <=====
+2008-06-16 23:13:56.972: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-16 23:13:56.972: debug: Check RFC5011 status
+2008-06-16 23:13:56.972: debug: ->ksk5011status returns 0
+2008-06-16 23:13:56.972: debug: Check ksk status
+2008-06-16 23:13:56.973: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 28w3d14h49m32s
+2008-06-16 23:13:56.973: debug: Re-signing not necessary!
+2008-06-16 23:13:56.973: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-16 23:13:56.973: debug: Check RFC5011 status
+2008-06-16 23:13:56.973: debug: ->ksk5011status returns 2
+2008-06-16 23:13:56.973: debug: Re-signing not necessary!
+2008-06-16 23:13:56.973: notice: end of run: 0 errors occured
+2008-06-16 23:15:16.980: notice: ------------------------------------------------------------
+2008-06-16 23:15:16.982: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-16 23:15:16.982: debug: Check RFC5011 status
+2008-06-16 23:15:16.982: debug: ->ksk5011status returns 0
+2008-06-16 23:15:16.982: debug: Check ksk status
+2008-06-16 23:15:16.982: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 28w3d14h50m52s
+2008-06-16 23:15:16.982: debug: Re-signing not necessary!
+2008-06-16 23:15:16.982: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-16 23:15:16.982: debug: Check RFC5011 status
+2008-06-16 23:15:16.982: debug: ->ksk5011status returns 2
+2008-06-16 23:15:16.982: debug: Re-signing not necessary!
+2008-06-16 23:15:16.983: notice: end of run: 0 errors occured
+2008-06-16 23:18:48.101: notice: ------------------------------------------------------------
+2008-06-16 23:18:48.101: notice: running as ../../dnssec-signer -v -v
+2008-06-16 23:18:48.103: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-16 23:18:48.103: debug: Check RFC5011 status
+2008-06-16 23:18:48.103: debug: ->ksk5011status returns 0
+2008-06-16 23:18:48.103: debug: Check ksk status
+2008-06-16 23:18:48.103: warning: "sub.example.net.": lifetime of key signing key 54876 exceeded since 28w3d14h54m24s
+2008-06-16 23:18:48.103: debug: Re-signing not necessary!
+2008-06-16 23:18:48.103: debug:
+2008-06-16 23:18:48.103: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-16 23:18:48.104: debug: Check RFC5011 status
+2008-06-16 23:18:48.104: debug: ->ksk5011status returns 2
+2008-06-16 23:18:48.104: debug: Re-signing not necessary!
+2008-06-16 23:18:48.104: debug:
+2008-06-16 23:18:48.104: notice: end of run: 0 errors occured
+2008-06-24 14:55:16.347: notice: ------------------------------------------------------------
+2008-06-24 14:55:16.347: notice: running ../../dnssec-signer -v -v
+2008-06-24 14:55:16.349: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-24 14:55:16.349: debug: Check RFC5011 status
+2008-06-24 14:55:16.349: debug: ->ksk5011status returns 0
+2008-06-24 14:55:16.349: debug: Check ksk status
+2008-06-24 14:55:16.349: debug: Lifetime(390 sec) of depreciated key 44833 exceeded (483774 sec)
+2008-06-24 14:55:16.350: debug: ->remove it
+2008-06-24 14:55:16.350: debug: Lifetime(259200 +/-150 sec) of active key 55267 exceeded (483774 sec)
+2008-06-24 14:55:16.350: debug: ->depreciate it
+2008-06-24 14:55:16.350: debug: ->activate pre-publish key 56149
+2008-06-24 14:55:16.350: notice: "sub.example.net.": lifetime of zone signing key 55267 exceeded: ZSK rollover done
+2008-06-24 14:55:16.350: notice: "sub.example.net.": lifetime of zone signing key 56149 exceeded since 2d14h22m54s: ZSK rollover deferred: waiting for pre-publish key
+2008-06-24 14:55:16.350: debug: New pre-publish key needed
+2008-06-24 14:55:16.532: debug: ->creating new pre-publish key 2338
+2008-06-24 14:55:16.532: debug: Re-signing necessary: New zone key
+2008-06-24 14:55:16.533: notice: "sub.example.net.": re-signing triggered: New zone key
+2008-06-24 14:55:16.533: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-06-24 14:55:16.533: debug: Signing zone "sub.example.net."
+2008-06-24 14:55:16.533: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -p -d ../keysets -o sub.example.net. -e +172800 -g -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-06-24 14:55:16.776: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-24 14:55:16.776: debug: Signing completed after 0s.
+2008-06-24 14:55:16.776: debug:
+2008-06-24 14:55:16.776: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-24 14:55:16.776: debug: Check RFC5011 status
+2008-06-24 14:55:16.776: debug: ->ksk5011status returns 2
+2008-06-24 14:55:16.776: debug: Re-signing necessary: re-signing interval (2d) reached
+2008-06-24 14:55:16.776: notice: "example.net.": re-signing triggered: re-signing interval (2d) reached
+2008-06-24 14:55:16.776: debug: Writing key file "./example.net./dnskey.db"
+2008-06-24 14:55:16.777: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-06-24 14:55:16.777: debug: Signing zone "example.net."
+2008-06-24 14:55:16.777: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -p -d ../keysets -o example.net. -e +518400 -g zone.db K*.private"
+2008-06-24 14:55:16.922: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-24 14:55:16.922: debug: Signing completed after 0s.
+2008-06-24 14:55:16.922: debug:
+2008-06-24 14:55:16.922: notice: end of run: 0 errors occured
+2008-06-24 14:57:56.093: notice: ------------------------------------------------------------
+2008-06-24 14:57:56.094: notice: running ../../dnssec-signer -v -v
+2008-06-24 14:57:56.096: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-24 14:57:56.096: debug: Check RFC5011 status
+2008-06-24 14:57:56.096: debug: ->ksk5011status returns 0
+2008-06-24 14:57:56.096: debug: Check ksk status
+2008-06-24 14:57:56.097: debug: Re-signing not necessary!
+2008-06-24 14:57:56.097: debug:
+2008-06-24 14:57:56.097: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-24 14:57:56.097: debug: Check RFC5011 status
+2008-06-24 14:57:56.097: debug: ->ksk5011status returns 2
+2008-06-24 14:57:56.097: debug: Re-signing not necessary!
+2008-06-24 14:57:56.097: debug:
+2008-06-24 14:57:56.098: notice: end of run: 0 errors occured
+2008-06-24 23:26:12.632: notice: ------------------------------------------------------------
+2008-06-24 23:26:12.632: notice: running ../../dnssec-signer -v -v
+2008-06-24 23:26:12.648: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-06-24 23:26:12.648: debug: Check RFC5011 status
+2008-06-24 23:26:12.648: debug: ->ksk5011status returns 0
+2008-06-24 23:26:12.648: debug: Check ksk status
+2008-06-24 23:26:12.648: debug: Lifetime(390 sec) of depreciated key 55267 exceeded (30656 sec)
+2008-06-24 23:26:12.648: debug: ->remove it
+2008-06-24 23:26:12.648: debug: Re-signing necessary: New zone key
+2008-06-24 23:26:12.649: notice: "sub.example.net.": re-signing triggered: New zone key
+2008-06-24 23:26:12.649: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-06-24 23:26:12.655: debug: Signing zone "sub.example.net."
+2008-06-24 23:26:12.655: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -p -d ../keysets -o sub.example.net. -e +172800 -g -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-06-24 23:26:13.030: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-24 23:26:13.030: debug: Signing completed after 1s.
+2008-06-24 23:26:13.030: debug:
+2008-06-24 23:26:13.030: debug: parsing zone "example.net." in dir "./example.net."
+2008-06-24 23:26:13.030: debug: Check RFC5011 status
+2008-06-24 23:26:13.030: debug: ->ksk5011status returns 2
+2008-06-24 23:26:13.030: debug: Re-signing not necessary!
+2008-06-24 23:26:13.030: debug:
+2008-06-24 23:26:13.030: notice: end of run: 0 errors occured
+2008-07-08 00:53:55.013: notice: ------------------------------------------------------------
+2008-07-08 00:53:55.013: notice: running ../../dnssec-signer -v -v
+2008-07-08 00:53:55.015: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-08 00:53:55.015: debug: Check RFC5011 status
+2008-07-08 00:53:55.015: debug: ->ksk5011status returns 0
+2008-07-08 00:53:55.015: debug: Check KSK status
+2008-07-08 00:53:55.015: debug: Check ZSK status
+2008-07-08 00:53:55.015: debug: Lifetime(259200 +/-150 sec) of active key 56149 exceeded (1159119 sec)
+2008-07-08 00:53:55.015: debug: ->depreciate it
+2008-07-08 00:53:55.015: debug: ->activate pre-publish key 2338
+2008-07-08 00:53:55.018: notice: "sub.example.net.": lifetime of zone signing key 56149 exceeded: ZSK rollover done
+2008-07-08 00:53:55.018: debug: New pre-publish key needed
+2008-07-08 00:53:55.547: debug: ->creating new pre-publish key 9198
+2008-07-08 00:53:55.547: info: "sub.example.net.": new pre-publish key 9198 created
+2008-07-08 00:53:55.547: debug: Re-signing necessary: New zone key
+2008-07-08 00:53:55.548: notice: "sub.example.net.": re-signing triggered: New zone key
+2008-07-08 00:53:55.548: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-08 00:53:55.578: debug: Signing zone "sub.example.net."
+2008-07-08 00:53:55.578: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-08 00:53:55.708: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-08 00:53:55.708: debug: Signing completed after 0s.
+2008-07-08 00:53:55.708: debug:
+2008-07-08 00:53:55.708: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-08 00:53:55.708: debug: Check RFC5011 status
+2008-07-08 00:53:55.708: debug: ->ksk5011status returns 2
+2008-07-08 00:53:55.708: debug: Check ZSK status
+2008-07-08 00:53:55.708: debug: Lifetime(1209600 +/-150 sec) of active key 14939 exceeded (1642893 sec)
+2008-07-08 00:53:55.708: debug: ->waiting for pre-publish key
+2008-07-08 00:53:55.708: notice: "example.net.": lifetime of zone signing key 14939 exceeded since 5d21m33s: ZSK rollover deferred: waiting for pre-publish key
+2008-07-08 00:53:55.708: debug: New pre-publish key needed
+2008-07-08 00:53:55.747: debug: ->creating new pre-publish key 16682
+2008-07-08 00:53:55.747: info: "example.net.": new pre-publish key 16682 created
+2008-07-08 00:53:55.747: debug: Re-signing necessary: New zone key
+2008-07-08 00:53:55.747: notice: "example.net.": re-signing triggered: New zone key
+2008-07-08 00:53:55.747: debug: Writing key file "./example.net./dnskey.db"
+2008-07-08 00:53:55.748: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-08 00:53:55.748: debug: Signing zone "example.net."
+2008-07-08 00:53:55.748: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-08 00:53:55.899: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-08 00:53:55.899: debug: Signing completed after 0s.
+2008-07-08 00:53:55.899: debug:
+2008-07-08 00:53:55.899: notice: end of run: 0 errors occured
+2008-07-08 00:53:57.597: notice: ------------------------------------------------------------
+2008-07-08 00:53:57.597: notice: running ../../dnssec-signer -v -v
+2008-07-08 00:53:57.599: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-08 00:53:57.599: debug: Check RFC5011 status
+2008-07-08 00:53:57.599: debug: ->ksk5011status returns 0
+2008-07-08 00:53:57.599: debug: Check KSK status
+2008-07-08 00:53:57.599: debug: Check ZSK status
+2008-07-08 00:53:57.599: debug: Re-signing not necessary!
+2008-07-08 00:53:57.599: debug: Check if there is a parent file to copy
+2008-07-08 00:53:57.599: debug:
+2008-07-08 00:53:57.599: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-08 00:53:57.599: debug: Check RFC5011 status
+2008-07-08 00:53:57.599: debug: ->ksk5011status returns 2
+2008-07-08 00:53:57.599: debug: Check ZSK status
+2008-07-08 00:53:57.599: debug: Lifetime(1209600 +/-150 sec) of active key 14939 exceeded (1642895 sec)
+2008-07-08 00:53:57.599: debug: ->waiting for pre-publish key
+2008-07-08 00:53:57.600: notice: "example.net.": lifetime of zone signing key 14939 exceeded since 5d21m35s: ZSK rollover deferred: waiting for pre-publish key
+2008-07-08 00:53:57.600: debug: Re-signing not necessary!
+2008-07-08 00:53:57.600: debug: Check if there is a parent file to copy
+2008-07-08 00:53:57.600: debug:
+2008-07-08 00:53:57.600: notice: end of run: 0 errors occured
+2008-07-08 20:28:20.476: notice: ------------------------------------------------------------
+2008-07-08 20:28:20.476: notice: running ../../dnssec-signer -v -v -N named.conf
+2008-07-08 20:28:20.476: debug: parsing zone "sub.example.net." in dir "././sub.example.net."
+2008-07-08 20:28:20.476: debug: Check RFC5011 status
+2008-07-08 20:28:20.476: debug: ->ksk5011status returns 0
+2008-07-08 20:28:20.476: debug: Check KSK status
+2008-07-08 20:28:20.476: debug: Check ZSK status
+2008-07-08 20:28:20.476: debug: Lifetime(390 sec) of depreciated key 56149 exceeded (70465 sec)
+2008-07-08 20:28:20.476: info: "sub.example.net.": removed old ZSK 56149
+
+2008-07-08 20:28:20.656: debug: ->remove it
+2008-07-08 20:28:20.656: debug: Re-signing necessary: New zone key
+2008-07-08 20:28:20.656: notice: "sub.example.net.": re-signing triggered: New zone key
+2008-07-08 20:28:20.656: debug: Writing key file "././sub.example.net./dnskey.db"
+2008-07-08 20:28:20.656: debug: Signing zone "sub.example.net."
+2008-07-08 20:28:20.656: debug: Run cmd "cd ././sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-08 20:28:20.990: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-08 20:28:20.990: debug: Signing completed after 0s.
+2008-07-08 20:28:20.990: debug:
+2008-07-08 20:28:20.990: debug: parsing zone "example.net." in dir "././example.net."
+2008-07-08 20:28:20.990: debug: Check RFC5011 status
+2008-07-08 20:28:20.990: debug: ->ksk5011status returns 2
+2008-07-08 20:28:20.990: debug: Check ZSK status
+2008-07-08 20:28:20.990: debug: Lifetime(1209600 +/-150 sec) of active key 14939 exceeded (1713358 sec)
+2008-07-08 20:28:20.990: debug: ->depreciate it
+2008-07-08 20:28:20.990: debug: ->activate pre-publish key 16682
+2008-07-08 20:28:20.990: notice: "example.net.": lifetime of zone signing key 14939 exceeded: ZSK rollover done
+2008-07-08 20:28:20.990: debug: Re-signing necessary: New zone key
+2008-07-08 20:28:20.990: notice: "example.net.": re-signing triggered: New zone key
+2008-07-08 20:28:20.990: debug: Writing key file "././example.net./dnskey.db"
+2008-07-08 20:28:20.991: debug: Incrementing serial number in file "././example.net./zone.db"
+2008-07-08 20:28:20.991: debug: Signing zone "example.net."
+2008-07-08 20:28:20.991: debug: Run cmd "cd ././example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-08 20:28:21.112: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-08 20:28:21.112: debug: Signing completed after 1s.
+2008-07-08 20:28:21.112: debug:
+2008-07-08 20:28:21.113: notice: end of run: 0 errors occured
+2008-07-08 20:32:23.121: notice: ------------------------------------------------------------
+2008-07-08 20:32:23.121: notice: running ../../dnssec-signer -v -v
+2008-07-08 20:32:23.123: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-08 20:32:23.123: debug: Check RFC5011 status
+2008-07-08 20:32:23.124: debug: ->ksk5011status returns 0
+2008-07-08 20:32:23.124: debug: Check KSK status
+2008-07-08 20:32:23.124: debug: Check ZSK status
+2008-07-08 20:32:23.124: debug: Re-signing not necessary!
+2008-07-08 20:32:23.124: debug: Check if there is a parent file to copy
+2008-07-08 20:32:23.124: debug:
+2008-07-08 20:32:23.124: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-08 20:32:23.124: debug: Check RFC5011 status
+2008-07-08 20:32:23.124: debug: ->ksk5011status returns 2
+2008-07-08 20:32:23.124: debug: Check ZSK status
+2008-07-08 20:32:23.124: debug: Re-signing not necessary!
+2008-07-08 20:32:23.124: debug: Check if there is a parent file to copy
+2008-07-08 20:32:23.124: debug:
+2008-07-08 20:32:23.124: notice: end of run: 0 errors occured
+2008-07-08 20:32:30.246: notice: ------------------------------------------------------------
+2008-07-08 20:32:30.246: notice: running ../../dnssec-signer -v -v -N named.conf
+2008-07-08 20:32:30.246: debug: parsing zone "sub.example.net." in dir "././sub.example.net."
+2008-07-08 20:32:30.246: debug: Check RFC5011 status
+2008-07-08 20:32:30.246: debug: ->ksk5011status returns 0
+2008-07-08 20:32:30.246: debug: Check KSK status
+2008-07-08 20:32:30.246: debug: Check ZSK status
+2008-07-08 20:32:30.246: debug: Re-signing not necessary!
+2008-07-08 20:32:30.246: debug: Check if there is a parent file to copy
+2008-07-08 20:32:30.246: debug:
+2008-07-08 20:32:30.246: debug: parsing zone "example.net." in dir "././example.net."
+2008-07-08 20:32:30.246: debug: Check RFC5011 status
+2008-07-08 20:32:30.246: debug: ->ksk5011status returns 2
+2008-07-08 20:32:30.247: debug: Check ZSK status
+2008-07-08 20:32:30.247: debug: Re-signing not necessary!
+2008-07-08 20:32:30.247: debug: Check if there is a parent file to copy
+2008-07-08 20:32:30.247: debug:
+2008-07-08 20:32:30.247: notice: end of run: 0 errors occured
+2008-07-08 20:35:51.512: notice: ------------------------------------------------------------
+2008-07-08 20:35:51.512: notice: running ../../dnssec-signer -v -v -N named.conf
+2008-07-08 20:35:51.512: debug: parsing zone "sub.example.net." in dir "././sub.example.net."
+2008-07-08 20:35:51.512: debug: Check RFC5011 status
+2008-07-08 20:35:51.512: debug: ->ksk5011status returns 0
+2008-07-08 20:35:51.513: debug: Check KSK status
+2008-07-08 20:35:51.513: debug: Check ZSK status
+2008-07-08 20:35:51.513: debug: Re-signing not necessary!
+2008-07-08 20:35:51.513: debug: Check if there is a parent file to copy
+2008-07-08 20:35:51.513: debug:
+2008-07-08 20:35:51.513: debug: parsing zone "example.net." in dir "././example.net."
+2008-07-08 20:35:51.513: debug: Check RFC5011 status
+2008-07-08 20:35:51.513: debug: ->ksk5011status returns 2
+2008-07-08 20:35:51.513: debug: Check ZSK status
+2008-07-08 20:35:51.513: debug: Re-signing not necessary!
+2008-07-08 20:35:51.513: debug: Check if there is a parent file to copy
+2008-07-08 20:35:51.513: debug:
+2008-07-08 20:35:51.513: notice: end of run: 0 errors occured
+2008-07-08 20:37:16.569: notice: ------------------------------------------------------------
+2008-07-08 20:37:16.569: notice: running ../../dnssec-signer -v -v -N named.conf
+2008-07-08 20:37:16.569: debug: parsing zone "sub.example.net." in dir "././sub.example.net."
+2008-07-08 20:37:16.569: debug: Check RFC5011 status
+2008-07-08 20:37:16.569: debug: ->ksk5011status returns 0
+2008-07-08 20:37:16.570: debug: Check KSK status
+2008-07-08 20:37:16.570: debug: Check ZSK status
+2008-07-08 20:37:16.570: debug: Re-signing not necessary!
+2008-07-08 20:37:16.570: debug: Check if there is a parent file to copy
+2008-07-08 20:37:16.570: debug:
+2008-07-08 20:37:16.570: debug: parsing zone "example.net." in dir "././example.net."
+2008-07-08 20:37:16.570: debug: Check RFC5011 status
+2008-07-08 20:37:16.570: debug: ->ksk5011status returns 2
+2008-07-08 20:37:16.570: debug: Check ZSK status
+2008-07-08 20:37:16.570: debug: Re-signing not necessary!
+2008-07-08 20:37:16.570: debug: Check if there is a parent file to copy
+2008-07-08 20:37:16.570: debug:
+2008-07-08 20:37:16.570: notice: end of run: 0 errors occured
+2008-07-08 20:37:29.134: notice: ------------------------------------------------------------
+2008-07-08 20:37:29.134: notice: running ../../dnssec-signer -v -v
+2008-07-08 20:37:29.137: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-08 20:37:29.137: debug: Check RFC5011 status
+2008-07-08 20:37:29.137: debug: ->ksk5011status returns 0
+2008-07-08 20:37:29.137: debug: Check KSK status
+2008-07-08 20:37:29.137: debug: Check ZSK status
+2008-07-08 20:37:29.137: debug: Re-signing not necessary!
+2008-07-08 20:37:29.138: debug: Check if there is a parent file to copy
+2008-07-08 20:37:29.138: debug:
+2008-07-08 20:37:29.138: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-08 20:37:29.138: debug: Check RFC5011 status
+2008-07-08 20:37:29.138: debug: ->ksk5011status returns 2
+2008-07-08 20:37:29.138: debug: Check ZSK status
+2008-07-08 20:37:29.138: debug: Re-signing not necessary!
+2008-07-08 20:37:29.139: debug: Check if there is a parent file to copy
+2008-07-08 20:37:29.139: debug:
+2008-07-08 20:37:29.139: notice: end of run: 0 errors occured
+2008-07-08 20:39:39.895: notice: ------------------------------------------------------------
+2008-07-08 20:39:39.895: notice: running ../../dnssec-signer -N named.conf -v -v
+2008-07-08 20:39:39.895: debug: parsing zone "sub.example.net." in dir "././sub.example.net."
+2008-07-08 20:39:39.895: debug: Check RFC5011 status
+2008-07-08 20:39:39.895: debug: ->ksk5011status returns 0
+2008-07-08 20:39:39.895: debug: Check KSK status
+2008-07-08 20:39:39.895: debug: Check ZSK status
+2008-07-08 20:39:39.895: debug: Re-signing not necessary!
+2008-07-08 20:39:39.895: debug: Check if there is a parent file to copy
+2008-07-08 20:39:39.895: debug:
+2008-07-08 20:39:39.895: debug: parsing zone "example.net." in dir "././example.net."
+2008-07-08 20:39:39.895: debug: Check RFC5011 status
+2008-07-08 20:39:39.895: debug: ->ksk5011status returns 2
+2008-07-08 20:39:39.895: debug: Check ZSK status
+2008-07-08 20:39:39.895: debug: Re-signing not necessary!
+2008-07-08 20:39:39.895: debug: Check if there is a parent file to copy
+2008-07-08 20:39:39.895: debug:
+2008-07-08 20:39:39.895: notice: end of run: 0 errors occured
+2008-07-08 20:42:54.377: notice: ------------------------------------------------------------
+2008-07-08 20:42:54.377: notice: running ../../dnssec-signer -v -v -D .
+2008-07-08 20:42:54.377: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-08 20:42:54.377: debug: Check RFC5011 status
+2008-07-08 20:42:54.377: debug: ->ksk5011status returns 0
+2008-07-08 20:42:54.377: debug: Check KSK status
+2008-07-08 20:42:54.377: debug: Check ZSK status
+2008-07-08 20:42:54.377: debug: Re-signing not necessary!
+2008-07-08 20:42:54.377: debug: Check if there is a parent file to copy
+2008-07-08 20:42:54.377: debug:
+2008-07-08 20:42:54.377: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-08 20:42:54.378: debug: Check RFC5011 status
+2008-07-08 20:42:54.378: debug: ->ksk5011status returns 2
+2008-07-08 20:42:54.378: debug: Check ZSK status
+2008-07-08 20:42:54.378: debug: Re-signing not necessary!
+2008-07-08 20:42:54.378: debug: Check if there is a parent file to copy
+2008-07-08 20:42:54.378: debug:
+2008-07-08 20:42:54.378: notice: end of run: 0 errors occured
+2008-07-08 20:53:40.414: notice: ------------------------------------------------------------
+2008-07-08 20:53:40.414: notice: running ../../dnssec-signer -v -v -D .
+2008-07-08 20:53:40.417: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-08 20:53:40.417: debug: Check RFC5011 status
+2008-07-08 20:53:40.417: debug: ->ksk5011status returns 0
+2008-07-08 20:53:40.417: debug: Check KSK status
+2008-07-08 20:53:40.417: debug: Check ZSK status
+2008-07-08 20:53:40.417: debug: Re-signing not necessary!
+2008-07-08 20:53:40.417: debug: Check if there is a parent file to copy
+2008-07-08 20:53:40.417: debug:
+2008-07-08 20:53:40.417: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-08 20:53:40.417: debug: Check RFC5011 status
+2008-07-08 20:53:40.417: debug: ->ksk5011status returns 2
+2008-07-08 20:53:40.417: debug: Check ZSK status
+2008-07-08 20:53:40.417: debug: Re-signing not necessary!
+2008-07-08 20:53:40.418: debug: Check if there is a parent file to copy
+2008-07-08 20:53:40.418: debug:
+2008-07-08 20:53:40.418: notice: end of run: 0 errors occured
+2008-07-08 20:53:49.488: notice: ------------------------------------------------------------
+2008-07-08 20:53:49.488: notice: running ../../dnssec-signer -v -v -N named.conf
+2008-07-08 20:53:49.490: debug: parsing zone "sub.example.net." in dir "././sub.example.net."
+2008-07-08 20:53:49.490: debug: Check RFC5011 status
+2008-07-08 20:53:49.490: debug: ->ksk5011status returns 0
+2008-07-08 20:53:49.491: debug: Check KSK status
+2008-07-08 20:53:49.491: debug: Check ZSK status
+2008-07-08 20:53:49.491: debug: Re-signing not necessary!
+2008-07-08 20:53:49.491: debug: Check if there is a parent file to copy
+2008-07-08 20:53:49.491: debug:
+2008-07-08 20:53:49.491: debug: parsing zone "example.net." in dir "././example.net."
+2008-07-08 20:53:49.492: debug: Check RFC5011 status
+2008-07-08 20:53:49.492: debug: ->ksk5011status returns 2
+2008-07-08 20:53:49.492: debug: Check ZSK status
+2008-07-08 20:53:49.492: debug: Re-signing not necessary!
+2008-07-08 20:53:49.492: debug: Check if there is a parent file to copy
+2008-07-08 20:53:49.492: debug:
+2008-07-08 20:53:49.492: notice: end of run: 0 errors occured
+2008-07-09 00:42:08.103: notice: ------------------------------------------------------------
+2008-07-09 00:42:08.103: notice: running ../../dnssec-signer -v -v
+2008-07-09 00:42:08.106: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-09 00:42:08.106: debug: Check RFC5011 status
+2008-07-09 00:42:08.106: debug: ->ksk5011status returns 0
+2008-07-09 00:42:08.106: debug: Check KSK status
+2008-07-09 00:42:08.106: debug: ksk_rollover
+2008-07-09 00:42:08.106: debug: Check ZSK status
+2008-07-09 00:42:08.106: debug: Re-signing not necessary!
+2008-07-09 00:42:08.106: debug: Check if there is a parent file to copy
+2008-07-09 00:42:08.106: debug:
+2008-07-09 00:42:08.106: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-09 00:42:08.106: debug: Check RFC5011 status
+2008-07-09 00:42:08.106: debug: ->ksk5011status returns 2
+2008-07-09 00:42:08.106: debug: Check ZSK status
+2008-07-09 00:42:08.106: debug: Re-signing not necessary!
+2008-07-09 00:42:08.106: debug: Check if there is a parent file to copy
+2008-07-09 00:42:08.106: debug:
+2008-07-09 00:42:08.106: notice: end of run: 0 errors occured
+2008-07-09 00:45:19.663: notice: ------------------------------------------------------------
+2008-07-09 00:45:19.663: notice: running ../../dnssec-signer -v -v
+2008-07-09 00:45:19.665: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-09 00:45:19.665: debug: Check RFC5011 status
+2008-07-09 00:45:19.665: debug: ->ksk5011status returns 0
+2008-07-09 00:45:19.665: debug: Check KSK status
+2008-07-09 00:45:19.665: debug: Check ZSK status
+2008-07-09 00:45:19.665: debug: Re-signing not necessary!
+2008-07-09 00:45:19.665: debug: Check if there is a parent file to copy
+2008-07-09 00:45:19.665: debug:
+2008-07-09 00:45:19.665: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-09 00:45:19.665: debug: Check RFC5011 status
+2008-07-09 00:45:19.665: debug: ->ksk5011status returns 2
+2008-07-09 00:45:19.665: debug: Check ZSK status
+2008-07-09 00:45:19.665: debug: Re-signing not necessary!
+2008-07-09 00:45:19.665: debug: Check if there is a parent file to copy
+2008-07-09 00:45:19.665: debug:
+2008-07-09 00:45:19.665: notice: end of run: 0 errors occured
+2008-07-09 23:46:12.682: notice: ------------------------------------------------------------
+2008-07-09 23:46:12.682: notice: running ../../dnssec-signer -v -v -D /home/hoz/named/dnssec-signer/zkt-0.97/examples/flat/
+2008-07-09 23:46:12.702: debug: parsing zone "sub.example.net." in dir "/home/hoz/named/dnssec-signer/zkt-0.97/examples/flat/sub.example.net."
+2008-07-09 23:46:12.702: debug: Check RFC5011 status
+2008-07-09 23:46:12.702: debug: ->ksk5011status returns 0
+2008-07-09 23:46:12.702: debug: Check KSK status
+2008-07-09 23:46:12.702: debug: Check ZSK status
+2008-07-09 23:46:12.702: debug: Re-signing necessary: re-signing interval (1d) reached
+2008-07-09 23:46:12.702: notice: "sub.example.net.": re-signing triggered: re-signing interval (1d) reached
+2008-07-09 23:46:12.702: debug: Writing key file "/home/hoz/named/dnssec-signer/zkt-0.97/examples/flat/sub.example.net./dnskey.db"
+2008-07-09 23:46:12.702: debug: Signing zone "sub.example.net."
+2008-07-09 23:46:12.702: debug: Run cmd "cd /home/hoz/named/dnssec-signer/zkt-0.97/examples/flat/sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-09 23:46:13.222: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-09 23:46:13.222: debug: Signing completed after 1s.
+2008-07-09 23:46:13.222: debug:
+2008-07-09 23:46:13.222: debug: parsing zone "example.net." in dir "/home/hoz/named/dnssec-signer/zkt-0.97/examples/flat/example.net."
+2008-07-09 23:46:13.222: debug: Check RFC5011 status
+2008-07-09 23:46:13.222: debug: ->ksk5011status returns 2
+2008-07-09 23:46:13.222: debug: Check ZSK status
+2008-07-09 23:46:13.222: debug: Lifetime(29100 sec) of depreciated key 14939 exceeded (98273 sec)
+2008-07-09 23:46:13.222: info: "example.net.": removed old ZSK 14939
+
+2008-07-09 23:46:13.222: debug: ->remove it
+2008-07-09 23:46:13.222: debug: Re-signing necessary: New zone key
+2008-07-09 23:46:13.222: notice: "example.net.": re-signing triggered: New zone key
+2008-07-09 23:46:13.222: debug: Writing key file "/home/hoz/named/dnssec-signer/zkt-0.97/examples/flat/example.net./dnskey.db"
+2008-07-09 23:46:13.223: debug: Incrementing serial number in file "/home/hoz/named/dnssec-signer/zkt-0.97/examples/flat/example.net./zone.db"
+2008-07-09 23:46:13.223: debug: Signing zone "example.net."
+2008-07-09 23:46:13.223: debug: Run cmd "cd /home/hoz/named/dnssec-signer/zkt-0.97/examples/flat/example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-09 23:46:13.374: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-09 23:46:13.374: debug: Signing completed after 0s.
+2008-07-09 23:46:13.374: debug:
+2008-07-09 23:46:13.374: notice: end of run: 0 errors occured
+2008-07-15 00:21:04.641: notice: ------------------------------------------------------------
+2008-07-15 00:21:04.641: notice: running ../../dnssec-signer -r -v -v
+2008-07-15 00:21:05.071: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-15 00:21:05.071: debug: Check RFC5011 status
+2008-07-15 00:21:05.071: debug: ->ksk5011status returns 0
+2008-07-15 00:21:05.071: debug: Check KSK status
+2008-07-15 00:21:05.071: debug: Check ZSK status
+2008-07-15 00:21:05.071: debug: Lifetime(259200 +/-150 sec) of active key 2338 exceeded (602830 sec)
+2008-07-15 00:21:05.071: debug: ->depreciate it
+2008-07-15 00:21:05.072: debug: ->activate published key 9198
+2008-07-15 00:21:05.072: notice: "sub.example.net.": lifetime of zone signing key 2338 exceeded: ZSK rollover done
+2008-07-15 00:21:05.072: debug: New published key needed
+2008-07-15 00:21:05.128: debug: ->creating new published key 8397
+2008-07-15 00:21:05.128: info: "sub.example.net.": new published key 8397 created
+2008-07-15 00:21:05.128: debug: Re-signing necessary: New zone key
+2008-07-15 00:21:05.128: notice: "sub.example.net.": re-signing triggered: New zone key
+2008-07-15 00:21:05.129: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-15 00:21:05.129: debug: Signing zone "sub.example.net."
+2008-07-15 00:21:05.129: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-15 00:21:05.274: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-15 00:21:05.274: debug: Signing completed after 0s.
+2008-07-15 00:21:05.274: notice: "sub.example.net.": distribution triggered
+2008-07-15 00:21:05.275: debug: Distribute zone "sub.example.net."
+2008-07-15 00:21:05.275: debug: Run cmd "./dist.sh reload sub.example.net."
+2008-07-15 00:21:05.279: debug:
+2008-07-15 00:21:05.279: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-15 00:21:05.279: debug: Check RFC5011 status
+2008-07-15 00:21:05.279: debug: ->ksk5011status returns 2
+2008-07-15 00:21:05.279: debug: Check ZSK status
+2008-07-15 00:21:05.279: debug: Re-signing necessary: re-signing interval (2d) reached
+2008-07-15 00:21:05.279: notice: "example.net.": re-signing triggered: re-signing interval (2d) reached
+2008-07-15 00:21:05.279: debug: Writing key file "./example.net./dnskey.db"
+2008-07-15 00:21:05.280: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-15 00:21:05.280: debug: Signing zone "example.net."
+2008-07-15 00:21:05.280: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-15 00:21:05.418: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-15 00:21:05.419: debug: Signing completed after 0s.
+2008-07-15 00:21:05.419: notice: "example.net.": distribution triggered
+2008-07-15 00:21:05.419: debug: Distribute zone "example.net."
+2008-07-15 00:21:05.419: debug: Run cmd "./dist.sh reload example.net."
+2008-07-15 00:21:05.423: debug:
+2008-07-15 00:21:05.423: notice: end of run: 0 errors occured
+2008-07-15 00:21:18.128: notice: ------------------------------------------------------------
+2008-07-15 00:21:18.128: notice: running ../../dnssec-signer -r -v -v
+2008-07-15 00:21:18.130: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-15 00:21:18.130: debug: Check RFC5011 status
+2008-07-15 00:21:18.130: debug: ->ksk5011status returns 0
+2008-07-15 00:21:18.130: debug: Check KSK status
+2008-07-15 00:21:18.130: debug: Check ZSK status
+2008-07-15 00:21:18.130: debug: Re-signing not necessary!
+2008-07-15 00:21:18.130: debug: Check if there is a parent file to copy
+2008-07-15 00:21:18.130: debug:
+2008-07-15 00:21:18.130: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-15 00:21:18.131: debug: Check RFC5011 status
+2008-07-15 00:21:18.131: debug: ->ksk5011status returns 2
+2008-07-15 00:21:18.131: debug: Check ZSK status
+2008-07-15 00:21:18.131: debug: Re-signing not necessary!
+2008-07-15 00:21:18.131: debug: Check if there is a parent file to copy
+2008-07-15 00:21:18.131: debug:
+2008-07-15 00:21:18.131: notice: end of run: 0 errors occured
+2008-07-15 00:21:26.360: notice: ------------------------------------------------------------
+2008-07-15 00:21:26.360: notice: running ../../dnssec-signer -f -r -v -v
+2008-07-15 00:21:26.362: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-15 00:21:26.362: debug: Check RFC5011 status
+2008-07-15 00:21:26.362: debug: ->ksk5011status returns 0
+2008-07-15 00:21:26.362: debug: Check KSK status
+2008-07-15 00:21:26.362: debug: Check ZSK status
+2008-07-15 00:21:26.362: debug: Re-signing necessary: Option -f
+2008-07-15 00:21:26.362: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-15 00:21:26.362: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-15 00:21:26.363: debug: Signing zone "sub.example.net."
+2008-07-15 00:21:26.363: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-15 00:21:26.978: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-15 00:21:26.978: debug: Signing completed after 0s.
+2008-07-15 00:21:26.978: notice: "sub.example.net.": distribution triggered
+2008-07-15 00:21:26.978: debug: Distribute zone "sub.example.net."
+2008-07-15 00:21:26.978: debug: Run cmd "./dist.sh reload sub.example.net."
+2008-07-15 00:21:26.983: debug:
+2008-07-15 00:21:26.983: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-15 00:21:26.983: debug: Check RFC5011 status
+2008-07-15 00:21:26.983: debug: ->ksk5011status returns 2
+2008-07-15 00:21:26.983: debug: Check ZSK status
+2008-07-15 00:21:26.983: debug: Re-signing necessary: Option -f
+2008-07-15 00:21:26.983: notice: "example.net.": re-signing triggered: Option -f
+2008-07-15 00:21:26.983: debug: Writing key file "./example.net./dnskey.db"
+2008-07-15 00:21:26.983: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-15 00:21:26.983: debug: Signing zone "example.net."
+2008-07-15 00:21:26.983: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-15 00:21:27.122: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-15 00:21:27.122: debug: Signing completed after 1s.
+2008-07-15 00:21:27.122: notice: "example.net.": distribution triggered
+2008-07-15 00:21:27.122: debug: Distribute zone "example.net."
+2008-07-15 00:21:27.122: debug: Run cmd "./dist.sh reload example.net."
+2008-07-15 00:21:27.127: debug:
+2008-07-15 00:21:27.127: notice: end of run: 0 errors occured
+2008-07-15 00:21:52.947: notice: ------------------------------------------------------------
+2008-07-15 00:21:52.947: notice: running ../../dnssec-signer -f -r -v -v
+2008-07-15 00:21:52.951: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-15 00:21:52.951: debug: Check RFC5011 status
+2008-07-15 00:21:52.951: debug: ->ksk5011status returns 0
+2008-07-15 00:21:52.951: debug: Check KSK status
+2008-07-15 00:21:52.951: debug: Check ZSK status
+2008-07-15 00:21:52.951: debug: Re-signing necessary: Option -f
+2008-07-15 00:21:52.951: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-15 00:21:52.951: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-15 00:21:52.952: debug: Signing zone "sub.example.net."
+2008-07-15 00:21:52.952: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-15 00:21:53.119: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-15 00:21:53.119: debug: Signing completed after 1s.
+2008-07-15 00:21:53.120: notice: "sub.example.net.": distribution triggered
+2008-07-15 00:21:53.120: debug: Distribute zone "sub.example.net."
+2008-07-15 00:21:53.120: debug: Run cmd "./dist.sh reload sub.example.net."
+2008-07-15 00:21:53.126: debug:
+2008-07-15 00:21:53.126: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-15 00:21:53.126: debug: Check RFC5011 status
+2008-07-15 00:21:53.126: debug: ->ksk5011status returns 2
+2008-07-15 00:21:53.126: debug: Check ZSK status
+2008-07-15 00:21:53.126: debug: Re-signing necessary: Option -f
+2008-07-15 00:21:53.126: notice: "example.net.": re-signing triggered: Option -f
+2008-07-15 00:21:53.126: debug: Writing key file "./example.net./dnskey.db"
+2008-07-15 00:21:53.126: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-15 00:21:53.126: debug: Signing zone "example.net."
+2008-07-15 00:21:53.126: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-15 00:21:53.262: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-15 00:21:53.262: debug: Signing completed after 0s.
+2008-07-15 00:21:53.262: notice: "example.net.": distribution triggered
+2008-07-15 00:21:53.262: debug: Distribute zone "example.net."
+2008-07-15 00:21:53.262: debug: Run cmd "./dist.sh reload example.net."
+2008-07-15 00:21:53.268: debug:
+2008-07-15 00:21:53.268: notice: end of run: 0 errors occured
+2008-07-15 00:23:40.781: notice: ------------------------------------------------------------
+2008-07-15 00:23:40.781: notice: running ../../dnssec-signer -f -r -v -v
+2008-07-15 00:23:40.783: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-15 00:23:40.783: debug: Check RFC5011 status
+2008-07-15 00:23:40.783: debug: ->ksk5011status returns 0
+2008-07-15 00:23:40.783: debug: Check KSK status
+2008-07-15 00:23:40.783: debug: Check ZSK status
+2008-07-15 00:23:40.783: debug: Re-signing necessary: Option -f
+2008-07-15 00:23:40.783: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-15 00:23:40.783: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-15 00:23:40.786: debug: Signing zone "sub.example.net."
+2008-07-15 00:23:40.786: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-15 00:23:41.281: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-15 00:23:41.281: debug: Signing completed after 1s.
+2008-07-15 00:23:41.281: notice: "sub.example.net.": distribution triggered
+2008-07-15 00:23:41.281: debug: Distribute zone "sub.example.net."
+2008-07-15 00:23:41.281: debug: Run cmd "./dist.sh reload sub.example.net."
+2008-07-15 00:23:41.287: debug:
+2008-07-15 00:23:41.287: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-15 00:23:41.287: debug: Check RFC5011 status
+2008-07-15 00:23:41.287: debug: ->ksk5011status returns 2
+2008-07-15 00:23:41.287: debug: Check ZSK status
+2008-07-15 00:23:41.287: debug: Re-signing necessary: Option -f
+2008-07-15 00:23:41.287: notice: "example.net.": re-signing triggered: Option -f
+2008-07-15 00:23:41.288: debug: Writing key file "./example.net./dnskey.db"
+2008-07-15 00:23:41.288: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-15 00:23:41.288: debug: Signing zone "example.net."
+2008-07-15 00:23:41.289: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-15 00:23:41.561: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-15 00:23:41.561: debug: Signing completed after 0s.
+2008-07-15 00:23:41.561: notice: "example.net.": distribution triggered
+2008-07-15 00:23:41.561: debug: Distribute zone "example.net."
+2008-07-15 00:23:41.561: debug: Run cmd "./dist.sh reload example.net."
+2008-07-15 00:23:41.566: debug:
+2008-07-15 00:23:41.567: notice: end of run: 0 errors occured
+2008-07-15 00:31:10.917: notice: ------------------------------------------------------------
+2008-07-15 00:31:10.917: notice: running ../../dnssec-signer -f -r -v -v
+2008-07-15 00:31:10.923: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-15 00:31:10.923: debug: Check RFC5011 status
+2008-07-15 00:31:10.923: debug: ->ksk5011status returns 0
+2008-07-15 00:31:10.923: debug: Check KSK status
+2008-07-15 00:31:10.923: debug: Check ZSK status
+2008-07-15 00:31:10.923: debug: Lifetime(390 sec) of depreciated key 2338 exceeded (605 sec)
+2008-07-15 00:31:10.923: info: "sub.example.net.": removed old ZSK 2338
+
+2008-07-15 00:31:10.924: debug: ->remove it
+2008-07-15 00:31:10.924: debug: Re-signing necessary: Option -f
+2008-07-15 00:31:10.924: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-15 00:31:10.924: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-15 00:31:11.347: debug: Signing zone "sub.example.net."
+2008-07-15 00:31:11.347: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-15 00:31:11.571: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-15 00:31:11.571: debug: Signing completed after 0s.
+2008-07-15 00:31:11.571: notice: "sub.example.net.": distribution triggered
+2008-07-15 00:31:11.571: debug: Distribute zone "sub.example.net."
+2008-07-15 00:31:11.571: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-15 00:31:11.579: debug: ./dist.sh reload return: "scp ./sub.example.net./zone.db.signed :/sub.example.net."
+2008-07-15 00:31:11.579: debug:
+2008-07-15 00:31:11.580: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-15 00:31:11.580: debug: Check RFC5011 status
+2008-07-15 00:31:11.580: debug: ->ksk5011status returns 2
+2008-07-15 00:31:11.580: debug: Check ZSK status
+2008-07-15 00:31:11.580: debug: Re-signing necessary: Option -f
+2008-07-15 00:31:11.580: notice: "example.net.": re-signing triggered: Option -f
+2008-07-15 00:31:11.580: debug: Writing key file "./example.net./dnskey.db"
+2008-07-15 00:31:11.581: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-15 00:31:11.581: debug: Signing zone "example.net."
+2008-07-15 00:31:11.581: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-15 00:31:11.698: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-15 00:31:11.698: debug: Signing completed after 0s.
+2008-07-15 00:31:11.698: notice: "example.net.": distribution triggered
+2008-07-15 00:31:11.698: debug: Distribute zone "example.net."
+2008-07-15 00:31:11.698: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-15 00:31:11.704: debug: ./dist.sh reload return: "scp ./example.net./zone.db.signed :/example.net."
+2008-07-15 00:31:11.704: debug:
+2008-07-15 00:31:11.704: notice: end of run: 0 errors occured
+2008-07-15 00:32:00.676: notice: ------------------------------------------------------------
+2008-07-15 00:32:00.676: notice: running ../../dnssec-signer -f -r -v -v
+2008-07-15 00:32:00.678: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-15 00:32:00.678: debug: Check RFC5011 status
+2008-07-15 00:32:00.678: debug: ->ksk5011status returns 0
+2008-07-15 00:32:00.678: debug: Check KSK status
+2008-07-15 00:32:00.678: debug: Check ZSK status
+2008-07-15 00:32:00.678: debug: Re-signing necessary: Option -f
+2008-07-15 00:32:00.678: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-15 00:32:00.678: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-15 00:32:00.679: debug: Signing zone "sub.example.net."
+2008-07-15 00:32:00.679: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-15 00:32:01.282: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-15 00:32:01.282: debug: Signing completed after 1s.
+2008-07-15 00:32:01.282: notice: "sub.example.net.": distribution triggered
+2008-07-15 00:32:01.282: debug: Distribute zone "sub.example.net."
+2008-07-15 00:32:01.282: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-15 00:32:01.289: debug: ./dist.sh reload return: "scp ./sub.example.net./zone.db.signed localhost:/sub.example.net."
+2008-07-15 00:32:01.289: debug:
+2008-07-15 00:32:01.289: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-15 00:32:01.289: debug: Check RFC5011 status
+2008-07-15 00:32:01.289: debug: ->ksk5011status returns 2
+2008-07-15 00:32:01.289: debug: Check ZSK status
+2008-07-15 00:32:01.290: debug: Re-signing necessary: Option -f
+2008-07-15 00:32:01.290: notice: "example.net.": re-signing triggered: Option -f
+2008-07-15 00:32:01.290: debug: Writing key file "./example.net./dnskey.db"
+2008-07-15 00:32:01.291: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-15 00:32:01.291: debug: Signing zone "example.net."
+2008-07-15 00:32:01.291: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-15 00:32:01.405: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-15 00:32:01.405: debug: Signing completed after 0s.
+2008-07-15 00:32:01.406: notice: "example.net.": distribution triggered
+2008-07-15 00:32:01.406: debug: Distribute zone "example.net."
+2008-07-15 00:32:01.406: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-15 00:32:01.412: debug: ./dist.sh reload return: "scp ./example.net./zone.db.signed localhost:/example.net."
+2008-07-15 00:32:01.412: debug:
+2008-07-15 00:32:01.412: notice: end of run: 0 errors occured
+2008-07-15 00:33:00.866: notice: ------------------------------------------------------------
+2008-07-15 00:33:00.867: notice: running ../../dnssec-signer -f -r -v -v
+2008-07-15 00:33:00.869: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-15 00:33:00.869: debug: Check RFC5011 status
+2008-07-15 00:33:00.869: debug: ->ksk5011status returns 0
+2008-07-15 00:33:00.869: debug: Check KSK status
+2008-07-15 00:33:00.869: debug: Check ZSK status
+2008-07-15 00:33:00.869: debug: Re-signing necessary: Option -f
+2008-07-15 00:33:00.870: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-15 00:33:00.870: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-15 00:33:00.870: debug: Signing zone "sub.example.net."
+2008-07-15 00:33:00.870: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-15 00:33:01.531: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-15 00:33:01.531: debug: Signing completed after 1s.
+2008-07-15 00:33:01.531: notice: "sub.example.net.": distribution triggered
+2008-07-15 00:33:01.531: debug: Distribute zone "sub.example.net."
+2008-07-15 00:33:01.531: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-15 00:33:01.537: debug: ./dist.sh reload return: "scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net."
+2008-07-15 00:33:01.537: debug:
+2008-07-15 00:33:01.537: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-15 00:33:01.538: debug: Check RFC5011 status
+2008-07-15 00:33:01.538: debug: ->ksk5011status returns 2
+2008-07-15 00:33:01.538: debug: Check ZSK status
+2008-07-15 00:33:01.538: debug: Re-signing necessary: Option -f
+2008-07-15 00:33:01.538: notice: "example.net.": re-signing triggered: Option -f
+2008-07-15 00:33:01.538: debug: Writing key file "./example.net./dnskey.db"
+2008-07-15 00:33:01.539: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-15 00:33:01.539: debug: Signing zone "example.net."
+2008-07-15 00:33:01.539: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-15 00:33:01.655: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-15 00:33:01.655: debug: Signing completed after 0s.
+2008-07-15 00:33:01.655: notice: "example.net.": distribution triggered
+2008-07-15 00:33:01.655: debug: Distribute zone "example.net."
+2008-07-15 00:33:01.656: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-15 00:33:01.661: debug: ./dist.sh reload return: "scp ./example.net./zone.db.signed localhost:/var/named/example.net."
+2008-07-15 00:33:01.662: debug:
+2008-07-15 00:33:01.662: notice: end of run: 0 errors occured
+2008-07-15 00:34:09.259: notice: ------------------------------------------------------------
+2008-07-15 00:34:09.259: notice: running ../../dnssec-signer -f -r -v -v
+2008-07-15 00:34:09.261: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-15 00:34:09.261: debug: Check RFC5011 status
+2008-07-15 00:34:09.261: debug: ->ksk5011status returns 0
+2008-07-15 00:34:09.261: debug: Check KSK status
+2008-07-15 00:34:09.261: debug: Check ZSK status
+2008-07-15 00:34:09.261: debug: Re-signing necessary: Option -f
+2008-07-15 00:34:09.261: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-15 00:34:09.261: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-15 00:34:09.261: debug: Signing zone "sub.example.net."
+2008-07-15 00:34:09.261: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-15 00:34:10.245: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-15 00:34:10.245: debug: Signing completed after 1s.
+2008-07-15 00:34:10.245: notice: "sub.example.net.": distribution triggered
+2008-07-15 00:34:10.245: debug: Distribute zone "sub.example.net."
+2008-07-15 00:34:10.245: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-15 00:34:10.251: debug: ./dist.sh reload return: "scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net./"
+2008-07-15 00:34:10.252: debug:
+2008-07-15 00:34:10.252: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-15 00:34:10.252: debug: Check RFC5011 status
+2008-07-15 00:34:10.252: debug: ->ksk5011status returns 2
+2008-07-15 00:34:10.252: debug: Check ZSK status
+2008-07-15 00:34:10.252: debug: Re-signing necessary: Option -f
+2008-07-15 00:34:10.252: notice: "example.net.": re-signing triggered: Option -f
+2008-07-15 00:34:10.252: debug: Writing key file "./example.net./dnskey.db"
+2008-07-15 00:34:10.252: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-15 00:34:10.252: debug: Signing zone "example.net."
+2008-07-15 00:34:10.252: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-15 00:34:10.369: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-15 00:34:10.369: debug: Signing completed after 0s.
+2008-07-15 00:34:10.369: notice: "example.net.": distribution triggered
+2008-07-15 00:34:10.369: debug: Distribute zone "example.net."
+2008-07-15 00:34:10.369: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-15 00:34:10.375: debug: ./dist.sh reload return: "scp ./example.net./zone.db.signed localhost:/var/named/example.net./"
+2008-07-15 00:34:10.375: debug:
+2008-07-15 00:34:10.375: notice: end of run: 0 errors occured
+2008-07-18 00:38:52.860: notice: ------------------------------------------------------------
+2008-07-18 00:38:52.860: notice: running ../../dnssec-signer -v -v
+2008-07-18 00:38:52.862: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-18 00:38:52.862: debug: Check RFC5011 status
+2008-07-18 00:38:52.862: debug: ->ksk5011status returns 0
+2008-07-18 00:38:52.862: debug: Check KSK status
+2008-07-18 00:38:52.862: debug: Check ZSK status
+2008-07-18 00:38:52.862: debug: Lifetime(259200 +/-150 sec) of active key 9198 exceeded (260267 sec)
+2008-07-18 00:38:52.862: debug: ->depreciate it
+2008-07-18 00:38:52.862: debug: ->activate published key 8397
+2008-07-18 00:38:52.862: notice: "sub.example.net.": lifetime of zone signing key 9198 exceeded: ZSK rollover done
+2008-07-18 00:38:52.862: debug: New published key needed
+2008-07-18 00:38:53.418: debug: ->creating new published key 31081
+2008-07-18 00:38:53.418: info: "sub.example.net.": new key 31081 generated for publishing
+2008-07-18 00:38:53.418: debug: Re-signing necessary: New zone key
+2008-07-18 00:38:53.418: notice: "sub.example.net.": re-signing triggered: New zone key
+2008-07-18 00:38:53.418: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-18 00:38:53.419: debug: Signing zone "sub.example.net."
+2008-07-18 00:38:53.419: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-18 00:38:53.556: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-18 00:38:53.556: debug: Signing completed after 0s.
+2008-07-18 00:38:53.556: debug:
+2008-07-18 00:38:53.556: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-18 00:38:53.557: debug: Check RFC5011 status
+2008-07-18 00:38:53.557: debug: ->ksk5011status returns 2
+2008-07-18 00:38:53.557: debug: Check ZSK status
+2008-07-18 00:38:53.557: debug: Re-signing necessary: re-signing interval (2d) reached
+2008-07-18 00:38:53.557: notice: "example.net.": re-signing triggered: re-signing interval (2d) reached
+2008-07-18 00:38:53.557: debug: Writing key file "./example.net./dnskey.db"
+2008-07-18 00:38:53.558: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-18 00:38:53.558: debug: Signing zone "example.net."
+2008-07-18 00:38:53.559: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-18 00:38:53.715: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-18 00:38:53.715: debug: Signing completed after 0s.
+2008-07-18 00:38:53.715: debug:
+2008-07-18 00:38:53.716: notice: end of run: 0 errors occured
+2008-07-18 00:39:29.824: notice: ------------------------------------------------------------
+2008-07-18 00:39:29.824: notice: running ../../dnssec-signer -r -v -v
+2008-07-18 00:39:29.827: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-18 00:39:29.827: debug: Check RFC5011 status
+2008-07-18 00:39:29.827: debug: ->ksk5011status returns 0
+2008-07-18 00:39:29.827: debug: Check KSK status
+2008-07-18 00:39:29.827: debug: Check ZSK status
+2008-07-18 00:39:29.827: debug: Re-signing not necessary!
+2008-07-18 00:39:29.827: debug: Check if there is a parent file to copy
+2008-07-18 00:39:29.827: debug:
+2008-07-18 00:39:29.827: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-18 00:39:29.827: debug: Check RFC5011 status
+2008-07-18 00:39:29.827: debug: ->ksk5011status returns 2
+2008-07-18 00:39:29.827: debug: Check ZSK status
+2008-07-18 00:39:29.827: debug: Re-signing not necessary!
+2008-07-18 00:39:29.827: debug: Check if there is a parent file to copy
+2008-07-18 00:39:29.827: debug:
+2008-07-18 00:39:29.828: notice: end of run: 0 errors occured
+2008-07-18 00:39:36.641: notice: ------------------------------------------------------------
+2008-07-18 00:39:36.641: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-18 00:39:36.644: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-18 00:39:36.644: debug: Check RFC5011 status
+2008-07-18 00:39:36.644: debug: ->ksk5011status returns 0
+2008-07-18 00:39:36.644: debug: Check KSK status
+2008-07-18 00:39:36.644: debug: Check ZSK status
+2008-07-18 00:39:36.644: debug: Re-signing necessary: Option -f
+2008-07-18 00:39:36.644: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-18 00:39:36.644: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-18 00:39:36.644: debug: Signing zone "sub.example.net."
+2008-07-18 00:39:36.644: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-18 00:39:37.144: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-18 00:39:37.144: debug: Signing completed after 1s.
+2008-07-18 00:39:37.144: notice: "sub.example.net.": distribution triggered
+2008-07-18 00:39:37.144: debug: Distribute zone "sub.example.net."
+2008-07-18 00:39:37.144: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-18 00:39:37.151: debug: ./dist.sh reload return: "scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net./"
+2008-07-18 00:39:37.151: debug:
+2008-07-18 00:39:37.151: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-18 00:39:37.151: debug: Check RFC5011 status
+2008-07-18 00:39:37.151: debug: ->ksk5011status returns 2
+2008-07-18 00:39:37.151: debug: Check ZSK status
+2008-07-18 00:39:37.151: debug: Re-signing necessary: Option -f
+2008-07-18 00:39:37.151: notice: "example.net.": re-signing triggered: Option -f
+2008-07-18 00:39:37.151: debug: Writing key file "./example.net./dnskey.db"
+2008-07-18 00:39:37.152: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-18 00:39:37.152: debug: Signing zone "example.net."
+2008-07-18 00:39:37.152: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-18 00:39:37.313: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-18 00:39:37.313: debug: Signing completed after 0s.
+2008-07-18 00:39:37.313: notice: "example.net.": distribution triggered
+2008-07-18 00:39:37.313: debug: Distribute zone "example.net."
+2008-07-18 00:39:37.313: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-18 00:39:37.319: debug: ./dist.sh reload return: "scp ./example.net./zone.db.signed localhost:/var/named/example.net./"
+2008-07-18 00:39:37.319: debug:
+2008-07-18 00:39:37.319: notice: end of run: 0 errors occured
+2008-07-18 00:42:39.912: notice: ------------------------------------------------------------
+2008-07-18 00:42:39.912: notice: running ../../dnssec-signer -v -v
+2008-07-18 00:42:39.914: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-18 00:42:39.914: debug: Check RFC5011 status
+2008-07-18 00:42:39.914: debug: ->ksk5011status returns 0
+2008-07-18 00:42:39.914: debug: Check KSK status
+2008-07-18 00:42:39.914: debug: Check ZSK status
+2008-07-18 00:42:39.914: debug: Re-signing not necessary!
+2008-07-18 00:42:39.914: debug: Check if there is a parent file to copy
+2008-07-18 00:42:39.914: debug:
+2008-07-18 00:42:39.914: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-18 00:42:39.914: debug: Check RFC5011 status
+2008-07-18 00:42:39.914: debug: ->ksk5011status returns 2
+2008-07-18 00:42:39.914: debug: Check ZSK status
+2008-07-18 00:42:39.914: debug: Re-signing not necessary!
+2008-07-18 00:42:39.914: debug: Check if there is a parent file to copy
+2008-07-18 00:42:39.914: debug:
+2008-07-18 00:42:39.914: notice: end of run: 0 errors occured
+2008-07-22 00:10:38.346: notice: ------------------------------------------------------------
+2008-07-22 00:10:38.346: notice: running ../../dnssec-signer -v -v
+2008-07-22 00:10:38.349: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-22 00:10:38.349: debug: Check RFC5011 status
+2008-07-22 00:10:38.349: debug: ->ksk5011status returns 0
+2008-07-22 00:10:38.349: debug: Check KSK status
+2008-07-22 00:10:38.349: debug: Check ZSK status
+2008-07-22 00:10:38.349: debug: Lifetime(390 sec) of depreciated key 9198 exceeded (343906 sec)
+2008-07-22 00:10:38.349: info: "sub.example.net.": removed old ZSK 9198
+
+2008-07-22 00:10:38.349: debug: ->remove it
+2008-07-22 00:10:38.349: debug: Lifetime(259200 +/-150 sec) of active key 8397 exceeded (343906 sec)
+2008-07-22 00:10:38.349: debug: ->depreciate it
+2008-07-22 00:10:38.349: debug: ->activate published key 31081
+2008-07-22 00:10:38.349: notice: "sub.example.net.": lifetime of zone signing key 8397 exceeded: ZSK rollover done
+2008-07-22 00:10:38.349: debug: New published key needed
+2008-07-22 00:10:38.870: debug: ->creating new published key 3615
+2008-07-22 00:10:38.870: info: "sub.example.net.": new key 3615 generated for publishing
+2008-07-22 00:10:38.870: debug: Re-signing necessary: New zone key
+2008-07-22 00:10:38.870: notice: "sub.example.net.": re-signing triggered: New zone key
+2008-07-22 00:10:38.870: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-22 00:10:38.871: debug: Signing zone "sub.example.net."
+2008-07-22 00:10:38.871: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-22 00:10:39.208: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:10:39.208: debug: Signing completed after 1s.
+2008-07-22 00:10:39.208: debug:
+2008-07-22 00:10:39.208: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-22 00:10:39.208: debug: Check RFC5011 status
+2008-07-22 00:10:39.208: debug: ->ksk5011status returns 2
+2008-07-22 00:10:39.208: debug: Check ZSK status
+2008-07-22 00:10:39.208: debug: New published key needed
+2008-07-22 00:10:39.255: debug: ->creating new published key 41300
+2008-07-22 00:10:39.255: info: "example.net.": new key 41300 generated for publishing
+2008-07-22 00:10:39.255: debug: Re-signing necessary: New zone key
+2008-07-22 00:10:39.255: notice: "example.net.": re-signing triggered: New zone key
+2008-07-22 00:10:39.255: debug: Writing key file "./example.net./dnskey.db"
+2008-07-22 00:10:39.256: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-22 00:10:39.256: debug: Signing zone "example.net."
+2008-07-22 00:10:39.256: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-22 00:10:39.414: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:10:39.414: debug: Signing completed after 0s.
+2008-07-22 00:10:39.414: debug:
+2008-07-22 00:10:39.414: notice: end of run: 0 errors occured
+2008-07-22 00:16:04.680: notice: ------------------------------------------------------------
+2008-07-22 00:16:04.680: notice: running ../../dnssec-signer -v -v
+2008-07-22 00:16:04.682: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-22 00:16:04.682: debug: Check RFC5011 status
+2008-07-22 00:16:04.682: debug: ->ksk5011status returns 0
+2008-07-22 00:16:04.683: debug: Check KSK status
+2008-07-22 00:16:04.683: debug: Check ZSK status
+2008-07-22 00:16:04.683: debug: Re-signing not necessary!
+2008-07-22 00:16:04.683: debug: Check if there is a parent file to copy
+2008-07-22 00:16:04.683: debug:
+2008-07-22 00:16:04.683: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-22 00:16:04.683: debug: Check RFC5011 status
+2008-07-22 00:16:04.683: debug: ->ksk5011status returns 2
+2008-07-22 00:16:04.684: debug: Check ZSK status
+2008-07-22 00:16:04.684: debug: Re-signing not necessary!
+2008-07-22 00:16:04.684: debug: Check if there is a parent file to copy
+2008-07-22 00:16:04.684: debug:
+2008-07-22 00:16:04.684: notice: end of run: 0 errors occured
+2008-07-22 00:16:09.309: notice: ------------------------------------------------------------
+2008-07-22 00:16:09.309: notice: running ../../dnssec-signer -r -v -v
+2008-07-22 00:16:09.311: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-22 00:16:09.311: debug: Check RFC5011 status
+2008-07-22 00:16:09.311: debug: ->ksk5011status returns 0
+2008-07-22 00:16:09.312: debug: Check KSK status
+2008-07-22 00:16:09.312: debug: Check ZSK status
+2008-07-22 00:16:09.312: debug: Re-signing not necessary!
+2008-07-22 00:16:09.312: debug: Check if there is a parent file to copy
+2008-07-22 00:16:09.312: debug:
+2008-07-22 00:16:09.312: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-22 00:16:09.312: debug: Check RFC5011 status
+2008-07-22 00:16:09.312: debug: ->ksk5011status returns 2
+2008-07-22 00:16:09.313: debug: Check ZSK status
+2008-07-22 00:16:09.313: debug: Re-signing not necessary!
+2008-07-22 00:16:09.313: debug: Check if there is a parent file to copy
+2008-07-22 00:16:09.313: debug:
+2008-07-22 00:16:09.313: notice: end of run: 0 errors occured
+2008-07-22 00:16:13.285: notice: ------------------------------------------------------------
+2008-07-22 00:16:13.285: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-22 00:16:13.287: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-22 00:16:13.287: debug: Check RFC5011 status
+2008-07-22 00:16:13.287: debug: ->ksk5011status returns 0
+2008-07-22 00:16:13.287: debug: Check KSK status
+2008-07-22 00:16:13.287: debug: Check ZSK status
+2008-07-22 00:16:13.287: debug: Re-signing necessary: Option -f
+2008-07-22 00:16:13.287: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-22 00:16:13.287: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-22 00:16:13.287: debug: Signing zone "sub.example.net."
+2008-07-22 00:16:13.287: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-22 00:16:13.822: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:16:13.822: debug: Signing completed after 0s.
+2008-07-22 00:16:13.822: notice: "sub.example.net.": distribution triggered
+2008-07-22 00:16:13.822: debug: Distribute zone "sub.example.net."
+2008-07-22 00:16:13.822: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-22 00:16:13.828: debug: ./dist.sh reload return: "scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net./"
+2008-07-22 00:16:13.828: debug:
+2008-07-22 00:16:13.829: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-22 00:16:13.829: debug: Check RFC5011 status
+2008-07-22 00:16:13.829: debug: ->ksk5011status returns 2
+2008-07-22 00:16:13.829: debug: Check ZSK status
+2008-07-22 00:16:13.829: debug: Re-signing necessary: Option -f
+2008-07-22 00:16:13.829: notice: "example.net.": re-signing triggered: Option -f
+2008-07-22 00:16:13.829: debug: Writing key file "./example.net./dnskey.db"
+2008-07-22 00:16:13.830: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-22 00:16:13.830: debug: Signing zone "example.net."
+2008-07-22 00:16:13.830: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-22 00:16:13.976: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:16:13.976: debug: Signing completed after 0s.
+2008-07-22 00:16:13.977: notice: "example.net.": distribution triggered
+2008-07-22 00:16:13.977: debug: Distribute zone "example.net."
+2008-07-22 00:16:13.977: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-22 00:16:13.983: debug: ./dist.sh reload return: "scp ./example.net./zone.db.signed localhost:/var/named/example.net./"
+2008-07-22 00:16:13.983: debug:
+2008-07-22 00:16:13.983: notice: end of run: 0 errors occured
+2008-07-22 00:20:56.119: notice: ------------------------------------------------------------
+2008-07-22 00:20:56.119: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-22 00:20:56.121: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-22 00:20:56.121: debug: Check RFC5011 status
+2008-07-22 00:20:56.121: debug: ->ksk5011status returns 0
+2008-07-22 00:20:56.121: debug: Check KSK status
+2008-07-22 00:20:56.121: debug: Check ZSK status
+2008-07-22 00:20:56.121: debug: Lifetime(390 sec) of depreciated key 8397 exceeded (618 sec)
+2008-07-22 00:20:56.121: info: "sub.example.net.": removed old ZSK 8397
+
+2008-07-22 00:20:56.122: debug: ->remove it
+2008-07-22 00:20:56.122: debug: Re-signing necessary: Option -f
+2008-07-22 00:20:56.122: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-22 00:20:56.122: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-22 00:20:56.122: debug: Signing zone "sub.example.net."
+2008-07-22 00:20:56.122: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-22 00:20:56.627: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:20:56.627: debug: Signing completed after 0s.
+2008-07-22 00:20:56.627: notice: "sub.example.net.": distribution triggered
+2008-07-22 00:20:56.627: debug: Distribute zone "sub.example.net."
+2008-07-22 00:20:56.627: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-22 00:20:56.634: debug: ./dist.sh reload return: "scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net./"
+2008-07-22 00:20:56.635: debug:
+2008-07-22 00:20:56.635: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-22 00:20:56.635: debug: Check RFC5011 status
+2008-07-22 00:20:56.635: debug: ->ksk5011status returns 2
+2008-07-22 00:20:56.635: debug: Check ZSK status
+2008-07-22 00:20:56.635: debug: Re-signing necessary: Option -f
+2008-07-22 00:20:56.635: notice: "example.net.": re-signing triggered: Option -f
+2008-07-22 00:20:56.635: debug: Writing key file "./example.net./dnskey.db"
+2008-07-22 00:20:56.636: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-22 00:20:56.636: debug: Signing zone "example.net."
+2008-07-22 00:20:56.637: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-22 00:20:56.760: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:20:56.760: debug: Signing completed after 0s.
+2008-07-22 00:20:56.760: notice: "example.net.": distribution triggered
+2008-07-22 00:20:56.760: debug: Distribute zone "example.net."
+2008-07-22 00:20:56.760: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-22 00:20:56.768: debug: ./dist.sh reload return: "scp ./example.net./zone.db.signed localhost:/var/named/example.net./"
+2008-07-22 00:20:56.769: debug:
+2008-07-22 00:20:56.769: notice: end of run: 0 errors occured
+2008-07-22 00:23:51.528: notice: ------------------------------------------------------------
+2008-07-22 00:23:51.528: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-22 00:23:51.530: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-22 00:23:51.530: debug: Check RFC5011 status
+2008-07-22 00:23:51.530: debug: ->ksk5011status returns 0
+2008-07-22 00:23:51.531: debug: Check KSK status
+2008-07-22 00:23:51.531: debug: Check ZSK status
+2008-07-22 00:23:51.531: debug: Re-signing necessary: Option -f
+2008-07-22 00:23:51.531: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-22 00:23:51.531: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-22 00:23:51.531: debug: Signing zone "sub.example.net."
+2008-07-22 00:23:51.532: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-22 00:23:52.042: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:23:52.042: debug: Signing completed after 1s.
+2008-07-22 00:23:52.042: notice: "sub.example.net.": distribution triggered
+2008-07-22 00:23:52.042: debug: Distribute zone "sub.example.net."
+2008-07-22 00:23:52.043: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-22 00:23:52.049: debug: ./dist.sh reload return: "scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net./"
+2008-07-22 00:23:52.049: debug:
+2008-07-22 00:23:52.049: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-22 00:23:52.049: debug: Check RFC5011 status
+2008-07-22 00:23:52.049: debug: ->ksk5011status returns 2
+2008-07-22 00:23:52.049: debug: Check ZSK status
+2008-07-22 00:23:52.049: debug: Re-signing necessary: Option -f
+2008-07-22 00:23:52.049: notice: "example.net.": re-signing triggered: Option -f
+2008-07-22 00:23:52.049: debug: Writing key file "./example.net./dnskey.db"
+2008-07-22 00:23:52.050: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-22 00:23:52.050: debug: Signing zone "example.net."
+2008-07-22 00:23:52.050: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-22 00:23:52.176: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:23:52.176: debug: Signing completed after 0s.
+2008-07-22 00:23:52.176: notice: "example.net.": distribution triggered
+2008-07-22 00:23:52.176: debug: Distribute zone "example.net."
+2008-07-22 00:23:52.176: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-22 00:23:52.185: debug: ./dist.sh reload return: "scp ./example.net./zone.db.signed localhost:/var/named/example.net./"
+2008-07-22 00:23:52.185: debug:
+2008-07-22 00:23:52.185: notice: end of run: 0 errors occured
+2008-07-22 00:24:09.609: notice: ------------------------------------------------------------
+2008-07-22 00:24:09.609: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-22 00:24:09.614: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-22 00:24:09.614: debug: Check RFC5011 status
+2008-07-22 00:24:09.614: debug: ->ksk5011status returns 0
+2008-07-22 00:24:09.614: debug: Check KSK status
+2008-07-22 00:24:09.614: debug: Check ZSK status
+2008-07-22 00:24:09.614: debug: Re-signing necessary: Option -f
+2008-07-22 00:24:09.614: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-22 00:24:09.614: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-22 00:24:09.614: debug: Signing zone "sub.example.net."
+2008-07-22 00:24:09.614: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-22 00:24:10.692: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:24:10.692: debug: Signing completed after 1s.
+2008-07-22 00:24:10.692: notice: "sub.example.net.": distribution triggered
+2008-07-22 00:24:10.692: debug: Distribute zone "sub.example.net."
+2008-07-22 00:24:10.692: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-22 00:24:10.698: debug: ./dist.sh reload return: "scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net./"
+2008-07-22 00:24:10.698: debug:
+2008-07-22 00:24:10.698: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-22 00:24:10.698: debug: Check RFC5011 status
+2008-07-22 00:24:10.698: debug: ->ksk5011status returns 2
+2008-07-22 00:24:10.698: debug: Check ZSK status
+2008-07-22 00:24:10.698: debug: Re-signing necessary: Option -f
+2008-07-22 00:24:10.698: notice: "example.net.": re-signing triggered: Option -f
+2008-07-22 00:24:10.698: debug: Writing key file "./example.net./dnskey.db"
+2008-07-22 00:24:10.699: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-22 00:24:10.699: debug: Signing zone "example.net."
+2008-07-22 00:24:10.699: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-22 00:24:10.883: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:24:10.883: debug: Signing completed after 0s.
+2008-07-22 00:24:10.883: notice: "example.net.": distribution triggered
+2008-07-22 00:24:10.883: debug: Distribute zone "example.net."
+2008-07-22 00:24:10.883: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-22 00:24:10.889: debug: ./dist.sh reload return: "scp ./example.net./zone.db.signed localhost:/var/named/example.net./"
+2008-07-22 00:24:10.889: debug:
+2008-07-22 00:24:10.889: notice: end of run: 0 errors occured
+2008-07-22 00:28:44.300: notice: ------------------------------------------------------------
+2008-07-22 00:28:44.300: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-22 00:28:44.302: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-22 00:28:44.302: debug: Check RFC5011 status
+2008-07-22 00:28:44.302: debug: ->ksk5011status returns 0
+2008-07-22 00:28:44.302: debug: Check KSK status
+2008-07-22 00:28:44.302: debug: Check ZSK status
+2008-07-22 00:28:44.302: debug: Re-signing necessary: Option -f
+2008-07-22 00:28:44.302: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-22 00:28:44.302: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-22 00:28:44.306: debug: Signing zone "sub.example.net."
+2008-07-22 00:28:44.306: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-22 00:28:44.898: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:28:44.898: debug: Signing completed after 0s.
+2008-07-22 00:28:44.898: notice: "sub.example.net.": distribution triggered
+2008-07-22 00:28:44.899: debug: Distribute zone "sub.example.net."
+2008-07-22 00:28:44.899: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-22 00:28:44.904: debug: ./dist.sh reload return: "scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net./"
+2008-07-22 00:28:44.905: debug:
+2008-07-22 00:28:44.905: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-22 00:28:44.905: debug: Check RFC5011 status
+2008-07-22 00:28:44.905: debug: ->ksk5011status returns 2
+2008-07-22 00:28:44.905: debug: Check ZSK status
+2008-07-22 00:28:44.905: debug: Re-signing necessary: Option -f
+2008-07-22 00:28:44.905: notice: "example.net.": re-signing triggered: Option -f
+2008-07-22 00:28:44.905: debug: Writing key file "./example.net./dnskey.db"
+2008-07-22 00:28:44.906: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-22 00:28:44.906: debug: Signing zone "example.net."
+2008-07-22 00:28:44.907: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-22 00:28:45.039: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:28:45.039: debug: Signing completed after 1s.
+2008-07-22 00:28:45.039: notice: "example.net.": distribution triggered
+2008-07-22 00:28:45.039: debug: Distribute zone "example.net."
+2008-07-22 00:28:45.040: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-22 00:28:45.046: debug: ./dist.sh reload return: "scp ./example.net./zone.db.signed localhost:/var/named/example.net./"
+2008-07-22 00:28:45.046: debug:
+2008-07-22 00:28:45.046: notice: end of run: 0 errors occured
+2008-07-22 00:39:15.968: notice: ------------------------------------------------------------
+2008-07-22 00:39:15.968: notice: running ../../dnssec-signer -r -v -v
+2008-07-22 00:39:16.005: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-22 00:39:16.006: debug: Check RFC5011 status
+2008-07-22 00:39:16.006: debug: ->ksk5011status returns 0
+2008-07-22 00:39:16.006: debug: Check KSK status
+2008-07-22 00:39:16.006: debug: Check ZSK status
+2008-07-22 00:39:16.006: debug: Re-signing not necessary!
+2008-07-22 00:39:16.006: debug: Check if there is a parent file to copy
+2008-07-22 00:39:16.006: debug:
+2008-07-22 00:39:16.006: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-22 00:39:16.006: debug: Check RFC5011 status
+2008-07-22 00:39:16.006: debug: ->ksk5011status returns 2
+2008-07-22 00:39:16.007: debug: Check ZSK status
+2008-07-22 00:39:16.007: debug: Re-signing not necessary!
+2008-07-22 00:39:16.007: debug: Check if there is a parent file to copy
+2008-07-22 00:39:16.007: debug:
+2008-07-22 00:39:16.007: notice: end of run: 0 errors occured
+2008-07-22 00:39:31.578: notice: ------------------------------------------------------------
+2008-07-22 00:39:31.578: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-22 00:39:31.580: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-22 00:39:31.580: debug: Check RFC5011 status
+2008-07-22 00:39:31.580: debug: ->ksk5011status returns 0
+2008-07-22 00:39:31.580: debug: Check KSK status
+2008-07-22 00:39:31.581: debug: Check ZSK status
+2008-07-22 00:39:31.581: debug: Re-signing necessary: Option -f
+2008-07-22 00:39:31.581: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-22 00:39:31.581: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-22 00:39:31.581: debug: Signing zone "sub.example.net."
+2008-07-22 00:39:31.582: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-22 00:39:32.216: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:39:32.216: debug: Signing completed after 1s.
+2008-07-22 00:39:32.216: notice: "sub.example.net.": distribution triggered
+2008-07-22 00:39:32.216: debug: Distribute zone "sub.example.net."
+2008-07-22 00:39:32.217: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-22 00:39:32.223: debug: ./dist.sh reload return: "scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net./"
+2008-07-22 00:39:32.223: debug:
+2008-07-22 00:39:32.223: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-22 00:39:32.223: debug: Check RFC5011 status
+2008-07-22 00:39:32.223: debug: ->ksk5011status returns 2
+2008-07-22 00:39:32.223: debug: Check ZSK status
+2008-07-22 00:39:32.223: debug: Re-signing necessary: Option -f
+2008-07-22 00:39:32.223: notice: "example.net.": re-signing triggered: Option -f
+2008-07-22 00:39:32.223: debug: Writing key file "./example.net./dnskey.db"
+2008-07-22 00:39:32.224: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-22 00:39:32.224: debug: Signing zone "example.net."
+2008-07-22 00:39:32.225: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-22 00:39:32.360: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:39:32.361: debug: Signing completed after 0s.
+2008-07-22 00:39:32.361: notice: "example.net.": distribution triggered
+2008-07-22 00:39:32.361: debug: Distribute zone "example.net."
+2008-07-22 00:39:32.361: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-22 00:39:32.367: debug: ./dist.sh reload return: "scp ./example.net./zone.db.signed localhost:/var/named/example.net./"
+2008-07-22 00:39:32.367: debug:
+2008-07-22 00:39:32.367: notice: end of run: 0 errors occured
+2008-07-22 00:41:53.710: notice: ------------------------------------------------------------
+2008-07-22 00:41:53.710: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-22 00:41:53.712: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-22 00:41:53.712: debug: Check RFC5011 status
+2008-07-22 00:41:53.712: debug: ->ksk5011status returns 0
+2008-07-22 00:41:53.712: debug: Check KSK status
+2008-07-22 00:41:53.712: debug: Check ZSK status
+2008-07-22 00:41:53.712: debug: Re-signing necessary: Option -f
+2008-07-22 00:41:53.712: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-22 00:41:53.712: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-22 00:41:53.712: debug: Signing zone "sub.example.net."
+2008-07-22 00:41:53.713: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-22 00:41:53.866: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:41:53.866: debug: Signing completed after 0s.
+2008-07-22 00:41:53.866: notice: "sub.example.net.": distribution triggered
+2008-07-22 00:41:53.866: debug: Distribute zone "sub.example.net."
+2008-07-22 00:41:53.867: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-22 00:41:53.873: debug: ./dist.sh reload return: "scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net./"
+2008-07-22 00:41:53.873: debug:
+2008-07-22 00:41:53.873: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-22 00:41:53.873: debug: Check RFC5011 status
+2008-07-22 00:41:53.873: debug: ->ksk5011status returns 2
+2008-07-22 00:41:53.873: debug: Check ZSK status
+2008-07-22 00:41:53.873: debug: Re-signing necessary: Option -f
+2008-07-22 00:41:53.873: notice: "example.net.": re-signing triggered: Option -f
+2008-07-22 00:41:53.873: debug: Writing key file "./example.net./dnskey.db"
+2008-07-22 00:41:53.873: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-22 00:41:53.873: debug: Signing zone "example.net."
+2008-07-22 00:41:53.873: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-22 00:41:53.989: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:41:53.989: debug: Signing completed after 0s.
+2008-07-22 00:41:53.989: notice: "example.net.": distribution triggered
+2008-07-22 00:41:53.989: debug: Distribute zone "example.net."
+2008-07-22 00:41:53.989: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-22 00:41:53.995: debug: ./dist.sh reload return: "scp ./example.net./zone.db.signed localhost:/var/named/example.net./"
+2008-07-22 00:41:53.995: debug:
+2008-07-22 00:41:53.995: notice: end of run: 0 errors occured
+2008-07-22 00:45:46.509: notice: ------------------------------------------------------------
+2008-07-22 00:45:46.509: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-22 00:45:46.511: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-22 00:45:46.512: debug: Check RFC5011 status
+2008-07-22 00:45:46.512: debug: ->ksk5011status returns 0
+2008-07-22 00:45:46.512: debug: Check KSK status
+2008-07-22 00:45:46.512: debug: Check ZSK status
+2008-07-22 00:45:46.512: debug: Re-signing necessary: Option -f
+2008-07-22 00:45:46.512: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-22 00:45:46.512: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-22 00:45:46.513: debug: Signing zone "sub.example.net."
+2008-07-22 00:45:46.513: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-22 00:45:46.734: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:45:46.734: debug: Signing completed after 0s.
+2008-07-22 00:45:46.734: notice: "sub.example.net.": distribution triggered
+2008-07-22 00:45:46.734: debug: Distribute zone "sub.example.net."
+2008-07-22 00:45:46.734: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-22 00:45:46.740: debug: ./dist.sh reload return: "scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net./"
+2008-07-22 00:45:46.740: debug:
+2008-07-22 00:45:46.740: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-22 00:45:46.740: debug: Check RFC5011 status
+2008-07-22 00:45:46.741: debug: ->ksk5011status returns 2
+2008-07-22 00:45:46.741: debug: Check ZSK status
+2008-07-22 00:45:46.741: debug: Re-signing necessary: Option -f
+2008-07-22 00:45:46.741: notice: "example.net.": re-signing triggered: Option -f
+2008-07-22 00:45:46.741: debug: Writing key file "./example.net./dnskey.db"
+2008-07-22 00:45:46.742: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-22 00:45:46.742: debug: Signing zone "example.net."
+2008-07-22 00:45:46.742: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-22 00:45:47.013: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:45:47.013: debug: Signing completed after 1s.
+2008-07-22 00:45:47.013: notice: "example.net.": distribution triggered
+2008-07-22 00:45:47.013: debug: Distribute zone "example.net."
+2008-07-22 00:45:47.013: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-22 00:45:47.019: debug: ./dist.sh reload return: "scp ./example.net./zone.db.signed localhost:/var/named/example.net./"
+2008-07-22 00:45:47.019: debug:
+2008-07-22 00:45:47.019: notice: end of run: 0 errors occured
+2008-07-22 00:48:02.761: notice: ------------------------------------------------------------
+2008-07-22 00:48:02.761: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-22 00:48:02.763: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-22 00:48:02.763: debug: Check RFC5011 status
+2008-07-22 00:48:02.763: debug: ->ksk5011status returns 0
+2008-07-22 00:48:02.763: debug: Check KSK status
+2008-07-22 00:48:02.763: debug: Check ZSK status
+2008-07-22 00:48:02.763: debug: Re-signing necessary: Option -f
+2008-07-22 00:48:02.763: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-22 00:48:02.763: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-22 00:48:02.763: debug: Signing zone "sub.example.net."
+2008-07-22 00:48:02.763: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-22 00:48:02.907: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:48:02.907: debug: Signing completed after 0s.
+2008-07-22 00:48:02.907: notice: "sub.example.net.": distribution triggered
+2008-07-22 00:48:02.907: debug: Distribute zone "sub.example.net."
+2008-07-22 00:48:02.907: debug:
+2008-07-22 00:48:02.907: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-22 00:48:02.907: debug: Check RFC5011 status
+2008-07-22 00:48:02.907: debug: ->ksk5011status returns 2
+2008-07-22 00:48:02.907: debug: Check ZSK status
+2008-07-22 00:48:02.907: debug: Re-signing necessary: Option -f
+2008-07-22 00:48:02.907: notice: "example.net.": re-signing triggered: Option -f
+2008-07-22 00:48:02.907: debug: Writing key file "./example.net./dnskey.db"
+2008-07-22 00:48:02.908: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-22 00:48:02.908: debug: Signing zone "example.net."
+2008-07-22 00:48:02.908: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-22 00:48:03.029: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:48:03.029: debug: Signing completed after 1s.
+2008-07-22 00:48:03.029: notice: "example.net.": distribution triggered
+2008-07-22 00:48:03.029: debug: Distribute zone "example.net."
+2008-07-22 00:48:03.029: debug:
+2008-07-22 00:48:03.029: notice: end of run: 0 errors occured
+2008-07-22 00:48:56.098: notice: ------------------------------------------------------------
+2008-07-22 00:48:56.098: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-22 00:48:56.100: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-22 00:48:56.101: debug: Check RFC5011 status
+2008-07-22 00:48:56.101: debug: ->ksk5011status returns 0
+2008-07-22 00:48:56.101: debug: Check KSK status
+2008-07-22 00:48:56.101: debug: Check ZSK status
+2008-07-22 00:48:56.101: debug: Re-signing necessary: Option -f
+2008-07-22 00:48:56.101: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-22 00:48:56.101: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-22 00:48:56.102: debug: Signing zone "sub.example.net."
+2008-07-22 00:48:56.102: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-22 00:48:56.244: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:48:56.244: debug: Signing completed after 0s.
+2008-07-22 00:48:56.244: notice: "sub.example.net.": distribution triggered
+2008-07-22 00:48:56.244: debug: Distribute zone "sub.example.net."
+2008-07-22 00:48:56.245: debug:
+2008-07-22 00:48:56.245: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-22 00:48:56.245: debug: Check RFC5011 status
+2008-07-22 00:48:56.245: debug: ->ksk5011status returns 2
+2008-07-22 00:48:56.245: debug: Check ZSK status
+2008-07-22 00:48:56.245: debug: Re-signing necessary: Option -f
+2008-07-22 00:48:56.245: notice: "example.net.": re-signing triggered: Option -f
+2008-07-22 00:48:56.246: debug: Writing key file "./example.net./dnskey.db"
+2008-07-22 00:48:56.246: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-22 00:48:56.246: debug: Signing zone "example.net."
+2008-07-22 00:48:56.247: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-22 00:48:56.367: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 00:48:56.367: debug: Signing completed after 0s.
+2008-07-22 00:48:56.367: notice: "example.net.": distribution triggered
+2008-07-22 00:48:56.367: debug: Distribute zone "example.net."
+2008-07-22 00:48:56.367: debug:
+2008-07-22 00:48:56.367: notice: end of run: 0 errors occured
+2008-07-22 08:07:30.993: notice: ------------------------------------------------------------
+2008-07-22 08:07:30.993: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-22 08:07:30.995: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-22 08:07:30.995: debug: Check RFC5011 status
+2008-07-22 08:07:30.995: debug: ->ksk5011status returns 0
+2008-07-22 08:07:30.995: debug: Check KSK status
+2008-07-22 08:07:30.995: debug: Check ZSK status
+2008-07-22 08:07:30.995: debug: Re-signing necessary: Option -f
+2008-07-22 08:07:30.996: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-22 08:07:30.996: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-22 08:07:30.996: debug: Signing zone "sub.example.net."
+2008-07-22 08:07:30.996: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-22 08:07:31.454: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 08:07:31.454: debug: Signing completed after 1s.
+2008-07-22 08:07:31.454: notice: "sub.example.net.": distribution triggered
+2008-07-22 08:07:31.454: debug: Distribute zone "sub.example.net."
+2008-07-22 08:07:31.454: debug:
+2008-07-22 08:07:31.454: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-22 08:07:31.454: debug: Check RFC5011 status
+2008-07-22 08:07:31.454: debug: ->ksk5011status returns 2
+2008-07-22 08:07:31.454: debug: Check ZSK status
+2008-07-22 08:07:31.454: debug: Re-signing necessary: Option -f
+2008-07-22 08:07:31.454: notice: "example.net.": re-signing triggered: Option -f
+2008-07-22 08:07:31.454: debug: Writing key file "./example.net./dnskey.db"
+2008-07-22 08:07:31.454: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-22 08:07:31.454: debug: Signing zone "example.net."
+2008-07-22 08:07:31.455: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-22 08:07:31.588: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 08:07:31.589: debug: Signing completed after 0s.
+2008-07-22 08:07:31.589: notice: "example.net.": distribution triggered
+2008-07-22 08:07:31.589: debug: Distribute zone "example.net."
+2008-07-22 08:07:31.589: debug:
+2008-07-22 08:07:31.589: notice: end of run: 0 errors occured
+2008-07-22 08:08:09.237: notice: ------------------------------------------------------------
+2008-07-22 08:08:09.237: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-22 08:08:09.239: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-22 08:08:09.239: debug: Check RFC5011 status
+2008-07-22 08:08:09.239: debug: ->ksk5011status returns 0
+2008-07-22 08:08:09.239: debug: Check KSK status
+2008-07-22 08:08:09.239: debug: Check ZSK status
+2008-07-22 08:08:09.239: debug: Re-signing necessary: Option -f
+2008-07-22 08:08:09.239: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-22 08:08:09.239: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-22 08:08:09.240: debug: Signing zone "sub.example.net."
+2008-07-22 08:08:09.240: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-22 08:08:09.506: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 08:08:09.507: debug: Signing completed after 0s.
+2008-07-22 08:08:09.507: notice: "sub.example.net.": distribution triggered
+2008-07-22 08:08:09.507: debug: Distribute zone "sub.example.net."
+2008-07-22 08:10:10.328: notice: ------------------------------------------------------------
+2008-07-22 08:10:10.328: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-22 08:10:10.330: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-22 08:10:10.330: debug: Check RFC5011 status
+2008-07-22 08:10:10.330: debug: ->ksk5011status returns 0
+2008-07-22 08:10:10.330: debug: Check KSK status
+2008-07-22 08:10:10.330: debug: Check ZSK status
+2008-07-22 08:10:10.330: debug: Re-signing necessary: Option -f
+2008-07-22 08:10:10.330: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-22 08:10:10.330: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-22 08:10:10.331: debug: Signing zone "sub.example.net."
+2008-07-22 08:10:10.331: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-22 08:10:10.950: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 08:10:10.950: debug: Signing completed after 0s.
+2008-07-22 08:10:10.950: notice: "sub.example.net.": distribution triggered
+2008-07-22 08:10:10.950: debug: Distribute zone "sub.example.net."
+2008-07-22 08:11:17.247: notice: ------------------------------------------------------------
+2008-07-22 08:11:17.247: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-22 08:11:17.249: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-22 08:11:17.250: debug: Check RFC5011 status
+2008-07-22 08:11:17.250: debug: ->ksk5011status returns 0
+2008-07-22 08:11:17.250: debug: Check KSK status
+2008-07-22 08:11:17.250: debug: Check ZSK status
+2008-07-22 08:11:17.250: debug: Re-signing necessary: Option -f
+2008-07-22 08:11:17.250: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-22 08:11:17.250: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-22 08:11:17.251: debug: Signing zone "sub.example.net."
+2008-07-22 08:11:17.251: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-22 08:11:17.883: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 08:11:17.883: debug: Signing completed after 0s.
+2008-07-22 08:11:17.883: notice: "sub.example.net.": distribution triggered
+2008-07-22 08:11:17.883: debug: Distribute zone "sub.example.net."
+2008-07-22 08:11:17.883: debug:
+2008-07-22 08:11:17.883: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-22 08:11:17.884: debug: Check RFC5011 status
+2008-07-22 08:11:17.884: debug: ->ksk5011status returns 2
+2008-07-22 08:11:17.884: debug: Check ZSK status
+2008-07-22 08:11:17.884: debug: Re-signing necessary: Option -f
+2008-07-22 08:11:17.884: notice: "example.net.": re-signing triggered: Option -f
+2008-07-22 08:11:17.884: debug: Writing key file "./example.net./dnskey.db"
+2008-07-22 08:11:17.884: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-22 08:11:17.884: debug: Signing zone "example.net."
+2008-07-22 08:11:17.884: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-22 08:11:18.005: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-22 08:11:18.005: debug: Signing completed after 1s.
+2008-07-22 08:11:18.006: notice: "example.net.": distribution triggered
+2008-07-22 08:11:18.006: debug: Distribute zone "example.net."
+2008-07-22 08:11:18.006: debug:
+2008-07-22 08:11:18.006: notice: end of run: 0 errors occured
+2008-07-24 00:13:56.493: notice: ------------------------------------------------------------
+2008-07-24 00:13:56.493: notice: running ../../dnssec-signer -v -v
+2008-07-24 00:13:56.495: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 00:13:56.495: debug: Check RFC5011 status
+2008-07-24 00:13:56.495: debug: ->ksk5011status returns 0
+2008-07-24 00:13:56.495: debug: Check KSK status
+2008-07-24 00:13:56.495: debug: Check ZSK status
+2008-07-24 00:13:56.495: debug: Re-signing necessary: re-signing interval (1d) reached
+2008-07-24 00:13:56.495: notice: "sub.example.net.": re-signing triggered: re-signing interval (1d) reached
+2008-07-24 00:13:56.495: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-24 00:13:56.495: debug: Signing zone "sub.example.net."
+2008-07-24 00:13:56.495: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-24 00:13:57.439: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 00:13:57.439: debug: Signing completed after 1s.
+2008-07-24 00:13:57.439: debug:
+2008-07-24 00:13:57.439: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 00:13:57.439: debug: Check RFC5011 status
+2008-07-24 00:13:57.439: debug: ->ksk5011status returns 2
+2008-07-24 00:13:57.439: debug: Check ZSK status
+2008-07-24 00:13:57.440: debug: Lifetime(1209600 +/-150 sec) of active key 16682 exceeded (1309537 sec)
+2008-07-24 00:13:57.440: debug: ->depreciate it
+2008-07-24 00:13:57.440: debug: ->activate published key 41300
+2008-07-24 00:13:57.440: notice: "example.net.": lifetime of zone signing key 16682 exceeded: ZSK rollover done
+2008-07-24 00:13:57.440: debug: Re-signing necessary: New zone key
+2008-07-24 00:13:57.440: notice: "example.net.": re-signing triggered: New zone key
+2008-07-24 00:13:57.441: debug: Writing key file "./example.net./dnskey.db"
+2008-07-24 00:13:57.441: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-24 00:13:57.441: debug: Signing zone "example.net."
+2008-07-24 00:13:57.442: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-24 00:13:57.562: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 00:13:57.562: debug: Signing completed after 0s.
+2008-07-24 00:13:57.562: debug:
+2008-07-24 00:13:57.562: notice: end of run: 0 errors occured
+2008-07-24 00:14:08.862: notice: ------------------------------------------------------------
+2008-07-24 00:14:08.862: notice: running ../../dnssec-signer -r -v -v
+2008-07-24 00:14:08.864: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 00:14:08.864: debug: Check RFC5011 status
+2008-07-24 00:14:08.864: debug: ->ksk5011status returns 0
+2008-07-24 00:14:08.864: debug: Check KSK status
+2008-07-24 00:14:08.864: debug: Check ZSK status
+2008-07-24 00:14:08.864: debug: Re-signing not necessary!
+2008-07-24 00:14:08.864: debug: Check if there is a parent file to copy
+2008-07-24 00:14:08.864: debug:
+2008-07-24 00:14:08.864: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 00:14:08.864: debug: Check RFC5011 status
+2008-07-24 00:14:08.864: debug: ->ksk5011status returns 2
+2008-07-24 00:14:08.864: debug: Check ZSK status
+2008-07-24 00:14:08.864: debug: Re-signing not necessary!
+2008-07-24 00:14:08.864: debug: Check if there is a parent file to copy
+2008-07-24 00:14:08.864: debug:
+2008-07-24 00:14:08.864: notice: end of run: 0 errors occured
+2008-07-24 00:14:12.963: notice: ------------------------------------------------------------
+2008-07-24 00:14:12.963: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-24 00:14:12.965: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 00:14:12.965: debug: Check RFC5011 status
+2008-07-24 00:14:12.965: debug: ->ksk5011status returns 0
+2008-07-24 00:14:12.965: debug: Check KSK status
+2008-07-24 00:14:12.965: debug: Check ZSK status
+2008-07-24 00:14:12.965: debug: Re-signing necessary: Option -f
+2008-07-24 00:14:12.965: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-24 00:14:12.966: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-24 00:14:12.966: debug: Signing zone "sub.example.net."
+2008-07-24 00:14:12.966: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-24 00:14:13.488: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 00:14:13.488: debug: Signing completed after 1s.
+2008-07-24 00:14:13.488: error: exec of distribution command Ìö÷¿ forbidden due to strange file mode settings
+2008-07-24 00:14:13.488: debug:
+2008-07-24 00:14:13.488: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 00:14:13.488: debug: Check RFC5011 status
+2008-07-24 00:14:13.488: debug: ->ksk5011status returns 2
+2008-07-24 00:14:13.488: debug: Check ZSK status
+2008-07-24 00:14:13.488: debug: Re-signing necessary: Option -f
+2008-07-24 00:14:13.488: notice: "example.net.": re-signing triggered: Option -f
+2008-07-24 00:14:13.488: debug: Writing key file "./example.net./dnskey.db"
+2008-07-24 00:14:13.489: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-24 00:14:13.489: debug: Signing zone "example.net."
+2008-07-24 00:14:13.489: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-24 00:14:13.601: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 00:14:13.601: debug: Signing completed after 0s.
+2008-07-24 00:14:13.601: error: exec of distribution command Ìö÷¿ forbidden due to strange file mode settings
+2008-07-24 00:14:13.602: debug:
+2008-07-24 00:14:13.602: notice: end of run: 2 errors occured
+2008-07-24 00:15:38.304: notice: ------------------------------------------------------------
+2008-07-24 00:15:38.304: notice: running ../../dnssec-signer -f -v -v
+2008-07-24 00:15:38.306: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 00:15:38.306: debug: Check RFC5011 status
+2008-07-24 00:15:38.307: debug: ->ksk5011status returns 0
+2008-07-24 00:15:38.307: debug: Check KSK status
+2008-07-24 00:15:38.307: debug: Check ZSK status
+2008-07-24 00:15:38.307: debug: Re-signing necessary: Option -f
+2008-07-24 00:15:38.307: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-24 00:15:38.307: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-24 00:15:38.308: debug: Signing zone "sub.example.net."
+2008-07-24 00:15:38.308: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-24 00:15:39.280: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 00:15:39.280: debug: Signing completed after 1s.
+2008-07-24 00:15:39.281: debug:
+2008-07-24 00:15:39.281: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 00:15:39.281: debug: Check RFC5011 status
+2008-07-24 00:15:39.281: debug: ->ksk5011status returns 2
+2008-07-24 00:15:39.281: debug: Check ZSK status
+2008-07-24 00:15:39.281: debug: Re-signing necessary: Option -f
+2008-07-24 00:15:39.281: notice: "example.net.": re-signing triggered: Option -f
+2008-07-24 00:15:39.281: debug: Writing key file "./example.net./dnskey.db"
+2008-07-24 00:15:39.282: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-24 00:15:39.282: debug: Signing zone "example.net."
+2008-07-24 00:15:39.282: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-24 00:15:39.402: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 00:15:39.402: debug: Signing completed after 0s.
+2008-07-24 00:15:39.403: debug:
+2008-07-24 00:15:39.403: notice: end of run: 0 errors occured
+2008-07-24 00:18:59.568: notice: ------------------------------------------------------------
+2008-07-24 00:18:59.568: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-24 00:18:59.570: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 00:18:59.573: debug: Check RFC5011 status
+2008-07-24 00:18:59.573: debug: ->ksk5011status returns 0
+2008-07-24 00:18:59.573: debug: Check KSK status
+2008-07-24 00:18:59.573: debug: Check ZSK status
+2008-07-24 00:18:59.573: debug: Re-signing necessary: Option -f
+2008-07-24 00:18:59.573: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-24 00:18:59.573: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-24 00:18:59.573: debug: Signing zone "sub.example.net."
+2008-07-24 00:18:59.573: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-24 00:19:00.167: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 00:19:00.167: debug: Signing completed after 1s.
+2008-07-24 00:19:00.168: error: exec of distribution command ./dist.sh forbidden due to strange file mode settings
+2008-07-24 00:19:00.168: debug:
+2008-07-24 00:19:00.168: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 00:19:00.168: debug: Check RFC5011 status
+2008-07-24 00:19:00.168: debug: ->ksk5011status returns 2
+2008-07-24 00:19:00.168: debug: Check ZSK status
+2008-07-24 00:19:00.168: debug: Re-signing necessary: Option -f
+2008-07-24 00:19:00.168: notice: "example.net.": re-signing triggered: Option -f
+2008-07-24 00:19:00.168: debug: Writing key file "./example.net./dnskey.db"
+2008-07-24 00:19:00.169: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-24 00:19:00.169: debug: Signing zone "example.net."
+2008-07-24 00:19:00.169: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-24 00:19:00.280: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 00:19:00.280: debug: Signing completed after 0s.
+2008-07-24 00:19:00.280: error: exec of distribution command ./dist.sh forbidden due to strange file mode settings
+2008-07-24 00:19:00.280: debug:
+2008-07-24 00:19:00.280: notice: end of run: 2 errors occured
+2008-07-24 00:22:24.567: notice: ------------------------------------------------------------
+2008-07-24 00:22:24.567: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-24 00:22:24.569: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 00:22:24.569: debug: Check RFC5011 status
+2008-07-24 00:22:24.569: debug: ->ksk5011status returns 0
+2008-07-24 00:22:24.569: debug: Check KSK status
+2008-07-24 00:22:24.570: debug: Check ZSK status
+2008-07-24 00:22:24.570: debug: Re-signing necessary: Option -f
+2008-07-24 00:22:24.570: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-24 00:22:24.570: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-24 00:22:24.570: debug: Signing zone "sub.example.net."
+2008-07-24 00:22:24.571: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-24 00:22:25.147: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 00:22:25.148: debug: Signing completed after 1s.
+2008-07-24 00:22:25.148: error: exec of distribution command ./dist.sh forbidden due to strange file mode settings
+2008-07-24 00:22:25.148: debug: not running distribution command ./dist.sh because of strange file mode settings
+2008-07-24 00:22:25.148: debug:
+2008-07-24 00:22:25.148: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 00:22:25.148: debug: Check RFC5011 status
+2008-07-24 00:22:25.148: debug: ->ksk5011status returns 2
+2008-07-24 00:22:25.148: debug: Check ZSK status
+2008-07-24 00:22:25.149: debug: Re-signing necessary: Option -f
+2008-07-24 00:22:25.149: notice: "example.net.": re-signing triggered: Option -f
+2008-07-24 00:22:25.149: debug: Writing key file "./example.net./dnskey.db"
+2008-07-24 00:22:25.150: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-24 00:22:25.150: debug: Signing zone "example.net."
+2008-07-24 00:22:25.150: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-24 00:22:25.271: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 00:22:25.271: debug: Signing completed after 0s.
+2008-07-24 00:22:25.271: error: exec of distribution command ./dist.sh forbidden due to strange file mode settings
+2008-07-24 00:22:25.271: debug: not running distribution command ./dist.sh because of strange file mode settings
+2008-07-24 00:22:25.271: debug:
+2008-07-24 00:22:25.271: notice: end of run: 2 errors occured
+2008-07-24 00:23:08.907: notice: ------------------------------------------------------------
+2008-07-24 00:23:08.907: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-24 00:23:08.909: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 00:23:08.909: debug: Check RFC5011 status
+2008-07-24 00:23:08.909: debug: ->ksk5011status returns 0
+2008-07-24 00:23:08.909: debug: Check KSK status
+2008-07-24 00:23:08.909: debug: Check ZSK status
+2008-07-24 00:23:08.909: debug: Re-signing necessary: Option -f
+2008-07-24 00:23:08.909: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-24 00:23:08.909: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-24 00:23:08.910: debug: Signing zone "sub.example.net."
+2008-07-24 00:23:08.910: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-24 00:23:09.510: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 00:23:09.510: debug: Signing completed after 1s.
+2008-07-24 00:23:09.511: notice: "sub.example.net.": distribution triggered
+2008-07-24 00:23:09.511: debug: Distribute zone "sub.example.net."
+2008-07-24 00:23:09.511: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-24 00:23:09.517: debug: ./dist.sh reload return: "scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net./"
+2008-07-24 00:23:09.517: debug:
+2008-07-24 00:23:09.517: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 00:23:09.517: debug: Check RFC5011 status
+2008-07-24 00:23:09.517: debug: ->ksk5011status returns 2
+2008-07-24 00:23:09.517: debug: Check ZSK status
+2008-07-24 00:23:09.517: debug: Re-signing necessary: Option -f
+2008-07-24 00:23:09.517: notice: "example.net.": re-signing triggered: Option -f
+2008-07-24 00:23:09.517: debug: Writing key file "./example.net./dnskey.db"
+2008-07-24 00:23:09.518: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-24 00:23:09.518: debug: Signing zone "example.net."
+2008-07-24 00:23:09.518: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-24 00:23:09.633: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 00:23:09.633: debug: Signing completed after 0s.
+2008-07-24 00:23:09.634: notice: "example.net.": distribution triggered
+2008-07-24 00:23:09.634: debug: Distribute zone "example.net."
+2008-07-24 00:23:09.634: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-24 00:23:09.640: debug: ./dist.sh reload return: "scp ./example.net./zone.db.signed localhost:/var/named/example.net./"
+2008-07-24 00:23:09.640: debug:
+2008-07-24 00:23:09.640: notice: end of run: 0 errors occured
+2008-07-24 00:33:30.818: notice: ------------------------------------------------------------
+2008-07-24 00:33:30.818: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-24 00:33:30.820: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 00:33:30.820: debug: Check RFC5011 status
+2008-07-24 00:33:30.821: debug: ->ksk5011status returns 0
+2008-07-24 00:33:30.821: debug: Check KSK status
+2008-07-24 00:33:30.821: debug: Check ZSK status
+2008-07-24 00:33:30.821: debug: Re-signing necessary: Option -f
+2008-07-24 00:33:30.821: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-24 00:33:30.821: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-24 00:33:30.822: debug: Signing zone "sub.example.net."
+2008-07-24 00:33:30.822: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-24 00:33:31.320: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 00:33:31.320: debug: Signing completed after 1s.
+2008-07-24 00:33:31.320: error: exec of distribution command ./dist.sh forbidden due to running as root
+2008-07-24 00:33:31.320: debug: Not running distribution command ./dist.sh as root
+2008-07-24 00:33:31.320: debug:
+2008-07-24 00:33:31.320: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 00:33:31.320: debug: Check RFC5011 status
+2008-07-24 00:33:31.320: debug: ->ksk5011status returns 2
+2008-07-24 00:33:31.320: debug: Check ZSK status
+2008-07-24 00:33:31.320: debug: Re-signing necessary: Option -f
+2008-07-24 00:33:31.320: notice: "example.net.": re-signing triggered: Option -f
+2008-07-24 00:33:31.320: debug: Writing key file "./example.net./dnskey.db"
+2008-07-24 00:33:31.321: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-24 00:33:31.321: debug: Signing zone "example.net."
+2008-07-24 00:33:31.321: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-24 00:33:31.443: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 00:33:31.443: debug: Signing completed after 0s.
+2008-07-24 00:33:31.443: error: exec of distribution command ./dist.sh forbidden due to running as root
+2008-07-24 00:33:31.443: debug: Not running distribution command ./dist.sh as root
+2008-07-24 00:33:31.443: debug:
+2008-07-24 00:33:31.443: notice: end of run: 2 errors occured
+2008-07-24 23:21:55.189: notice: ------------------------------------------------------------
+2008-07-24 23:21:55.189: notice: running ../../dnssec-signer -r -v -v
+2008-07-24 23:21:55.196: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 23:21:55.196: debug: Check RFC5011 status
+2008-07-24 23:21:55.196: debug: ->not a rfc5011 zone, looking for a regular ksk rollover
+2008-07-24 23:21:55.196: debug: Check KSK status
+2008-07-24 23:21:55.196: debug: Check ZSK status
+2008-07-24 23:21:55.196: debug: Re-signing not necessary!
+2008-07-24 23:21:55.196: debug: Check if there is a parent file to copy
+2008-07-24 23:21:55.196: debug:
+2008-07-24 23:21:55.196: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 23:21:55.196: debug: Check RFC5011 status
+2008-07-24 23:21:55.196: debug: Check ZSK status
+2008-07-24 23:21:55.196: debug: Lifetime(29100 sec) of depreciated key 16682 exceeded (83278 sec)
+2008-07-24 23:21:55.196: info: "example.net.": old ZSK 16682 removed
+2008-07-24 23:21:55.196: debug: ->remove it
+2008-07-24 23:21:55.196: debug: Re-signing necessary: New zone key
+2008-07-24 23:21:55.197: notice: "example.net.": re-signing triggered: New zone key
+2008-07-24 23:21:55.197: debug: Writing key file "./example.net./dnskey.db"
+2008-07-24 23:21:55.197: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-24 23:21:55.197: debug: Signing zone "example.net."
+2008-07-24 23:21:55.197: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-24 23:21:55.873: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 23:21:55.873: debug: Signing completed after 0s.
+2008-07-24 23:21:55.873: debug: Distribution command ./dist.sh not run as root
+2008-07-24 23:21:55.873: error: exec of distribution command ./dist.sh suppressed because of security reasons
+2008-07-24 23:21:55.873: debug:
+2008-07-24 23:21:55.874: notice: end of run: 1 error occured
+2008-07-24 23:23:06.278: notice: ------------------------------------------------------------
+2008-07-24 23:23:06.278: notice: running ../../dnssec-signer -r -v -v
+2008-07-24 23:23:06.279: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 23:23:06.280: debug: Check RFC5011 status
+2008-07-24 23:23:06.280: debug: ->not a rfc5011 zone, looking for a regular ksk rollover
+2008-07-24 23:23:06.280: debug: Check KSK status
+2008-07-24 23:23:06.280: debug: Check ZSK status
+2008-07-24 23:23:06.280: debug: Re-signing not necessary!
+2008-07-24 23:23:06.280: debug: Check if there is a parent file to copy
+2008-07-24 23:23:06.280: debug:
+2008-07-24 23:23:06.280: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 23:23:06.280: debug: Check RFC5011 status
+2008-07-24 23:23:06.280: debug: Check ZSK status
+2008-07-24 23:23:06.280: debug: Re-signing not necessary!
+2008-07-24 23:23:06.280: debug: Check if there is a parent file to copy
+2008-07-24 23:23:06.280: debug:
+2008-07-24 23:23:06.280: notice: end of run: 0 errors occured
+2008-07-24 23:25:21.930: notice: ------------------------------------------------------------
+2008-07-24 23:25:21.930: notice: running ../../dnssec-signer -r -v -v
+2008-07-24 23:25:21.932: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 23:25:21.932: debug: Check RFC5011 status
+2008-07-24 23:25:21.932: debug: ->not a rfc5011 zone, looking for a regular ksk rollover
+2008-07-24 23:25:21.932: debug: Check KSK status
+2008-07-24 23:25:21.932: debug: Check ZSK status
+2008-07-24 23:25:21.932: debug: Re-signing not necessary!
+2008-07-24 23:25:21.932: debug: Check if there is a parent file to copy
+2008-07-24 23:25:21.932: debug:
+2008-07-24 23:25:21.932: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 23:25:21.932: debug: Check RFC5011 status
+2008-07-24 23:25:21.932: debug: Check ZSK status
+2008-07-24 23:25:21.932: debug: Re-signing not necessary!
+2008-07-24 23:25:21.932: debug: Check if there is a parent file to copy
+2008-07-24 23:25:21.932: debug:
+2008-07-24 23:25:21.932: notice: end of run: 0 errors occured
+2008-07-24 23:25:39.009: notice: ------------------------------------------------------------
+2008-07-24 23:25:39.009: notice: running ../../dnssec-signer -f -r -v -v
+2008-07-24 23:25:39.011: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 23:25:39.011: debug: Check RFC5011 status
+2008-07-24 23:25:39.011: debug: ->not a rfc5011 zone, looking for a regular ksk rollover
+2008-07-24 23:25:39.011: debug: Check KSK status
+2008-07-24 23:25:39.011: debug: Check ZSK status
+2008-07-24 23:25:39.011: debug: Re-signing necessary: Option -f
+2008-07-24 23:25:39.011: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-24 23:25:39.011: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-24 23:25:39.011: debug: Signing zone "sub.example.net."
+2008-07-24 23:25:39.012: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-24 23:25:39.591: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 23:25:39.591: debug: Signing completed after 0s.
+2008-07-24 23:25:39.591: debug: Distribution command ./dist.sh not run as root
+2008-07-24 23:25:39.591: error: exec of distribution command ./dist.sh suppressed because of security reasons
+2008-07-24 23:25:39.592: debug:
+2008-07-24 23:25:39.592: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 23:25:39.592: debug: Check RFC5011 status
+2008-07-24 23:25:39.592: debug: Check ZSK status
+2008-07-24 23:25:39.592: debug: Re-signing necessary: Option -f
+2008-07-24 23:25:39.592: notice: "example.net.": re-signing triggered: Option -f
+2008-07-24 23:25:39.592: debug: Writing key file "./example.net./dnskey.db"
+2008-07-24 23:25:39.592: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-24 23:25:39.592: debug: Signing zone "example.net."
+2008-07-24 23:25:39.592: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-24 23:25:39.703: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 23:25:39.703: debug: Signing completed after 0s.
+2008-07-24 23:25:39.703: debug: Distribution command ./dist.sh not run as root
+2008-07-24 23:25:39.703: error: exec of distribution command ./dist.sh suppressed because of security reasons
+2008-07-24 23:25:39.703: debug:
+2008-07-24 23:25:39.703: notice: end of run: 2 errors occured
+2008-07-24 23:28:16.436: notice: ------------------------------------------------------------
+2008-07-24 23:28:16.436: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-24 23:28:16.438: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 23:28:16.438: debug: Check RFC5011 status
+2008-07-24 23:28:16.438: debug: ->not a rfc5011 zone, looking for a regular ksk rollover
+2008-07-24 23:28:16.438: debug: Check KSK status
+2008-07-24 23:28:16.438: debug: Check ZSK status
+2008-07-24 23:28:16.438: debug: Re-signing necessary: Option -f
+2008-07-24 23:28:16.438: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-24 23:28:16.438: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-24 23:28:16.438: debug: Signing zone "sub.example.net."
+2008-07-24 23:28:16.439: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-24 23:28:17.008: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 23:28:17.008: debug: Signing completed after 1s.
+2008-07-24 23:28:17.009: notice: "sub.example.net.": distribution triggered
+2008-07-24 23:28:17.009: debug: Distribute zone "sub.example.net."
+2008-07-24 23:28:17.009: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-24 23:28:17.015: debug: ./dist.sh reload return: "scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net./"
+2008-07-24 23:28:17.015: debug:
+2008-07-24 23:28:17.015: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 23:28:17.015: debug: Check RFC5011 status
+2008-07-24 23:28:17.015: debug: Check ZSK status
+2008-07-24 23:28:17.015: debug: Re-signing necessary: Option -f
+2008-07-24 23:28:17.015: notice: "example.net.": re-signing triggered: Option -f
+2008-07-24 23:28:17.015: debug: Writing key file "./example.net./dnskey.db"
+2008-07-24 23:28:17.016: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-24 23:28:17.016: debug: Signing zone "example.net."
+2008-07-24 23:28:17.016: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-24 23:28:17.132: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 23:28:17.132: debug: Signing completed after 0s.
+2008-07-24 23:28:17.132: notice: "example.net.": distribution triggered
+2008-07-24 23:28:17.132: debug: Distribute zone "example.net."
+2008-07-24 23:28:17.132: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-24 23:28:17.138: debug: ./dist.sh reload return: "scp ./example.net./zone.db.signed localhost:/var/named/example.net./"
+2008-07-24 23:28:17.138: debug:
+2008-07-24 23:28:17.138: notice: end of run: 0 errors occured
+2008-07-24 23:31:17.354: notice: ------------------------------------------------------------
+2008-07-24 23:31:17.354: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-24 23:31:17.364: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 23:31:17.364: debug: Check RFC5011 status
+2008-07-24 23:31:17.364: debug: ->not a rfc5011 zone, looking for a regular ksk rollover
+2008-07-24 23:31:17.364: debug: Check KSK status
+2008-07-24 23:31:17.364: debug: Check ZSK status
+2008-07-24 23:31:17.364: debug: Re-signing necessary: Option -f
+2008-07-24 23:31:17.364: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-24 23:31:17.364: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-24 23:31:17.364: debug: Signing zone "sub.example.net."
+2008-07-24 23:31:17.364: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-24 23:31:18.032: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 23:31:18.032: debug: Signing completed after 1s.
+2008-07-24 23:31:18.032: notice: "sub.example.net.": distribution triggered
+2008-07-24 23:31:18.032: debug: Distribute zone "sub.example.net."
+2008-07-24 23:31:18.032: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-24 23:31:18.039: debug: ./dist.sh reload return: "rndc reload "
+2008-07-24 23:31:18.039: debug:
+2008-07-24 23:31:18.039: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 23:31:18.039: debug: Check RFC5011 status
+2008-07-24 23:31:18.039: debug: Check ZSK status
+2008-07-24 23:31:18.039: debug: Re-signing necessary: Option -f
+2008-07-24 23:31:18.039: notice: "example.net.": re-signing triggered: Option -f
+2008-07-24 23:31:18.039: debug: Writing key file "./example.net./dnskey.db"
+2008-07-24 23:31:18.040: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-24 23:31:18.040: debug: Signing zone "example.net."
+2008-07-24 23:31:18.040: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-24 23:31:18.155: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 23:31:18.155: debug: Signing completed after 0s.
+2008-07-24 23:31:18.155: notice: "example.net.": distribution triggered
+2008-07-24 23:31:18.155: debug: Distribute zone "example.net."
+2008-07-24 23:31:18.155: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-24 23:31:18.161: debug: ./dist.sh reload return: "rndc reload "
+2008-07-24 23:31:18.161: debug:
+2008-07-24 23:31:18.162: notice: end of run: 0 errors occured
+2008-07-24 23:31:28.467: notice: ------------------------------------------------------------
+2008-07-24 23:31:28.467: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-24 23:31:28.470: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 23:31:28.470: debug: Check RFC5011 status
+2008-07-24 23:31:28.470: debug: ->not a rfc5011 zone, looking for a regular ksk rollover
+2008-07-24 23:31:28.470: debug: Check KSK status
+2008-07-24 23:31:28.470: debug: Check ZSK status
+2008-07-24 23:31:28.470: debug: Re-signing necessary: Option -f
+2008-07-24 23:31:28.470: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-24 23:31:28.470: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-24 23:31:28.471: debug: Signing zone "sub.example.net."
+2008-07-24 23:31:28.471: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-24 23:31:29.058: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 23:31:29.059: debug: Signing completed after 1s.
+2008-07-24 23:31:29.059: notice: "sub.example.net.": distribution triggered
+2008-07-24 23:31:29.059: debug: Distribute zone "sub.example.net."
+2008-07-24 23:31:29.059: debug: Run cmd "./dist.sh distribute sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-24 23:31:29.066: debug: ./dist.sh distribute return: "scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net./"
+2008-07-24 23:31:29.066: notice: scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net./: distribution triggered
+2008-07-24 23:31:29.066: debug: Distribute zone scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net./
+2008-07-24 23:31:29.066: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-24 23:31:29.072: debug: ./dist.sh reload return: "rndc reload "
+2008-07-24 23:31:29.072: debug:
+2008-07-24 23:31:29.073: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 23:31:29.073: debug: Check RFC5011 status
+2008-07-24 23:31:29.073: debug: Check ZSK status
+2008-07-24 23:31:29.073: debug: Re-signing necessary: Option -f
+2008-07-24 23:31:29.073: notice: "example.net.": re-signing triggered: Option -f
+2008-07-24 23:31:29.073: debug: Writing key file "./example.net./dnskey.db"
+2008-07-24 23:31:29.074: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-24 23:31:29.074: debug: Signing zone "example.net."
+2008-07-24 23:31:29.075: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-24 23:31:29.204: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 23:31:29.204: debug: Signing completed after 0s.
+2008-07-24 23:31:29.204: notice: "example.net.": distribution triggered
+2008-07-24 23:31:29.204: debug: Distribute zone "example.net."
+2008-07-24 23:31:29.205: debug: Run cmd "./dist.sh distribute example.net. ./example.net./zone.db.signed"
+2008-07-24 23:31:29.211: debug: ./dist.sh distribute return: "scp ./example.net./zone.db.signed localhost:/var/named/example.net./"
+2008-07-24 23:31:29.211: notice: scp ./example.net./zone.db.signed localhost:/var/named/example.net./: distribution triggered
+2008-07-24 23:31:29.211: debug: Distribute zone scp ./example.net./zone.db.signed localhost:/var/named/example.net./
+2008-07-24 23:31:29.211: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-24 23:31:29.217: debug: ./dist.sh reload return: "rndc reload "
+2008-07-24 23:31:29.217: debug:
+2008-07-24 23:31:29.217: notice: end of run: 0 errors occured
+2008-07-24 23:35:48.844: notice: ------------------------------------------------------------
+2008-07-24 23:35:48.844: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-24 23:35:48.846: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 23:35:48.846: debug: Check RFC5011 status
+2008-07-24 23:35:48.846: debug: ->not a rfc5011 zone, looking for a regular ksk rollover
+2008-07-24 23:35:48.846: debug: Check KSK status
+2008-07-24 23:35:48.846: debug: Check ZSK status
+2008-07-24 23:35:48.846: debug: Re-signing necessary: Option -f
+2008-07-24 23:35:48.846: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-24 23:35:48.846: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-24 23:35:48.846: debug: Signing zone "sub.example.net."
+2008-07-24 23:35:48.846: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-24 23:35:49.455: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 23:35:49.455: debug: Signing completed after 1s.
+2008-07-24 23:35:49.455: notice: "sub.example.net.": distribution triggered
+2008-07-24 23:35:49.455: debug: Distribute zone "sub.example.net."
+2008-07-24 23:35:49.455: debug: Run cmd "./dist.sh distribute sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-24 23:35:49.462: notice: "sub.example.net.": distribution triggered
+2008-07-24 23:35:49.462: debug: Distribute zone "sub.example.net."
+2008-07-24 23:35:49.462: debug: ./dist.sh distribute return: "scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net./"
+2008-07-24 23:35:49.462: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-24 23:35:49.468: notice: "sub.example.net.": reload triggered
+2008-07-24 23:35:49.468: debug: Reload zone "sub.example.net."
+2008-07-24 23:35:49.468: debug: ./dist.sh reload return: "rndc reload "
+2008-07-24 23:35:49.468: debug:
+2008-07-24 23:35:49.468: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 23:35:49.468: debug: Check RFC5011 status
+2008-07-24 23:35:49.469: debug: Check ZSK status
+2008-07-24 23:35:49.469: debug: Re-signing necessary: Option -f
+2008-07-24 23:35:49.469: notice: "example.net.": re-signing triggered: Option -f
+2008-07-24 23:35:49.469: debug: Writing key file "./example.net./dnskey.db"
+2008-07-24 23:35:49.470: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-24 23:35:49.470: debug: Signing zone "example.net."
+2008-07-24 23:35:49.470: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-24 23:35:49.600: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 23:35:49.600: debug: Signing completed after 0s.
+2008-07-24 23:35:49.600: notice: "example.net.": distribution triggered
+2008-07-24 23:35:49.600: debug: Distribute zone "example.net."
+2008-07-24 23:35:49.600: debug: Run cmd "./dist.sh distribute example.net. ./example.net./zone.db.signed"
+2008-07-24 23:35:49.606: notice: "example.net.": distribution triggered
+2008-07-24 23:35:49.606: debug: Distribute zone "example.net."
+2008-07-24 23:35:49.606: debug: ./dist.sh distribute return: "scp ./example.net./zone.db.signed localhost:/var/named/example.net./"
+2008-07-24 23:35:49.606: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-24 23:35:49.613: notice: "example.net.": reload triggered
+2008-07-24 23:35:49.613: debug: Reload zone "example.net."
+2008-07-24 23:35:49.613: debug: ./dist.sh reload return: "rndc reload "
+2008-07-24 23:35:49.613: debug:
+2008-07-24 23:35:49.613: notice: end of run: 0 errors occured
+2008-07-24 23:37:41.081: notice: ------------------------------------------------------------
+2008-07-24 23:37:41.081: notice: running ../../dnssec-signer -r -f -v -v
+2008-07-24 23:37:41.083: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 23:37:41.083: debug: Check RFC5011 status
+2008-07-24 23:37:41.083: debug: ->not a rfc5011 zone, looking for a regular ksk rollover
+2008-07-24 23:37:41.083: debug: Check KSK status
+2008-07-24 23:37:41.083: debug: Check ZSK status
+2008-07-24 23:37:41.083: debug: Re-signing necessary: Option -f
+2008-07-24 23:37:41.083: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-24 23:37:41.083: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-24 23:37:41.084: debug: Signing zone "sub.example.net."
+2008-07-24 23:37:41.084: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-24 23:37:41.688: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 23:37:41.688: debug: Signing completed after 0s.
+2008-07-24 23:37:41.689: notice: "sub.example.net.": distribution triggered
+2008-07-24 23:37:41.689: debug: Distribute zone "sub.example.net."
+2008-07-24 23:37:41.689: debug: Run cmd "./dist.sh distribute sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-24 23:37:41.695: debug: ./dist.sh distribute return: "scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net./"
+2008-07-24 23:37:41.695: notice: "sub.example.net.": reload triggered
+2008-07-24 23:37:41.695: debug: Reload zone "sub.example.net."
+2008-07-24 23:37:41.695: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-24 23:37:41.701: debug: ./dist.sh reload return: "rndc reload "
+2008-07-24 23:37:41.701: debug:
+2008-07-24 23:37:41.701: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 23:37:41.701: debug: Check RFC5011 status
+2008-07-24 23:37:41.701: debug: Check ZSK status
+2008-07-24 23:37:41.701: debug: Re-signing necessary: Option -f
+2008-07-24 23:37:41.701: notice: "example.net.": re-signing triggered: Option -f
+2008-07-24 23:37:41.701: debug: Writing key file "./example.net./dnskey.db"
+2008-07-24 23:37:41.702: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-24 23:37:41.702: debug: Signing zone "example.net."
+2008-07-24 23:37:41.702: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-24 23:37:41.823: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 23:37:41.824: debug: Signing completed after 0s.
+2008-07-24 23:37:41.824: notice: "example.net.": distribution triggered
+2008-07-24 23:37:41.824: debug: Distribute zone "example.net."
+2008-07-24 23:37:41.824: debug: Run cmd "./dist.sh distribute example.net. ./example.net./zone.db.signed"
+2008-07-24 23:37:41.830: debug: ./dist.sh distribute return: "scp ./example.net./zone.db.signed localhost:/var/named/example.net./"
+2008-07-24 23:37:41.831: notice: "example.net.": reload triggered
+2008-07-24 23:37:41.831: debug: Reload zone "example.net."
+2008-07-24 23:37:41.831: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-24 23:37:41.837: debug: ./dist.sh reload return: "rndc reload "
+2008-07-24 23:37:41.837: debug:
+2008-07-24 23:37:41.837: notice: end of run: 0 errors occured
+2008-07-24 23:37:51.742: notice: ------------------------------------------------------------
+2008-07-24 23:37:51.742: notice: running ../../dnssec-signer -r -f -v
+2008-07-24 23:37:51.744: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 23:37:51.744: debug: Check RFC5011 status
+2008-07-24 23:37:51.744: debug: ->not a rfc5011 zone, looking for a regular ksk rollover
+2008-07-24 23:37:51.744: debug: Check KSK status
+2008-07-24 23:37:51.744: debug: Check ZSK status
+2008-07-24 23:37:51.744: debug: Re-signing necessary: Option -f
+2008-07-24 23:37:51.744: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-24 23:37:51.744: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-24 23:37:51.745: debug: Signing zone "sub.example.net."
+2008-07-24 23:37:51.745: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-24 23:37:52.263: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 23:37:52.264: debug: Signing completed after 1s.
+2008-07-24 23:37:52.264: notice: "sub.example.net.": distribution triggered
+2008-07-24 23:37:52.264: debug: Distribute zone "sub.example.net."
+2008-07-24 23:37:52.264: debug: Run cmd "./dist.sh distribute sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-24 23:37:52.270: debug: ./dist.sh distribute return: "scp ./sub.example.net./zone.db.signed localhost:/var/named/sub.example.net./"
+2008-07-24 23:37:52.271: notice: "sub.example.net.": reload triggered
+2008-07-24 23:37:52.271: debug: Reload zone "sub.example.net."
+2008-07-24 23:37:52.271: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-24 23:37:52.276: debug: ./dist.sh reload return: "rndc reload "
+2008-07-24 23:37:52.277: debug:
+2008-07-24 23:37:52.277: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 23:37:52.277: debug: Check RFC5011 status
+2008-07-24 23:37:52.277: debug: Check ZSK status
+2008-07-24 23:37:52.277: debug: Re-signing necessary: Option -f
+2008-07-24 23:37:52.277: notice: "example.net.": re-signing triggered: Option -f
+2008-07-24 23:37:52.277: debug: Writing key file "./example.net./dnskey.db"
+2008-07-24 23:37:52.277: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-24 23:37:52.277: debug: Signing zone "example.net."
+2008-07-24 23:37:52.277: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-24 23:37:52.397: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-24 23:37:52.398: debug: Signing completed after 0s.
+2008-07-24 23:37:52.398: notice: "example.net.": distribution triggered
+2008-07-24 23:37:52.398: debug: Distribute zone "example.net."
+2008-07-24 23:37:52.398: debug: Run cmd "./dist.sh distribute example.net. ./example.net./zone.db.signed"
+2008-07-24 23:37:52.404: debug: ./dist.sh distribute return: "scp ./example.net./zone.db.signed localhost:/var/named/example.net./"
+2008-07-24 23:37:52.404: notice: "example.net.": reload triggered
+2008-07-24 23:37:52.404: debug: Reload zone "example.net."
+2008-07-24 23:37:52.404: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-24 23:37:52.410: debug: ./dist.sh reload return: "rndc reload "
+2008-07-24 23:37:52.410: debug:
+2008-07-24 23:37:52.410: notice: end of run: 0 errors occured
+2008-07-24 23:44:51.717: notice: ------------------------------------------------------------
+2008-07-24 23:44:51.717: notice: running ../../dnssec-signer -n -r -f -v
+2008-07-24 23:44:51.719: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 23:44:51.719: debug: Check RFC5011 status
+2008-07-24 23:44:51.719: debug: ->not a rfc5011 zone, looking for a regular ksk rollover
+2008-07-24 23:44:51.719: debug: Check KSK status
+2008-07-24 23:44:51.720: debug: Check ZSK status
+2008-07-24 23:44:51.720: debug: Re-signing necessary: Option -f
+2008-07-24 23:44:51.720: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-24 23:44:51.720: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-24 23:44:51.720: debug: Signing zone "sub.example.net."
+2008-07-24 23:44:51.720: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-24 23:44:51.720: debug: Cmd dnssec-signzone return: ""
+2008-07-24 23:44:51.720: debug: Signing completed after 0s.
+2008-07-24 23:44:51.721: notice: "sub.example.net.": distribution triggered
+2008-07-24 23:44:51.721: debug: Distribute zone "sub.example.net."
+2008-07-24 23:44:51.721: debug: Run cmd "./dist.sh distribute sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-24 23:44:51.721: debug: ./dist.sh distribute return: ""
+2008-07-24 23:44:51.721: notice: "sub.example.net.": reload triggered
+2008-07-24 23:44:51.721: debug: Reload zone "sub.example.net."
+2008-07-24 23:44:51.721: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-24 23:44:51.721: debug: ./dist.sh reload return: ""
+2008-07-24 23:44:51.721: debug:
+2008-07-24 23:44:51.721: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 23:44:51.721: debug: Check RFC5011 status
+2008-07-24 23:44:51.721: debug: Check ZSK status
+2008-07-24 23:44:51.721: debug: Re-signing necessary: Option -f
+2008-07-24 23:44:51.722: notice: "example.net.": re-signing triggered: Option -f
+2008-07-24 23:44:51.722: debug: Writing key file "./example.net./dnskey.db"
+2008-07-24 23:44:51.722: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-24 23:44:51.722: notice: "example.net.": distribution triggered
+2008-07-24 23:44:51.722: debug: Distribute zone "example.net."
+2008-07-24 23:44:51.722: debug: Run cmd "./dist.sh distribute example.net. ./example.net./zone.db.signed"
+2008-07-24 23:44:51.722: debug: ./dist.sh distribute return: ""
+2008-07-24 23:44:51.722: notice: "example.net.": reload triggered
+2008-07-24 23:44:51.722: debug: Reload zone "example.net."
+2008-07-24 23:44:51.722: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-24 23:44:51.722: debug: ./dist.sh reload return: ""
+2008-07-24 23:44:51.723: debug:
+2008-07-24 23:44:51.723: notice: end of run: 0 errors occured
+2008-07-24 23:44:57.039: notice: ------------------------------------------------------------
+2008-07-24 23:44:57.040: notice: running ../../dnssec-signer -n -r -f -v -v
+2008-07-24 23:44:57.042: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-24 23:44:57.042: debug: Check RFC5011 status
+2008-07-24 23:44:57.042: debug: ->not a rfc5011 zone, looking for a regular ksk rollover
+2008-07-24 23:44:57.042: debug: Check KSK status
+2008-07-24 23:44:57.042: debug: Check ZSK status
+2008-07-24 23:44:57.042: debug: Re-signing necessary: Option -f
+2008-07-24 23:44:57.042: notice: "sub.example.net.": re-signing triggered: Option -f
+2008-07-24 23:44:57.042: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-24 23:44:57.042: debug: Signing zone "sub.example.net."
+2008-07-24 23:44:57.042: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-24 23:44:57.042: debug: Cmd dnssec-signzone return: ""
+2008-07-24 23:44:57.042: debug: Signing completed after 0s.
+2008-07-24 23:44:57.042: notice: "sub.example.net.": distribution triggered
+2008-07-24 23:44:57.042: debug: Distribute zone "sub.example.net."
+2008-07-24 23:44:57.042: debug: Run cmd "./dist.sh distribute sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-24 23:44:57.042: debug: ./dist.sh distribute return: ""
+2008-07-24 23:44:57.043: notice: "sub.example.net.": reload triggered
+2008-07-24 23:44:57.043: debug: Reload zone "sub.example.net."
+2008-07-24 23:44:57.043: debug: Run cmd "./dist.sh reload sub.example.net. ./sub.example.net./zone.db.signed"
+2008-07-24 23:44:57.043: debug: ./dist.sh reload return: ""
+2008-07-24 23:44:57.043: debug:
+2008-07-24 23:44:57.043: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-24 23:44:57.043: debug: Check RFC5011 status
+2008-07-24 23:44:57.043: debug: Check ZSK status
+2008-07-24 23:44:57.043: debug: Re-signing necessary: Option -f
+2008-07-24 23:44:57.043: notice: "example.net.": re-signing triggered: Option -f
+2008-07-24 23:44:57.043: debug: Writing key file "./example.net./dnskey.db"
+2008-07-24 23:44:57.043: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-24 23:44:57.043: notice: "example.net.": distribution triggered
+2008-07-24 23:44:57.043: debug: Distribute zone "example.net."
+2008-07-24 23:44:57.043: debug: Run cmd "./dist.sh distribute example.net. ./example.net./zone.db.signed"
+2008-07-24 23:44:57.043: debug: ./dist.sh distribute return: ""
+2008-07-24 23:44:57.043: notice: "example.net.": reload triggered
+2008-07-24 23:44:57.043: debug: Reload zone "example.net."
+2008-07-24 23:44:57.043: debug: Run cmd "./dist.sh reload example.net. ./example.net./zone.db.signed"
+2008-07-24 23:44:57.043: debug: ./dist.sh reload return: ""
+2008-07-24 23:44:57.043: debug:
+2008-07-24 23:44:57.043: notice: end of run: 0 errors occured
+2008-07-25 23:31:07.235: notice: ------------------------------------------------------------
+2008-07-25 23:31:07.236: notice: running ../../dnssec-signer -v -v
+2008-07-25 23:31:07.238: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-25 23:31:07.238: debug: Check RFC5011 status
+2008-07-25 23:31:07.238: debug: ->not a rfc5011 zone, looking for a regular ksk rollover
+2008-07-25 23:31:07.238: debug: Check KSK status
+2008-07-25 23:31:07.238: debug: Check ZSK status
+2008-07-25 23:31:07.238: debug: Lifetime(259200 +/-150 sec) of active key 31081 exceeded (343229 sec)
+2008-07-25 23:31:07.239: debug: ->depreciate it
+2008-07-25 23:31:07.239: debug: ->activate published key 3615
+2008-07-25 23:31:07.239: notice: "sub.example.net.": lifetime of zone signing key 31081 exceeded: ZSK rollover done
+2008-07-25 23:31:07.239: debug: New published key needed
+2008-07-25 23:31:07.397: debug: ->creating new published key 4254
+2008-07-25 23:31:07.397: info: "sub.example.net.": new key 4254 generated for publishing
+2008-07-25 23:31:07.397: debug: Re-signing necessary: New zone key
+2008-07-25 23:31:07.397: notice: "sub.example.net.": re-signing triggered: New zone key
+2008-07-25 23:31:07.398: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-25 23:31:07.398: debug: Signing zone "sub.example.net."
+2008-07-25 23:31:07.398: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-25 23:31:07.639: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-25 23:31:07.639: debug: Signing completed after 0s.
+2008-07-25 23:31:07.639: debug:
+2008-07-25 23:31:07.639: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-25 23:31:07.639: debug: Check RFC5011 status
+2008-07-25 23:31:07.639: debug: Check ZSK status
+2008-07-25 23:31:07.639: debug: Re-signing necessary: Modified keys
+2008-07-25 23:31:07.639: notice: "example.net.": re-signing triggered: Modified keys
+2008-07-25 23:31:07.639: debug: Writing key file "./example.net./dnskey.db"
+2008-07-25 23:31:07.640: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-25 23:31:07.640: debug: Signing zone "example.net."
+2008-07-25 23:31:07.640: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-25 23:31:07.783: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-25 23:31:07.783: debug: Signing completed after 0s.
+2008-07-25 23:31:07.783: debug:
+2008-07-25 23:31:07.783: notice: end of run: 0 errors occured
+2008-07-25 23:32:27.052: notice: ------------------------------------------------------------
+2008-07-25 23:32:27.052: notice: running ../../dnssec-signer -v -v
+2008-07-25 23:32:27.054: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-25 23:32:27.054: debug: Check RFC5011 status
+2008-07-25 23:32:27.054: debug: ->not a rfc5011 zone, looking for a regular ksk rollover
+2008-07-25 23:32:27.054: debug: Check KSK status
+2008-07-25 23:32:27.054: debug: Check ZSK status
+2008-07-25 23:32:27.054: debug: Re-signing not necessary!
+2008-07-25 23:32:27.054: debug: Check if there is a parent file to copy
+2008-07-25 23:32:27.054: debug:
+2008-07-25 23:32:27.054: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-25 23:32:27.054: debug: Check RFC5011 status
+2008-07-25 23:32:27.054: debug: Check ZSK status
+2008-07-25 23:32:27.054: debug: Re-signing not necessary!
+2008-07-25 23:32:27.054: debug: Check if there is a parent file to copy
+2008-07-25 23:32:27.057: debug:
+2008-07-25 23:32:27.057: notice: end of run: 0 errors occured
+2008-07-31 00:25:52.601: notice: ------------------------------------------------------------
+2008-07-31 00:25:52.601: notice: running ../../dnssec-signer -v -v
+2008-07-31 00:25:52.604: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-31 00:25:52.604: debug: Check RFC5011 status
+2008-07-31 00:25:52.604: debug: ->not a rfc5011 zone, looking for a regular ksk rollover
+2008-07-31 00:25:52.604: debug: Check KSK status
+2008-07-31 00:25:52.604: debug: Check ZSK status
+2008-07-31 00:25:52.604: debug: Lifetime(390 sec) of depreciated key 31081 exceeded (435285 sec)
+2008-07-31 00:25:52.604: info: "sub.example.net.": old ZSK 31081 removed
+2008-07-31 00:25:52.605: debug: ->remove it
+2008-07-31 00:25:52.605: debug: Lifetime(259200 +/-150 sec) of active key 3615 exceeded (435285 sec)
+2008-07-31 00:25:52.605: debug: ->depreciate it
+2008-07-31 00:25:52.605: debug: ->activate published key 4254
+2008-07-31 00:25:52.605: notice: "sub.example.net.": lifetime of zone signing key 3615 exceeded: ZSK rollover done
+2008-07-31 00:25:52.605: debug: New key for publishing needed
+2008-07-31 00:25:53.128: debug: ->creating new key 56744
+2008-07-31 00:25:53.128: info: "sub.example.net.": new key 56744 generated for publishing
+2008-07-31 00:25:53.128: debug: Re-signing necessary: New zone key
+2008-07-31 00:25:53.128: notice: "sub.example.net.": re-signing triggered: New zone key
+2008-07-31 00:25:53.128: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-31 00:25:53.128: debug: Signing zone "sub.example.net."
+2008-07-31 00:25:53.128: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-31 00:25:53.332: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-31 00:25:53.332: debug: Signing completed after 0s.
+2008-07-31 00:25:53.332: debug:
+2008-07-31 00:25:53.332: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-31 00:25:53.332: debug: Check RFC5011 status
+2008-07-31 00:25:53.332: debug: Check ZSK status
+2008-07-31 00:25:53.332: debug: Re-signing necessary: re-signing interval (2d) reached
+2008-07-31 00:25:53.332: notice: "example.net.": re-signing triggered: re-signing interval (2d) reached
+2008-07-31 00:25:53.332: debug: Writing key file "./example.net./dnskey.db"
+2008-07-31 00:25:53.333: debug: Incrementing serial number in file "./example.net./zone.db"
+2008-07-31 00:25:53.333: debug: Signing zone "example.net."
+2008-07-31 00:25:53.333: debug: Run cmd "cd ./example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o example.net. -e +518400 zone.db K*.private"
+2008-07-31 00:25:53.477: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-31 00:25:53.477: debug: Signing completed after 0s.
+2008-07-31 00:25:53.477: debug:
+2008-07-31 00:25:53.477: notice: end of run: 0 errors occured
+2008-07-31 13:19:17.447: notice: ------------------------------------------------------------
+2008-07-31 13:19:17.447: notice: running ../../dnssec-signer -v -v
+2008-07-31 13:19:17.449: debug: parsing zone "sub.example.net." in dir "./sub.example.net."
+2008-07-31 13:19:17.449: debug: Check RFC5011 status
+2008-07-31 13:19:17.450: debug: ->not a rfc5011 zone, looking for a regular ksk rollover
+2008-07-31 13:19:17.450: debug: Check KSK status
+2008-07-31 13:19:17.450: debug: Check ZSK status
+2008-07-31 13:19:17.450: debug: Lifetime(390 sec) of depreciated key 3615 exceeded (46405 sec)
+2008-07-31 13:19:17.450: info: "sub.example.net.": old ZSK 3615 removed
+2008-07-31 13:19:17.450: debug: ->remove it
+2008-07-31 13:19:17.450: debug: Re-signing necessary: New zone key
+2008-07-31 13:19:17.451: notice: "sub.example.net.": re-signing triggered: New zone key
+2008-07-31 13:19:17.451: debug: Writing key file "./sub.example.net./dnskey.db"
+2008-07-31 13:19:17.451: debug: Signing zone "sub.example.net."
+2008-07-31 13:19:17.451: debug: Run cmd "cd ./sub.example.net.; /usr/local/sbin/dnssec-signzone -g -p -d ../keysets -o sub.example.net. -e +172800 -l dlv.trusted-keys.de -N unixtime zone.db K*.private"
+2008-07-31 13:19:17.943: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-07-31 13:19:17.944: debug: Signing completed after 0s.
+2008-07-31 13:19:17.944: debug:
+2008-07-31 13:19:17.944: debug: parsing zone "example.net." in dir "./example.net."
+2008-07-31 13:19:17.944: debug: Check RFC5011 status
+2008-07-31 13:19:17.944: debug: Check ZSK status
+2008-07-31 13:19:17.944: debug: Re-signing not necessary!
+2008-07-31 13:19:17.944: debug: Check if there is a parent file to copy
+2008-07-31 13:19:17.944: debug:
+2008-07-31 13:19:17.945: notice: end of run: 0 errors occured
diff --git a/contrib/zkt/examples/flat/zone.conf b/contrib/zkt/examples/flat/zone.conf
new file mode 100644
index 0000000..0ccc7f6
--- /dev/null
+++ b/contrib/zkt/examples/flat/zone.conf
@@ -0,0 +1,10 @@
+
+zone "example.NET." in {
+ type master;
+ file "example.net./zone.db.signed";
+};
+
+zone "sub.example.NET." in {
+ type master;
+ file "sub.example.net./zone.db.signed";
+};
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+11867.key b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+11867.key
new file mode 100644
index 0000000..a824208
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+11867.key
@@ -0,0 +1,3 @@
+;% generationtime=20080717083652
+;% lifetime=28d
+example.de. IN DNSKEY 256 3 5 BQEAAAAByN2rMrazHwh+sNOv8cBef3HUotAQTS9QW4Y5NjNuyYNraJBA OqV8KSaGQqIhkh0ZD0oIm2h0JowdyERZVj6ZZQ==
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+11867.published b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+11867.published
new file mode 100644
index 0000000..8703816
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+11867.published
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 5 (RSASHA1)
+Modulus: yN2rMrazHwh+sNOv8cBef3HUotAQTS9QW4Y5NjNuyYNraJBAOqV8KSaGQqIhkh0ZD0oIm2h0JowdyERZVj6ZZQ==
+PublicExponent: AQAAAAE=
+PrivateExponent: PUJ1+zrJn3r8Z+GcNmxwyHaNeLivsjSiSoGZu2FnlJHgHV3Kq5ZL+d5jeGpbPyW6Bc5z+NpkqGPuz/DG9C6OhQ==
+Prime1: 8NWUn++L7p45k/tgcIoVKWe9Jgwtn4m8K8PkNQG1H4s=
+Prime2: 1YPE6Nw/KsuDHPkM6NAqtnMWugaG9kDq348eSTkhSM8=
+Exponent1: tF/x51phYle6xgqBLw3ixmkQJCSpCa3F51pb/zGieV0=
+Exponent2: PeU/PmlccGmtux9ZC9rEdu/xmMERXZri3QdBtCzYDLs=
+Coefficient: gMF5l8BpGn2VBO7XqZNTJWOkx1lBOytfBc4y6yh+Cn8=
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+17439.key b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+17439.key
new file mode 100644
index 0000000..1986117
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+17439.key
@@ -0,0 +1,4 @@
+;% generationtime=20080506225722
+;% lifetime=20d
+;% expirationtime=20080711220959
+example.de. IN DNSKEY 385 3 5 BQEAAAABCyg92L7v21N3lc/gR07/2iLmvt6dUn1KKauLvmkRuT040XT+ Rd3Iq20iq6BqVPsPS+hCOTRA3xikTIn5YzmPLPutIRtjIodHhsrML4D9 Pp1dzgEDKWLam96v+E7KC0GGH/BI6/WelqeqjS5BjI4Gjv4roaTyDCi6 3oXwcMFDVwrSjws4A/5AGANka41Aky+UCGse6+64YmNP/QkSXDAeBZqw rw==
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+17439.private b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+17439.private
new file mode 100644
index 0000000..62b7ca4
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+17439.private
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 5 (RSASHA1)
+Modulus: Cyg92L7v21N3lc/gR07/2iLmvt6dUn1KKauLvmkRuT040XT+Rd3Iq20iq6BqVPsPS+hCOTRA3xikTIn5YzmPLPutIRtjIodHhsrML4D9Pp1dzgEDKWLam96v+E7KC0GGH/BI6/WelqeqjS5BjI4Gjv4roaTyDCi63oXwcMFDVwrSjws4A/5AGANka41Aky+UCGse6+64YmNP/QkSXDAeBZqwrw==
+PublicExponent: AQAAAAE=
+PrivateExponent: CGYBtGSIMmSFoqnh6yYuoYlvTP2O7vkBdRrfkN43NwdlQVhco+wQO55QxCZNhCcbp2xau9IdejetNH0pQ3Zfg2Vllx78F8VMTMqkgw2HudWS/RahkMg+Hq6DBUaX/LYt90ToGyy5+FmyBm4fOV8FxJVrmTFMw4m7ULp3FgRcxmzS5zNjKYP2LKU/pYz0wFpyAr88DGNjChgwvRN/GE4obsoJgQ==
+Prime1: A18v8idXV3o9tpIzalTEpOeDX7OxKumhUsoDpPhOJf7XqHLS6hYoYwFbRObF23Zi/3kHiAoGffR1Dkd+ji3xZhFOSEcUDuikQ2jdzdY8NxbzQQ==
+Prime2: A08XMjIEpsViYvYB+ChuYxPbq7Z/eHtT/r5f8zS+nuEUwYAlKeq/i+U5sIydC1txv5XQuRPqpjtlZTClJ85BpS0GnSspG5PcY3OMwkA2smLX7w==
+Exponent1: AcLu8YM68M8LtP7Dr7vYI+vJK6RK5SN/mAnz4ALt53igCUB/iVrfvBWCHp7hEgkRZUQQoItbT9C6YXrC3G9DW+IldSP8vrtqYva4YDBD2X1LAQ==
+Exponent2: JdJVp3CAJPPcx0KiKDS8gHDiu22CBV2w1cycnXgwFmJl4aQkbTA7/xlgl15r3lByacAc19JreArqgCQRQV3bS7NG2PiQmzO26XkwCq+Kj7OJ
+Coefficient: i6sKgv2zpCvdY9fChryaf5nZyb4nFd2dG/vnjQScBz8YVw4LnfL/XqKIego0Ez6/KlL4AnvkcafzogJ+MtmBB7V4RXEyObcbR6M/MLGMhpL8
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+35672.key b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+35672.key
new file mode 100644
index 0000000..4836d51
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+35672.key
@@ -0,0 +1,3 @@
+;% generationtime=20080608210458
+;% lifetime=28d
+example.de. IN DNSKEY 256 3 5 BQEAAAABnRJdmY7dzRKi93pVkLToV5FK4Ffm8YnY0c6IHKcAmb5t8FLv pNijniIclCPXTpfio+HNa59a4UA8jTdJb+kT0w==
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+35672.private b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+35672.private
new file mode 100644
index 0000000..3b1b32e
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+35672.private
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 5 (RSASHA1)
+Modulus: nRJdmY7dzRKi93pVkLToV5FK4Ffm8YnY0c6IHKcAmb5t8FLvpNijniIclCPXTpfio+HNa59a4UA8jTdJb+kT0w==
+PublicExponent: AQAAAAE=
+PrivateExponent: I2jMbjLfEzJ4iZHvXDTRZKM2/SXOLH9dTWkzH8zfbW+jzsKObfnt7/yJYaIHv0gQOvOAfQ46RutqryjQpLPtoQ==
+Prime1: 0TgZK52tc+JlhyG5229kjntpXP0enYcMqROdLM9lSoM=
+Prime2: wDFNEVHv0GDU7L7ZLPIuRewnHg9SHgSnQ+kOWDhZEHE=
+Exponent1: aVdC0HyDAG7bvUkwx468HhrL/00lGXQYvnxoKqV3/dU=
+Exponent2: quQ/NY7YkT3jYi649bQ9hsWDkaAoBf1FrIVPcf3FSXE=
+Coefficient: Td8UjaaoC44Qt0jCQ4uULI1YUQRNdPYH3024NghryrE=
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+41145.key b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+41145.key
new file mode 100644
index 0000000..3a636d4
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+41145.key
@@ -0,0 +1,3 @@
+;% generationtime=20080608210458
+;% lifetime=20d
+example.de. IN DNSKEY 257 3 5 BQEAAAABDrm5aXRPuZOmwT4nINnY2qXyXWLtutggFAJgBW5Ua7uzAR+7 r/DcOE7IfjnT5FQhbYXIuKy61uOEqPu1TYvDsGb1pseKSB4J0jmXDU9N tu9TDp6X6ZXE11+cFdATa4TPnsAUMSxVkLZanrbyACmcNr1gjT3dz6qI VBVPb5OnUldndbgtlOX3wcE0aR/MIsIjz1UQl/QoxbVclZVOUNdJQGb9 zQ==
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+41145.private b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+41145.private
new file mode 100644
index 0000000..b0466be
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+41145.private
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 5 (RSASHA1)
+Modulus: Drm5aXRPuZOmwT4nINnY2qXyXWLtutggFAJgBW5Ua7uzAR+7r/DcOE7IfjnT5FQhbYXIuKy61uOEqPu1TYvDsGb1pseKSB4J0jmXDU9Ntu9TDp6X6ZXE11+cFdATa4TPnsAUMSxVkLZanrbyACmcNr1gjT3dz6qIVBVPb5OnUldndbgtlOX3wcE0aR/MIsIjz1UQl/QoxbVclZVOUNdJQGb9zQ==
+PublicExponent: AQAAAAE=
+PrivateExponent: AQM2fRAmc6coPLeTHAK1DCHOYCRPSjsHYXoOzwMzzdIpHschjfxka35UdNSGKYpqM9E+VTZmV96w9ZZK5recxYak/6F72ZYTIYtsWYqCkej18nzhpnlt4nASnRt0nsS9UVVwc1Y7QxqRtSVXEcgcbiW3lr0jq+PSBf/HjY9qOHV4ExXlz7KPYOWbJa1YLFnvGlMd/W7hmQvXNEfTvOwjKURV4Q==
+Prime1: A/0Yax4evJzC7VSw0Swt0KNM7gtIJ9nwzDCrTymulzKhu6Wgeu0veU9OAGDhv0Yfmn0kr1JLITpMu4uo3a5jfLb18yZEAyPphejZBA+wPIll+Q==
+Prime2: A7EcplBfPWZmeCeL6UnFz4h45nxi3jRfQT00k34Nu5aFt5v+ngExbatcoOMnEKZSq2SQKDQRTp6XBOiwPNB9mVaLmzl9k9tyX6JvkCBEDrM7dQ==
+Exponent1: AjoJbjmJarH7I4Zj5UPc9r0I5NtVgrAx4ZltcqPN07/1cBS2QAnZuMSLUvv8pkK+Lng9Wdy9c2FL0XjWY5Q+ORYj4ONGl9OWpi2zKqpTw4WgOQ==
+Exponent2: AZfFGuYsztbn6tHFUIdIeXfaFTYyVbSfCEUp2Uv8N75QMyyuT4dzAlkU2cfSg3oAefrlCKWqXtLv9XlOJ1hTeXZOz8jyYAyhvGWGoHmSbeaNKQ==
+Coefficient: AX6DKJRk0GXwCnkpfbn91myfZ2wgsUTXKjqasdlTqm3JL9Rtpq8J2MWPhexcSSz8DNa5LQlGduE1nh4eqqntnSNckD6CeImMdWgTNbQS3zV8Bw==
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+59244.key b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+59244.key
new file mode 100644
index 0000000..35d4c6a
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+59244.key
@@ -0,0 +1,3 @@
+;% generationtime=20080711221000
+;% lifetime=20d
+example.de. IN DNSKEY 257 3 5 BQEAAAABDfaBERX9p+FUi1OXYVig7zLCQFZoRYpwDDuLzBcC7k+G1+wW dftyA1vBm5HMpyq0OifT0Hsez4+H+0CIWHZP8oPCYfKrq+wM2EgMzDDO Yv+O1TQU4i3G+iONxB1RAwH/J2lA+U0zCbrdf0KLq/enNquchhPw4gCX 0RB9HC+TkpoPf2u7aKFcjlpw4C4uhDl1s6FpfdXe6NQWW6c+ONUcLAEt +w==
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+59244.published b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+59244.published
new file mode 100644
index 0000000..b7f28db
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./Kexample.de.+005+59244.published
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 5 (RSASHA1)
+Modulus: DfaBERX9p+FUi1OXYVig7zLCQFZoRYpwDDuLzBcC7k+G1+wWdftyA1vBm5HMpyq0OifT0Hsez4+H+0CIWHZP8oPCYfKrq+wM2EgMzDDOYv+O1TQU4i3G+iONxB1RAwH/J2lA+U0zCbrdf0KLq/enNquchhPw4gCX0RB9HC+TkpoPf2u7aKFcjlpw4C4uhDl1s6FpfdXe6NQWW6c+ONUcLAEt+w==
+PublicExponent: AQAAAAE=
+PrivateExponent: /MDd0rAZf9mm/3cDi6TjTqeegMmnidhKYIzxyz1+quzwOA16L3jLf3ucWjz/BlEiOYh1CZbAroGRYqBAskys8u7FDinOQEP5cEn5NUyL5z0WebSCO+qnaqaQSokRs0oUx3+e9tJc9GhhmZIVNXQe4mYxfeYCl6KZS9CXe22y31PkvJ+SQIBh/I+SQnM4rbW012rKroAxdHfTvmalofx+Qb1h
+Prime1: A/5Pkk5UAGvEa06GrEcATMOjsxZ0BbgalPuJKLLTFzvtYhdlJY738oY0QfsHba9hEC+iiSwfjWYyNlH/7bcVqSFtbLJiJ0aUfvObj75qw4HjXQ==
+Prime2: A38aQzy3UrARKcwUqCiQrSOTM5P7xIDfbruW7ywmaWA1lXCvP3EJAal6MYs0pG2vx1cxVTIPva3Se26NkGaBqZw+RgHxmRmfgxvSoCfWXGZZNw==
+Exponent1: OvPYJBkVUbncb0mBtTe5uwa9RgGlCgW4ges93zf3UQuHGvAesUFNnMh6y9zi4vgyVNbz2KOSnA91onc9l42b6NwqRNbExGhDsMc8NQi16vnF
+Exponent2: AkkCNzHuGv3HaQ4MpRT/PLPA2UONseMBvJHWlgK+aO2xb6/7I09sPqKnJ4f6Bj5jL8efNZYHWsaN4l335V9lc5791opU+07LHHpULn2qVRpJYw==
+Coefficient: An94juF2F5cDtoMC6gwI5iaWDH/qxkeuZ62fnMFoMY18XO0/clTVfdW7XvXCOn1DQyDLDOYpxR5MfeDKkbxtGGYKABWBOWlyaS1A5D5wTQRJzw==
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./dnskey.db b/contrib/zkt/examples/hierarchical/de./example.de./dnskey.db
new file mode 100644
index 0000000..bd106bd
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./dnskey.db
@@ -0,0 +1,48 @@
+;
+; !!! Don't edit this file by hand.
+; !!! It will be generated by dnssec-signer.
+;
+; Last generation time Jul 29 2008 12:44:06
+;
+
+; *** List of Key Signing Keys ***
+; example.de. tag=17439 algo=RSASHA1 generated Jun 19 2008 00:32:22
+example.de. 3600 IN DNSKEY 385 3 5 (
+ BQEAAAABCyg92L7v21N3lc/gR07/2iLmvt6dUn1KKauLvmkRuT040XT+
+ Rd3Iq20iq6BqVPsPS+hCOTRA3xikTIn5YzmPLPutIRtjIodHhsrML4D9
+ Pp1dzgEDKWLam96v+E7KC0GGH/BI6/WelqeqjS5BjI4Gjv4roaTyDCi6
+ 3oXwcMFDVwrSjws4A/5AGANka41Aky+UCGse6+64YmNP/QkSXDAeBZqw
+ rw==
+ ) ; key id = 17567 (original key id = 17439)
+
+; example.de. tag=41145 algo=RSASHA1 generated Jul 12 2008 00:10:00
+example.de. 3600 IN DNSKEY 257 3 5 (
+ BQEAAAABDrm5aXRPuZOmwT4nINnY2qXyXWLtutggFAJgBW5Ua7uzAR+7
+ r/DcOE7IfjnT5FQhbYXIuKy61uOEqPu1TYvDsGb1pseKSB4J0jmXDU9N
+ tu9TDp6X6ZXE11+cFdATa4TPnsAUMSxVkLZanrbyACmcNr1gjT3dz6qI
+ VBVPb5OnUldndbgtlOX3wcE0aR/MIsIjz1UQl/QoxbVclZVOUNdJQGb9
+ zQ==
+ ) ; key id = 41145
+
+; example.de. tag=59244 algo=RSASHA1 generated Jul 12 2008 00:10:00
+example.de. 3600 IN DNSKEY 257 3 5 (
+ BQEAAAABDfaBERX9p+FUi1OXYVig7zLCQFZoRYpwDDuLzBcC7k+G1+wW
+ dftyA1vBm5HMpyq0OifT0Hsez4+H+0CIWHZP8oPCYfKrq+wM2EgMzDDO
+ Yv+O1TQU4i3G+iONxB1RAwH/J2lA+U0zCbrdf0KLq/enNquchhPw4gCX
+ 0RB9HC+TkpoPf2u7aKFcjlpw4C4uhDl1s6FpfdXe6NQWW6c+ONUcLAEt
+ +w==
+ ) ; key id = 59244
+
+; *** List of Zone Signing Keys ***
+; example.de. tag=35672 algo=RSASHA1 generated Jul 17 2008 10:36:52
+example.de. 3600 IN DNSKEY 256 3 5 (
+ BQEAAAABnRJdmY7dzRKi93pVkLToV5FK4Ffm8YnY0c6IHKcAmb5t8FLv
+ pNijniIclCPXTpfio+HNa59a4UA8jTdJb+kT0w==
+ ) ; key id = 35672
+
+; example.de. tag=11867 algo=RSASHA1 generated Jul 17 2008 10:36:52
+example.de. 3600 IN DNSKEY 256 3 5 (
+ BQEAAAAByN2rMrazHwh+sNOv8cBef3HUotAQTS9QW4Y5NjNuyYNraJBA
+ OqV8KSaGQqIhkh0ZD0oIm2h0JowdyERZVj6ZZQ==
+ ) ; key id = 11867
+
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./dsset-example.de. b/contrib/zkt/examples/hierarchical/de./example.de./dsset-example.de.
new file mode 100644
index 0000000..a2cb04a
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./dsset-example.de.
@@ -0,0 +1,6 @@
+example.de. IN DS 17567 5 1 D2AE03CF2A76AA0A28AE8593B3D96E497C6508E5
+example.de. IN DS 17567 5 2 A9F2D82927721257F7C4325B402F664BBFE58780A786BB7B7188A0DB FD5D7008
+example.de. IN DS 41145 5 1 8F18A5F2A59AEF518DBA5A0CD0F0E259DD0F8C05
+example.de. IN DS 41145 5 2 BA5A78FB98E5A38554B4D73B32F15C4794AEE9E25934B3696B999451 A534102A
+example.de. IN DS 59244 5 1 56F34A865AFA3A183D3C008490B94CB1D238BB9A
+example.de. IN DS 59244 5 2 08C1BFC17C4634BE4A03A297D65E44CC8EB375B4027534541B7E0596 5E985313
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./keyset-example.de. b/contrib/zkt/examples/hierarchical/de./example.de./keyset-example.de.
new file mode 100644
index 0000000..2b40c68
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./keyset-example.de.
@@ -0,0 +1,28 @@
+$ORIGIN .
+example.de 7200 IN DNSKEY 257 3 5 (
+ BQEAAAABDfaBERX9p+FUi1OXYVig7zLCQFZo
+ RYpwDDuLzBcC7k+G1+wWdftyA1vBm5HMpyq0
+ OifT0Hsez4+H+0CIWHZP8oPCYfKrq+wM2EgM
+ zDDOYv+O1TQU4i3G+iONxB1RAwH/J2lA+U0z
+ Cbrdf0KLq/enNquchhPw4gCX0RB9HC+TkpoP
+ f2u7aKFcjlpw4C4uhDl1s6FpfdXe6NQWW6c+
+ ONUcLAEt+w==
+ ) ; key id = 59244
+ 7200 IN DNSKEY 257 3 5 (
+ BQEAAAABDrm5aXRPuZOmwT4nINnY2qXyXWLt
+ utggFAJgBW5Ua7uzAR+7r/DcOE7IfjnT5FQh
+ bYXIuKy61uOEqPu1TYvDsGb1pseKSB4J0jmX
+ DU9Ntu9TDp6X6ZXE11+cFdATa4TPnsAUMSxV
+ kLZanrbyACmcNr1gjT3dz6qIVBVPb5OnUldn
+ dbgtlOX3wcE0aR/MIsIjz1UQl/QoxbVclZVO
+ UNdJQGb9zQ==
+ ) ; key id = 41145
+ 7200 IN DNSKEY 385 3 5 (
+ BQEAAAABCyg92L7v21N3lc/gR07/2iLmvt6d
+ Un1KKauLvmkRuT040XT+Rd3Iq20iq6BqVPsP
+ S+hCOTRA3xikTIn5YzmPLPutIRtjIodHhsrM
+ L4D9Pp1dzgEDKWLam96v+E7KC0GGH/BI6/We
+ lqeqjS5BjI4Gjv4roaTyDCi63oXwcMFDVwrS
+ jws4A/5AGANka41Aky+UCGse6+64YmNP/QkS
+ XDAeBZqwrw==
+ ) ; key id = 17567
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./keyset-sub.example.de. b/contrib/zkt/examples/hierarchical/de./example.de./keyset-sub.example.de.
new file mode 100644
index 0000000..04ed33a
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./keyset-sub.example.de.
@@ -0,0 +1,8 @@
+$ORIGIN .
+sub.example.de 7200 IN DNSKEY 257 3 5 (
+ BQEAAAABpL4/T8z6mCbTm46Y9+KJOgCAk+dG
+ HBoyg75N1f0lwYSZOLyyyOLWwDxlsfkb5Wwv
+ Z1ZG6NFmg/3o5N3Zd7TEkkvHZafRMrzHFicd
+ IMSvjmOWVBR0GsEb+reREu5X0sdZbqOuxT6C
+ kKoTXRpRZgU9ouus6W5bSWQAfdQIegTBBKk=
+ ) ; key id = 40998
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+19793.key b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+19793.key
new file mode 100644
index 0000000..6b6aca1
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+19793.key
@@ -0,0 +1,3 @@
+;% generationtime=20080729104405
+;% lifetime=2d
+sub.example.de. IN DNSKEY 256 3 1 BQEAAAABny2+yO3erGn/4hCJyG031zbeZa91KPPsQRfqgx3eNgyaQjfD 7NTKuAfJjbSTbHnvXF008duYET+UU9+hS01RIw==
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+19793.private b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+19793.private
new file mode 100644
index 0000000..2377635
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+19793.private
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 1 (RSA)
+Modulus: ny2+yO3erGn/4hCJyG031zbeZa91KPPsQRfqgx3eNgyaQjfD7NTKuAfJjbSTbHnvXF008duYET+UU9+hS01RIw==
+PublicExponent: AQAAAAE=
+PrivateExponent: njIKbIVXtg54r7CRULxKaNXpW0BUus3VYh/JBkMgd+runwCUtXUccG14jHrZ/H2M6Yx46EIYxebzoi0rStisAQ==
+Prime1: zsU5EgehqDuowoV/yRkMTDa/b3unK6hUy4AnqCpumtE=
+Prime2: xRPHnd4KuW4H4SueCLf3oduoTfOp6pl6cKdJyjooQbM=
+Exponent1: WbbHa11huZfttfhiiocYX0zKzy+2hTHb8vXBJ27mIcE=
+Exponent2: JrXRbJt0aQuZ7PEcBuYpcLp0d4WZFD0htANku1j9xHc=
+Coefficient: y0cK7SB3Usly0yku3wY50DpxX0k+qPu8HztqHeGCXpg=
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+51977.depreciated b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+51977.depreciated
new file mode 100644
index 0000000..934f630
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+51977.depreciated
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 1 (RSA)
+Modulus: rPRVqWxFqCoVRrtQ8XYrbeogdBKBvEus359hPgFqYdGHvR1Kkyl8EhioksP/Tze5cGBHTSFCjIh+lGMPEssJCQ==
+PublicExponent: AQAAAAE=
+PrivateExponent: OGFXm5oxuztSyLrcmyhrWs14NTOKh745RZMjIUVyoem0SLRjkJWdqGlPnMsR+lmyVieKx6OhFTOZnbjRaeu2AQ==
+Prime1: 1epbg5Yr1USYkwGu9zV7AXpB74Wfu7I3WDzPabBFQ+k=
+Prime2: zvsD4Q/+PCmzXiRwsSlwZwtwpcSump1fuIve+REOCCE=
+Exponent1: kMpHQJed0XNHcNZ2hcEZ1/yG3Ex4MZbdJ9DsK2Rgosk=
+Exponent2: LEK4vqbV5lWlccULSqR0puA/1lFWmvRbS0yu7qp4OGE=
+Coefficient: gXEyODoVUSbHQP2mar5cwP3BDdi1LwDYVvdvKYEPIrw=
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+51977.key b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+51977.key
new file mode 100644
index 0000000..2c662a9
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+51977.key
@@ -0,0 +1,3 @@
+;% generationtime=20080726213646
+;% lifetime=2d
+sub.example.de. IN DNSKEY 256 3 1 BQEAAAABrPRVqWxFqCoVRrtQ8XYrbeogdBKBvEus359hPgFqYdGHvR1K kyl8EhioksP/Tze5cGBHTSFCjIh+lGMPEssJCQ==
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+55699.key b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+55699.key
new file mode 100644
index 0000000..3a0fcec
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+55699.key
@@ -0,0 +1,3 @@
+;% generationtime=20080731111645
+;% lifetime=2d
+sub.example.de. IN DNSKEY 256 3 1 BQEAAAABwutYROLC3W5wyq8jZEN7Fjgn2bLMoUAVJoteHeTZgfc11ekm /T+TEsR0L1Eazfc/MP+8X0OzdEl97NGOPtmT9w==
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+55699.published b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+55699.published
new file mode 100644
index 0000000..b45db1f
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+001+55699.published
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 1 (RSA)
+Modulus: wutYROLC3W5wyq8jZEN7Fjgn2bLMoUAVJoteHeTZgfc11ekm/T+TEsR0L1Eazfc/MP+8X0OzdEl97NGOPtmT9w==
+PublicExponent: AQAAAAE=
+PrivateExponent: f7ufWzg6L93T6LUD9P4Enjv0YvfQoIAJwO3OLdaMTuvz7ehqy+FWuAzy4fQwBxr768pDWv/EZqpqPuDIifUCUQ==
+Prime1: 50l7b5UFq5ejhH7Y/ZTA03M0JMZiIQDrpJdWL89sn6M=
+Prime2: 178TrVx2Of4cF18K9sbgdrbQCL82IotrErwo5YAsb50=
+Exponent1: Gs/D3DZdG7gy9INcfyIBH8pOHkcITjxJQbEJotYtp48=
+Exponent2: xVkRB61kvgdvwcowk4UnL6FqBPi5p9Jk1AlNteSksMU=
+Coefficient: Z9dHWKQ4b7QgZt5kzJNs4gW4iZPvD2pdm31V0jEbPoA=
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+005+40998.key b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+005+40998.key
new file mode 100644
index 0000000..9c7c36c
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+005+40998.key
@@ -0,0 +1,3 @@
+;% generationtime=20080726221746
+;% lifetime=5d
+sub.example.de. IN DNSKEY 257 3 5 BQEAAAABpL4/T8z6mCbTm46Y9+KJOgCAk+dGHBoyg75N1f0lwYSZOLyy yOLWwDxlsfkb5WwvZ1ZG6NFmg/3o5N3Zd7TEkkvHZafRMrzHFicdIMSv jmOWVBR0GsEb+reREu5X0sdZbqOuxT6CkKoTXRpRZgU9ouus6W5bSWQA fdQIegTBBKk=
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+005+40998.private b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+005+40998.private
new file mode 100644
index 0000000..3e39f5a
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./Ksub.example.de.+005+40998.private
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 5 (RSASHA1)
+Modulus: pL4/T8z6mCbTm46Y9+KJOgCAk+dGHBoyg75N1f0lwYSZOLyyyOLWwDxlsfkb5WwvZ1ZG6NFmg/3o5N3Zd7TEkkvHZafRMrzHFicdIMSvjmOWVBR0GsEb+reREu5X0sdZbqOuxT6CkKoTXRpRZgU9ouus6W5bSWQAfdQIegTBBKk=
+PublicExponent: AQAAAAE=
+PrivateExponent: CrFKdhkCOgyF27Jc4GPfo7A6v2q0OgRE2nBdkw7XFUEADEHSVLA6XYUm3AZmAOWxTmrGU8EK+76hfC22DjA6O0BljTNdxLB5cGRL2Dxey603jCIEVt/ahIqyb2STr0pWYEVc3qAKJL93iP4v5r7fJt157sJhQF8F5Zpqj24QvmE=
+Prime1: 1EpVvo011F2qgjesKSKplhqtvbmRPjTuhijb7531zIbxDzBF+lXCDyjt3Y/LrWS240t74vbZpo9FUZIETIf/FQ==
+Prime2: xqm8Bk18u2WJZ9uUr+/MMPKfh6OgAFqtBwFi81FFJ62kHGL9i8AcychE9tD5IRu74KLCGW+Vk87lyLOF3WU0RQ==
+Exponent1: JmLNa+QmMjHVDmAM833bF024/+NIyZgfNSDLnGXxTqYZ3PK/llLHIwBChLMKAQgFvt5PP0id1Nkc9N16xjkuFQ==
+Exponent2: rZW7rMmQxQQRHD8TKQTAhCX+31n8jnq7gW9dyVpjY85GDuQe6+3rox6xvsMfUzEOgXk1lgnm46FAIHOH6DhMuQ==
+Coefficient: MPoirwMUkLzLWeynO1Izy+lff70hnDnOcZEckS+Sy1TlUkk22uHBF4uNLkgoF26XqeKzK9pG1rCGfccfWTCayQ==
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./dlvset-sub.example.de. b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./dlvset-sub.example.de.
new file mode 100644
index 0000000..c392b9a
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./dlvset-sub.example.de.
@@ -0,0 +1,2 @@
+sub.example.de.dlv.trusted-keys.net. IN DLV 40998 5 1 1414E9C46F367D787EEF2EC91E1FC66DD087AEAE
+sub.example.de.dlv.trusted-keys.net. IN DLV 40998 5 2 6FE53984AB75C31A06778E9944F8CDB4790527D36BBD08CC1E90DA7A E32EEE5F
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./dnskey.db b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./dnskey.db
new file mode 100644
index 0000000..e922c18
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./dnskey.db
@@ -0,0 +1,35 @@
+;
+; !!! Don't edit this file by hand.
+; !!! It will be generated by dnssec-signer.
+;
+; Last generation time Jul 31 2008 13:16:45
+;
+
+; *** List of Key Signing Keys ***
+; sub.example.de. tag=40998 algo=RSASHA1 generated Jul 27 2008 00:17:46
+sub.example.de. 3600 IN DNSKEY 257 3 5 (
+ BQEAAAABpL4/T8z6mCbTm46Y9+KJOgCAk+dGHBoyg75N1f0lwYSZOLyy
+ yOLWwDxlsfkb5WwvZ1ZG6NFmg/3o5N3Zd7TEkkvHZafRMrzHFicdIMSv
+ jmOWVBR0GsEb+reREu5X0sdZbqOuxT6CkKoTXRpRZgU9ouus6W5bSWQA
+ fdQIegTBBKk=
+ ) ; key id = 40998
+
+; *** List of Zone Signing Keys ***
+; sub.example.de. tag=51977 algo=RSAMD5 generated Jul 29 2008 12:44:04
+sub.example.de. 3600 IN DNSKEY 256 3 1 (
+ BQEAAAABrPRVqWxFqCoVRrtQ8XYrbeogdBKBvEus359hPgFqYdGHvR1K
+ kyl8EhioksP/Tze5cGBHTSFCjIh+lGMPEssJCQ==
+ ) ; key id = 51977
+
+; sub.example.de. tag=19793 algo=RSAMD5 generated Jul 29 2008 12:44:05
+sub.example.de. 3600 IN DNSKEY 256 3 1 (
+ BQEAAAABny2+yO3erGn/4hCJyG031zbeZa91KPPsQRfqgx3eNgyaQjfD
+ 7NTKuAfJjbSTbHnvXF008duYET+UU9+hS01RIw==
+ ) ; key id = 19793
+
+; sub.example.de. tag=55699 algo=RSAMD5 generated Jul 31 2008 13:16:45
+sub.example.de. 3600 IN DNSKEY 256 3 1 (
+ BQEAAAABwutYROLC3W5wyq8jZEN7Fjgn2bLMoUAVJoteHeTZgfc11ekm
+ /T+TEsR0L1Eazfc/MP+8X0OzdEl97NGOPtmT9w==
+ ) ; key id = 55699
+
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./dnssec.conf b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./dnssec.conf
new file mode 100644
index 0000000..d7d33ca
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./dnssec.conf
@@ -0,0 +1,17 @@
+##
+## dnssec-zkt v0.4 (c) Jan 2005 hoz <at> hznet <dot> de ##
+##
+
+resigninterval 36h
+sigvalidity 2d
+max_ttl 90s
+
+ksk_lifetime 5d
+ksk_algo RSASHA1
+ksk_bits 1024
+
+zsk_lifetime 2d
+zsk_algo RSAMD5
+zsk_bits 512
+
+dlv_domain "dlv.trusted-keys.net"
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./dsset-sub.example.de. b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./dsset-sub.example.de.
new file mode 100644
index 0000000..b8ec77b
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./dsset-sub.example.de.
@@ -0,0 +1,2 @@
+sub.example.de. IN DS 40998 5 1 1414E9C46F367D787EEF2EC91E1FC66DD087AEAE
+sub.example.de. IN DS 40998 5 2 6FE53984AB75C31A06778E9944F8CDB4790527D36BBD08CC1E90DA7A E32EEE5F
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./keyset-sub.example.de. b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./keyset-sub.example.de.
new file mode 100644
index 0000000..04ed33a
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./keyset-sub.example.de.
@@ -0,0 +1,8 @@
+$ORIGIN .
+sub.example.de 7200 IN DNSKEY 257 3 5 (
+ BQEAAAABpL4/T8z6mCbTm46Y9+KJOgCAk+dG
+ HBoyg75N1f0lwYSZOLyyyOLWwDxlsfkb5Wwv
+ Z1ZG6NFmg/3o5N3Zd7TEkkvHZafRMrzHFicd
+ IMSvjmOWVBR0GsEb+reREu5X0sdZbqOuxT6C
+ kKoTXRpRZgU9ouus6W5bSWQAfdQIegTBBKk=
+ ) ; key id = 40998
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./zone.db b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./zone.db
new file mode 100644
index 0000000..05489a4
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./zone.db
@@ -0,0 +1,25 @@
+;-----------------------------------------------------------------
+;
+; @(#) sub.example.de/zone.db
+;
+;-----------------------------------------------------------------
+
+$TTL 7200
+
+@ IN SOA ns1.example.de. hostmaster.example.de. (
+ 2008073101; Serial (up to 10 digits)
+ 86400 ; Refresh (RIPE recommendation if NOTIFY is used)
+ 1800 ; Retry
+ 2W ; Expire
+ 7200 ) ; Minimum
+
+
+ IN NS ns1.example.de.
+
+$INCLUDE dnskey.db
+
+localhost IN A 127.0.0.1
+
+a IN A 1.2.3.4
+b IN A 1.2.3.5
+c IN A 1.2.3.6
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./zone.db.signed b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./zone.db.signed
new file mode 100644
index 0000000..d607de5
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./sub.example.de./zone.db.signed
@@ -0,0 +1,108 @@
+; File written on Thu Jul 31 13:16:45 2008
+; dnssec_signzone version 9.5.1b1
+sub.example.de. 7200 IN SOA ns1.example.de. hostmaster.example.de. (
+ 2008073101 ; serial
+ 86400 ; refresh (1 day)
+ 1800 ; retry (30 minutes)
+ 1209600 ; expire (2 weeks)
+ 7200 ; minimum (2 hours)
+ )
+ 7200 RRSIG SOA 1 3 7200 20080802100259 (
+ 20080731101645 19793 sub.example.de.
+ d/lRqmf+AWENEHoKbG+ABspEFH0UEHsyue0o
+ DPPUzkAw/gZcHcwoCuf4AsbUYHz1HKyHjeUz
+ g2+AsH8mPZKGvg== )
+ 7200 NS ns1.example.de.
+ 7200 RRSIG NS 1 3 7200 20080802095409 (
+ 20080731101645 19793 sub.example.de.
+ VoXeajFhxMQjwVXspcxBN/lfM1R6hc1fIVdV
+ HjWlw0RSeCL7fBOY54HOIWcu6jHegMrjuB9y
+ KTOgEwv3r8kOiw== )
+ 7200 NSEC a.sub.example.de. NS SOA RRSIG NSEC DNSKEY
+ 7200 RRSIG NSEC 1 3 7200 20080802095639 (
+ 20080731101645 19793 sub.example.de.
+ cmhtmISCv2bbpBkgwyMuKNnlrNsJ3GViYUxT
+ lhQ8ASHjNH74mIuenBIGy+w3RxyDzoMk1w6Y
+ J0qpEvDF3FNvRQ== )
+ 3600 DNSKEY 256 3 1 (
+ BQEAAAABny2+yO3erGn/4hCJyG031zbeZa91
+ KPPsQRfqgx3eNgyaQjfD7NTKuAfJjbSTbHnv
+ XF008duYET+UU9+hS01RIw==
+ ) ; key id = 19793
+ 3600 DNSKEY 256 3 1 (
+ BQEAAAABrPRVqWxFqCoVRrtQ8XYrbeogdBKB
+ vEus359hPgFqYdGHvR1Kkyl8EhioksP/Tze5
+ cGBHTSFCjIh+lGMPEssJCQ==
+ ) ; key id = 51977
+ 3600 DNSKEY 256 3 1 (
+ BQEAAAABwutYROLC3W5wyq8jZEN7Fjgn2bLM
+ oUAVJoteHeTZgfc11ekm/T+TEsR0L1Eazfc/
+ MP+8X0OzdEl97NGOPtmT9w==
+ ) ; key id = 55699
+ 3600 DNSKEY 257 3 5 (
+ BQEAAAABpL4/T8z6mCbTm46Y9+KJOgCAk+dG
+ HBoyg75N1f0lwYSZOLyyyOLWwDxlsfkb5Wwv
+ Z1ZG6NFmg/3o5N3Zd7TEkkvHZafRMrzHFicd
+ IMSvjmOWVBR0GsEb+reREu5X0sdZbqOuxT6C
+ kKoTXRpRZgU9ouus6W5bSWQAfdQIegTBBKk=
+ ) ; key id = 40998
+ 3600 RRSIG DNSKEY 1 3 3600 20080802100935 (
+ 20080731101645 19793 sub.example.de.
+ WU1UIuqpuCLRe/46p4u2eqEvKrfsBvKpzKmx
+ TLG2AX+AOxWhRH5CqZ1zDiKUd+Xu6ekGxB/g
+ ZOu0rsPqvux2PA== )
+ 3600 RRSIG DNSKEY 5 3 3600 20080802100334 (
+ 20080731101645 40998 sub.example.de.
+ WW23Oq06HTSt5R/4Ds/nOl1n0Egsbf4bztB8
+ MZQAv6khorlDzmy3B4WPG1f79yuc26Zb6/Z9
+ QxNH0s68kp3X/eBR7FTEfHehsKaoRtaxldhz
+ V0VjOKI2iu4mhA6n/P0bAEhfxFxxde5tymP/
+ Od6//GN4UmNi9LCwWtLbGnF4Gpc= )
+a.sub.example.de. 7200 IN A 1.2.3.4
+ 7200 RRSIG A 1 4 7200 20080802095159 (
+ 20080731101645 19793 sub.example.de.
+ LxVthdAkEiBec6khr63+rufhSwtByBNvff8e
+ HEG/m+yusTBVqVoUp987aabxqaeW5v6f4GaB
+ 4iK4mspVH4Md7A== )
+ 7200 NSEC b.sub.example.de. A RRSIG NSEC
+ 7200 RRSIG NSEC 1 4 7200 20080802100843 (
+ 20080731101645 19793 sub.example.de.
+ HEqR2LChtQD2AeGCBhCsCemP3kjwAGi3RIXu
+ UpklHVo44Yu+JINnO/jxZ61CtlvBaZ25dpjt
+ 4ldl+d6z3bs4pQ== )
+b.sub.example.de. 7200 IN A 1.2.3.5
+ 7200 RRSIG A 1 4 7200 20080802095415 (
+ 20080731101645 19793 sub.example.de.
+ eLTaD1maS++Py3rybVftMtz0V8QnJenAH6tQ
+ PIcoZElIaLt8DGfwJYPmIPJlhwNlyqJH7d2A
+ SDEWBEFsFCnMkg== )
+ 7200 NSEC c.sub.example.de. A RRSIG NSEC
+ 7200 RRSIG NSEC 1 4 7200 20080802094836 (
+ 20080731101645 19793 sub.example.de.
+ nHvo1ValqHljlwCiPI51hdl0lnd5WiDIHbo7
+ MMxxZrYLNAP9ECK5DCzht9UrEGgIpI/MAvsU
+ 7S7eIlt0jBSehg== )
+c.sub.example.de. 7200 IN A 1.2.3.6
+ 7200 RRSIG A 1 4 7200 20080802095037 (
+ 20080731101645 19793 sub.example.de.
+ eVluthAz6YLAJWSaroRGuf5IsjhHoLz60Ot9
+ 1KTnw9zAFU16H6vuQ/TIH7ZzHOT0CgdwawF5
+ V0L4MAkK76H00w== )
+ 7200 NSEC localhost.sub.example.de. A RRSIG NSEC
+ 7200 RRSIG NSEC 1 4 7200 20080802100135 (
+ 20080731101645 19793 sub.example.de.
+ KRTIiVJPkQayfB8k6sIWyZPm6fqQAZbs8BQ4
+ jz/EGrHj3oFPRULUpLMKUdLFAp0kU0qRqCwl
+ Ull//CFV9J272A== )
+localhost.sub.example.de. 7200 IN A 127.0.0.1
+ 7200 RRSIG A 1 4 7200 20080802095833 (
+ 20080731101645 19793 sub.example.de.
+ fXGLRIRCvK/Q9D+dQTia3HUe1xlVBwBL1vcY
+ wRWdvNQgXQnOkpGtcb9fjKXkPz34SirmyESh
+ 8kYWUvV1kghBzA== )
+ 7200 NSEC sub.example.de. A RRSIG NSEC
+ 7200 RRSIG NSEC 1 4 7200 20080802101452 (
+ 20080731101645 19793 sub.example.de.
+ EqI9jcbxtroVBCVrCLWezzcxNvwm2xl/1nCt
+ 6Nogs3WvBPpMExUX2tWvpJMV14vpFSW2qWQK
+ UoFq9NHsH2WSDw== )
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./zone.db b/contrib/zkt/examples/hierarchical/de./example.de./zone.db
new file mode 100644
index 0000000..c485181
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./zone.db
@@ -0,0 +1,37 @@
+;-----------------------------------------------------------------
+;
+; @(#) example.de/zone.db
+;
+;-----------------------------------------------------------------
+
+$TTL 7200
+
+; Be sure that the serial number below is left
+; justified in a field of at least 10 chars!!
+; 0123456789;
+; It's also possible to use the date form e.g. 2005040101
+@ IN SOA ns1.example.de. hostmaster.example.de. (
+ 258 ; Serial
+ 43200 ; Refresh
+ 1800 ; Retry
+ 2W ; Expire
+ 7200 ) ; Minimum
+
+ IN NS ns1.example.de.
+ IN NS ns2.example.de.
+
+ns1 IN A 1.0.0.5
+ IN AAAA 2001:db8::53
+ns2 IN A 1.2.0.6
+
+localhost IN A 127.0.0.1
+
+; Delegation to secure zone; The DS resource record will
+; be added by dnssec-signzone automatically if the
+; keyset-sub.example.de file is present (run dnssec-signzone
+; with option -g or use the dnssec-signer tool) ;-)
+sub IN NS ns1.example.de.
+
+; this file will have all the zone keys
+$INCLUDE dnskey.db
+
diff --git a/contrib/zkt/examples/hierarchical/de./example.de./zone.db.signed b/contrib/zkt/examples/hierarchical/de./example.de./zone.db.signed
new file mode 100644
index 0000000..4b9b3dc
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./example.de./zone.db.signed
@@ -0,0 +1,147 @@
+; File written on Tue Jul 29 12:44:06 2008
+; dnssec_signzone version 9.5.1b1
+example.de. 7200 IN SOA ns1.example.de. hostmaster.example.de. (
+ 258 ; serial
+ 43200 ; refresh (12 hours)
+ 1800 ; retry (30 minutes)
+ 1209600 ; expire (2 weeks)
+ 7200 ; minimum (2 hours)
+ )
+ 7200 RRSIG SOA 5 2 7200 20080808092956 (
+ 20080729094406 35672 example.de.
+ UufM9vATUwvqXJjvgt9WGAytmMhd7Pz/3DK0
+ 6a9uReXHcU4NcO0BhTP9chwXAQC5pI2ucRxs
+ /4p/Vc/L91wUMA== )
+ 7200 NS ns1.example.de.
+ 7200 NS ns2.example.de.
+ 7200 RRSIG NS 5 2 7200 20080808091515 (
+ 20080729094406 35672 example.de.
+ hpHATL81t7GASSKPPBuheQqBqXU688itETkN
+ QYfy/OwcE/7g+LvS1oHEBRds6neRkXxUpDa1
+ hsdbbCDo6UuHSg== )
+ 7200 NSEC localhost.example.de. NS SOA RRSIG NSEC DNSKEY
+ 7200 RRSIG NSEC 5 2 7200 20080808092007 (
+ 20080729094406 35672 example.de.
+ aN9cYobVe+qJ5Gw0GPMQI3V7vPQaF7cBuX6T
+ +yWZ/TAHhKcJYqbwOQH2XQar2s+JwckEMSdI
+ HFPySUOtQaNNxA== )
+ 3600 DNSKEY 256 3 5 (
+ BQEAAAABnRJdmY7dzRKi93pVkLToV5FK4Ffm
+ 8YnY0c6IHKcAmb5t8FLvpNijniIclCPXTpfi
+ o+HNa59a4UA8jTdJb+kT0w==
+ ) ; key id = 35672
+ 3600 DNSKEY 256 3 5 (
+ BQEAAAAByN2rMrazHwh+sNOv8cBef3HUotAQ
+ TS9QW4Y5NjNuyYNraJBAOqV8KSaGQqIhkh0Z
+ D0oIm2h0JowdyERZVj6ZZQ==
+ ) ; key id = 11867
+ 3600 DNSKEY 257 3 5 (
+ BQEAAAABDfaBERX9p+FUi1OXYVig7zLCQFZo
+ RYpwDDuLzBcC7k+G1+wWdftyA1vBm5HMpyq0
+ OifT0Hsez4+H+0CIWHZP8oPCYfKrq+wM2EgM
+ zDDOYv+O1TQU4i3G+iONxB1RAwH/J2lA+U0z
+ Cbrdf0KLq/enNquchhPw4gCX0RB9HC+TkpoP
+ f2u7aKFcjlpw4C4uhDl1s6FpfdXe6NQWW6c+
+ ONUcLAEt+w==
+ ) ; key id = 59244
+ 3600 DNSKEY 257 3 5 (
+ BQEAAAABDrm5aXRPuZOmwT4nINnY2qXyXWLt
+ utggFAJgBW5Ua7uzAR+7r/DcOE7IfjnT5FQh
+ bYXIuKy61uOEqPu1TYvDsGb1pseKSB4J0jmX
+ DU9Ntu9TDp6X6ZXE11+cFdATa4TPnsAUMSxV
+ kLZanrbyACmcNr1gjT3dz6qIVBVPb5OnUldn
+ dbgtlOX3wcE0aR/MIsIjz1UQl/QoxbVclZVO
+ UNdJQGb9zQ==
+ ) ; key id = 41145
+ 3600 DNSKEY 385 3 5 (
+ BQEAAAABCyg92L7v21N3lc/gR07/2iLmvt6d
+ Un1KKauLvmkRuT040XT+Rd3Iq20iq6BqVPsP
+ S+hCOTRA3xikTIn5YzmPLPutIRtjIodHhsrM
+ L4D9Pp1dzgEDKWLam96v+E7KC0GGH/BI6/We
+ lqeqjS5BjI4Gjv4roaTyDCi63oXwcMFDVwrS
+ jws4A/5AGANka41Aky+UCGse6+64YmNP/QkS
+ XDAeBZqwrw==
+ ) ; key id = 17567
+ 3600 RRSIG DNSKEY 5 2 3600 20080808092214 (
+ 20080729094406 41145 example.de.
+ BMVp5vW7MgvrhoGfqQhdwGg1mBHNw4xnI+YX
+ XMYqOAMMRmFg7G6Vn+UcFmUoL1AdUKIdXPp7
+ t30UREHQspELWmnLVdJ36HRmzk1eNgwLFuUM
+ l+Lr+KeoufJ2QlF4TWeItozv0pgmkxaOr0Im
+ fzRmWKs84rwautwY+R/b5wrCMfZt96/JPGA0
+ 4JWDls1wJ7iR0LtiJxe7mvtNRZ5krPFKXBRz
+ nA== )
+ 3600 RRSIG DNSKEY 5 2 3600 20080808092411 (
+ 20080729094406 17567 example.de.
+ BmHQcJsmGmt7HZHqWPAHQuelDrWXASUy7tgc
+ W4RVIed4voZiHyvxfTPR3cldIWpdP2RqxMm8
+ Dj5hlYRqnVt3phSSnwpczcPkfQD4meTqK0DJ
+ kpX/mBCMHedfvATKf82A9wri13/Zi97N6sTK
+ 4VZZIWaUH/YDYyMwxgK70+jU0m2N8Iebm3s6
+ RshTMxAZjiSH29mgow/HSHtf+cnaTUGAr83P
+ ug== )
+ 3600 RRSIG DNSKEY 5 2 3600 20080808093317 (
+ 20080729094406 35672 example.de.
+ Q5UnfDMbzApCl/wOy9IDna25UVvjKhuV/dos
+ hFKPUArM4wDx9kJU5tc1Eatwh4MAXPM81kNW
+ 6DbiKMXJpO7biQ== )
+localhost.example.de. 7200 IN A 127.0.0.1
+ 7200 RRSIG A 5 3 7200 20080808092724 (
+ 20080729094406 35672 example.de.
+ JW8ScAtavvTR0fHI/ZDZTgARHSXM/QcLT+w6
+ dl6kaeR/9JqxTKpKnH6mtYYdfqom4siJnZCI
+ D66sltGHW/er+Q== )
+ 7200 NSEC ns1.example.de. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080808094047 (
+ 20080729094406 35672 example.de.
+ XsTqHahVRcPPyrdffkdyBj0BFlTx2vkmfrvY
+ IIQcaNiUxrgZfyDBQ1GZbL4tDGK/ujValdz9
+ s2s+6ISxxobC3A== )
+ns1.example.de. 7200 IN A 1.0.0.5
+ 7200 RRSIG A 5 3 7200 20080808091743 (
+ 20080729094406 35672 example.de.
+ ljYOmOC9r3RlsohXrHt40sIQuF98JSkRSFHb
+ xKlcToqEVSgxAKkMlwPKBQPaHtRdQhIVkxly
+ OpCYxAQSguB/MA== )
+ 7200 AAAA 2001:db8::53
+ 7200 RRSIG AAAA 5 3 7200 20080808094144 (
+ 20080729094406 35672 example.de.
+ nNchBWvoPtgRNxaz9bmFwvv/KtgloYq1SGti
+ 59yQFFm6ixY0p0l0d+U5nnwgI1iS5h0JGYqI
+ 0mOu0mNbxtt9gQ== )
+ 7200 NSEC ns2.example.de. A AAAA RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080808092537 (
+ 20080729094406 35672 example.de.
+ MgnxPyKHMqQXnmfjh5ffr0FRvgRyl7D56phx
+ xKzTquSXDECP5ORpDxvybixbvHvM8R59LjYH
+ 1OZ3fi+/kWVAJg== )
+ns2.example.de. 7200 IN A 1.2.0.6
+ 7200 RRSIG A 5 3 7200 20080808091624 (
+ 20080729094406 35672 example.de.
+ MkrwvOLYJQvoNFNeqtLOOmDnVFY0n7qdTOUL
+ Ia2stlfOn7r/7f4lKQTE5UMM+SBN2iizV4qc
+ SFFUxREAI5UGkQ== )
+ 7200 NSEC sub.example.de. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080808094337 (
+ 20080729094406 35672 example.de.
+ QE8DYRraVloZVQi2RTpYwxEY1P0u3ovHgC58
+ AR1NiLtbQ0YCsPJZeIhVSXbdd8qLZzb5gsJ2
+ 9AU6m1TfAa5WSw== )
+sub.example.de. 7200 IN NS ns1.example.de.
+ 7200 DS 40998 5 1 (
+ 1414E9C46F367D787EEF2EC91E1FC66DD087
+ AEAE )
+ 7200 DS 40998 5 2 (
+ 6FE53984AB75C31A06778E9944F8CDB47905
+ 27D36BBD08CC1E90DA7AE32EEE5F )
+ 7200 RRSIG DS 5 3 7200 20080808092142 (
+ 20080729094406 35672 example.de.
+ cdyXeVNOD5TBuab8JFkwcf4GiS2n9F4tgct/
+ ZedULbikEqO0CyJddPW3wSsNAZeP2tgXJNI8
+ H6SutDh0IiR5MA== )
+ 7200 NSEC example.de. NS DS RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080808091754 (
+ 20080729094406 35672 example.de.
+ jkvn4NznbaH8S5PeWkPf/cHaq19kNav8Y78E
+ 3GVQHD3ApcDAMs8gImjRrJMT1lqSB7yCu/5f
+ k3CPfTs/+p/8Og== )
diff --git a/contrib/zkt/examples/hierarchical/de./keyset-example.de. b/contrib/zkt/examples/hierarchical/de./keyset-example.de.
new file mode 100644
index 0000000..2b40c68
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/de./keyset-example.de.
@@ -0,0 +1,28 @@
+$ORIGIN .
+example.de 7200 IN DNSKEY 257 3 5 (
+ BQEAAAABDfaBERX9p+FUi1OXYVig7zLCQFZo
+ RYpwDDuLzBcC7k+G1+wWdftyA1vBm5HMpyq0
+ OifT0Hsez4+H+0CIWHZP8oPCYfKrq+wM2EgM
+ zDDOYv+O1TQU4i3G+iONxB1RAwH/J2lA+U0z
+ Cbrdf0KLq/enNquchhPw4gCX0RB9HC+TkpoP
+ f2u7aKFcjlpw4C4uhDl1s6FpfdXe6NQWW6c+
+ ONUcLAEt+w==
+ ) ; key id = 59244
+ 7200 IN DNSKEY 257 3 5 (
+ BQEAAAABDrm5aXRPuZOmwT4nINnY2qXyXWLt
+ utggFAJgBW5Ua7uzAR+7r/DcOE7IfjnT5FQh
+ bYXIuKy61uOEqPu1TYvDsGb1pseKSB4J0jmX
+ DU9Ntu9TDp6X6ZXE11+cFdATa4TPnsAUMSxV
+ kLZanrbyACmcNr1gjT3dz6qIVBVPb5OnUldn
+ dbgtlOX3wcE0aR/MIsIjz1UQl/QoxbVclZVO
+ UNdJQGb9zQ==
+ ) ; key id = 41145
+ 7200 IN DNSKEY 385 3 5 (
+ BQEAAAABCyg92L7v21N3lc/gR07/2iLmvt6d
+ Un1KKauLvmkRuT040XT+Rd3Iq20iq6BqVPsP
+ S+hCOTRA3xikTIn5YzmPLPutIRtjIodHhsrM
+ L4D9Pp1dzgEDKWLam96v+E7KC0GGH/BI6/We
+ lqeqjS5BjI4Gjv4roaTyDCi63oXwcMFDVwrS
+ jws4A/5AGANka41Aky+UCGse6+64YmNP/QkS
+ XDAeBZqwrw==
+ ) ; key id = 17567
diff --git a/contrib/zkt/examples/hierarchical/dnssec.conf b/contrib/zkt/examples/hierarchical/dnssec.conf
new file mode 100644
index 0000000..12da654
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/dnssec.conf
@@ -0,0 +1,40 @@
+#
+# @(#) dnssec.conf vT0.96 (c) Feb 2005 - May 2008 Holger Zuleger hznet.de
+#
+
+# dnssec-zkt options
+Zonedir: "."
+Recursive: True
+PrintTime: False
+PrintAge: True
+LeftJustify: False
+
+# zone specific values
+ResignInterval: 1w # (604800 seconds)
+Sigvalidity: 10d # (864000 seconds)
+Max_TTL: 6h # (21600 seconds)
+Propagation: 5m # (300 seconds)
+KEY_TTL: 1h # (3600 seconds)
+Serialformat: incremental
+
+# signing key parameters
+KSK_lifetime: 20d # (1728000 seconds)
+KSK_algo: RSASHA1 # (Algorithm ID 5)
+KSK_bits: 1300
+KSK_randfile: "/dev/urandom"
+ZSK_lifetime: 4w # (2419200 seconds)
+ZSK_algo: RSASHA1 # (Algorithm ID 5)
+ZSK_bits: 512
+ZSK_randfile: "/dev/urandom"
+
+# dnssec-signer options
+LogFile: "log"
+LogLevel: "info"
+SyslogFacility: "user"
+SyslogLevel: "notice"
+Keyfile: "dnskey.db"
+Zonefile: "zone.db"
+KeySetDir: ".."
+DLV_Domain: ""
+Sig_Pseudorand: True
+Sig_Parameter: "-j 1800"
diff --git a/contrib/zkt/examples/hierarchical/named.conf b/contrib/zkt/examples/hierarchical/named.conf
new file mode 100644
index 0000000..8bd3f9d
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/named.conf
@@ -0,0 +1,102 @@
+/*****************************************************************
+**
+** #(@) named.conf (c) 6. May 2004 (hoz)
+**
+*****************************************************************/
+
+/*****************************************************************
+** logging options
+*****************************************************************/
+logging {
+ channel "named-log" {
+ file "/var/log/named" versions 3 size 2m;
+ print-time yes;
+ print-category yes;
+ print-severity yes;
+ severity info;
+ };
+ channel "resolver-log" {
+ file "/var/log/named";
+ print-time yes;
+ print-category yes;
+ print-severity yes;
+ severity debug 1;
+ };
+ channel "dnssec-log" {
+# file "/var/log/named-dnssec" ;
+ file "/var/log/named" ;
+ print-time yes;
+ print-category yes;
+ print-severity yes;
+ severity debug 3;
+ };
+ category "dnssec" { "dnssec-log"; };
+ category "default" { "named-log"; };
+ category "resolver" { "resolver-log"; };
+ category "client" { "resolver-log"; };
+ category "queries" { "resolver-log"; };
+};
+
+/*****************************************************************
+** name server options
+*****************************************************************/
+options {
+ directory ".";
+
+ dump-file "/var/log/named_dump.db";
+ statistics-file "/var/log/named.stats";
+
+ listen-on-v6 { any; };
+
+ query-source address * port 53;
+ transfer-source * port 53;
+ notify-source * port 53;
+
+ recursion yes;
+ dnssec-enable yes;
+ edns-udp-size 4096;
+
+# dnssec-lookaside "." trust-anchor "trusted-keys.de.";
+
+ querylog yes;
+
+};
+
+/*****************************************************************
+** include shared secrets...
+*****************************************************************/
+/** for control sessions ... **/
+# include "rndc.key";
+controls {
+ inet 127.0.0.1
+ allow { localhost; }
+ keys { "rndc-key"; };
+ inet ::1
+ allow { localhost; }
+ keys { "rndc-key"; };
+};
+
+/*****************************************************************
+** ... and trusted_keys
+*****************************************************************/
+# include "trusted-keys.conf" ;
+
+/*****************************************************************
+** root server hints and required 127 stuff
+*****************************************************************/
+zone "." in {
+ type hint;
+ file "root.hint";
+};
+
+zone "localhost" in {
+ type master;
+ file "localhost.zone";
+};
+
+zone "0.0.127.in-addr.arpa" in {
+ type master;
+ file "127.0.0.zone";
+};
+
+include "zone.conf";
diff --git a/contrib/zkt/examples/hierarchical/zone.conf b/contrib/zkt/examples/hierarchical/zone.conf
new file mode 100644
index 0000000..6944d5a
--- /dev/null
+++ b/contrib/zkt/examples/hierarchical/zone.conf
@@ -0,0 +1,10 @@
+
+zone "example.de." in {
+ type master;
+ file "de./example.de./zone.db.signed";
+};
+
+zone "sub.example.de." in {
+ type master;
+ file "de./example.de./sub.example.de./zone.db.signed";
+};
diff --git a/contrib/zkt/examples/views/dnssec-extern.conf b/contrib/zkt/examples/views/dnssec-extern.conf
new file mode 100644
index 0000000..728dcc9
--- /dev/null
+++ b/contrib/zkt/examples/views/dnssec-extern.conf
@@ -0,0 +1,39 @@
+#
+# @(#) dnssec.conf vT0.96 (c) Feb 2005 - May 2008 Holger Zuleger hznet.de
+#
+
+# dnssec-zkt options
+Zonedir: "extern"
+Recursive: True
+PrintTime: False
+PrintAge: True
+LeftJustify: False
+
+# zone specific values
+ResignInterval: 1w # (604800 seconds)
+Sigvalidity: 10d # (864000 seconds)
+Max_TTL: 8h # (28800 seconds)
+Propagation: 5m # (300 seconds)
+KEY_TTL: 1h # (3600 seconds)
+Serialformat: unixtime
+
+# signing key parameters
+KSK_lifetime: 1y # (31536000 seconds)
+KSK_algo: RSASHA1 # (Algorithm ID 5)
+KSK_bits: 1300
+KSK_randfile: "/dev/urandom"
+ZSK_lifetime: 30d # (2592000 seconds)
+ZSK_algo: RSASHA1 # (Algorithm ID 5)
+ZSK_bits: 512
+ZSK_randfile: "/dev/urandom"
+
+# dnssec-signer options
+LogFile: "zkt-ext.log"
+LogLevel: "debug"
+SyslogFacility: "none"
+SyslogLevel: "notice"
+VerboseLog: 2
+Keyfile: "dnskey.db"
+Zonefile: "zone.db"
+DLV_Domain: ""
+Sig_Pseudorand: True
diff --git a/contrib/zkt/examples/views/dnssec-intern.conf b/contrib/zkt/examples/views/dnssec-intern.conf
new file mode 100644
index 0000000..d49fc94
--- /dev/null
+++ b/contrib/zkt/examples/views/dnssec-intern.conf
@@ -0,0 +1,39 @@
+#
+# @(#) dnssec.conf vT0.96 (c) Feb 2005 - May 2008 Holger Zuleger hznet.de
+#
+
+# dnssec-zkt options
+Zonedir: "intern"
+Recursive: True
+PrintTime: False
+PrintAge: True
+LeftJustify: False
+
+# zone specific values
+ResignInterval: 5h # (18000 seconds)
+Sigvalidity: 1d # (86400 seconds)
+Max_TTL: 30m # (1800 seconds)
+Propagation: 1m # (60 seconds)
+KEY_TTL: 30m # (1800 seconds)
+Serialformat: unixtime
+
+# signing key parameters
+KSK_lifetime: 1y # (31536000 seconds)
+KSK_algo: RSASHA1 # (Algorithm ID 5)
+KSK_bits: 1300
+KSK_randfile: "/dev/urandom"
+ZSK_lifetime: 30d # (2592000 seconds)
+ZSK_algo: RSASHA1 # (Algorithm ID 5)
+ZSK_bits: 512
+ZSK_randfile: "/dev/urandom"
+
+# dnssec-signer options
+LogFile: "zkt-int.log"
+LogLevel: "debug"
+SyslogFacility: "none"
+SyslogLevel: "notice"
+VerboseLog: 2
+Keyfile: "dnskey.db"
+Zonefile: "zone.db"
+DLV_Domain: ""
+Sig_Pseudorand: True
diff --git a/contrib/zkt/examples/views/dnssec-signer-extern b/contrib/zkt/examples/views/dnssec-signer-extern
new file mode 100755
index 0000000..910e82a
--- /dev/null
+++ b/contrib/zkt/examples/views/dnssec-signer-extern
@@ -0,0 +1,7 @@
+#!/bin/sh
+#
+# Shell script to start the dnssec-signer
+# command out of the view directory
+#
+
+ZKT_CONFFILE=`pwd`/dnssec.conf ../../dnssec-signer -V extern "$@"
diff --git a/contrib/zkt/examples/views/dnssec-signer-intern b/contrib/zkt/examples/views/dnssec-signer-intern
new file mode 100755
index 0000000..915ed15
--- /dev/null
+++ b/contrib/zkt/examples/views/dnssec-signer-intern
@@ -0,0 +1,7 @@
+#!/bin/sh
+#
+# Shell script to start the dnssec-signer
+# command out of the view directory
+#
+
+ZKT_CONFFILE=`pwd`/dnssec.conf ../../dnssec-signer -V intern "$@"
diff --git a/contrib/zkt/examples/views/dnssec-zkt-extern b/contrib/zkt/examples/views/dnssec-zkt-extern
new file mode 100755
index 0000000..129b4e1
--- /dev/null
+++ b/contrib/zkt/examples/views/dnssec-zkt-extern
@@ -0,0 +1,7 @@
+#!/bin/sh
+#
+# Shell script to start the dnssec-zkt command
+# out of the view directory
+#
+
+ZKT_CONFFILE=`pwd`/dnssec.conf ../../dnssec-zkt --view extern "$@"
diff --git a/contrib/zkt/examples/views/dnssec-zkt-intern b/contrib/zkt/examples/views/dnssec-zkt-intern
new file mode 100755
index 0000000..1836840
--- /dev/null
+++ b/contrib/zkt/examples/views/dnssec-zkt-intern
@@ -0,0 +1,7 @@
+#!/bin/sh
+#
+# Shell script to start the dnssec-zkt command
+# out of the view directory
+#
+
+ZKT_CONFFILE=`pwd`/dnssec.conf ../../dnssec-zkt --view intern "$@"
diff --git a/contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+10367.key b/contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+10367.key
new file mode 100644
index 0000000..54ba934
--- /dev/null
+++ b/contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+10367.key
@@ -0,0 +1,3 @@
+;% generationtime=20080609231143
+;% lifetime=30d
+example.net. IN DNSKEY 256 3 5 BQEAAAAB3U9DMT6BkywYADO+5p0lG4VFLLzNvJUMaOc++HqN2N1sKSX4 ZTf2V5gtamPZ/1kMrg8gYImKCl6n3K37EjXYBw==
diff --git a/contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+10367.published b/contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+10367.published
new file mode 100644
index 0000000..7240075
--- /dev/null
+++ b/contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+10367.published
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 5 (RSASHA1)
+Modulus: 3U9DMT6BkywYADO+5p0lG4VFLLzNvJUMaOc++HqN2N1sKSX4ZTf2V5gtamPZ/1kMrg8gYImKCl6n3K37EjXYBw==
+PublicExponent: AQAAAAE=
+PrivateExponent: Q3TKb2j5AMk4wn9q5vvgtEy7o1VAhCvv/Nw3QRpXi7xGeHb7WJHj2ia2I44vQQk9fB+Kck1M8KNRMgYt0d0xCQ==
+Prime1: 7l4yn7VYrTSOaZu+lubsFvE+JB7asyYyymAEQeod2p0=
+Prime2: 7a4LEAmrtZTI/PHjdk/Ij/hbpDmtOe1H0lnWTVG+GfM=
+Exponent1: DTpyBBW39+d9b8LqCo7hJf5KQ3oVw9tdnUuHNstGZd0=
+Exponent2: b+aBbhRPr/a9ZCNM2JTjZJrrSebtMQCy1GcE33o64HM=
+Coefficient: UdvxnKd2GL6In82yHG40rU35WTZ2SUYQ+1mfz3DQqnE=
diff --git a/contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+23553.key b/contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+23553.key
new file mode 100644
index 0000000..ec11dcb
--- /dev/null
+++ b/contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+23553.key
@@ -0,0 +1 @@
+example.net. IN DNSKEY 257 3 5 BQEAAAABDEEycfY6uqWNTpQO8ygi9xms6NOFYGhCjijN109fVGJ4KDnI ZtLhoFrOKru9rZn+pyqurlyZG4vESg0BMty6xljVDlr/TegDYFTN19mQ uwvlasJhZPv9pjROPqQGnqLaw3O4OKCY9HgTTPdXK1hQ4Mg2rNU4SM2T u5ki91f5AQqiXF8KYMics0mwVvpj5C2YTDvE9SafLrce68JM6DaiC6E1 sQ==
diff --git a/contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+23553.private b/contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+23553.private
new file mode 100644
index 0000000..ea29447
--- /dev/null
+++ b/contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+23553.private
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 5 (RSASHA1)
+Modulus: DEEycfY6uqWNTpQO8ygi9xms6NOFYGhCjijN109fVGJ4KDnIZtLhoFrOKru9rZn+pyqurlyZG4vESg0BMty6xljVDlr/TegDYFTN19mQuwvlasJhZPv9pjROPqQGnqLaw3O4OKCY9HgTTPdXK1hQ4Mg2rNU4SM2Tu5ki91f5AQqiXF8KYMics0mwVvpj5C2YTDvE9SafLrce68JM6DaiC6E1sQ==
+PublicExponent: AQAAAAE=
+PrivateExponent: A3ZXTF8afjlxddgO/sDxotc0XLBMa3sNrXhCpdFzeDV1HszZbz1lP8rrZjA1wQgSo56DjiGRKTsHjAAm4xN1lGYKBZuVF4U3uiWie2PhJStt7kckNduKOfV9Nofow5Jh8I2lXKqcOJ8Qd+EJYIsajdBoGQ72PGGfDaHphbN/mW13n59PlilMF4RRRybcMA6jTAOfvIcv5Mes3+ADh0TktHdHQQ==
+Prime1: A+SKyrgtNzGVpAXPQysMQ9O/10B/+nhy6//1F5Epxihyuln+d2euh+TjVneojx4D2JUflDUSD5BQAdflDb+KiBXdQjBEmqfWwY+INwSQzv4M5Q==
+Prime2: AyXovkiIs7ywIRS6FfRolMMUeh3yeYNtCVAvLB6EC2MiNCzfkDOFB7rpmUkZR8HYUWuz1hQfR781RDO81Sp3RIpSyL7SwOqkpMZyaSgK/GKE3Q==
+Exponent1: D1vC405mkcUVfno92EuBXomRiOG7VeSyjwofgCpa0JKR6J2BThdCGrcVbq68ucIddn+cbkD8JsZB3k4aeDYFxm6d1En1Z2C1cVHrzCFi2zFV
+Exponent2: N+iliM1Qp3spcsR06kXImb/N4FosHrZkXtcbRIMWhV8NBcyqLDIfGlNluaiztv4rf6Kn2UyVeiGC822nqZHcW5PiXJnBEWs9AC4Di1QzZh0h
+Coefficient: AtZ4sYqGgyB5kfdcQBBlIkPbsRRNKrUVAsZkjabdZTQa+ox6tYnlVjh7BgPMHJlj/Z4VTRJ5rfAUPnB4ZwO/r1eAJLd+vxjJb9M7DaGMc+RqQA==
diff --git a/contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+35744.key b/contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+35744.key
new file mode 100644
index 0000000..1809a93
--- /dev/null
+++ b/contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+35744.key
@@ -0,0 +1,4 @@
+;% generationtime=20071217224527
+;% lifetime=30
+;% expiretime=20080116224527
+example.net. IN DNSKEY 256 3 5 BQEAAAABsQvn4MXvSlbajLPMJdGnczsX/Zw5yYSeERYtaO2Wxi+kHz6w iAyKkbBYFUGtmbPJ6JFt+4f9KnNPi1txiBg76Q==
diff --git a/contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+35744.private b/contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+35744.private
new file mode 100644
index 0000000..ca789eb
--- /dev/null
+++ b/contrib/zkt/examples/views/extern/example.net./Kexample.net.+005+35744.private
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 5 (RSASHA1)
+Modulus: sQvn4MXvSlbajLPMJdGnczsX/Zw5yYSeERYtaO2Wxi+kHz6wiAyKkbBYFUGtmbPJ6JFt+4f9KnNPi1txiBg76Q==
+PublicExponent: AQAAAAE=
+PrivateExponent: fZs/S7/pOPP1C9Jjdb7KhnbfiLfCIXdc7d8LDWmm7d9rL2kZK77WMp+o5WRQhoIDDQPAdv+phoIdFEIiXKLN8Q==
+Prime1: 6NEgG3Z86nn9fNjG+3E9OqF/7oaCvrVnb1XogalZgr0=
+Prime2: wq0aosO1mWXo38HuxO5JiR2mX/9LWjxxqwK6I9gnJp0=
+Exponent1: ZvI2y//PImr1OqeVLoWfFHop2iorgT4+SYiz1Gw9FME=
+Exponent2: TBUeoolmnFcOfWO6T1v0S6za7LEib2H1Pgt95UvDA40=
+Coefficient: eHmKka0EVRfjDfEpcwRp5nZ36ZHfLxuKF5tGQ1YclBI=
diff --git a/contrib/zkt/examples/views/extern/example.net./dnskey.db b/contrib/zkt/examples/views/extern/example.net./dnskey.db
new file mode 100644
index 0000000..d46eff9
--- /dev/null
+++ b/contrib/zkt/examples/views/extern/example.net./dnskey.db
@@ -0,0 +1,30 @@
+;
+; !!! Don't edit this file by hand.
+; !!! It will be generated by dnssec-signer.
+;
+; Last generation time Jun 12 2008 17:56:05
+;
+
+; *** List of Key Signing Keys ***
+; example.net. tag=23553 algo=RSASHA1 generated Nov 20 2007 12:49:04
+example.net. 3600 IN DNSKEY 257 3 5 (
+ BQEAAAABDEEycfY6uqWNTpQO8ygi9xms6NOFYGhCjijN109fVGJ4KDnI
+ ZtLhoFrOKru9rZn+pyqurlyZG4vESg0BMty6xljVDlr/TegDYFTN19mQ
+ uwvlasJhZPv9pjROPqQGnqLaw3O4OKCY9HgTTPdXK1hQ4Mg2rNU4SM2T
+ u5ki91f5AQqiXF8KYMics0mwVvpj5C2YTDvE9SafLrce68JM6DaiC6E1
+ sQ==
+ ) ; key id = 23553
+
+; *** List of Zone Signing Keys ***
+; example.net. tag=35744 algo=RSASHA1 generated Jun 10 2008 01:11:43
+example.net. 3600 IN DNSKEY 256 3 5 (
+ BQEAAAABsQvn4MXvSlbajLPMJdGnczsX/Zw5yYSeERYtaO2Wxi+kHz6w
+ iAyKkbBYFUGtmbPJ6JFt+4f9KnNPi1txiBg76Q==
+ ) ; key id = 35744
+
+; example.net. tag=10367 algo=RSASHA1 generated Jun 10 2008 01:11:43
+example.net. 3600 IN DNSKEY 256 3 5 (
+ BQEAAAAB3U9DMT6BkywYADO+5p0lG4VFLLzNvJUMaOc++HqN2N1sKSX4
+ ZTf2V5gtamPZ/1kMrg8gYImKCl6n3K37EjXYBw==
+ ) ; key id = 10367
+
diff --git a/contrib/zkt/examples/views/extern/example.net./dsset-example.net. b/contrib/zkt/examples/views/extern/example.net./dsset-example.net.
new file mode 100644
index 0000000..cbcd3d0
--- /dev/null
+++ b/contrib/zkt/examples/views/extern/example.net./dsset-example.net.
@@ -0,0 +1,2 @@
+example.net. IN DS 23553 5 1 A1A6D06CB84D619730F605AEF2A6DD4148DD9D5B
+example.net. IN DS 23553 5 2 B0DCAB8A32C230495CEC1FD61CEC03849450909CA6636FD9BC53D1B3 3B4F3A2D
diff --git a/contrib/zkt/examples/views/extern/example.net./keyset-example.net. b/contrib/zkt/examples/views/extern/example.net./keyset-example.net.
new file mode 100644
index 0000000..b845245
--- /dev/null
+++ b/contrib/zkt/examples/views/extern/example.net./keyset-example.net.
@@ -0,0 +1,10 @@
+$ORIGIN .
+example.net 7200 IN DNSKEY 257 3 5 (
+ BQEAAAABDEEycfY6uqWNTpQO8ygi9xms6NOF
+ YGhCjijN109fVGJ4KDnIZtLhoFrOKru9rZn+
+ pyqurlyZG4vESg0BMty6xljVDlr/TegDYFTN
+ 19mQuwvlasJhZPv9pjROPqQGnqLaw3O4OKCY
+ 9HgTTPdXK1hQ4Mg2rNU4SM2Tu5ki91f5AQqi
+ XF8KYMics0mwVvpj5C2YTDvE9SafLrce68JM
+ 6DaiC6E1sQ==
+ ) ; key id = 23553
diff --git a/contrib/zkt/examples/views/extern/example.net./zone.db b/contrib/zkt/examples/views/extern/example.net./zone.db
new file mode 100644
index 0000000..4c72928
--- /dev/null
+++ b/contrib/zkt/examples/views/extern/example.net./zone.db
@@ -0,0 +1,33 @@
+;-----------------------------------------------------------------
+;
+; @(#) extern/example.net/zone.db
+;
+;-----------------------------------------------------------------
+
+$TTL 7200
+
+@ IN SOA ns1.example.net. hostmaster.example.net. (
+ 0 ; Serial
+ 43200 ; Refresh
+ 1800 ; Retry
+ 2W ; Expire
+ 7200 ) ; Minimum
+
+ IN NS ns1.example.net.
+ IN NS ns2.example.net.
+
+ns1 IN A 1.0.0.5
+ IN AAAA 2001:db8::53
+ns2 IN A 1.2.0.6
+
+localhost IN A 127.0.0.1
+
+; Delegation to secure zone; The DS resource record will
+; be added by dnssec-signzone automatically if the
+; keyset-sub.example.net file is present (run dnssec-signzone
+; with option -g or use the dnssec-signer tool) ;-)
+sub IN NS ns1.example.net.
+
+; this file will have all the zone keys
+$INCLUDE dnskey.db
+
diff --git a/contrib/zkt/examples/views/extern/example.net./zone.db.signed b/contrib/zkt/examples/views/extern/example.net./zone.db.signed
new file mode 100644
index 0000000..c0e2801
--- /dev/null
+++ b/contrib/zkt/examples/views/extern/example.net./zone.db.signed
@@ -0,0 +1,109 @@
+; File written on Thu Jun 12 17:56:06 2008
+; dnssec_signzone version 9.5.0
+example.net. 7200 IN SOA ns1.example.net. hostmaster.example.net. (
+ 1213286165 ; serial
+ 43200 ; refresh (12 hours)
+ 1800 ; retry (30 minutes)
+ 1209600 ; expire (2 weeks)
+ 7200 ; minimum (2 hours)
+ )
+ 7200 RRSIG SOA 5 2 7200 20080622145605 (
+ 20080612145605 35744 example.net.
+ iSF46kemTmJ62ipRyAzcVF0zlND4ZXdMSzAg
+ wGLfXN1xlgt0IwB8ypP1OjDyUx+YwBpbMlJt
+ tFsswvYaZtP11Q== )
+ 7200 NS ns1.example.net.
+ 7200 NS ns2.example.net.
+ 7200 RRSIG NS 5 2 7200 20080622145605 (
+ 20080612145605 35744 example.net.
+ fmC9BXzFcy6TRXixIHk51TYTetGd69YcRguc
+ VlqTalvPJTJ99nKkRS5HdP2CZPJqv9bHOmSO
+ yQibjS4TA5Pr3g== )
+ 7200 NSEC localhost.example.net. NS SOA RRSIG NSEC DNSKEY
+ 7200 RRSIG NSEC 5 2 7200 20080622145605 (
+ 20080612145605 35744 example.net.
+ kimcFA1awlsIou/66y2XLByBWKc2e7Wm8vis
+ Pz/i0NS4NFoe+oSKIeIjUorWOSf5AkpxxntV
+ 91i/sxof6bc61w== )
+ 3600 DNSKEY 256 3 5 (
+ BQEAAAABsQvn4MXvSlbajLPMJdGnczsX/Zw5
+ yYSeERYtaO2Wxi+kHz6wiAyKkbBYFUGtmbPJ
+ 6JFt+4f9KnNPi1txiBg76Q==
+ ) ; key id = 35744
+ 3600 DNSKEY 256 3 5 (
+ BQEAAAAB3U9DMT6BkywYADO+5p0lG4VFLLzN
+ vJUMaOc++HqN2N1sKSX4ZTf2V5gtamPZ/1kM
+ rg8gYImKCl6n3K37EjXYBw==
+ ) ; key id = 10367
+ 3600 DNSKEY 257 3 5 (
+ BQEAAAABDEEycfY6uqWNTpQO8ygi9xms6NOF
+ YGhCjijN109fVGJ4KDnIZtLhoFrOKru9rZn+
+ pyqurlyZG4vESg0BMty6xljVDlr/TegDYFTN
+ 19mQuwvlasJhZPv9pjROPqQGnqLaw3O4OKCY
+ 9HgTTPdXK1hQ4Mg2rNU4SM2Tu5ki91f5AQqi
+ XF8KYMics0mwVvpj5C2YTDvE9SafLrce68JM
+ 6DaiC6E1sQ==
+ ) ; key id = 23553
+ 3600 RRSIG DNSKEY 5 2 3600 20080622145605 (
+ 20080612145605 23553 example.net.
+ Bfg8AMvj3OmC7E5aMCfotsdL4eJ+hPqtH30E
+ +aGEJojZNgfhnSKZrolMJa5fij4oZ+Fp8U+a
+ V73egxkrYI+NnddGRVium+vT6NDVknYl6hx0
+ kgKmZ8oYMulF8CCmTaw6WXswIX0j/7e17Qtw
+ ZjbkWZagIXWotE5t0qel3doAQ37ZUaKMMAoc
+ SRgJ8s+w7OZ86f1kWyGNdhYeF8yY3AraSx7h
+ fg== )
+ 3600 RRSIG DNSKEY 5 2 3600 20080622145605 (
+ 20080612145605 35744 example.net.
+ SrsmKW7eB+zWA+8j2DvlDktthDusinJP4QKV
+ ihsJN1Gq8fTcHsFX2+3EJLyGZfhKyW7Q5Z1W
+ dIM4sjx78Zjh5Q== )
+localhost.example.net. 7200 IN A 127.0.0.1
+ 7200 RRSIG A 5 3 7200 20080622145605 (
+ 20080612145605 35744 example.net.
+ DUWSV0Wj/h1U4idKUoDLB+NXgj8M9et1E8BP
+ X0lhAu4CMrPhsiFU1NN+N3bhC16u7S+xxeEI
+ N/c7vC223ejn8A== )
+ 7200 NSEC ns1.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080622145605 (
+ 20080612145605 35744 example.net.
+ qQ7FB0+O9Ve88VblRspGAm28JXurNAQ23HX9
+ rkmbFLL/Z7Xp7xO2899oJZrgHl3CWLcKRBV+
+ P50QYwYXET3byw== )
+ns1.example.net. 7200 IN A 1.0.0.5
+ 7200 RRSIG A 5 3 7200 20080622145605 (
+ 20080612145605 35744 example.net.
+ qv8y5gEQg/5BpSTMoZvwW6AAzMIxT34ds4VK
+ QQ9ScfVYOwtKigsaFmr8Zs97R946rl5vh/cs
+ w8uw5x6/1ECflg== )
+ 7200 AAAA 2001:db8::53
+ 7200 RRSIG AAAA 5 3 7200 20080622145605 (
+ 20080612145605 35744 example.net.
+ T5MtLR9ZY0e6PKk+nU9cjRpSAWaccH2bGjzI
+ aYEvKRFcLQ0QPDww8gBZNimYL+BYfCSysyXz
+ LNjR7KqYQxrXmg== )
+ 7200 NSEC ns2.example.net. A AAAA RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080622145605 (
+ 20080612145605 35744 example.net.
+ IlRZWwLVtf7oalaLBCMbqH4pxgqCJ7f0wQzO
+ ftS2jhMGVez+q7SgO8Vpw5f+vhNiSWe6noiN
+ ogRV1rxohxDyCw== )
+ns2.example.net. 7200 IN A 1.2.0.6
+ 7200 RRSIG A 5 3 7200 20080622145605 (
+ 20080612145605 35744 example.net.
+ NR3Nkw9U12uZcZs8ChTY+u3a0QisLV/5okqR
+ Cy1Jpg8YkEzBJ0nEdxoGX6WUtnb0u5Kjxea1
+ iTZYEXffLBchmw== )
+ 7200 NSEC sub.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080622145605 (
+ 20080612145605 35744 example.net.
+ eM1ckSfeiEg6pV8JxJEEkDeDo04i1iblO6a1
+ pWydc4IGMH0vaCuGHvLlfCmSOZK7TWMFSLJN
+ SqabEFO1114AyQ== )
+sub.example.net. 7200 IN NS ns1.example.net.
+ 7200 NSEC example.net. NS RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080622145605 (
+ 20080612145605 35744 example.net.
+ nwfqNjzYHKtWWsJgoiM9ZQFY9UKHMS6pkyNB
+ ISgm6pTLeG9QXuwf9vTrtfvhPYAp5DRz96AT
+ db/3/DXIwUnMnA== )
diff --git a/contrib/zkt/examples/views/extern/zkt-ext.log b/contrib/zkt/examples/views/extern/zkt-ext.log
new file mode 100644
index 0000000..04fa4fb
--- /dev/null
+++ b/contrib/zkt/examples/views/extern/zkt-ext.log
@@ -0,0 +1,28 @@
+2008-06-12 17:59:04.194: notice: running as ../../dnssec-signer -V extern -v -v
+2008-06-12 17:59:04.195: debug: parsing zone "example.net." in dir "extern/example.net."
+2008-06-12 17:59:04.196: debug: Check RFC5011 status
+2008-06-12 17:59:04.196: debug: ->ksk5011status returns 0
+2008-06-12 17:59:04.196: debug: Check ksk status
+2008-06-12 17:59:04.196: debug: Re-signing not necessary!
+2008-06-12 17:59:04.196: notice: end of run: 0 errors occured
+2008-06-12 17:59:17.435: notice: running as ../../dnssec-signer -V extern -v -v
+2008-06-12 17:59:17.436: debug: parsing zone "example.net." in dir "extern/example.net."
+2008-06-12 17:59:17.436: debug: Check RFC5011 status
+2008-06-12 17:59:17.436: debug: ->ksk5011status returns 0
+2008-06-12 17:59:17.436: debug: Check ksk status
+2008-06-12 17:59:17.436: debug: Re-signing not necessary!
+2008-06-12 17:59:17.436: notice: end of run: 0 errors occured
+2008-06-12 18:00:07.818: notice: running as ../../dnssec-signer -V extern -v -v
+2008-06-12 18:00:07.819: debug: parsing zone "example.net." in dir "extern/example.net."
+2008-06-12 18:00:07.819: debug: Check RFC5011 status
+2008-06-12 18:00:07.819: debug: ->ksk5011status returns 0
+2008-06-12 18:00:07.819: debug: Check ksk status
+2008-06-12 18:00:07.819: debug: Re-signing not necessary!
+2008-06-12 18:00:07.819: notice: end of run: 0 errors occured
+2008-06-12 18:00:39.019: notice: running as ../../dnssec-signer -V extern -v -v
+2008-06-12 18:00:39.020: debug: parsing zone "example.net." in dir "extern/example.net."
+2008-06-12 18:00:39.020: debug: Check RFC5011 status
+2008-06-12 18:00:39.020: debug: ->ksk5011status returns 0
+2008-06-12 18:00:39.020: debug: Check ksk status
+2008-06-12 18:00:39.020: debug: Re-signing not necessary!
+2008-06-12 18:00:39.020: notice: end of run: 0 errors occured
diff --git a/contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+00126.key b/contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+00126.key
new file mode 100644
index 0000000..316e4cf
--- /dev/null
+++ b/contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+00126.key
@@ -0,0 +1 @@
+example.net. IN DNSKEY 257 3 5 BQEAAAABC+JLXRgWPqqGe0cta8CR95tz7PkkgRDlXyxESD+XkpVDkJ3W ey/1Lh7083Ve1WmIuUAo3N4d7HjLgrFVZxiumGGRz/aV3s01OFFS5JqI wF9BTNrNPGLPzzbBaQMHErO88HIbbg4sot7e6bSrtpAEf23MhZ3qZJC9 +nN+DknmsgTE6EpK6ZyUrZc64/0K68EWhtk1gf95NQEzTD4QgrOD6IYq Lw==
diff --git a/contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+00126.private b/contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+00126.private
new file mode 100644
index 0000000..96e1ff6
--- /dev/null
+++ b/contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+00126.private
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 5 (RSASHA1)
+Modulus: C+JLXRgWPqqGe0cta8CR95tz7PkkgRDlXyxESD+XkpVDkJ3Wey/1Lh7083Ve1WmIuUAo3N4d7HjLgrFVZxiumGGRz/aV3s01OFFS5JqIwF9BTNrNPGLPzzbBaQMHErO88HIbbg4sot7e6bSrtpAEf23MhZ3qZJC9+nN+DknmsgTE6EpK6ZyUrZc64/0K68EWhtk1gf95NQEzTD4QgrOD6IYqLw==
+PublicExponent: AQAAAAE=
+PrivateExponent: CF6/bss8OtQFdcjO6kJh9EamPFXAsaXFCdcYpHF55CU4H3jBuu7teLFEanvgm6M+wROYF0Yohiyb2aeSBdGLRIfTC9l3xfHD+XixuZVoNk6DqR1/8Wlxwu/a/hW9dq7pUXqDfTbzdZKR6SVRPa4MAdQ0p8aSF4S926NRqZC6E/anqhqNPSlBpxTs3TrRk+wY6u8wMXxPGNjJYoID8Y0Qau/H6Q==
+Prime1: A50B7etEtQCDudL8+KBxU1/2sVT3ORMfoZPsOe+ZLFrwcOO9Iyrr6saymuD4QvcIHECdLUM5rsT1JBo87wgvVysibco7oVLxlIfsTcbM70l2Kw==
+Prime2: A0n3+qM3ng3WAFzlpYRNUZpH/CW1pMq3nOHjx2olWwDxDZ4tAsUPKuW9n3kVZAR+4FkeUKn2ePR7xRtO3AzvA6QmZuZN6EHuLPlSKRufzeZ+DQ==
+Exponent1: Hk5KY5PiXs6pf8T8rSvVs6PJqDX491R01ZDdAIDYjmhIUHKWQ2STAlPEpSAGXi+oqOo4dD1eJWgw36hT0JakjXU4aIvPoSdmVPMs8aod0NUh
+Exponent2: AXKBZ5sYApCCj/0fGBTkmU6Zc89/ddQNrFm2lVLrwSTILHQWm/aXDvI+5icpF5kdrukVcNHUeCz1R/RTgeV4N9/qvr5YzbPWieqDNvpG1RcNRQ==
+Coefficient: BZxK+fKwUNWoJ5huBqLsi8UMWgrCMqAfXvge4+Y4n4IL0VCU1UUEXZQEEeiATh0g52CuetOMej6FZ4QKbNryWg036ZKl81ataMGtDX/i/yZG
diff --git a/contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+05972.key b/contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+05972.key
new file mode 100644
index 0000000..8be3973
--- /dev/null
+++ b/contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+05972.key
@@ -0,0 +1 @@
+example.net. IN DNSKEY 256 3 5 BQEAAAABsMIdQ+yt52Q/OR1s+QPj7SuBydYb11l0HC5kGIDp+JPQIQHx pyCWa/LaLgcvK3IA1HR8YaO3QXB2LAHEz5B/CQ==
diff --git a/contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+05972.private b/contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+05972.private
new file mode 100644
index 0000000..b519641
--- /dev/null
+++ b/contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+05972.private
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 5 (RSASHA1)
+Modulus: sMIdQ+yt52Q/OR1s+QPj7SuBydYb11l0HC5kGIDp+JPQIQHxpyCWa/LaLgcvK3IA1HR8YaO3QXB2LAHEz5B/CQ==
+PublicExponent: AQAAAAE=
+PrivateExponent: fpWuYAOXJWdjMrZnI91hTi1wwuje4sKjDu8xvfnKvqKhr61QxK1gR9TB3mc2FM+Awivphb3xfi8+y2cacq9iUQ==
+Prime1: 6DE1tFJXGIm2SW3fSwQymX7Zcw8VSIMWiHQPCqX1FA0=
+Prime2: wuHS7u0I9aYOFkDAndfEVyDi8vOh96CcY/BuSvEZ6+0=
+Exponent1: sn7RttKPap3cgw2sddmgwcuVSaEpwOswF/O42Ou3fMk=
+Exponent2: LoJ305VksT7SWWR6bM5OybcdTm39PTZM0g3V2hOceK0=
+Coefficient: SwRF9S9ICVeyeYw3djxbg7kUZjz5AkbHIgz9VeX4mzM=
diff --git a/contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+23375.key b/contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+23375.key
new file mode 100644
index 0000000..160110e
--- /dev/null
+++ b/contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+23375.key
@@ -0,0 +1,3 @@
+;% generationtime=20080612154545
+;% lifetime=30d
+example.net. IN DNSKEY 256 3 5 BQEAAAABzbx90CiFrOSh0/BkiRQYRC4rHL0QQv96Qwy5/zuOa/3Zy9Lc TpbE13DtEAqOfVGSQ79S4WgKalFJxq6lSk0xrw==
diff --git a/contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+23375.published b/contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+23375.published
new file mode 100644
index 0000000..60e4316
--- /dev/null
+++ b/contrib/zkt/examples/views/intern/example.net./Kexample.net.+005+23375.published
@@ -0,0 +1,10 @@
+Private-key-format: v1.2
+Algorithm: 5 (RSASHA1)
+Modulus: zbx90CiFrOSh0/BkiRQYRC4rHL0QQv96Qwy5/zuOa/3Zy9LcTpbE13DtEAqOfVGSQ79S4WgKalFJxq6lSk0xrw==
+PublicExponent: AQAAAAE=
+PrivateExponent: XZK4eHRUrFka7O0Q/RBuBG3iW8KFng5em4FnjCSBQpwSAvFzTBebqwfNSOcgqKihz8VzvKHxEd6BxVZRGI2dgQ==
+Prime1: 8Jji5R57Y4ROxrO5EuEFjxL723VQ/Ym+4KYG+tM3bP8=
+Prime2: 2uhGRdJU3UJvnPwx0gJGio6KmRBC6CmDqTMORhYrS1E=
+Exponent1: cqVno4KLgMmKN5VPWaYA+pB5e55r6UEIaxqj6WMXATs=
+Exponent2: EqSKzb/r02jmNCTv5aX7wHl+57LYR40rJvzgVTfh/tE=
+Coefficient: 37ywfYlNFmtR/jZwoZBHNdIEy+C+jIeJ+fEepesSpoI=
diff --git a/contrib/zkt/examples/views/intern/example.net./dnskey.db b/contrib/zkt/examples/views/intern/example.net./dnskey.db
new file mode 100644
index 0000000..9e2c47f
--- /dev/null
+++ b/contrib/zkt/examples/views/intern/example.net./dnskey.db
@@ -0,0 +1,30 @@
+;
+; !!! Don't edit this file by hand.
+; !!! It will be generated by dnssec-signer.
+;
+; Last generation time Jun 12 2008 18:13:43
+;
+
+; *** List of Key Signing Keys ***
+; example.net. tag=126 algo=RSASHA1 generated Nov 20 2007 12:44:27
+example.net. 1800 IN DNSKEY 257 3 5 (
+ BQEAAAABC+JLXRgWPqqGe0cta8CR95tz7PkkgRDlXyxESD+XkpVDkJ3W
+ ey/1Lh7083Ve1WmIuUAo3N4d7HjLgrFVZxiumGGRz/aV3s01OFFS5JqI
+ wF9BTNrNPGLPzzbBaQMHErO88HIbbg4sot7e6bSrtpAEf23MhZ3qZJC9
+ +nN+DknmsgTE6EpK6ZyUrZc64/0K68EWhtk1gf95NQEzTD4QgrOD6IYq
+ Lw==
+ ) ; key id = 126
+
+; *** List of Zone Signing Keys ***
+; example.net. tag=5972 algo=RSASHA1 generated Nov 20 2007 12:44:27
+example.net. 1800 IN DNSKEY 256 3 5 (
+ BQEAAAABsMIdQ+yt52Q/OR1s+QPj7SuBydYb11l0HC5kGIDp+JPQIQHx
+ pyCWa/LaLgcvK3IA1HR8YaO3QXB2LAHEz5B/CQ==
+ ) ; key id = 5972
+
+; example.net. tag=23375 algo=RSASHA1 generated Jun 12 2008 17:45:45
+example.net. 1800 IN DNSKEY 256 3 5 (
+ BQEAAAABzbx90CiFrOSh0/BkiRQYRC4rHL0QQv96Qwy5/zuOa/3Zy9Lc
+ TpbE13DtEAqOfVGSQ79S4WgKalFJxq6lSk0xrw==
+ ) ; key id = 23375
+
diff --git a/contrib/zkt/examples/views/intern/example.net./dsset-example.net. b/contrib/zkt/examples/views/intern/example.net./dsset-example.net.
new file mode 100644
index 0000000..b61c1b6
--- /dev/null
+++ b/contrib/zkt/examples/views/intern/example.net./dsset-example.net.
@@ -0,0 +1,2 @@
+example.net. IN DS 126 5 1 D32161DCFCA120944CB9C0394CBED1389FDB72CA
+example.net. IN DS 126 5 2 351C6807B25E47223D7A6AA222291E8D7D7DDDA61D64CE839F937F22 47481FC9
diff --git a/contrib/zkt/examples/views/intern/example.net./keyset-example.net. b/contrib/zkt/examples/views/intern/example.net./keyset-example.net.
new file mode 100644
index 0000000..0aa2c7d
--- /dev/null
+++ b/contrib/zkt/examples/views/intern/example.net./keyset-example.net.
@@ -0,0 +1,10 @@
+$ORIGIN .
+example.net 7200 IN DNSKEY 257 3 5 (
+ BQEAAAABC+JLXRgWPqqGe0cta8CR95tz7Pkk
+ gRDlXyxESD+XkpVDkJ3Wey/1Lh7083Ve1WmI
+ uUAo3N4d7HjLgrFVZxiumGGRz/aV3s01OFFS
+ 5JqIwF9BTNrNPGLPzzbBaQMHErO88HIbbg4s
+ ot7e6bSrtpAEf23MhZ3qZJC9+nN+DknmsgTE
+ 6EpK6ZyUrZc64/0K68EWhtk1gf95NQEzTD4Q
+ grOD6IYqLw==
+ ) ; key id = 126
diff --git a/contrib/zkt/examples/views/intern/example.net./zone.db b/contrib/zkt/examples/views/intern/example.net./zone.db
new file mode 100644
index 0000000..d3e90f7
--- /dev/null
+++ b/contrib/zkt/examples/views/intern/example.net./zone.db
@@ -0,0 +1,33 @@
+;-----------------------------------------------------------------
+;
+; @(#) intern/example.net/zone.db
+;
+;-----------------------------------------------------------------
+
+$TTL 7200
+
+@ IN SOA ns1.example.net. hostmaster.example.net. (
+ 0 ; Serial
+ 43200 ; Refresh
+ 1800 ; Retry
+ 2W ; Expire
+ 7200 ) ; Minimum
+
+ IN NS ns1.example.net.
+ IN NS ns2.example.net.
+
+ns1 IN A 192.168.1.53
+ IN AAAA fd12:063c:cdbb::53
+ns2 IN A 10.1.2.3
+
+localhost IN A 127.0.0.1
+
+; Delegation to secure zone; The DS resource record will
+; be added by dnssec-signzone automatically if the
+; keyset-sub.example.net file is present (run dnssec-signzone
+; with option -g or use the dnssec-signer tool) ;-)
+sub IN NS ns1.example.net.
+
+; this file will have all the zone keys
+$INCLUDE dnskey.db
+
diff --git a/contrib/zkt/examples/views/intern/example.net./zone.db.signed b/contrib/zkt/examples/views/intern/example.net./zone.db.signed
new file mode 100644
index 0000000..88a42c6
--- /dev/null
+++ b/contrib/zkt/examples/views/intern/example.net./zone.db.signed
@@ -0,0 +1,109 @@
+; File written on Thu Jun 12 18:13:43 2008
+; dnssec_signzone version 9.5.0
+example.net. 7200 IN SOA ns1.example.net. hostmaster.example.net. (
+ 1213287223 ; serial
+ 43200 ; refresh (12 hours)
+ 1800 ; retry (30 minutes)
+ 1209600 ; expire (2 weeks)
+ 7200 ; minimum (2 hours)
+ )
+ 7200 RRSIG SOA 5 2 7200 20080613151343 (
+ 20080612151343 5972 example.net.
+ Pc3wGwZm0n5gMs9lSHUiRG4EIpalC+UUJPwy
+ 2LwHbyFkzCdGQz2RDJeL6mRKS4Z+gmt3oNUV
+ aV3H0KfNq6ITLg== )
+ 7200 NS ns1.example.net.
+ 7200 NS ns2.example.net.
+ 7200 RRSIG NS 5 2 7200 20080613151343 (
+ 20080612151343 5972 example.net.
+ dUy23xqHx9shvAc20zW9uBOt8TnrI5ot31vS
+ Gas9s5ksxGZuQIIdpdYvbFtufp9jLfAQG98L
+ a6rQDFcnJ8xzng== )
+ 7200 NSEC localhost.example.net. NS SOA RRSIG NSEC DNSKEY
+ 7200 RRSIG NSEC 5 2 7200 20080613151343 (
+ 20080612151343 5972 example.net.
+ gWt7VDw60E1q7qS4+pkor6RR2Dfc1sshGHia
+ UEJBt9F4PiHux3ICJbyWQ2USBLJMzO+uR8GH
+ kt2inbyQytbPDQ== )
+ 1800 DNSKEY 256 3 5 (
+ BQEAAAABsMIdQ+yt52Q/OR1s+QPj7SuBydYb
+ 11l0HC5kGIDp+JPQIQHxpyCWa/LaLgcvK3IA
+ 1HR8YaO3QXB2LAHEz5B/CQ==
+ ) ; key id = 5972
+ 1800 DNSKEY 256 3 5 (
+ BQEAAAABzbx90CiFrOSh0/BkiRQYRC4rHL0Q
+ Qv96Qwy5/zuOa/3Zy9LcTpbE13DtEAqOfVGS
+ Q79S4WgKalFJxq6lSk0xrw==
+ ) ; key id = 23375
+ 1800 DNSKEY 257 3 5 (
+ BQEAAAABC+JLXRgWPqqGe0cta8CR95tz7Pkk
+ gRDlXyxESD+XkpVDkJ3Wey/1Lh7083Ve1WmI
+ uUAo3N4d7HjLgrFVZxiumGGRz/aV3s01OFFS
+ 5JqIwF9BTNrNPGLPzzbBaQMHErO88HIbbg4s
+ ot7e6bSrtpAEf23MhZ3qZJC9+nN+DknmsgTE
+ 6EpK6ZyUrZc64/0K68EWhtk1gf95NQEzTD4Q
+ grOD6IYqLw==
+ ) ; key id = 126
+ 1800 RRSIG DNSKEY 5 2 1800 20080613151343 (
+ 20080612151343 126 example.net.
+ CPj9rEcjTazkLm5yNpC4PatufPvKQdCkaIj9
+ EKFgYUpPftfvhP1MzKcHnKraVq8jU995e1vU
+ WZ3ac9M4KRynUoYYj4/nMFwWQu/xC9yaUjj0
+ XodXMEMlSjjN5BE/2Og3xzKJ9grim7riKClH
+ fixhNn6WGUXWT7TV1GKNnB7Ix/ZVCpzU4QAz
+ qr28rqTYvbmoowGXPf6OgafFdRQ6rdTRTzvK
+ xA== )
+ 1800 RRSIG DNSKEY 5 2 1800 20080613151343 (
+ 20080612151343 5972 example.net.
+ dOdjm4GD0nzgoMgRYl8HiEqi4nxP/ocB7n/N
+ WRKdU4Tuk7OYacr2Bd+tVa2bKLJZ9JmMQR8v
+ VDkzRjT4eONxuA== )
+localhost.example.net. 7200 IN A 127.0.0.1
+ 7200 RRSIG A 5 3 7200 20080613151343 (
+ 20080612151343 5972 example.net.
+ KRpkDBsuqC+WHv++YBsxW1rhkALl/LWyI24E
+ qJJevkm0+5tCmHgHa9WovZwDDMEn/tzxOaqi
+ rk8Mnbf6cYxSlw== )
+ 7200 NSEC ns1.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080613151343 (
+ 20080612151343 5972 example.net.
+ GdpOVVyqa1nTaGFuN4ohqxnYs5yG+vGK9gK0
+ Tt4aenChFAmcuIvhX7ZcdejXM8x+imttnKCp
+ Smho3kSGf9gQRQ== )
+ns1.example.net. 7200 IN A 192.168.1.53
+ 7200 RRSIG A 5 3 7200 20080613151343 (
+ 20080612151343 5972 example.net.
+ P4vZDd3DBZIEwk9mQWoR1qjqyFTNOvsp+yOt
+ z2OvdAjSnlVnYHC0lM0LY24RVTQlQPLRq75F
+ joAIP/0wvXihsA== )
+ 7200 AAAA fd12:63c:cdbb::53
+ 7200 RRSIG AAAA 5 3 7200 20080613151343 (
+ 20080612151343 5972 example.net.
+ V04kA3VrzhcNfwCEXBpgKyu+eRFYGCIrXuty
+ XiRCHV2DCOlr9EBKGdXzpR8kUnpRZI2BuP17
+ 2a3emgs9BHJJ6A== )
+ 7200 NSEC ns2.example.net. A AAAA RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080613151343 (
+ 20080612151343 5972 example.net.
+ Y0DaMxmczQLNCtzKO/MA7Nvt4Rh3MdnEvcPJ
+ 48blsqd3UWGlRcHD/yx1NFV2JxBFSNTsAkBs
+ JFhw+nVeZJdHJA== )
+ns2.example.net. 7200 IN A 10.1.2.3
+ 7200 RRSIG A 5 3 7200 20080613151343 (
+ 20080612151343 5972 example.net.
+ GsvMGEozNeTjBPOuYM3thOZsQ+pPv7/8zQlj
+ FPnivBwkvkgrk+IyJxoh9xyTnVxd93mPY0Rv
+ Xsp5ITBTILSM6Q== )
+ 7200 NSEC sub.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080613151343 (
+ 20080612151343 5972 example.net.
+ LYIa+Hhk4l6KnbT/QKS0Zqkfy8Ywpz8J9RLh
+ 9VqzxFcdXrJswV4o/5fbZCT33sBqzebggBVR
+ LYF/o0HVi5uzJA== )
+sub.example.net. 7200 IN NS ns1.example.net.
+ 7200 NSEC example.net. NS RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080613151343 (
+ 20080612151343 5972 example.net.
+ nkGsdegvupGxCOpr/8K6kY/0iZH1ZC8y5HwQ
+ 8Z3/aD0wJxaVK9iMjZ+jbIbQHg3Es5V0UYFR
+ RPdjTNk7YEC0Mg== )
diff --git a/contrib/zkt/examples/views/intern/zkt-int.log b/contrib/zkt/examples/views/intern/zkt-int.log
new file mode 100644
index 0000000..0729139
--- /dev/null
+++ b/contrib/zkt/examples/views/intern/zkt-int.log
@@ -0,0 +1,169 @@
+2008-06-12 18:02:13.593: notice: running as ../../dnssec-signer -V intern -v -v
+2008-06-12 18:02:13.594: debug: parsing zone "example.net." in dir "intern/example.net."
+2008-06-12 18:02:13.594: debug: Check RFC5011 status
+2008-06-12 18:02:13.595: debug: ->ksk5011status returns 0
+2008-06-12 18:02:13.595: debug: Check ksk status
+2008-06-12 18:02:13.595: debug: Lifetime(2592000 +/-150 sec) of active key 5972 exceeded (17727466 sec)
+2008-06-12 18:02:13.595: debug: ->waiting for pre-publish key
+2008-06-12 18:02:13.595: notice: "example.net.": lifetime of zone signing key 5972 exceeded since 25w4h17m46s: ZSK rollover deferred: waiting for pre-publish key
+2008-06-12 18:02:13.595: debug: Re-signing necessary: Modified keys
+2008-06-12 18:02:13.595: notice: "example.net.": re-signing triggered: Modified keys
+2008-06-12 18:02:13.595: debug: Writing key file "intern/example.net./dnskey.db"
+2008-06-12 18:02:13.596: debug: Signing zone "example.net."
+2008-06-12 18:02:13.596: debug: Run cmd "cd intern/example.net.; /usr/local/sbin/dnssec-signzone -p -o example.net. -e +86400 -g -N unixtime zone.db K*.private"
+2008-06-12 18:02:13.705: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-12 18:02:13.705: debug: Signing completed after 0s.
+2008-06-12 18:02:13.705: debug:
+2008-06-12 18:02:13.705: notice: end of run: 0 errors occured
+2008-06-12 18:03:13.208: notice: running as ../../dnssec-signer -V intern -r -v -v
+2008-06-12 18:03:13.209: debug: parsing zone "example.net." in dir "intern/example.net."
+2008-06-12 18:03:13.209: debug: Check RFC5011 status
+2008-06-12 18:03:13.209: debug: ->ksk5011status returns 0
+2008-06-12 18:03:13.209: debug: Check ksk status
+2008-06-12 18:03:13.209: debug: Lifetime(2592000 +/-150 sec) of active key 5972 exceeded (17727526 sec)
+2008-06-12 18:03:13.209: debug: ->waiting for pre-publish key
+2008-06-12 18:03:13.209: notice: "example.net.": lifetime of zone signing key 5972 exceeded since 25w4h18m46s: ZSK rollover deferred: waiting for pre-publish key
+2008-06-12 18:03:13.209: debug: Re-signing not necessary!
+2008-06-12 18:03:13.209: notice: end of run: 0 errors occured
+2008-06-12 18:03:19.287: notice: running as ../../dnssec-signer -V intern -r -v -v
+2008-06-12 18:03:19.288: debug: parsing zone "example.net." in dir "intern/example.net."
+2008-06-12 18:03:19.288: debug: Check RFC5011 status
+2008-06-12 18:03:19.289: debug: ->ksk5011status returns 0
+2008-06-12 18:03:19.289: debug: Check ksk status
+2008-06-12 18:03:19.289: debug: Lifetime(2592000 +/-150 sec) of active key 5972 exceeded (17727532 sec)
+2008-06-12 18:03:19.289: debug: ->waiting for pre-publish key
+2008-06-12 18:03:19.289: notice: "example.net.": lifetime of zone signing key 5972 exceeded since 25w4h18m52s: ZSK rollover deferred: waiting for pre-publish key
+2008-06-12 18:03:19.289: debug: Re-signing not necessary!
+2008-06-12 18:03:19.289: notice: end of run: 0 errors occured
+2008-06-12 18:03:23.617: notice: running as ../../dnssec-signer -V intern -f -r -v -v
+2008-06-12 18:03:23.618: debug: parsing zone "example.net." in dir "intern/example.net."
+2008-06-12 18:03:23.618: debug: Check RFC5011 status
+2008-06-12 18:03:23.618: debug: ->ksk5011status returns 0
+2008-06-12 18:03:23.618: debug: Check ksk status
+2008-06-12 18:03:23.618: debug: Lifetime(2592000 +/-150 sec) of active key 5972 exceeded (17727536 sec)
+2008-06-12 18:03:23.618: debug: ->waiting for pre-publish key
+2008-06-12 18:03:23.618: notice: "example.net.": lifetime of zone signing key 5972 exceeded since 25w4h18m56s: ZSK rollover deferred: waiting for pre-publish key
+2008-06-12 18:03:23.618: debug: Re-signing necessary: Option -f
+2008-06-12 18:03:23.618: notice: "example.net.": re-signing triggered: Option -f
+2008-06-12 18:03:23.618: debug: Writing key file "intern/example.net./dnskey.db"
+2008-06-12 18:03:23.619: debug: Signing zone "example.net."
+2008-06-12 18:03:23.619: debug: Run cmd "cd intern/example.net.; /usr/local/sbin/dnssec-signzone -p -o example.net. -e +86400 -g -N unixtime zone.db K*.private"
+2008-06-12 18:03:23.719: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-12 18:03:23.719: debug: Signing completed after 0s.
+2008-06-12 18:03:23.720: notice: ""example.net." in view "intern"": reload triggered
+2008-06-12 18:03:23.772: debug:
+2008-06-12 18:03:23.772: notice: end of run: 0 errors occured
+2008-06-12 18:05:39.532: notice: running as ../../dnssec-signer -V intern -f -r -v -v
+2008-06-12 18:05:39.533: debug: parsing zone "example.net." in dir "intern/example.net."
+2008-06-12 18:05:39.533: debug: Check RFC5011 status
+2008-06-12 18:05:39.533: debug: ->ksk5011status returns 0
+2008-06-12 18:05:39.533: debug: Check ksk status
+2008-06-12 18:05:39.533: debug: Lifetime(2592000 +/-150 sec) of active key 5972 exceeded (17727672 sec)
+2008-06-12 18:05:39.533: debug: ->waiting for pre-publish key
+2008-06-12 18:05:39.533: notice: "example.net.": lifetime of zone signing key 5972 exceeded since 25w4h21m12s: ZSK rollover deferred: waiting for pre-publish key
+2008-06-12 18:05:39.533: debug: Re-signing necessary: Option -f
+2008-06-12 18:05:39.533: notice: "example.net.": re-signing triggered: Option -f
+2008-06-12 18:05:39.533: debug: Writing key file "intern/example.net./dnskey.db"
+2008-06-12 18:05:39.534: debug: Signing zone "example.net."
+2008-06-12 18:05:39.534: debug: Run cmd "cd intern/example.net.; /usr/local/sbin/dnssec-signzone -p -o example.net. -e +86400 -g -N unixtime zone.db K*.private"
+2008-06-12 18:05:39.629: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-12 18:05:39.630: debug: Signing completed after 0s.
+2008-06-12 18:05:39.630: notice: ""example.net."": reload triggered
+2008-06-12 18:05:39.640: debug:
+2008-06-12 18:05:39.640: notice: end of run: 0 errors occured
+2008-06-12 18:07:47.753: notice: running as ../../dnssec-signer -V intern -f -r -v -v
+2008-06-12 18:07:47.754: debug: parsing zone "example.net." in dir "intern/example.net."
+2008-06-12 18:07:47.754: debug: Check RFC5011 status
+2008-06-12 18:07:47.754: debug: ->ksk5011status returns 0
+2008-06-12 18:07:47.754: debug: Check ksk status
+2008-06-12 18:07:47.754: debug: Lifetime(2592000 +/-150 sec) of active key 5972 exceeded (17727800 sec)
+2008-06-12 18:07:47.754: debug: ->waiting for pre-publish key
+2008-06-12 18:07:47.754: notice: "example.net.": lifetime of zone signing key 5972 exceeded since 25w4h23m20s: ZSK rollover deferred: waiting for pre-publish key
+2008-06-12 18:07:47.754: debug: Re-signing necessary: Option -f
+2008-06-12 18:07:47.754: notice: "example.net.": re-signing triggered: Option -f
+2008-06-12 18:07:47.754: debug: Writing key file "intern/example.net./dnskey.db"
+2008-06-12 18:07:47.754: debug: Signing zone "example.net."
+2008-06-12 18:07:47.754: debug: Run cmd "cd intern/example.net.; /usr/local/sbin/dnssec-signzone -p -o example.net. -e +86400 -g -N unixtime zone.db K*.private"
+2008-06-12 18:07:47.856: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-12 18:07:47.856: debug: Signing completed after 0s.
+2008-06-12 18:07:47.856: notice: ""example.net."": reload triggered
+2008-06-12 18:07:47.866: debug:
+2008-06-12 18:07:47.867: notice: end of run: 0 errors occured
+2008-06-12 18:10:57.978: notice: running as ../../dnssec-signer -V intern -f -r -v -v
+2008-06-12 18:10:57.978: debug: parsing zone "example.net." in dir "intern/example.net."
+2008-06-12 18:10:57.978: debug: Check RFC5011 status
+2008-06-12 18:10:57.978: debug: ->ksk5011status returns 0
+2008-06-12 18:10:57.978: debug: Check ksk status
+2008-06-12 18:10:57.978: debug: Lifetime(2592000 +/-150 sec) of active key 5972 exceeded (17727990 sec)
+2008-06-12 18:10:57.978: debug: ->waiting for pre-publish key
+2008-06-12 18:10:57.978: notice: "example.net.": lifetime of zone signing key 5972 exceeded since 25w4h26m30s: ZSK rollover deferred: waiting for pre-publish key
+2008-06-12 18:10:57.978: debug: Re-signing necessary: Option -f
+2008-06-12 18:10:57.978: notice: "example.net.": re-signing triggered: Option -f
+2008-06-12 18:10:57.978: debug: Writing key file "intern/example.net./dnskey.db"
+2008-06-12 18:10:57.979: debug: Signing zone "example.net."
+2008-06-12 18:10:57.979: debug: Run cmd "cd intern/example.net.; /usr/local/sbin/dnssec-signzone -p -o example.net. -e +86400 -g -N unixtime zone.db K*.private"
+2008-06-12 18:10:58.081: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-12 18:10:58.081: debug: Signing completed after 1s.
+2008-06-12 18:10:58.081: notice: ""example.net." in view "intern"": reload triggered
+2008-06-12 18:10:58.093: debug:
+2008-06-12 18:10:58.093: notice: end of run: 0 errors occured
+2008-06-12 18:13:29.511: notice: running as ../../dnssec-signer -V intern -f -r -v -v
+2008-06-12 18:13:29.512: debug: parsing zone "example.net." in dir "intern/example.net."
+2008-06-12 18:13:29.512: debug: Check RFC5011 status
+2008-06-12 18:13:29.512: debug: ->ksk5011status returns 0
+2008-06-12 18:13:29.512: debug: Check ksk status
+2008-06-12 18:13:29.512: debug: Lifetime(2592000 +/-150 sec) of active key 5972 exceeded (17728142 sec)
+2008-06-12 18:13:29.512: debug: ->waiting for pre-publish key
+2008-06-12 18:13:29.512: notice: "example.net.": lifetime of zone signing key 5972 exceeded since 25w4h29m2s: ZSK rollover deferred: waiting for pre-publish key
+2008-06-12 18:13:29.512: debug: Re-signing necessary: Option -f
+2008-06-12 18:13:29.512: notice: "example.net.": re-signing triggered: Option -f
+2008-06-12 18:13:29.512: debug: Writing key file "intern/example.net./dnskey.db"
+2008-06-12 18:13:29.513: debug: Signing zone "example.net."
+2008-06-12 18:13:29.513: debug: Run cmd "cd intern/example.net.; /usr/local/sbin/dnssec-signzone -p -o example.net. -e +86400 -g -N unixtime zone.db K*.private"
+2008-06-12 18:13:29.612: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-12 18:13:29.612: debug: Signing completed after 0s.
+2008-06-12 18:13:29.612: notice: ""example.net." in view "intern"": reload triggered
+2008-06-12 18:13:29.612: debug: Reload zone "example.net." in view "intern"
+2008-06-12 18:13:29.612: debug: Run cmd "/usr/local/sbin/rndc reload example.net. IN intern"
+2008-06-12 18:13:29.623: debug:
+2008-06-12 18:13:29.623: notice: end of run: 0 errors occured
+2008-06-12 18:13:38.707: notice: running as ../../dnssec-signer -V intern -f -r -v
+2008-06-12 18:13:38.708: debug: parsing zone "example.net." in dir "intern/example.net."
+2008-06-12 18:13:38.709: debug: Check RFC5011 status
+2008-06-12 18:13:38.709: debug: ->ksk5011status returns 0
+2008-06-12 18:13:38.709: debug: Check ksk status
+2008-06-12 18:13:38.709: debug: Lifetime(2592000 +/-150 sec) of active key 5972 exceeded (17728151 sec)
+2008-06-12 18:13:38.709: debug: ->waiting for pre-publish key
+2008-06-12 18:13:38.709: notice: "example.net.": lifetime of zone signing key 5972 exceeded since 25w4h29m11s: ZSK rollover deferred: waiting for pre-publish key
+2008-06-12 18:13:38.709: debug: Re-signing necessary: Option -f
+2008-06-12 18:13:38.709: notice: "example.net.": re-signing triggered: Option -f
+2008-06-12 18:13:38.709: debug: Writing key file "intern/example.net./dnskey.db"
+2008-06-12 18:13:38.710: debug: Signing zone "example.net."
+2008-06-12 18:13:38.710: debug: Run cmd "cd intern/example.net.; /usr/local/sbin/dnssec-signzone -p -o example.net. -e +86400 -g -N unixtime zone.db K*.private"
+2008-06-12 18:13:39.163: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-12 18:13:39.163: debug: Signing completed after 1s.
+2008-06-12 18:13:39.163: notice: ""example.net." in view "intern"": reload triggered
+2008-06-12 18:13:39.163: debug: Reload zone "example.net." in view "intern"
+2008-06-12 18:13:39.163: debug: Run cmd "/usr/local/sbin/rndc reload example.net. IN intern"
+2008-06-12 18:13:39.174: debug:
+2008-06-12 18:13:39.174: notice: end of run: 0 errors occured
+2008-06-12 18:13:43.163: notice: running as ../../dnssec-signer -V intern -f -r -v -v
+2008-06-12 18:13:43.164: debug: parsing zone "example.net." in dir "intern/example.net."
+2008-06-12 18:13:43.164: debug: Check RFC5011 status
+2008-06-12 18:13:43.164: debug: ->ksk5011status returns 0
+2008-06-12 18:13:43.164: debug: Check ksk status
+2008-06-12 18:13:43.164: debug: Lifetime(2592000 +/-150 sec) of active key 5972 exceeded (17728156 sec)
+2008-06-12 18:13:43.164: debug: ->waiting for pre-publish key
+2008-06-12 18:13:43.164: notice: "example.net.": lifetime of zone signing key 5972 exceeded since 25w4h29m16s: ZSK rollover deferred: waiting for pre-publish key
+2008-06-12 18:13:43.164: debug: Re-signing necessary: Option -f
+2008-06-12 18:13:43.164: notice: "example.net.": re-signing triggered: Option -f
+2008-06-12 18:13:43.164: debug: Writing key file "intern/example.net./dnskey.db"
+2008-06-12 18:13:43.164: debug: Signing zone "example.net."
+2008-06-12 18:13:43.164: debug: Run cmd "cd intern/example.net.; /usr/local/sbin/dnssec-signzone -p -o example.net. -e +86400 -g -N unixtime zone.db K*.private"
+2008-06-12 18:13:43.262: debug: Cmd dnssec-signzone return: "zone.db.signed"
+2008-06-12 18:13:43.262: debug: Signing completed after 0s.
+2008-06-12 18:13:43.262: notice: ""example.net." in view "intern"": reload triggered
+2008-06-12 18:13:43.262: debug: Reload zone "example.net." in view "intern"
+2008-06-12 18:13:43.262: debug: Run cmd "/usr/local/sbin/rndc reload example.net. IN intern"
+2008-06-12 18:13:43.273: debug:
+2008-06-12 18:13:43.273: notice: end of run: 0 errors occured
diff --git a/contrib/zkt/examples/views/named.conf b/contrib/zkt/examples/views/named.conf
new file mode 100644
index 0000000..1ec3d13
--- /dev/null
+++ b/contrib/zkt/examples/views/named.conf
@@ -0,0 +1,97 @@
+/*****************************************************************
+**
+** #(@) named.conf (c) 6. May 2004 (hoz)
+*****************************************************************/
+
+/*****************************************************************
+** logging options
+*****************************************************************/
+logging {
+ channel "named-log" {
+ file "named.log";
+ print-time yes;
+ print-category yes;
+ print-severity yes;
+ severity info;
+ };
+ category "dnssec" { "named-log"; };
+ category "edns-disabled" { "named-log"; };
+ category "default" { "named-log"; };
+};
+
+/*****************************************************************
+** name server options
+*****************************************************************/
+options {
+ directory ".";
+
+ pid-file "named.pid";
+ listen-on-v6 port 1053 { any; };
+ listen-on port 1053 { any; };
+
+ empty-zones-enable no;
+
+ port 1053;
+ query-source address * port 1053;
+ query-source-v6 address * port 1053;
+ transfer-source * port 53;
+ transfer-source-v6 * port 53;
+ use-alt-transfer-source no;
+ notify-source * port 53;
+ notify-source-v6 * port 53;
+
+ recursion yes;
+ dnssec-enable yes;
+ dnssec-validation yes; /* required by BIND 9.4.0 */
+ dnssec-accept-expired false; /* added since BIND 9.5.0 */
+ edns-udp-size 1460; /* (M4) */
+ max-udp-size 1460; /* (M5) */
+
+ # allow-query { localhost; }; /* default in 9.4.0 */
+ # allow-query-cache { localhost; }; /* default in 9.4.0 */
+
+ dnssec-must-be-secure "." no;
+
+ querylog yes;
+
+ stats-server 127.0.0.1 port 8881; /* added since BIND 9.5.0 */
+};
+
+/*****************************************************************
+** view intern
+*****************************************************************/
+view "intern" {
+ match-clients { 127.0.0.1; ::1; };
+ recursion yes;
+ zone "." in {
+ type hint;
+ file "root.hint";
+ };
+
+ zone "0.0.127.in-addr.arpa" in {
+ type master;
+ file "127.0.0.zone";
+ };
+
+ zone "example.net" in {
+ type master;
+ file "intern/example.net./zone.db.signed";
+ };
+};
+
+/*****************************************************************
+** view extern
+*****************************************************************/
+view "extern" {
+ match-clients { any; };
+ recursion no;
+ zone "." in {
+ type hint;
+ file "root.hint";
+ };
+
+ zone "example.net" in {
+ type master;
+ file "extern/example.net./zone.db.signed";
+ };
+};
diff --git a/contrib/zkt/examples/views/named.log b/contrib/zkt/examples/views/named.log
new file mode 100644
index 0000000..15d5f7b
--- /dev/null
+++ b/contrib/zkt/examples/views/named.log
@@ -0,0 +1,17 @@
+20-Nov-2007 17:12:58.092 general: critical: couldn't open pid file '/var/run/named.pid': Permission denied
+20-Nov-2007 17:12:58.092 general: critical: exiting (due to early fatal error)
+20-Nov-2007 17:20:24.941 general: critical: couldn't open pid file '/var/run/named.pid': Permission denied
+20-Nov-2007 17:20:24.941 general: critical: exiting (due to early fatal error)
+20-Nov-2007 17:28:22.686 general: critical: couldn't open pid file '/var/run/named.pid': Permission denied
+20-Nov-2007 17:28:22.686 general: critical: exiting (due to early fatal error)
+20-Nov-2007 17:40:12.389 general: error: zone 0.0.127.in-addr.arpa/IN/intern: loading from master file 127.0.0.zone failed: file not found
+20-Nov-2007 17:40:12.391 general: info: zone example.net/IN/intern: loaded serial 1195574789 (signed)
+20-Nov-2007 17:40:12.393 general: info: zone example.net/IN/extern: loaded serial 1195561217 (signed)
+20-Nov-2007 17:40:12.393 general: notice: running
+20-Nov-2007 17:40:12.393 notify: info: zone example.net/IN/intern: sending notifies (serial 1195574789)
+20-Nov-2007 17:40:12.394 notify: info: zone example.net/IN/extern: sending notifies (serial 1195561217)
+20-Nov-2007 19:07:04.016 general: info: shutting down
+20-Nov-2007 19:07:04.017 network: info: no longer listening on ::#1053
+20-Nov-2007 19:07:04.017 network: info: no longer listening on 127.0.0.1#1053
+20-Nov-2007 19:07:04.017 network: info: no longer listening on 145.253.100.51#1053
+20-Nov-2007 19:07:04.020 general: notice: exiting
diff --git a/contrib/zkt/examples/views/root.hint b/contrib/zkt/examples/views/root.hint
new file mode 100644
index 0000000..2b5c167
--- /dev/null
+++ b/contrib/zkt/examples/views/root.hint
@@ -0,0 +1,45 @@
+; <<>> DiG 9.5.0a6 <<>> ns . @a.root-servers.net
+;; global options: printcmd
+;; Got answer:
+;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33355
+;; flags: qr aa rd; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 13
+;; WARNING: recursion requested but not available
+
+;; QUESTION SECTION:
+;. IN NS
+
+;; ANSWER SECTION:
+. 518400 IN NS H.ROOT-SERVERS.NET.
+. 518400 IN NS I.ROOT-SERVERS.NET.
+. 518400 IN NS J.ROOT-SERVERS.NET.
+. 518400 IN NS K.ROOT-SERVERS.NET.
+. 518400 IN NS L.ROOT-SERVERS.NET.
+. 518400 IN NS M.ROOT-SERVERS.NET.
+. 518400 IN NS A.ROOT-SERVERS.NET.
+. 518400 IN NS B.ROOT-SERVERS.NET.
+. 518400 IN NS C.ROOT-SERVERS.NET.
+. 518400 IN NS D.ROOT-SERVERS.NET.
+. 518400 IN NS E.ROOT-SERVERS.NET.
+. 518400 IN NS F.ROOT-SERVERS.NET.
+. 518400 IN NS G.ROOT-SERVERS.NET.
+
+;; ADDITIONAL SECTION:
+A.ROOT-SERVERS.NET. 3600000 IN A 198.41.0.4
+B.ROOT-SERVERS.NET. 3600000 IN A 192.228.79.201
+C.ROOT-SERVERS.NET. 3600000 IN A 192.33.4.12
+D.ROOT-SERVERS.NET. 3600000 IN A 128.8.10.90
+E.ROOT-SERVERS.NET. 3600000 IN A 192.203.230.10
+F.ROOT-SERVERS.NET. 3600000 IN A 192.5.5.241
+G.ROOT-SERVERS.NET. 3600000 IN A 192.112.36.4
+H.ROOT-SERVERS.NET. 3600000 IN A 128.63.2.53
+I.ROOT-SERVERS.NET. 3600000 IN A 192.36.148.17
+J.ROOT-SERVERS.NET. 3600000 IN A 192.58.128.30
+K.ROOT-SERVERS.NET. 3600000 IN A 193.0.14.129
+L.ROOT-SERVERS.NET. 3600000 IN A 199.7.83.42
+M.ROOT-SERVERS.NET. 3600000 IN A 202.12.27.33
+
+;; Query time: 114 msec
+;; SERVER: 198.41.0.4#53(198.41.0.4)
+;; WHEN: Mon Nov 5 07:28:00 2007
+;; MSG SIZE rcvd: 436
+
diff --git a/contrib/zkt/examples/views/viewtest.sh b/contrib/zkt/examples/views/viewtest.sh
new file mode 100755
index 0000000..f0a1754
--- /dev/null
+++ b/contrib/zkt/examples/views/viewtest.sh
@@ -0,0 +1,20 @@
+
+
+ZKT_CONFFILE=dnssec.conf
+export ZKT_CONFFILE
+
+if true
+then
+ echo "All internal keys:"
+ ./dnssec-zkt-intern
+ echo
+
+ echo "All external keys:"
+ ./dnssec-zkt-extern
+ echo
+fi
+
+echo "Sign both views"
+./dnssec-signer-intern -v -v -f -r
+echo
+./dnssec-signer-extern -v -v
diff --git a/contrib/zkt/examples/zone.db b/contrib/zkt/examples/zone.db
new file mode 100644
index 0000000..9864cb1
--- /dev/null
+++ b/contrib/zkt/examples/zone.db
@@ -0,0 +1,45 @@
+;-----------------------------------------------------------------
+;
+; @(#) example.net/zone.db
+;
+;-----------------------------------------------------------------
+
+$TTL 7200
+
+; Be sure that the serial number below is left
+; justified in a field of at least 10 chars!!
+; 0123456789;
+; It's also possible to use the date form e.g. 2005040101
+@ IN SOA ns1.example.net. hostmaster.example.net. (
+ 263 ; Serial
+ 43200 ; Refresh
+ 1800 ; Retry
+ 2W ; Expire
+ 7200 ) ; Minimum
+
+ IN NS ns1.example.net.
+ IN NS ns2.example.net.
+
+ns1 IN A 1.0.0.5
+ IN AAAA 2001:db8::53
+ns2 IN A 1.2.0.6
+
+localhost IN A 127.0.0.1
+
+a IN A 1.2.3.1
+b IN MX 10 a
+;c IN A 1.2.3.2
+d IN A 1.2.3.3
+ IN AAAA 2001:0db8::3
+
+; Delegation to secure zone; The DS resource record will
+; be added by dnssec-signzone automatically if the
+; keyset-sub.example.net file is present (run dnssec-signzone
+; with option -g or use the dnssec-signer tool) ;-)
+sub IN NS ns1.example.net.
+sub IN DS 54876 5 1 CAB6127E303A8A8D7D5A29AE05DB60F4C5060B10
+sub IN DS 54876 5 2 7C8CAF1844479F3600213173BB5D1E2A44143D63B6E0B3E10D8C5310 ADF84D30
+
+; this file will have all the zone keys
+$INCLUDE dnskey.db
+
diff --git a/contrib/zkt/examples/zone.db.signed b/contrib/zkt/examples/zone.db.signed
new file mode 100644
index 0000000..1e389ea
--- /dev/null
+++ b/contrib/zkt/examples/zone.db.signed
@@ -0,0 +1,146 @@
+; File written on Tue Jun 24 10:00:31 2008
+; dnssec_signzone version 9.5.0
+example.net. 7200 IN SOA ns1.example.net. hostmaster.example.net. (
+ 263 ; serial
+ 43200 ; refresh (12 hours)
+ 1800 ; retry (30 minutes)
+ 1209600 ; expire (2 weeks)
+ 7200 ; minimum (2 hours)
+ )
+ 7200 RRSIG SOA 5 2 7200 20080724070030 (
+ 20080624070030 33755 example.net.
+ FFUGR4+nzjZbpDT/RAncV7dNvBy1xil4MO17
+ DU+gotHHV1Yq+4RRqEnRhOSWydDC9ENAjH7W
+ lmzr+igFHp8qiw== )
+ 7200 NS ns1.example.net.
+ 7200 NS ns2.example.net.
+ 7200 RRSIG NS 5 2 7200 20080724070030 (
+ 20080624070030 33755 example.net.
+ mpT5zY57UtLMdl6iKVtvr78vINyaA3NkZ0af
+ E/TtUUBJeIEjLauzxA5jJBGqLWAiLj8HKWhS
+ dq1VfORhRh/Xng== )
+ 7200 NSEC a.example.net. NS SOA RRSIG NSEC DNSKEY
+ 7200 RRSIG NSEC 5 2 7200 20080724070030 (
+ 20080624070030 33755 example.net.
+ Q5yxSoL+Df3UbGe1RSFFj01SoBGLgjXvgLd5
+ wKota7wnjO8CxidmrN+qcKQHjF+R+mH8GeQ7
+ xL1qZxKLQqxmwA== )
+ 14400 DNSKEY 256 3 5 (
+ BQEAAAABzN8pvZb5GSy8AozXt4L8HK/x59TQ
+ jh9IaZS+mIyyuHDX2iaFUigOqHixIJtDLD1r
+ /MfelgJ/Mh6+vCu+XmMQuw==
+ ) ; key id = 33755
+ 14400 DNSKEY 257 3 5 (
+ BQEAAAABC23icFZAD3DFBLoEw7DWKl8Hig7a
+ zmEbpXHYyAV98l+QQaTAb98Ob3YbrVJ9IU8E
+ 0KBFb5iYpHobxowPsI8FjUH2oL/7PfhtN1E3
+ NlL6Uhbo8Umf6H0UULEsUTlTT8dnX+ikjAr8
+ bN71YJP7BXlszezsFHuMEspNdOPyMr93230+
+ R2KTEzC2H4CQzSRIr5xXSIq8kkrJ3miGjTyj
+ 5awvXfJ+eQ==
+ ) ; key id = 31674
+ 14400 RRSIG DNSKEY 5 2 14400 20080724070030 (
+ 20080624070030 31674 example.net.
+ BGed6Vivkmx/SM7HuXMy9ex+p0fDWcXW6uTH
+ SZLs9oAZMSkm8Xh2RNNI1sgZefGpsOc7AZJE
+ JuIWttqKm5VL57qpEKeTxZ9oE6Vpk4ko5lMo
+ yTJUoih7lTXo7a1OsNHMFZadE7Fu4Q8pjGUZ
+ ZJI4zBrT7JmgyPNCkgn1JdC2qJlc6ClHEb4E
+ 6pQyH3BnSOFudZDz8MdVQnqdxpShGwucnf2i
+ oA== )
+ 14400 RRSIG DNSKEY 5 2 14400 20080724070030 (
+ 20080624070030 33755 example.net.
+ f03G7Cq3CwWz7Lbe7cl61ciSsdEYv4heYnR3
+ binJ3xWO7jSiRAvUAfkIYDspdlF/PCOnv8sr
+ id8TL8q/qQ0MCg== )
+a.example.net. 7200 IN A 1.2.3.1
+ 7200 RRSIG A 5 3 7200 20080724070030 (
+ 20080624070030 33755 example.net.
+ VuIrcft9jvWKORJy2SQ4UgWwRnUL4gIiaVpy
+ 3i5hfjM6X38FHsy0SvGrjxQqiurwZZS4NxXG
+ ljUerawxMdHWWw== )
+ 7200 NSEC b.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080724070030 (
+ 20080624070030 33755 example.net.
+ yc/tsRYQRaYsPp+5jPUj2NR0R3zHKvXBQ/RO
+ 14b/eKL9i4NnuzS50qFZwzpcOBOJd6XITO4p
+ yJNZQKtryRJuSg== )
+b.example.net. 7200 IN MX 10 a.example.net.
+ 7200 RRSIG MX 5 3 7200 20080724070030 (
+ 20080624070030 33755 example.net.
+ xVjOhCO2zJVp1SsoMdM6ePCZUkittsqEP7rI
+ 7j8r2S1j4oiIdXaxCBBVwddhS/x1eziI/a2S
+ /HwVRJThIYIKnQ== )
+ 7200 NSEC d.example.net. MX RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080724070030 (
+ 20080624070030 33755 example.net.
+ jC171VBU0dqcI1NnMUUqrUIjq09sVHnFo9CH
+ 0jKNwxkj+K1Zkr7CBm6htH+EkKKhqKFW8kz7
+ b2r05FL1xakcnQ== )
+d.example.net. 7200 IN A 1.2.3.3
+ 7200 RRSIG A 5 3 7200 20080724070030 (
+ 20080624070030 33755 example.net.
+ Q4C7HCpDR6fxIczzqGDnkpXUL5oxdPDYWF2H
+ vmAalL++9A5hVGz8S5IfX87dZAg71c1j8ZAe
+ 5oS0pvLQnweoIw== )
+ 7200 AAAA 2001:db8::3
+ 7200 RRSIG AAAA 5 3 7200 20080724070030 (
+ 20080624070030 33755 example.net.
+ ECjxqQpJCbL6A9iBk/bImgzDNevUXFjq8n2L
+ 14ewG5zQSz/0l0NqcHKtCiruBjHd+DEXjTEI
+ Qo8RvMm7Rn8OsA== )
+ 7200 NSEC localhost.example.net. A AAAA RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080724070030 (
+ 20080624070030 33755 example.net.
+ k+AhslVfBZgXkTaWjDVB+3nLm2ye8UOGMNhY
+ QcKxJZaVYKnUZfyX1sJONN4UdFjmnkdNcRVC
+ 6ouWrLbIwslqIQ== )
+localhost.example.net. 7200 IN A 127.0.0.1
+ 7200 RRSIG A 5 3 7200 20080724070030 (
+ 20080624070030 33755 example.net.
+ wZjK9o3CElHLPSzynvzft/nQAEeBpNOj22vq
+ 3TWa9HWQ0RqL55NRmzxuDtyMtPOFQpniVxgV
+ jizb8X3SPJ5V1g== )
+ 7200 NSEC ns1.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080724070030 (
+ 20080624070030 33755 example.net.
+ e4nOW7PuqCQBYgSCBQH06V2XB7SF85jmfFIc
+ dSMbsLRK+1tN/Y2+85WKVSQrXZzWRHgjQ+Hw
+ iL/FWK5Zfq7ixg== )
+ns1.example.net. 7200 IN A 1.0.0.5
+ 7200 RRSIG A 5 3 7200 20080724070030 (
+ 20080624070030 33755 example.net.
+ tTfMDk2ww2uWutlhjRMDPGo9ZPugjJqSbdyP
+ 6cJcCDJUBce0UZFxjvDBZhfG7O2XUscooUjp
+ JpXsJ54ksPugXA== )
+ 7200 AAAA 2001:db8::53
+ 7200 RRSIG AAAA 5 3 7200 20080724070030 (
+ 20080624070030 33755 example.net.
+ x8iMgcICSOxgx4biLForfZxgMbMVpzwMQR6n
+ naFVK79GOwFFT8krAfo6K6Rg7Fyu0jSE/59H
+ 3Y15F0ju6YvbAg== )
+ 7200 NSEC ns2.example.net. A AAAA RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080724070030 (
+ 20080624070030 33755 example.net.
+ EYof9XuXHXuWgRF0MzgO/Z8FGYJEfLlJKWCV
+ IWh+b8XJejLO1Tt0vlJZl0orrs6yam/B8CWb
+ dgq8ktbqpNHmvg== )
+ns2.example.net. 7200 IN A 1.2.0.6
+ 7200 RRSIG A 5 3 7200 20080724070030 (
+ 20080624070030 33755 example.net.
+ Uh93B1J7mOqBcW8sXWHA6vmeGszGJGE/BtFV
+ cdO4tBNoIDbIdkzBUJZphc6HfK7/gu7WFhAo
+ 5v6cZr4bRDOf6A== )
+ 7200 NSEC sub.example.net. A RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080724070030 (
+ 20080624070030 33755 example.net.
+ xOkV3aTsgrP7ZyaHfKhLmjJfhboQJpDYFdqV
+ y0zzZuGQr7Yr4PxWED5WJhm4fFf48agNWBmm
+ rk1OaFadv6m2uw== )
+sub.example.net. 7200 IN NS ns1.example.net.
+ 7200 NSEC example.net. NS RRSIG NSEC
+ 7200 RRSIG NSEC 5 3 7200 20080724070030 (
+ 20080624070030 33755 example.net.
+ Pr8KFvU/Fr2lp9W6Wqqq47VKrnh3tL90S8Eu
+ KIPsfmBE00g7eGPVswJUWShXMBZFLtfqI8z/
+ UBM6VzROSTtryA== )
diff --git a/contrib/zkt/log.c b/contrib/zkt/log.c
new file mode 100644
index 0000000..021be98
--- /dev/null
+++ b/contrib/zkt/log.c
@@ -0,0 +1,443 @@
+/*****************************************************************
+**
+** @(#) log.c -- The ZKT error logging module
+**
+** Copyright (c) June 2008, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+**
+*****************************************************************/
+# include <stdio.h>
+# include <string.h>
+# include <stdlib.h>
+# include <ctype.h>
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <sys/time.h>
+# include <time.h>
+# include <assert.h>
+# include <errno.h>
+# include <syslog.h>
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+# include "config_zkt.h"
+# include "misc.h"
+# include "debug.h"
+#define extern
+# include "log.h"
+#undef extern
+
+/*****************************************************************
+** module internal vars & declarations
+*****************************************************************/
+static FILE *lg_fp;
+static int lg_minfilelevel;
+static int lg_syslogging;
+static int lg_minsyslevel;
+static long lg_errcnt;
+static const char *lg_progname;
+
+typedef struct {
+ lg_lvl_t level;
+ const char *str;
+ int syslog_level;
+} lg_symtbl_t;
+
+static lg_symtbl_t symtbl[] = {
+ { LG_NONE, "none", -1 },
+ { LG_DEBUG, "debug", LOG_DEBUG },
+ { LG_INFO, "info", LOG_INFO },
+ { LG_NOTICE, "notice", LOG_NOTICE },
+ { LG_WARNING, "warning", LOG_WARNING },
+ { LG_ERROR, "error", LOG_ERR },
+ { LG_FATAL, "fatal", LOG_CRIT },
+
+ { LG_NONE, "user", LOG_USER },
+ { LG_NONE, "daemon", LOG_DAEMON },
+ { LG_NONE, "local0", LOG_LOCAL0 },
+ { LG_NONE, "local1", LOG_LOCAL1 },
+ { LG_NONE, "local2", LOG_LOCAL2 },
+ { LG_NONE, "local3", LOG_LOCAL3 },
+ { LG_NONE, "local4", LOG_LOCAL4 },
+ { LG_NONE, "local5", LOG_LOCAL5 },
+ { LG_NONE, "local6", LOG_LOCAL6 },
+ { LG_NONE, "local7", LOG_LOCAL7 },
+ { LG_NONE, NULL, -1 }
+};
+
+# define MAXFNAME (1023)
+/*****************************************************************
+** function definitions (for function declarations see log.h)
+*****************************************************************/
+
+/*****************************************************************
+** lg_fileopen (path, name) -- open the log file
+** Name is a (absolute or relative) file or directory name.
+** If path is given and name is a relative path name then path
+** is prepended to name.
+** returns the open file pointer or NULL on error
+*****************************************************************/
+static FILE *lg_fileopen (const char *path, const char *name)
+{
+ int len;
+ FILE *fp;
+ struct tm *t;
+ time_t sec;
+ char fname[MAXFNAME+1];
+
+ if ( name == NULL || *name == '\0' )
+ return NULL;
+ else if ( *name == '/' || path == NULL )
+ snprintf (fname, MAXFNAME, "%s", name);
+ else
+ snprintf (fname, MAXFNAME, "%s/%s", path, name);
+
+# ifdef LOG_TEST
+ fprintf (stderr, "\t ==> \"%s\"", fname);
+# endif
+ if ( is_directory (fname) )
+ {
+ len = strlen (fname);
+
+ time (&sec);
+ t = gmtime (&sec);
+ snprintf (fname+len, MAXFNAME-len, LOG_FNAMETMPL,
+ t->tm_year + 1900, t->tm_mon+1, t->tm_mday,
+ t->tm_hour, t->tm_min, t->tm_sec);
+# ifdef LOG_TEST
+ fprintf (stderr, " isdir \"%s\"", fname);
+# endif
+ }
+
+# ifdef LOG_TEST
+ fprintf (stderr, "\n");
+# endif
+
+ if ( (fp = fopen (fname, "a")) == NULL )
+ return NULL;
+
+ return fp;
+}
+
+/*****************************************************************
+** lg_str2lvl (level_name)
+*****************************************************************/
+lg_lvl_t lg_str2lvl (const char *name)
+{
+ lg_symtbl_t *p;
+
+ if ( !name )
+ return LG_NONE;
+
+ for ( p = symtbl; p->str; p++ )
+ if ( strcasecmp (name, p->str) == 0 )
+ return p->level;
+
+ return LG_NONE;
+}
+
+/*****************************************************************
+** lg_lvl2syslog (level)
+*****************************************************************/
+lg_lvl_t lg_lvl2syslog (lg_lvl_t level)
+{
+ lg_symtbl_t *p;
+
+ for ( p = symtbl; p->str; p++ )
+ if ( level == p->level )
+ return p->syslog_level;
+
+ assert ( p->str != NULL ); /* we assume not to reach this! */
+
+ return LOG_DEBUG; /* if not found, return DEBUG as default */
+}
+
+/*****************************************************************
+** lg_str2syslog (facility_name)
+*****************************************************************/
+int lg_str2syslog (const char *facility)
+{
+ lg_symtbl_t *p;
+
+ dbg_val1 ("lg_str2syslog (%s)\n", facility);
+ if ( !facility )
+ return LG_NONE;
+
+ for ( p = symtbl; p->str; p++ )
+ if ( strcasecmp (facility, p->str) == 0 )
+ return p->syslog_level;
+
+ return LG_NONE;
+}
+
+/*****************************************************************
+** lg_lvl2str (level)
+*****************************************************************/
+const char *lg_lvl2str (lg_lvl_t level)
+{
+ lg_symtbl_t *p;
+
+ if ( level < LG_DEBUG )
+ return "none";
+
+ for ( p = symtbl; p->str; p++ )
+ if ( level == p->level )
+ return p->str;
+ return "fatal";
+}
+
+/*****************************************************************
+** lg_geterrcnt () -- returns the current value of the internal
+** error counter
+*****************************************************************/
+long lg_geterrcnt ()
+{
+ return lg_errcnt;
+}
+
+/*****************************************************************
+** lg_seterrcnt () -- sets the internal error counter
+** returns the current value
+*****************************************************************/
+long lg_seterrcnt (long value)
+{
+ return lg_errcnt = value;
+}
+
+/*****************************************************************
+** lg_reseterrcnt () -- resets the internal error counter to 0
+** returns the current value
+*****************************************************************/
+long lg_reseterrcnt ()
+{
+ return lg_seterrcnt (0L);
+}
+
+
+/*****************************************************************
+** lg_open (prog, facility, syslevel, path, file, filelevel)
+** -- open the log channel
+** return values:
+** 0 on success
+** -1 on file open error
+*****************************************************************/
+int lg_open (const char *progname, const char *facility, const char *syslevel, const char *path, const char *file, const char *filelevel)
+{
+ int sysfacility;
+
+ dbg_val6 ("lg_open (%s, %s, %s, %s, %s, %s)\n", progname, facility, syslevel, path, file, filelevel);
+
+ lg_minsyslevel = lg_str2lvl (syslevel);
+ lg_minfilelevel = lg_str2lvl (filelevel);
+
+ sysfacility = lg_str2syslog (facility);
+ if ( sysfacility >= 0 )
+ {
+ lg_syslogging = 1;
+ dbg_val2 ("lg_open: openlog (%s, LOG_NDELAY, %d)\n", progname, lg_str2syslog (facility));
+ openlog (progname, LOG_NDELAY, lg_str2syslog (facility));
+ }
+ if ( file && * file )
+ {
+ if ( (lg_fp = lg_fileopen (path, file)) == NULL )
+ return -1;
+ lg_progname = progname;
+ }
+
+ return 0;
+}
+
+/*****************************************************************
+** lg_close () -- close the open filepointer for error logging
+** return 0 if no error log file is currently open,
+** otherwise the return code of fclose is returned.
+*****************************************************************/
+int lg_close ()
+{
+ int ret = 0;
+
+ if ( lg_syslogging )
+ {
+ closelog ();
+ lg_syslogging = 0;
+ }
+ if ( lg_fp )
+ {
+ ret = fclose (lg_fp);
+ lg_fp = NULL;
+ }
+
+ return ret;
+}
+
+/*****************************************************************
+**
+** lg_args (level, argc, argv[])
+** log all command line arguments (up to a length of 511 chars)
+** with priority level
+**
+*****************************************************************/
+void lg_args (lg_lvl_t level, int argc, char * const argv[])
+{
+ char cmdline[511+1];
+ int len;
+ int i;
+
+ len = 0;
+ for ( i = 0; i < argc && len < sizeof (cmdline); i++ )
+ len += snprintf (cmdline+len, sizeof (cmdline) - len, " %s", argv[i]);
+
+#if 1
+ lg_mesg (level, "------------------------------------------------------------");
+#else
+ lg_mesg (level, "");
+#endif
+ lg_mesg (level, "running%s ", cmdline);
+}
+
+/*****************************************************************
+**
+** lg_mesg (level, fmt, ...)
+**
+** Write a given message to the error log file and counts
+** all messages written with an level greater than LOG_ERR.
+**
+** All messages will be on one line in the logfile, so it's
+** not necessary to add an '\n' to the message.
+**
+** To call this function before an elog_open() is called is
+** useless!
+**
+*****************************************************************/
+void lg_mesg (int priority, char *fmt, ...)
+{
+ va_list ap;
+ struct timeval tv;
+ struct tm *t;
+ char format[256];
+
+ assert (fmt != NULL);
+ assert (priority >= LG_DEBUG && priority <= LG_FATAL);
+
+ format[0] ='\0';
+
+ dbg_val3 ("syslog = %d prio = %d >= sysmin = %d\n", lg_syslogging, priority, lg_minsyslevel);
+ if ( lg_syslogging && priority >= lg_minsyslevel )
+ {
+#if defined (LOG_WITH_LEVEL) && LOG_WITH_LEVEL
+ snprintf (format, sizeof (format), "%s: %s", lg_lvl2str(priority), fmt);
+ fmt = format;
+#endif
+ va_start(ap, fmt);
+ vsyslog (lg_lvl2syslog (priority), fmt, ap);
+ va_end(ap);
+ }
+
+ dbg_val3 ("filelg = %d prio = %d >= filmin = %d\n", lg_fp!=NULL, priority, lg_minfilelevel);
+ if ( lg_fp && priority >= lg_minfilelevel )
+ {
+#if defined (LOG_WITH_TIMESTAMP) && LOG_WITH_TIMESTAMP
+ gettimeofday (&tv, NULL);
+ t = localtime ((time_t *) &tv.tv_sec);
+ fprintf (lg_fp, "%04d-%02d-%02d ",
+ t->tm_year+1900, t->tm_mon+1, t->tm_mday);
+ fprintf (lg_fp, "%02d:%02d:%02d.%03ld: ",
+ t->tm_hour, t->tm_min, t->tm_sec, tv.tv_usec / 1000);
+#endif
+#if defined (LOG_WITH_PROGNAME) && LOG_WITH_PROGNAME
+ if ( lg_progname )
+ fprintf (lg_fp, "%s: ", lg_progname);
+#endif
+#if defined (LOG_WITH_LEVEL) && LOG_WITH_LEVEL
+ if ( fmt != format ) /* level is not in fmt string */
+ fprintf (lg_fp, "%s: ", lg_lvl2str(priority));
+#endif
+ va_start(ap, fmt);
+ vfprintf (lg_fp, fmt, ap);
+ va_end(ap);
+ fprintf (lg_fp, "\n");
+ }
+
+ if ( priority >= LG_ERROR )
+ lg_errcnt++;
+}
+
+
+#ifdef LOG_TEST
+const char *progname;
+int main (int argc, char *argv[])
+{
+ const char *levelstr;
+ const char *newlevelstr;
+ int level;
+ int err;
+
+ progname = *argv;
+
+ if ( --argc )
+ levelstr = *++argv;
+ else
+ levelstr = "fatal";
+
+ level = lg_str2lvl (levelstr);
+ newlevelstr = lg_lvl2str (level+1);
+ dbg_val4 ("base level = %s(%d) newlevel = %s(%d)\n", levelstr, level, newlevelstr, level+1);
+ if ( (err = lg_open (progname,
+#if 1
+ "user",
+#else
+ "none",
+#endif
+ levelstr, ".",
+#if 1
+ "test.log",
+#else
+ NULL,
+#endif
+ newlevelstr)) )
+ fprintf (stderr, "\topen error %d\n", err);
+ else
+ {
+ lg_mesg (LG_DEBUG, "debug message");
+ lg_mesg (LG_INFO, "INFO message");
+ lg_mesg (LG_NOTICE, "Notice message");
+ lg_mesg (LG_WARNING, "Warning message");
+ lg_mesg (LG_ERROR, "Error message");
+ lg_mesg (LG_FATAL, "Fatal message ");
+ }
+
+ if ( (err = lg_close ()) < 0 )
+ fprintf (stderr, "\tclose error %d\n", err);
+
+ return 0;
+}
+#endif
diff --git a/contrib/zkt/log.h b/contrib/zkt/log.h
new file mode 100644
index 0000000..9a5d3ab
--- /dev/null
+++ b/contrib/zkt/log.h
@@ -0,0 +1,66 @@
+/*****************************************************************
+**
+** @(#) log.h (c) June 2008 Holger Zuleger hznet.de
+**
+** Copyright (c) June 2008, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+#ifndef LOG_H
+# define LOG_H
+# include <sys/types.h>
+# include <stdarg.h>
+# include <stdio.h>
+# include <time.h>
+# include <syslog.h>
+
+typedef enum {
+ LG_NONE = 0,
+ LG_DEBUG,
+ LG_INFO,
+ LG_NOTICE,
+ LG_WARNING,
+ LG_ERROR,
+ LG_FATAL
+} lg_lvl_t;
+
+extern lg_lvl_t lg_str2lvl (const char *name);
+extern int lg_str2syslog (const char *facility);
+extern const char *lg_lvl2str (lg_lvl_t level);
+extern lg_lvl_t lg_lvl2syslog (lg_lvl_t level);
+extern long lg_geterrcnt (void);
+extern long lg_seterrcnt (long value);
+extern long lg_reseterrcnt (void);
+extern int lg_open (const char *progname, const char *facility, const char *syslevel, const char *path, const char *file, const char *filelevel);
+extern int lg_close (void);
+extern void lg_args (lg_lvl_t level, int argc, char * const argv[]);
+extern void lg_mesg (int level, char *fmt, ...);
+#endif
diff --git a/contrib/zkt/misc.c b/contrib/zkt/misc.c
new file mode 100644
index 0000000..d2465c3
--- /dev/null
+++ b/contrib/zkt/misc.c
@@ -0,0 +1,1157 @@
+/*****************************************************************
+**
+** @(#) misc.c -- helper functions for the dnssec zone key tools
+**
+** Copyright (c) Jan 2005, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+# include <stdio.h>
+# include <string.h>
+# include <stdlib.h>
+# include <unistd.h> /* for link(), unlink() */
+# include <ctype.h>
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <time.h>
+# include <utime.h>
+# include <assert.h>
+# include <errno.h>
+# include <fcntl.h>
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+# include "config_zkt.h"
+# include "zconf.h"
+# include "log.h"
+# include "debug.h"
+#define extern
+# include "misc.h"
+#undef extern
+
+# define TAINTEDCHARS "`$@;&<>|"
+
+extern const char *progname;
+
+static int inc_soa_serial (FILE *fp, int use_unixtime);
+
+/*****************************************************************
+** getnameappendix (progname, basename)
+** return a pointer to the substring in progname subsequent
+** following basename "-".
+*****************************************************************/
+const char *getnameappendix (const char *progname, const char *basename)
+{
+ const char *p;
+ int baselen;
+
+ assert (progname != NULL);
+ assert (basename != NULL);
+
+ if ( (p = strrchr (progname, '/')) != NULL )
+ p++;
+ else
+ p = progname;
+
+ baselen = strlen (basename);
+ if ( strncmp (p, basename, baselen-1) == 0 && *(p+baselen) == '-' )
+ {
+ p += baselen + 1;
+ if ( *p )
+ return p;
+ }
+
+ return NULL;
+}
+
+/*****************************************************************
+** getdefconfname (view)
+** returns the default configuration file name
+*****************************************************************/
+const char *getdefconfname (const char *view)
+{
+ char *p;
+ char *file;
+ char *buf;
+ int size;
+
+ if ( (file = getenv ("ZKT_CONFFILE")) == NULL )
+ file = CONFIG_FILE;
+
+ if ( view == NULL || *view == '\0' || (p = strrchr (file, '.')) == NULL )
+ return strdup (file);
+
+ size = strlen (file) + strlen (view) + 1 + 1;
+ if ( (buf = malloc (size)) == NULL )
+ return file;
+
+ dbg_val1 ("0123456789o123456789o123456789\tsize=%d\n", size);
+ dbg_val4 ("%.*s-%s%s\n", p - file, file, view, p);
+
+ snprintf (buf, size, "%.*s-%s%s", p - file, file, view, p);
+ return buf;
+}
+
+/*****************************************************************
+** str_tolowerdup (s)
+*****************************************************************/
+char *str_tolowerdup (const char *s)
+{
+ char *new;
+ char *p;
+
+ if ( s == NULL || (new = p = malloc (strlen (s) + 1)) == NULL )
+ return NULL;
+
+ while ( *s )
+ *p++ = tolower (*s++);
+ *p = '\0';
+
+ return new;
+}
+
+/*****************************************************************
+** str_delspace (s)
+** Remove in string 's' all white space char
+*****************************************************************/
+char *str_delspace (char *s)
+{
+ char *start;
+ char *p;
+
+ if ( !s ) /* is there a string ? */
+ return s;
+
+ start = s;
+ for ( p = s; *p; p++ )
+ if ( !isspace (*p) )
+ *s++ = *p; /* copy each nonspace */
+
+ *s = '\0'; /* terminate string */
+
+ return start;
+}
+
+/*****************************************************************
+** in_strarr (str, arr, cnt)
+** check if string array 'arr' contains the string 'str'
+** return 1 if true or 'arr' or 'str' is empty, otherwise 0
+*****************************************************************/
+int in_strarr (const char *str, char *const arr[], int cnt)
+{
+ if ( arr == NULL || cnt <= 0 )
+ return 1;
+
+ if ( str == NULL || *str == '\0' )
+ return 0;
+
+ while ( --cnt >= 0 )
+ if ( strcmp (str, arr[cnt]) == 0 )
+ return 1;
+
+ return 0;
+}
+
+/*****************************************************************
+** str_untaint (s)
+** Remove in string 's' all TAINTED chars
+*****************************************************************/
+char *str_untaint (char *str)
+{
+ char *p;
+
+ assert (str != NULL);
+
+ for ( p = str; *p; p++ )
+ if ( strchr (TAINTEDCHARS, *p) )
+ *p = ' ';
+ return str;
+}
+
+/*****************************************************************
+** str_chop (str, c)
+** delete all occurrences of char 'c' at the end of string 's'
+*****************************************************************/
+char *str_chop (char *str, char c)
+{
+ int len;
+
+ assert (str != NULL);
+
+ len = strlen (str) - 1;
+ while ( len >= 0 && str[len] == c )
+ str[len--] = '\0';
+
+ return str;
+}
+
+/*****************************************************************
+** parseurl (url, &proto, &host, &port, &para )
+** parses the given url (e.g. "proto://host.with.domain:port/para")
+** and set the pointer variables to the corresponding part of the string.
+*****************************************************************/
+void parseurl (char *url, char **proto, char **host, char **port, char **para)
+{
+ char *start;
+ char *p;
+
+ assert ( url != NULL );
+
+ /* parse protocol */
+ if ( (p = strchr (url, ':')) == NULL ) /* no protocol string given ? */
+ p = url;
+ else /* looks like a protocol string */
+ if ( p[1] == '/' && p[2] == '/' ) /* protocol string ? */
+ {
+ *p = '\0';
+ p += 3;
+ if ( proto )
+ *proto = url;
+ }
+ else /* no protocol string found ! */
+ p = url;
+
+ /* parse host */
+ if ( *p == '[' ) /* ipv6 address as hostname ? */
+ {
+ for ( start = ++p; *p && *p != ']'; p++ )
+ ;
+ if ( *p )
+ *p++ = '\0';
+ }
+ else
+ for ( start = p; *p && *p != ':' && *p != '/'; p++ )
+ ;
+ if ( host )
+ *host = start;
+
+ /* parse port */
+ if ( *p == ':' )
+ {
+ *p++ = '\0';
+ for ( start = p; *p && isdigit (*p); p++ )
+ ;
+ if ( *p )
+ *p++ = '\0';
+ if ( port )
+ *port = start;
+ }
+
+ if ( *p == '/' )
+ *p++ = '\0';
+
+ if ( *p && para )
+ *para = p;
+}
+
+/*****************************************************************
+** splitpath (path, size, filename)
+*****************************************************************/
+const char *splitpath (char *path, size_t size, const char *filename)
+{
+ char *p;
+
+ if ( !path )
+ return filename;
+
+ *path = '\0';
+ if ( !filename )
+ return filename;
+
+ if ( (p = strrchr (filename, '/')) ) /* file arg contains path ? */
+ {
+ if ( strlen (filename) > size )
+ return filename;
+
+ strcpy (path, filename);
+ path[p-filename] = '\0';
+ filename = ++p;
+ }
+ return filename;
+}
+
+/*****************************************************************
+** pathname (path, size, dir, file, ext)
+** Concatenate 'dir', 'file' and 'ext' (if not null) to build
+** a pathname, and store the result in the character array
+** with length 'size' pointed to by 'path'.
+*****************************************************************/
+char *pathname (char *path, size_t size, const char *dir, const char *file, const char *ext)
+{
+ int len;
+
+ if ( path == NULL || file == NULL )
+ return path;
+
+ len = strlen (file) + 1;
+ if ( dir )
+ len += strlen (dir);
+ if ( ext )
+ len += strlen (ext);
+ if ( len > size )
+ return path;
+
+ *path = '\0';
+ if ( dir && *dir )
+ {
+ len = sprintf (path, "%s", dir);
+ if ( path[len-1] != '/' )
+ {
+ path[len++] = '/';
+ path[len] = '\0';
+ }
+ }
+ strcat (path, file);
+ if ( ext )
+ strcat (path, ext);
+ return path;
+}
+
+/*****************************************************************
+** is_directory (name)
+** Check if the given pathname 'name' exists and is a directory.
+** returns 0 | 1
+*****************************************************************/
+int is_directory (const char *name)
+{
+ struct stat st;
+
+ if ( !name || !*name )
+ return 0;
+
+ return ( stat (name, &st) == 0 && S_ISDIR (st.st_mode) );
+}
+
+/*****************************************************************
+** fileexist (name)
+** Check if a file with the given pathname 'name' exists.
+** returns 0 | 1
+*****************************************************************/
+int fileexist (const char *name)
+{
+ struct stat st;
+ return ( stat (name, &st) == 0 && S_ISREG (st.st_mode) );
+}
+
+/*****************************************************************
+** filesize (name)
+** return the size of the file with the given pathname 'name'.
+** returns -1 if the file not exist
+*****************************************************************/
+size_t filesize (const char *name)
+{
+ struct stat st;
+ if ( stat (name, &st) == -1 )
+ return -1L;
+ return ( st.st_size );
+}
+
+/*****************************************************************
+** is_keyfilename (name)
+** Check if the given name looks like a dnssec (public)
+** keyfile name. Returns 0 | 1
+*****************************************************************/
+int is_keyfilename (const char *name)
+{
+ int len;
+
+ if ( name == NULL || *name != 'K' )
+ return 0;
+
+ len = strlen (name);
+ if ( len > 4 && strcmp (&name[len - 4], ".key") == 0 )
+ return 1;
+
+ return 0;
+}
+
+/*****************************************************************
+** is_dotfile (name)
+** Check if the given pathname 'name' looks like "." or "..".
+** Returns 0 | 1
+*****************************************************************/
+int is_dotfile (const char *name)
+{
+ if ( name && (
+ (name[0] == '.' && name[1] == '\0') ||
+ (name[0] == '.' && name[1] == '.' && name[2] == '\0')) )
+ return 1;
+
+ return 0;
+}
+
+/*****************************************************************
+** touch (name, sec)
+** Set the modification time of the given pathname 'fname' to
+** 'sec'. Returns 0 on success.
+*****************************************************************/
+int touch (const char *fname, time_t sec)
+{
+ struct utimbuf utb;
+
+ utb.actime = utb.modtime = sec;
+ return utime (fname, &utb);
+}
+
+/*****************************************************************
+** linkfile (fromfile, tofile)
+*****************************************************************/
+int linkfile (const char *fromfile, const char *tofile)
+{
+ int ret;
+
+ /* fprintf (stderr, "linkfile (%s, %s)\n", fromfile, tofile); */
+ if ( (ret = link (fromfile, tofile)) == -1 && errno == EEXIST )
+ if ( unlink (tofile) == 0 )
+ ret = link (fromfile, tofile);
+
+ return ret;
+}
+
+/*****************************************************************
+** copyfile (fromfile, tofile, dnskeyfile)
+*****************************************************************/
+int copyfile (const char *fromfile, const char *tofile, const char *dnskeyfile)
+{
+ FILE *infp;
+ FILE *outfp;
+ int c;
+
+ /* fprintf (stderr, "copyfile (%s, %s)\n", fromfile, tofile); */
+ if ( (infp = fopen (fromfile, "r")) == NULL )
+ return -1;
+ if ( (outfp = fopen (tofile, "w")) == NULL )
+ {
+ fclose (infp);
+ return -2;
+ }
+ while ( (c = getc (infp)) != EOF )
+ putc (c, outfp);
+
+ fclose (infp);
+ if ( dnskeyfile && *dnskeyfile && (infp = fopen (dnskeyfile, "r")) != NULL )
+ {
+ while ( (c = getc (infp)) != EOF )
+ putc (c, outfp);
+ fclose (infp);
+ }
+ fclose (outfp);
+
+ return 0;
+}
+
+/*****************************************************************
+** copyzonefile (fromfile, tofile, dnskeyfile)
+** copy a already signed zonefile and replace all zone DNSKEY
+** resource records by one "$INCLUDE dnskey.db" line
+*****************************************************************/
+int copyzonefile (const char *fromfile, const char *tofile, const char *dnskeyfile)
+{
+ FILE *infp;
+ FILE *outfp;
+ int len;
+ int dnskeys;
+ int multi_line_dnskey;
+ int bufoverflow;
+ char buf[1024];
+ char *p;
+
+ if ( fromfile == NULL )
+ infp = stdin;
+ else
+ if ( (infp = fopen (fromfile, "r")) == NULL )
+ return -1;
+ if ( tofile == NULL )
+ outfp = stdout;
+ else
+ if ( (outfp = fopen (tofile, "w")) == NULL )
+ {
+ if ( fromfile )
+ fclose (infp);
+ return -2;
+ }
+
+ multi_line_dnskey = 0;
+ dnskeys = 0;
+ bufoverflow = 0;
+ while ( fgets (buf, sizeof buf, infp) != NULL )
+ {
+ p = buf;
+ if ( !bufoverflow && !multi_line_dnskey && (*p == '@' || isspace (*p)) ) /* check if DNSKEY RR */
+ {
+ do
+ p++;
+ while ( isspace (*p) ) ;
+
+ /* skip TTL */
+ while ( isdigit (*p) )
+ p++;
+
+ while ( isspace (*p) )
+ p++;
+
+ /* skip Class */
+ if ( strncasecmp (p, "IN", 2) == 0 )
+ {
+ p += 2;
+ while ( isspace (*p) )
+ p++;
+ }
+
+ if ( strncasecmp (p, "DNSKEY", 6) == 0 ) /* bingo! */
+ {
+ dnskeys++;
+ p += 6;
+ while ( *p )
+ {
+ if ( *p == '(' )
+ multi_line_dnskey = 1;
+ if ( *p == ')' )
+ multi_line_dnskey = 0;
+ p++;
+ }
+ if ( dnskeys == 1 )
+ fprintf (outfp, "$INCLUDE %s\n", dnskeyfile);
+ }
+ else
+ fputs (buf, outfp);
+ }
+ else
+ {
+ if ( bufoverflow )
+ fprintf (stderr, "!! buffer overflow in copyzonefile() !!\n");
+ if ( !multi_line_dnskey )
+ fputs (buf, outfp);
+ else
+ {
+ while ( *p && *p != ')' )
+ p++;
+ if ( *p == ')' )
+ multi_line_dnskey = 0;
+ }
+ }
+
+ len = strlen (buf);
+ bufoverflow = buf[len-1] != '\n'; /* line too long ? */
+ }
+
+ if ( fromfile )
+ fclose (infp);
+ if ( tofile )
+ fclose (outfp);
+
+ return 0;
+}
+
+/*****************************************************************
+** cmpfile (file1, file2)
+** returns -1 on error, 1 if the files differ and 0 if they
+** are identical.
+*****************************************************************/
+int cmpfile (const char *file1, const char *file2)
+{
+ FILE *fp1;
+ FILE *fp2;
+ int c1;
+ int c2;
+
+ /* fprintf (stderr, "cmpfile (%s, %s)\n", file1, file2); */
+ if ( (fp1 = fopen (file1, "r")) == NULL )
+ return -1;
+ if ( (fp2 = fopen (file2, "r")) == NULL )
+ {
+ fclose (fp1);
+ return -1;
+ }
+
+ do {
+ c1 = getc (fp1);
+ c2 = getc (fp2);
+ } while ( c1 != EOF && c2 != EOF && c1 == c2 );
+
+ fclose (fp1);
+ fclose (fp2);
+
+ if ( c1 == c2 )
+ return 0;
+ return 1;
+}
+
+/*****************************************************************
+** file_age (fname)
+*****************************************************************/
+int file_age (const char *fname)
+{
+ time_t curr = time (NULL);
+ time_t mtime = file_mtime (fname);
+
+ return curr - mtime;
+}
+
+/*****************************************************************
+** file_mtime (fname)
+*****************************************************************/
+time_t file_mtime (const char *fname)
+{
+ struct stat st;
+
+ if ( stat (fname, &st) < 0 )
+ return 0;
+ return st.st_mtime;
+}
+
+/*****************************************************************
+** is_exec_ok (prog)
+** Check if we are running as root or if the file owner of
+** "prog" do not match the current user or the file permissions
+** allows file modification for others then the owner.
+** The same condition will be checked for the group ownership.
+** return 1 if the execution of the command "prog" will not
+** open a big security whole, 0 otherwise
+*****************************************************************/
+int is_exec_ok (const char *prog)
+{
+ uid_t curr_uid;
+ struct stat st;
+
+ if ( stat (prog, &st) < 0 )
+ return 0;
+
+ curr_uid = getuid ();
+ if ( curr_uid == 0 ) /* don't run the cmd if we are root */
+ return 0;
+
+ /* if the file owner and the current user matches and */
+ /* the file mode is not writable except for the owner, we are save */
+ if ( curr_uid == st.st_uid && (st.st_mode & (S_IWGRP | S_IWOTH)) == 0 )
+ return 1;
+
+ /* if the file group and the current group matches and */
+ /* the file mode is not writable except for the group, we are also save */
+ if ( getgid() != st.st_gid && (st.st_mode & (S_IWUSR | S_IWOTH)) == 0 )
+ return 1;
+
+ return 0;
+}
+
+/*****************************************************************
+** fatal (fmt, ...)
+*****************************************************************/
+void fatal (char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ if ( progname )
+ fprintf (stderr, "%s: ", progname);
+ vfprintf (stderr, fmt, ap);
+ va_end(ap);
+ exit (127);
+}
+
+/*****************************************************************
+** error (fmt, ...)
+*****************************************************************/
+void error (char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vfprintf (stderr, fmt, ap);
+ va_end(ap);
+}
+
+/*****************************************************************
+** logmesg (fmt, ...)
+*****************************************************************/
+void logmesg (char *fmt, ...)
+{
+ va_list ap;
+
+#if defined (LOG_WITH_PROGNAME) && LOG_WITH_PROGNAME
+ fprintf (stdout, "%s: ", progname);
+#endif
+ va_start(ap, fmt);
+ vfprintf (stdout, fmt, ap);
+ va_end(ap);
+}
+
+/*****************************************************************
+** verbmesg (verblvl, conf, fmt, ...)
+*****************************************************************/
+void verbmesg (int verblvl, const zconf_t *conf, char *fmt, ...)
+{
+ char str[511+1];
+ va_list ap;
+
+ str[0] = '\0';
+ va_start(ap, fmt);
+ vsnprintf (str, sizeof (str), fmt, ap);
+ va_end(ap);
+
+ //fprintf (stderr, "verbmesg (%d stdout=%d filelog=%d str = :%s:\n", verblvl, conf->verbosity, conf->verboselog, str);
+ if ( verblvl <= conf->verbosity ) /* check if we have to print this to stdout */
+ logmesg (str);
+
+ str_chop (str, '\n');
+ if ( verblvl <= conf->verboselog ) /* check logging to syslog and/or file */
+ lg_mesg (LG_DEBUG, str);
+}
+
+
+/*****************************************************************
+** logflush ()
+*****************************************************************/
+void logflush ()
+{
+ fflush (stdout);
+}
+
+/*****************************************************************
+** timestr2time (timestr)
+** timestr should look like "20071211223901" for 12 dec 2007 22:39:01
+*****************************************************************/
+time_t timestr2time (const char *timestr)
+{
+ struct tm t;
+ time_t sec;
+
+ // fprintf (stderr, "timestr = \"%s\"\n", timestr);
+ if ( sscanf (timestr, "%4d%2d%2d%2d%2d%2d",
+ &t.tm_year, &t.tm_mon, &t.tm_mday,
+ &t.tm_hour, &t.tm_min, &t.tm_sec) != 6 )
+ return 0L;
+ t.tm_year -= 1900;
+ t.tm_mon -= 1;
+ t.tm_isdst = 0;
+
+#if defined(HAS_TIMEGM) && HAS_TIMEGM
+ sec = timegm (&t);
+#else
+ {
+ time_t ret;
+ char *tz;
+
+ tz = getenv("TZ");
+ // setenv("TZ", "", 1);
+ setenv("TZ", "UTC", 1);
+ tzset();
+ sec = mktime(&t);
+ if (tz)
+ setenv("TZ", tz, 1);
+ else
+ unsetenv("TZ");
+ tzset();
+ }
+#endif
+
+ return sec < 0L ? 0L : sec;
+}
+
+/*****************************************************************
+** time2str (sec, precison)
+** sec is seconds since 1.1.1970
+** precison is currently either 's' (for seconds) or 'm' (minutes)
+*****************************************************************/
+char *time2str (time_t sec, int precision)
+{
+ struct tm *t;
+ static char timestr[31+1]; /* 27+1 should be enough */
+#if defined(HAVE_STRFTIME) && HAVE_STRFTIME
+ char tformat[127+1];
+
+ timestr[0] = '\0';
+ if ( sec <= 0L )
+ return timestr;
+ t = localtime (&sec);
+ if ( precision == 's' )
+ strcpy (tformat, "%b %d %Y %T");
+ else
+ strcpy (tformat, "%b %d %Y %R");
+# if PRINT_TIMEZONE
+ strcat (tformat, " %z");
+# endif
+ strftime (timestr, sizeof (timestr), tformat, t);
+
+#else /* no strftime available */
+ static char *mstr[] = {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+ };
+
+ timestr[0] = '\0';
+ if ( sec <= 0L )
+ return timestr;
+ t = localtime (&sec);
+# if PRINT_TIMEZONE
+ {
+ int h, s;
+
+ s = abs (t->tm_gmtoff);
+ h = t->tm_gmtoff / 3600;
+ s = t->tm_gmtoff % 3600;
+ if ( precision == 's' )
+ snprintf (timestr, sizeof (timestr), "%s %2d %4d %02d:%02d:%02d %c%02d%02d",
+ mstr[t->tm_mon], t->tm_mday, t->tm_year + 1900,
+ t->tm_hour, t->tm_min, t->tm_sec,
+ t->tm_gmtoff < 0 ? '-': '+',
+ h, s);
+ else
+ snprintf (timestr, sizeof (timestr), "%s %2d %4d %02d:%02d %c%02d%02d",
+ mstr[t->tm_mon], t->tm_mday, t->tm_year + 1900,
+ t->tm_hour, t->tm_min,
+ t->tm_gmtoff < 0 ? '-': '+',
+ h, s);
+ }
+# else
+ if ( precision == 's' )
+ snprintf (timestr, sizeof (timestr), "%s %2d %4d %02d:%02d:%02d",
+ mstr[t->tm_mon], t->tm_mday, t->tm_year + 1900,
+ t->tm_hour, t->tm_min, t->tm_sec);
+ else
+ snprintf (timestr, sizeof (timestr), "%s %2d %4d %02d:%02d",
+ mstr[t->tm_mon], t->tm_mday, t->tm_year + 1900,
+ t->tm_hour, t->tm_min);
+# endif
+#endif
+
+ return timestr;
+}
+
+/*****************************************************************
+** time2isostr (sec, precison)
+** sec is seconds since 1.1.1970
+** precison is currently either 's' (for seconds) or 'm' (minutes)
+*****************************************************************/
+char *time2isostr (time_t sec, int precision)
+{
+ struct tm *t;
+ static char timestr[31+1]; /* 27+1 should be enough */
+
+ timestr[0] = '\0';
+ if ( sec <= 0L )
+ return timestr;
+
+ t = gmtime (&sec);
+ if ( precision == 's' )
+ snprintf (timestr, sizeof (timestr), "%4d%02d%02d%02d%02d%02d",
+ t->tm_year + 1900, t->tm_mon+1, t->tm_mday,
+ t->tm_hour, t->tm_min, t->tm_sec);
+ else
+ snprintf (timestr, sizeof (timestr), "%4d%02d%02d%02d%02d",
+ t->tm_year + 1900, t->tm_mon+1, t->tm_mday,
+ t->tm_hour, t->tm_min);
+
+ return timestr;
+}
+
+/*****************************************************************
+** age2str (sec)
+** !!Attention: This function is not reentrant
+*****************************************************************/
+char *age2str (time_t sec)
+{
+ static char str[20+1]; /* "2y51w6d23h50m55s" == 16+1 chars */
+ int len;
+ int strsize = sizeof (str);
+
+ len = 0;
+# if PRINT_AGE_WITH_YEAR
+ if ( sec / (YEARSEC) > 0 )
+ {
+ len += snprintf (str+len, strsize - len, "%1luy", sec / YEARSEC );
+ sec %= (YEARSEC);
+ }
+ else
+ len += snprintf (str+len, strsize - len, " ");
+# endif
+ if ( sec / WEEKSEC > 0 )
+ {
+ len += snprintf (str+len, strsize - len, "%2luw", (ulong) sec / WEEKSEC );
+ sec %= WEEKSEC;
+ }
+ else
+ len += snprintf (str+len, strsize - len, " ");
+ if ( sec / DAYSEC > 0 )
+ {
+ len += snprintf (str+len, strsize - len, "%2lud", sec / (ulong)DAYSEC);
+ sec %= DAYSEC;
+ }
+ else
+ len += snprintf (str+len, strsize - len, " ");
+ if ( sec / HOURSEC > 0 )
+ {
+ len += snprintf (str+len, strsize - len, "%2luh", sec / (ulong)HOURSEC);
+ sec %= HOURSEC;
+ }
+ else
+ len += snprintf (str+len, strsize - len, " ");
+ if ( sec / MINSEC > 0 )
+ {
+ len += snprintf (str+len, strsize - len, "%2lum", sec / (ulong)MINSEC);
+ sec %= MINSEC;
+ }
+ else
+ len += snprintf (str+len, strsize - len, " ");
+ if ( sec > 0 )
+ snprintf (str+len, strsize - len, "%2lus", (ulong) sec);
+ else
+ len += snprintf (str+len, strsize - len, " ");
+
+ return str;
+}
+
+/*****************************************************************
+** start_timer ()
+*****************************************************************/
+time_t start_timer ()
+{
+ return (time(NULL));
+}
+
+/*****************************************************************
+** stop_timer ()
+*****************************************************************/
+time_t stop_timer (time_t start)
+{
+ time_t stop = time (NULL);
+
+ return stop - start;
+}
+
+/****************************************************************
+**
+** int inc_serial (filename, use_unixtime)
+**
+** This function depends on a special syntax formating the
+** SOA record in the zone file!!
+**
+** To match the SOA record, the SOA RR must be formatted
+** like this:
+** @ IN SOA <master.fq.dn.> <hostmaster.fq.dn.> (
+** <SPACEes or TABs> 1234567890; serial number
+** <SPACEes or TABs> 86400 ; other values
+** ...
+** The space from the first digit of the serial number to
+** the first none white space char or to the end of the line
+** must be at least 10 characters!
+** So you have to left justify the serial number in a field
+** of at least 10 characters like this:
+** <SPACEes or TABs> 1 ; Serial
+**
+****************************************************************/
+int inc_serial (const char *fname, int use_unixtime)
+{
+ FILE *fp;
+ char buf[4095+1];
+ char master[254+1];
+ int error;
+
+ /**
+ since BIND 9.4, there is a dnssec-signzone option available for
+ serial number increment.
+ If the user request "unixtime" than use this mechanism
+ **/
+#if defined(BIND_VERSION) && BIND_VERSION >= 940
+ if ( use_unixtime )
+ return 0;
+#endif
+ if ( (fp = fopen (fname, "r+")) == NULL )
+ return -1;
+
+ /* read until the line matches the beginning of a soa record ... */
+ while ( fgets (buf, sizeof buf, fp) &&
+ sscanf (buf, "@ IN SOA %255s %*s (\n", master) != 1 )
+ ;
+
+ if ( feof (fp) )
+ {
+ fclose (fp);
+ return -2;
+ }
+
+ error = inc_soa_serial (fp, use_unixtime); /* .. inc soa serial no ... */
+
+ if ( fclose (fp) != 0 )
+ return -5;
+ return error;
+}
+
+/*****************************************************************
+** return the serial number of the current day in the form
+** of YYYYmmdd00
+*****************************************************************/
+static ulong today_serialtime ()
+{
+ struct tm *t;
+ ulong serialtime;
+ time_t now;
+
+ now = time (NULL);
+ t = gmtime (&now);
+ serialtime = (t->tm_year + 1900) * 10000;
+ serialtime += (t->tm_mon+1) * 100;
+ serialtime += t->tm_mday;
+ serialtime *= 100;
+
+ return serialtime;
+}
+
+/*****************************************************************
+** inc_soa_serial (fp, use_unixtime)
+** increment the soa serial number of the file 'fp'
+** 'fp' must be opened "r+"
+*****************************************************************/
+static int inc_soa_serial (FILE *fp, int use_unixtime)
+{
+ int c;
+ long pos, eos;
+ ulong serial;
+ int digits;
+ ulong today;
+
+ /* move forward until any non ws reached */
+ while ( (c = getc (fp)) != EOF && isspace (c) )
+ ;
+ ungetc (c, fp); /* push back the last char */
+
+ pos = ftell (fp); /* mark position */
+
+ serial = 0L; /* read in the current serial number */
+ /* be aware of the trailing space in the format string !! */
+ if ( fscanf (fp, "%lu ", &serial) != 1 ) /* try to get serial no */
+ return -3;
+ eos = ftell (fp); /* mark first non digit/ws character pos */
+
+ digits = eos - pos;
+ if ( digits < 10 ) /* not enough space for serial no ? */
+ return -4;
+
+ if ( use_unixtime )
+ today = time (NULL);
+ else
+ {
+ today = today_serialtime (); /* YYYYmmdd00 */
+ if ( serial > 1970010100L && serial < today )
+ serial = today; /* set to current time */
+ serial++; /* increment anyway */
+ }
+
+ fseek (fp, pos, SEEK_SET); /* go back to the beginning */
+ fprintf (fp, "%-*lu", digits, serial); /* write as many chars as before */
+
+ return 1; /* yep! */
+}
+
+/*****************************************************************
+** return the error text of the inc_serial return coode
+*****************************************************************/
+const char *inc_errstr (int err)
+{
+ switch ( err )
+ {
+ case -1: return "couldn't open zone file for modifying";
+ case -2: return "unexpected end of file";
+ case -3: return "no serial number found in zone file";
+ case -4: return "not enough space left for serialno";
+ case -5: return "error on closing zone file";
+ }
+ return "";
+}
+
+#ifdef SOA_TEST
+const char *progname;
+main (int argc, char *argv[])
+{
+ ulong now;
+ int err;
+ char cmd[255];
+
+ progname = *argv;
+
+ now = today_serialtime ();
+ printf ("now = %lu\n", now);
+
+ if ( (err = inc_serial (argv[1]), 0) < 0 )
+ error ("can't change serial errno=%d\n", err);
+
+ snprintf (cmd, sizeof(cmd), "head -15 %s", argv[1]);
+ system (cmd);
+}
+#endif
+
+#ifdef COPYZONE_TEST
+const char *progname;
+main (int argc, char *argv[])
+{
+ progname = *argv;
+
+ if ( copyzonefile (argv[1], NULL) < 0 )
+ error ("can't copy zone file %s\n", argv[1]);
+}
+#endif
+
+#ifdef URL_TEST
+const char *progname;
+main (int argc, char *argv[])
+{
+ char *proto;
+ char *host;
+ char *port;
+ char *para;
+ char url[1024];
+
+ progname = *argv;
+
+ proto = host = port = para = NULL;
+
+ if ( --argc <= 0 )
+ {
+ fprintf (stderr, "usage: url_test <url>\n");
+ fprintf (stderr, "e.g.: url_test http://www.hznet.de:80/zkt\n");
+ exit (1);
+ }
+
+ strcpy (url, argv[1]);
+ parseurl (url, &proto, &host, &port, &para);
+
+ if ( proto )
+ printf ("proto: \"%s\"\n", proto);
+ if ( host )
+ printf ("host: \"%s\"\n", host);
+ if ( port )
+ printf ("port: \"%s\"\n", port);
+ if ( para )
+ printf ("para: \"%s\"\n", para);
+
+}
+#endif
+
diff --git a/contrib/zkt/misc.h b/contrib/zkt/misc.h
new file mode 100644
index 0000000..842a80d
--- /dev/null
+++ b/contrib/zkt/misc.h
@@ -0,0 +1,84 @@
+/*****************************************************************
+**
+** @(#) misc.h (c) 2005 - 2007 Holger Zuleger hznet.de
+**
+** Copyright (c) 2005 - 2007, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+#ifndef MISC_H
+# define MISC_H
+# include <sys/types.h>
+# include <stdarg.h>
+# include <stdio.h>
+# include "zconf.h"
+
+# define min(a, b) ((a) < (b) ? (a) : (b))
+# define max(a, b) ((a) > (b) ? (a) : (b))
+
+extern const char *getnameappendix (const char *progname, const char *basename);
+extern const char *getdefconfname (const char *view);
+extern int fileexist (const char *name);
+extern size_t filesize (const char *name);
+extern int file_age (const char *fname);
+extern int touch (const char *fname, time_t sec);
+extern int linkfile (const char *fromfile, const char *tofile);
+//extern int copyfile (const char *fromfile, const char *tofile);
+extern int copyfile (const char *fromfile, const char *tofile, const char *dnskeyfile);
+extern int copyzonefile (const char *fromfile, const char *tofile, const char *dnskeyfile);
+extern int cmpfile (const char *file1, const char *file2);
+extern char *str_delspace (char *s);
+extern char *str_tolowerdup (const char *s);
+extern int in_strarr (const char *str, char *const arr[], int cnt);
+extern const char *splitpath (char *path, size_t size, const char *filename);
+extern char *pathname (char *name, size_t size, const char *path, const char *file, const char *ext);
+extern char *time2str (time_t sec, int precision);
+extern char *time2isostr (time_t sec, int precision);
+extern time_t timestr2time (const char *timestr);
+extern int is_keyfilename (const char *name);
+extern int is_directory (const char *name);
+extern time_t file_mtime (const char *fname);
+extern int is_exec_ok (const char *prog);
+extern char *age2str (time_t sec);
+extern time_t stop_timer (time_t start);
+extern time_t start_timer (void);
+extern void error (char *fmt, ...);
+extern void fatal (char *fmt, ...);
+extern void logmesg (char *fmt, ...);
+extern void verbmesg (int verblvl, const zconf_t *conf, char *fmt, ...);
+extern void logflush (void);
+extern int inc_serial (const char *fname, int use_unixtime);
+extern const char *inc_errstr (int err);
+extern char *str_untaint (char *str);
+extern char *str_chop (char *str, char c);
+extern int is_dotfile (const char *name);
+extern void parseurl (char *url, char **proto, char **host, char **port, char **para);
+#endif
diff --git a/contrib/zkt/ncparse.c b/contrib/zkt/ncparse.c
new file mode 100644
index 0000000..e67f4b0
--- /dev/null
+++ b/contrib/zkt/ncparse.c
@@ -0,0 +1,317 @@
+/*****************************************************************
+**
+** @(#) ncparse.c -- A very simple named.conf parser
+**
+** Copyright (c) Apr 2005 - Nov 2007, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+# include <stdio.h>
+# include <string.h>
+# include <ctype.h>
+# include <assert.h>
+# include "debug.h"
+# include "misc.h"
+# include "log.h"
+#define extern
+# include "ncparse.h"
+#undef extern
+
+# define TOK_STRING 257
+# define TOK_DIR 258
+# define TOK_INCLUDE 259
+
+# define TOK_ZONE 260
+# define TOK_TYPE 261
+# define TOK_MASTER 262
+# define TOK_SLAVE 263
+# define TOK_STUB 264
+# define TOK_HINT 265
+# define TOK_FORWARD 266
+# define TOK_DELEGATION 267
+# define TOK_VIEW 268
+
+# define TOK_FILE 270
+
+# define TOK_UNKNOWN 511
+
+/* list of "named.conf" keywords we are interested in */
+static struct KeyWords {
+ char *name;
+ int tok;
+} kw[] = {
+ { "STRING", TOK_STRING },
+ { "include", TOK_INCLUDE },
+ { "directory", TOK_DIR },
+ { "file", TOK_FILE },
+ { "zone", TOK_ZONE },
+#if 0 /* we don't need the type keyword; master, slave etc. is sufficient */
+ { "type", TOK_TYPE },
+#endif
+ { "master", TOK_MASTER },
+ { "slave", TOK_SLAVE },
+ { "stub", TOK_STUB },
+ { "hint", TOK_HINT },
+ { "forward", TOK_FORWARD },
+ { "delegation-only", TOK_DELEGATION },
+ { "view", TOK_VIEW },
+ { NULL, TOK_UNKNOWN },
+};
+
+#ifdef DBG
+static const char *tok2str (int tok)
+{
+ int i;
+
+ i = 0;
+ while ( kw[i].name && kw[i].tok != tok )
+ i++;
+
+ return kw[i].name;
+}
+#endif
+
+static int searchkw (const char *keyword)
+{
+ int i;
+
+ dbg_val ("ncparse: searchkw (%s)\n", keyword);
+ i = 0;
+ while ( kw[i].name && strcmp (kw[i].name, keyword) != 0 )
+ i++;
+
+ return kw[i].tok;
+}
+
+static int gettok (FILE *fp, char *val, size_t valsize)
+{
+ int lastc;
+ int c;
+ char buf[255+1];
+ char *p;
+ char *bufend;
+
+ *val = '\0';
+ do {
+ while ( (c = getc (fp)) != EOF && isspace (c) )
+ ;
+
+ if ( c == '#' ) /* single line comment ? */
+ {
+ while ( (c = getc (fp)) != EOF && c != '\n' )
+ ;
+ continue;
+ }
+
+ if ( c == EOF )
+ return EOF;
+
+ if ( c == '{' || c == '}' || c == ';' )
+ continue;
+
+ if ( c == '/' ) /* begin of C comment ? */
+ {
+ if ( (c = getc (fp)) == '*' ) /* yes! */
+ {
+ lastc = EOF; /* read until end of c comment */
+ while ( (c = getc (fp)) != EOF && !(lastc == '*' && c == '/') )
+ lastc = c;
+ }
+ else if ( c == '/' ) /* is it a C single line comment ? */
+ {
+ while ( (c = getc (fp)) != EOF && c != '\n' )
+ ;
+ }
+ else /* no ! */
+ ungetc (c, fp);
+ continue;
+ }
+
+ if ( c == '\"' )
+ {
+ p = val;
+ bufend = val + valsize - 1;
+ while ( (c = getc (fp)) != EOF && p < bufend && c != '\"' )
+ *p++ = c;
+ *p = '\0';
+ /* if string buffer is too small, eat up rest of string */
+ while ( c != EOF && c != '\"' )
+ c = getc (fp);
+
+ return TOK_STRING;
+ }
+
+ p = buf;
+ bufend = buf + sizeof (buf) - 1;
+ do
+ *p++ = tolower (c);
+ while ( (c = getc (fp)) != EOF && p < bufend && isalpha (c) );
+ *p = '\0';
+ ungetc (c, fp);
+
+ if ( (c = searchkw (buf)) != TOK_UNKNOWN )
+ return c;
+ } while ( c != EOF );
+
+ return EOF;
+}
+
+/*****************************************************************
+**
+** parse_namedconf (const char *filename, int (*func) ())
+**
+** Very dumb named.conf parser.
+** - In a zone declaration the _first_ keyword MUST be "type"
+** - For every master zone "func (directory, zone, filename)" will be called
+**
+*****************************************************************/
+int parse_namedconf (const char *filename, char *dir, size_t dirsize, int (*func) ())
+{
+ FILE *fp;
+ int tok;
+ char path[511+1];
+#if 1 /* this is potentialy too small for key data, but we don't need the keys... */
+ char strval[255+1];
+#else
+ char strval[4095+1];
+#endif
+ char view[255+1];
+ char zone[255+1];
+ char zonefile[255+1];
+
+ dbg_val ("parse_namedconf: parsing file \"%s\" \n", filename);
+
+ assert (filename != NULL);
+ assert (dir != NULL && dirsize != 0);
+ assert (func != NULL);
+
+ view[0] = '\0';
+ if ( (fp = fopen (filename, "r")) == NULL )
+ return 0;
+
+ while ( (tok = gettok (fp, strval, sizeof strval)) != EOF )
+ {
+ if ( tok > 0 && tok < 256 )
+ {
+ error ("parse_namedconf: token found with value %-10d: %c\n", tok, tok);
+ lg_mesg (LG_ERROR, "parse_namedconf: token found with value %-10d: %c", tok, tok);
+ }
+ else if ( tok == TOK_DIR )
+ {
+ if ( gettok (fp, strval, sizeof (strval)) == TOK_STRING )
+ {
+ dbg_val2 ("parse_namedconf: directory found \"%s\" (dir is %s)\n",
+ strval, dir);
+ if ( *strval != '/' && *dir )
+ snprintf (path, sizeof (path), "%s/%s", dir, strval);
+ else
+ snprintf (path, sizeof (path), "%s", strval);
+ snprintf (dir, dirsize, "%s", path);
+ dbg_val ("parse_namedconf: new dir \"%s\" \n", dir);
+ }
+ }
+ else if ( tok == TOK_INCLUDE )
+ {
+ if ( gettok (fp, strval, sizeof (strval)) == TOK_STRING )
+ {
+ if ( *strval != '/' && *dir )
+ snprintf (path, sizeof (path), "%s/%s", dir, strval);
+ else
+ snprintf (path, sizeof (path), "%s", strval);
+ if ( !parse_namedconf (path, dir, dirsize, func) )
+ return 0;
+ }
+ else
+ {
+ error ("parse_namedconf: need a filename after \"include\"!\n");
+ lg_mesg (LG_ERROR, "parse_namedconf: need a filename after \"include\"!");
+ }
+ }
+ else if ( tok == TOK_VIEW )
+ {
+ if ( gettok (fp, strval, sizeof (strval)) != TOK_STRING )
+ continue;
+ snprintf (view, sizeof view, "%s", strval); /* store the name of the view */
+ }
+ else if ( tok == TOK_ZONE )
+ {
+ if ( gettok (fp, strval, sizeof (strval)) != TOK_STRING )
+ continue;
+ snprintf (zone, sizeof zone, "%s", strval); /* store the name of the zone */
+
+ if ( gettok (fp, strval, sizeof (strval)) != TOK_MASTER )
+ continue;
+ if ( gettok (fp, strval, sizeof (strval)) != TOK_FILE )
+ continue;
+ if ( gettok (fp, strval, sizeof (strval)) != TOK_STRING )
+ continue;
+ snprintf (zonefile, sizeof zonefile, "%s", strval); /* this is the filename */
+
+ dbg_val4 ("dir %s view %s zone %s file %s\n", dir, view, zone, zonefile);
+ (*func) (dir, view, zone, zonefile);
+ }
+ else
+ dbg_val3 ("%-10s(%d): %s\n", tok2str(tok), tok, strval);
+ }
+ fclose (fp);
+
+ return 1;
+}
+
+#ifdef TEST_NCPARSE
+int printzone (const char *dir, const char *view, const char *zone, const char *file)
+{
+ printf ("printzone ");
+ printf ("view \"%s\" " , view);
+ printf ("zone \"%s\" " , zone);
+ printf ("file ");
+ if ( dir && *dir )
+ printf ("%s/", dir, file);
+ printf ("%s", file);
+ putchar ('\n');
+ return 1;
+}
+
+char *progname;
+
+main (int argc, char *argv[])
+{
+ char directory[255+1];
+
+ progname = argv[0];
+
+ directory[0] = '\0';
+ if ( --argc == 0 )
+ parse_namedconf ("/var/named/named.conf", directory, sizeof (directory), printzone);
+ else
+ parse_namedconf (argv[1], directory, sizeof (directory), printzone);
+}
+#endif
diff --git a/contrib/zkt/ncparse.h b/contrib/zkt/ncparse.h
new file mode 100644
index 0000000..4383c63
--- /dev/null
+++ b/contrib/zkt/ncparse.h
@@ -0,0 +1,41 @@
+/*****************************************************************
+**
+** @(#) ncparse.h -- headerfile for a simple named.conf parser
+**
+** Copyright (c) Apr 2005 - Nov 2007, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+
+#ifndef NCPARSE_H
+# define NCPARSE_H
+extern int parse_namedconf (const char *filename, char *dir, size_t dirsize, int (*func) ());
+#endif
diff --git a/contrib/zkt/rollover.c b/contrib/zkt/rollover.c
new file mode 100644
index 0000000..0c9fee0
--- /dev/null
+++ b/contrib/zkt/rollover.c
@@ -0,0 +1,615 @@
+/*****************************************************************
+**
+** @(#) rollover.c -- The key rollover functions
+**
+** Copyright (c) Jan 2005 - May 2008, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+# include <stdio.h>
+# include <string.h>
+# include <stdlib.h>
+# include <ctype.h>
+# include <time.h>
+# include <assert.h>
+# include <dirent.h>
+# include <errno.h>
+# include <unistd.h>
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+# include "config_zkt.h"
+# include "zconf.h"
+# include "debug.h"
+
+# include "misc.h"
+# include "zone.h"
+# include "dki.h"
+# include "log.h"
+#define extern
+# include "rollover.h"
+#undef extern
+
+/*****************************************************************
+** local function definition
+*****************************************************************/
+
+static dki_t *genkey (dki_t **listp, const char *dir, const char *domain, int ksk, const zconf_t *conf, int status)
+{
+ dki_t *dkp;
+
+ if ( listp == NULL || domain == NULL )
+ return NULL;
+
+ if ( ksk )
+ dkp = dki_new (dir, domain, DKI_KSK, conf->k_algo, conf->k_bits, conf->k_random, conf->k_life / DAYSEC);
+ else
+ dkp = dki_new (dir, domain, DKI_ZSK, conf->z_algo, conf->z_bits, conf->z_random, conf->z_life / DAYSEC);
+ dki_add (listp, dkp);
+ dki_setstatus (dkp, status);
+
+ return dkp;
+}
+
+static time_t get_exptime (dki_t *key, const zconf_t *z)
+{
+ time_t exptime;
+
+ exptime = dki_exptime (key);
+ if ( exptime == 0L )
+ {
+ if ( dki_lifetime (key) )
+ exptime = dki_time (key) + dki_lifetime (key);
+ else
+ exptime = dki_time (key) + z->k_life;
+ }
+
+ return exptime;
+}
+
+/*****************************************************************
+** is_parentdirsigned (name)
+** Check if the parent directory of the zone specified by zp
+** is a directory with a signed zone
+** Returns 0 | 1
+*****************************************************************/
+static int is_parentdirsigned (const zone_t *zonelist, const zone_t *zp)
+{
+ char path[MAX_PATHSIZE+1];
+ const char *ext;
+#if 0
+ const zconf_t *conf;
+
+ /* check if there is a local config file to get the name of the zone file */
+ snprintf (path, sizeof (path), "%s/../%s", zp->dir, LOCALCONF_FILE);
+ if ( fileexist (path) ) /* parent dir has local config file ? */
+ conf = loadconfig (path, NULL);
+ else
+ conf = zp->conf;
+
+ /* build the path of the .signed zone file */
+ snprintf (path, sizeof (path), "%s/../%s.signed", conf->dir, conf->zonefile);
+ if ( conf != zp->conf ) /* if we read in a local config file.. */
+ free (conf); /* ..free the memory used */
+
+#else
+ /* currently we use the signed zone file name of the
+ * current directory for checking if the file exist.
+ * TODO: Instead we have to use the name of the zone file
+ * used in the parent dir (see above)
+ */
+
+ ext = strrchr (zp->sfile, '.');
+ if ( ext && strcmp (zp->sfile, ".dsigned") == 0 ) /* is the current zone a dynamic one ? */
+ /* hack: we are using the standard zone file name for a static zone here */
+ snprintf (path, sizeof (path), "%s/../%s", zp->dir, "zone.db.signed");
+ else
+ {
+# if 1
+ const zone_t *parent;
+ const char *parentname;
+
+ /* find out name of parent */
+ parentname = strchr (zp->zone, '.'); /* find first dot in zone name */
+ if ( parentname == NULL ) /* no parent found! */
+ return 0;
+ parentname += 1; /* skip '.' */
+
+ /* try to find parent zone in zonelist */
+ if ( (parent = zone_search (zonelist, parentname)) == NULL )
+ return 0;
+ snprintf (path, sizeof (path), "%s/%s", parent->dir, parent->sfile);
+# else
+ snprintf (path, sizeof (path), "%s/../%s", zp->dir, zp->sfile);
+# endif
+ }
+#endif
+lg_mesg (LG_DEBUG, "%s: is_parentdirsigned = %d fileexist (%s)\n", zp->zone, fileexist (path), path);
+ return fileexist (path); /* parent dir has zone.db.signed file ? */
+}
+
+/*****************************************************************
+** create_parent_file ()
+*****************************************************************/
+static int create_parent_file (const char *fname, int phase, int ttl, const dki_t *dkp)
+{
+ FILE *fp;
+
+ assert ( fname != NULL );
+
+ if ( dkp == NULL || (phase != 1 && phase != 2) )
+ return 0;
+
+ if ( (fp = fopen (fname, "w")) == NULL )
+ fatal ("can\'t create new parentfile \"%s\"\n", fname);
+
+ if ( phase == 1 )
+ fprintf (fp, "; KSK rollover phase1 (new key generated but this is alread the old one)\n");
+ else
+ fprintf (fp, "; KSK rollover phase2 (this is the new key)\n");
+
+ dki_prt_dnskeyttl (dkp, fp, ttl);
+ fclose (fp);
+
+ return phase;
+}
+
+/*****************************************************************
+** get_parent_phase ()
+*****************************************************************/
+static int get_parent_phase (const char *file)
+{
+ FILE *fp;
+ int phase;
+
+ if ( (fp = fopen (file, "r")) == NULL )
+ return -1;
+
+ phase = 0;
+ if ( fscanf (fp, "; KSK rollover phase%d", &phase) != 1 )
+ phase = 0;
+
+ fclose (fp);
+ return phase;
+}
+
+/*****************************************************************
+** kskrollover ()
+*****************************************************************/
+static int kskrollover (dki_t *ksk, zone_t *zonelist, zone_t *zp)
+{
+ char path[MAX_PATHSIZE+1];
+ const zconf_t *z;
+ time_t lifetime;
+ time_t currtime;
+ time_t age;
+ int currphase;
+ int parfile_age;
+ int parent_propagation;
+ int parent_resign;
+ int parent_keyttl;
+
+
+ assert ( ksk != NULL );
+ assert ( zp != NULL );
+
+ z = zp->conf;
+ /* check ksk lifetime */
+ if ( (lifetime = dki_lifetime (ksk)) == 0 ) /* if lifetime of key is not set.. */
+ lifetime = z->k_life; /* ..use global configured lifetime */
+
+ currtime = time (NULL);
+ age = dki_age (ksk, currtime);
+
+ /* build path of parent-file */
+ pathname (path, sizeof (path), zp->dir, "parent-", zp->zone);
+
+ /* check if we have to change the ksk ? */
+ if ( lifetime > 0 && age > lifetime && !fileexist (path) ) /* lifetime is over and no kskrollover in progress */
+ {
+ /* we are using hierachical mode and the parent directory contains a signed zone ? */
+ if ( z->keysetdir && strcmp (z->keysetdir, "..") == 0 && is_parentdirsigned (zonelist, zp) )
+ {
+ verbmesg (2, z, "\t\tkskrollover: create new key signing key\n");
+ /* create a new key: this is phase one of a double signing key rollover */
+ ksk = genkey (&zp->keys, zp->dir, zp->zone, DKI_KSK, z, DKI_ACTIVE);
+ if ( ksk == NULL )
+ {
+ lg_mesg (LG_ERROR, "\"%s\": unable to generate new ksk for double signing rollover", zp->zone);
+ return 0;
+ }
+ lg_mesg (LG_INFO, "\"%s\": kskrollover phase1: New key %d generated", zp->zone, ksk->tag);
+
+ /* find the oldest active ksk to create the parent file */
+ if ( (ksk = (dki_t *)dki_find (zp->keys, 1, 'a', 1)) == NULL )
+ lg_mesg (LG_ERROR, "kskrollover phase1: Couldn't find the old active key\n");
+ if ( !create_parent_file (path, 1, z->key_ttl, ksk) )
+ lg_mesg (LG_ERROR, "Couldn't create parentfile %s\n", path);
+
+ }
+ else /* print out a warning only */
+ {
+ logmesg ("\t\tWarning: Lifetime of Key Signing Key %d exceeded: %s\n",
+ ksk->tag, str_delspace (age2str (age)));
+ lg_mesg (LG_WARNING, "\"%s\": lifetime of key signing key %d exceeded since %s",
+ zp->zone, ksk->tag, str_delspace (age2str (age - lifetime)));
+ }
+ return 1;
+ }
+
+ /* now check if there is an ongoing key rollover */
+
+ /* check if parent-file already exist */
+ if ( !fileexist (path) ) /* no parent-<zone> file found ? */
+ return 0; /* ok, that's it */
+
+ /* check the ksk rollover phase we are in */
+ currphase = get_parent_phase (path); /* this is the actual state we are in */
+ parfile_age = file_age (path);
+
+ /* TODO: Set these values to the one found in the parent dnssec.conf file */
+ parent_propagation = 5 * MINSEC;
+ parent_resign = z->resign;
+ parent_keyttl = z->key_ttl;
+
+ switch ( currphase )
+ {
+ case 1: /* we are currently in state one (new ksk already generated) */
+ if ( parfile_age > z->proptime + z->key_ttl ) /* can we go to phase 2 ? */
+ {
+ verbmesg (2, z, "\t\tkskrollover: save new ksk in parent file\n");
+ ksk = ksk->next; /* set ksk to new ksk */
+ if ( !create_parent_file (path, currphase+1, z->key_ttl, ksk) )
+ lg_mesg (LG_ERROR, "Couldn't create parentfile %s\n", path);
+ lg_mesg (LG_INFO, "\"%s\": kskrollover phase2: send new key %d to the parent zone", zp->zone, ksk->tag);
+ return 1;
+ }
+ else
+ verbmesg (2, z, "\t\tkskrollover: we are in state 1 and waiting for propagation of the new key (parentfile %d < prop %d + keyttl %d\n", parfile_age, z->proptime, z->key_ttl);
+ break;
+ case 2: /* we are currently in state two (propagation of new key to the parent) */
+#if 0
+ if ( parfile_age >= parent_propagation + parent_resign + parent_keyttl ) /* can we go to phase 3 ? */
+#else
+ if ( parfile_age >= parent_propagation + parent_keyttl ) /* can we go to phase 3 ? */
+#endif
+ {
+ /* remove the parentfile */
+ unlink (path);
+
+ /* remove oldest key from list and mark file as removed */
+ zp->keys = dki_remove (ksk);
+
+ // verbmesg (2, z, "kskrollover: remove parentfile and rename old key to k<zone>+<algo>+<tag>.key\n");
+ verbmesg (2, z, "\t\tkskrollover: remove parentfile and rename old key to k%s+%03d+%05d.key\n",
+ ksk->name, ksk->algo, ksk->tag);
+ lg_mesg (LG_INFO, "\"%s\": kskrollover phase3: Remove old key %d", zp->zone, ksk->tag);
+ return 1;
+ }
+ else
+#if 0
+ verbmesg (2, z, "\t\tkskrollover: we are in state 2 and waiting for parent propagation (parentfile %d < parentprop %d + parentresig %d + parentkeyttl %d\n", parfile_age, parent_propagation, parent_resign, parent_keyttl);
+#else
+ verbmesg (2, z, "\t\tkskrollover: we are in state 2 and waiting for parent propagation (parentfile %d < parentprop %d + parentkeyttl %d\n", parfile_age, parent_propagation, parent_keyttl);
+#endif
+ break;
+ default:
+ assert ( currphase == 1 || currphase == 2 );
+ /* NOTREACHED */
+ }
+
+ return 0;
+}
+
+/*****************************************************************
+** global function definition
+*****************************************************************/
+
+/*****************************************************************
+** ksk5011status ()
+** Check if the list of zone keys containing a revoked or a
+** standby key.
+** Remove the revoked key if it is older than 30 days.
+** If the lifetime of the active key is reached, do a rfc5011
+** keyrollover.
+** Returns an int with the rightmost bit set if a resigning
+** is required. The second rightmost bit is set, if it is an
+** rfc5011 zone.
+*****************************************************************/
+int ksk5011status (dki_t **listp, const char *dir, const char *domain, const zconf_t *z)
+{
+ dki_t *standbykey;
+ dki_t *activekey;
+ dki_t *dkp;
+ dki_t *prev;
+ time_t currtime;
+ time_t exptime;
+ int ret;
+
+ assert ( listp != NULL );
+ assert ( z != NULL );
+
+ if ( z->k_life == 0 )
+ return 0;
+
+ verbmesg (1, z, "\tCheck RFC5011 status\n");
+
+ ret = 0;
+ currtime = time (NULL);
+
+ /* go through the list of key signing keys, */
+ /* remove revoked keys and set a pointer to standby and active key */
+ standbykey = activekey = NULL;
+ prev = NULL;
+ for ( dkp = *listp; dkp && dki_isksk (dkp); dkp = dkp->next )
+ {
+ exptime = get_exptime (dkp, z);
+ if ( dki_isrevoked (dkp) )
+ lg_mesg (LG_DEBUG, "Rev Exptime: %s", time2str (exptime, 's'));
+
+ /* revoked key is older than 30 days? */
+ if ( dki_isrevoked (dkp) && currtime > exptime + (DAYSEC * 30) )
+ {
+ verbmesg (1, z, "\tRemove revoked key %d which is older than 30 days\n", dkp->tag);
+ lg_mesg (LG_NOTICE, "zone \"%s\": removing revoked key %d", domain, dkp->tag);
+
+ /* remove key from list and mark file as removed */
+ if ( prev == NULL ) /* at the beginning of the list ? */
+ *listp = dki_remove (dkp);
+ else /* anywhere in the middle of the list */
+ prev->next = dki_remove (dkp);
+
+ ret |= 01; /* from now on a resigning is neccessary */
+ }
+
+ /* remember oldest standby and active key */
+ if ( dki_status (dkp) == DKI_PUBLISHED )
+ standbykey = dkp;
+ if ( dki_status (dkp) == DKI_ACTIVE )
+ activekey = dkp;
+ }
+
+ if ( standbykey == NULL && ret == 0 ) /* no standby key and also no revoked key found ? */
+ return ret; /* Seems that this is a non rfc5011 zone! */
+
+ ret |= 02; /* Zone looks like a rfc5011 zone */
+
+ exptime = get_exptime (activekey, z);
+#if 0
+ lg_mesg (LG_DEBUG, "Act Exptime: %s", time2str (exptime, 's'));
+ lg_mesg (LG_DEBUG, "Stb time: %s", time2str (dki_time (standbykey), 's'));
+ lg_mesg (LG_DEBUG, "Stb time+wait: %s", time2str (dki_time (standbykey) + min (DAYSEC * 30, z->key_ttl), 's'));
+#endif
+ /* At the time we first introduce a standby key, the lifetime of the current KSK should not be expired, */
+ /* otherwise we run into an (nearly) immediate key rollover! */
+ if ( currtime > exptime && currtime > dki_time (standbykey) + min (DAYSEC * 30, z->key_ttl) )
+ {
+ lg_mesg (LG_NOTICE, "\"%s\": starting rfc5011 rollover", domain);
+ verbmesg (1, z, "\tLifetime of Key Signing Key %d exceeded (%s): Starting rfc5011 rollover!\n",
+ activekey->tag, str_delspace (age2str (dki_age (activekey, currtime))));
+ verbmesg (2, z, "\t\t=>Generating new standby key signing key\n");
+ dkp = genkey (listp, dir, domain, DKI_KSK, z, DKI_PUBLISHED); /* gentime == now; lifetime = z->k_life; exp = 0 */
+ if ( !dkp )
+ {
+ error ("\tcould not generate new standby KSK\n");
+ lg_mesg (LG_ERROR, "\%s\": can't generate new standby KSK", domain);
+ }
+ else
+ lg_mesg (LG_INFO, "\"%s\": generated new standby KSK %d", domain, dkp->tag);
+
+ /* standby key gets active */
+ verbmesg (2, z, "\t\t=>Activating old standby key %d \n", standbykey->tag);
+ dki_setstatus (standbykey, DKI_ACT);
+
+ /* active key should be revoked */
+ verbmesg (2, z, "\t\t=>Revoking old active key %d \n", activekey->tag);
+ dki_setstatus (activekey, DKI_REVOKED);
+ dki_setexptime (activekey, currtime); /* now the key is expired */
+
+ ret |= 01; /* resigning neccessary */
+ }
+
+ return ret;
+}
+
+/*****************************************************************
+** kskstatus ()
+** Check the ksk status of a zone if a ksk lifetime is set.
+** If there is no key signing key present create a new one.
+** Prints out a warning message if the lifetime of the current
+** key signing key is over.
+** Returns 1 if a resigning of the zone is neccessary, otherwise
+** the function returns 0.
+*****************************************************************/
+int kskstatus (zone_t *zonelist, zone_t *zp)
+{
+ dki_t *akey;
+ const zconf_t *z;
+
+ assert ( zp != NULL );
+
+ z = zp->conf;
+ if ( z->k_life == 0 )
+ return 0;
+
+ verbmesg (1, z, "\tCheck KSK status\n");
+ /* check if a key signing key exist ? */
+ akey = (dki_t *)dki_find (zp->keys, 1, 'a', 1);
+ if ( akey == NULL )
+ {
+ verbmesg (1, z, "\tNo active KSK found: generate new one\n");
+ akey = genkey (&zp->keys, zp->dir, zp->zone, DKI_KSK, z, DKI_ACTIVE);
+ if ( !akey )
+ {
+ error ("\tcould not generate new KSK\n");
+ lg_mesg (LG_ERROR, "\"%s\": can't generate new KSK: \"%s\"",
+ zp->zone, dki_geterrstr());
+ }
+ else
+ lg_mesg (LG_INFO, "\"%s\": generated new KSK %d", zp->zone, akey->tag);
+ return akey != NULL; /* return value of 1 forces a resigning of the zone */
+ }
+ else /* try to start a full automatic ksk rollover */
+ kskrollover (akey, zonelist, zp);
+
+ return 0;
+}
+
+/*****************************************************************
+** zskstatus ()
+** Check the zsk status of a zone.
+** Returns 1 if a resigning of the zone is neccessary, otherwise
+** the function returns 0.
+*****************************************************************/
+int zskstatus (dki_t **listp, const char *dir, const char *domain, const zconf_t *z)
+{
+ dki_t *akey;
+ dki_t *nextkey;
+ dki_t *dkp, *last;
+ int keychange;
+ time_t lifetime;
+ time_t age;
+ time_t currtime;
+
+ assert ( listp != NULL );
+ /* dir can be NULL */
+ assert ( domain != NULL );
+ assert ( z != NULL );
+
+ currtime = time (NULL);
+
+ verbmesg (1, z, "\tCheck ZSK status\n");
+ dbg_val("zskstatus for %s \n", domain);
+ keychange = 0;
+ /* Is the depreciated key expired ? */
+ /* As mentioned by olaf, this is the max_ttl of all the rr in the zone */
+ lifetime = z->max_ttl + z->proptime; /* draft kolkman/gieben */
+ last = NULL;
+ dkp = *listp;
+ while ( dkp )
+ if ( !dki_isksk (dkp) &&
+ dki_status (dkp) == DKI_DEPRECIATED &&
+ dki_age (dkp, currtime) > lifetime )
+ {
+ keychange = 1;
+ verbmesg (1, z, "\tLifetime(%d sec) of depreciated key %d exceeded (%d sec)\n",
+ lifetime, dkp->tag, dki_age (dkp, currtime));
+ lg_mesg (LG_INFO, "\"%s\": old ZSK %d removed", domain, dkp->tag);
+ dkp = dki_destroy (dkp); /* delete the keyfiles */
+ dbg_msg("zskstatus: depreciated key removed ");
+ if ( last )
+ last->next = dkp;
+ else
+ *listp = dkp;
+ verbmesg (1, z, "\t\t->remove it\n");
+ }
+ else
+ {
+ last = dkp;
+ dkp = dkp->next;
+ }
+
+ /* check status of active key */
+ dbg_msg("zskstatus check status of active key ");
+ lifetime = z->z_life; /* global configured lifetime for zsk */
+ akey = (dki_t *)dki_find (*listp, 0, 'a', 1);
+ if ( akey == NULL && lifetime > 0 ) /* no active key found */
+ {
+ verbmesg (1, z, "\tNo active ZSK found: generate new one\n");
+ akey = genkey (listp, dir, domain, DKI_ZSK, z, DKI_ACTIVE);
+ lg_mesg (LG_INFO, "\"%s\": generated new ZSK %d", domain, akey->tag);
+ }
+ else /* active key exist */
+ {
+ if ( dki_lifetime (akey) )
+ lifetime = dki_lifetime (akey); /* set lifetime to lt of active key */
+
+ /* lifetime of active key is expired and published key exist ? */
+ age = dki_age (akey, currtime);
+ if ( lifetime > 0 && age > lifetime - (OFFSET) )
+ {
+ verbmesg (1, z, "\tLifetime(%d +/-%d sec) of active key %d exceeded (%d sec)\n",
+ lifetime, (OFFSET) , akey->tag, dki_age (akey, currtime) );
+
+ /* depreciate the key only if there is another active or published key */
+ if ( (nextkey = (dki_t *)dki_find (*listp, 0, 'a', 2)) == NULL ||
+ nextkey == akey )
+ nextkey = (dki_t *)dki_find (*listp, 0, 'p', 1);
+
+ /* Is the published key sufficient long in the zone ? */
+ /* As mentioned by Olaf, this should be the ttl of the DNSKEY RR ! */
+ if ( nextkey && dki_age (nextkey, currtime) > z->key_ttl + z->proptime )
+ {
+ keychange = 1;
+ verbmesg (1, z, "\t\t->depreciate it\n");
+ dki_setstatus (akey, 'd'); /* depreciate the active key */
+ verbmesg (1, z, "\t\t->activate published key %d\n", nextkey->tag);
+ dki_setstatus (nextkey, 'a'); /* activate published key */
+ lg_mesg (LG_NOTICE, "\"%s\": lifetime of zone signing key %d exceeded: ZSK rollover done", domain, akey->tag);
+ akey = nextkey;
+ nextkey = NULL;
+ }
+ else
+ {
+ verbmesg (1, z, "\t\t->waiting for published key\n");
+ lg_mesg (LG_NOTICE, "\"%s\": lifetime of zone signing key %d exceeded since %s: ZSK rollover deferred: waiting for published key",
+ domain, akey->tag, str_delspace (age2str (age - lifetime)));
+ }
+ }
+ }
+ /* Should we add a new publish key? This is neccessary if the active
+ * key will be expired at the next re-signing interval (The published
+ * time will be checked just before the active key will be removed.
+ * See above).
+ */
+ nextkey = (dki_t *)dki_find (*listp, 0, 'p', 1);
+ if ( nextkey == NULL && lifetime > 0 && (akey == NULL ||
+ dki_age (akey, currtime + z->resign) > lifetime - (OFFSET)) )
+ {
+ keychange = 1;
+ verbmesg (1, z, "\tNew key for publishing needed\n");
+ nextkey = genkey (listp, dir, domain, DKI_ZSK, z, DKI_PUB);
+
+ if ( nextkey )
+ {
+ verbmesg (1, z, "\t\t->creating new key %d\n", nextkey->tag);
+ lg_mesg (LG_INFO, "\"%s\": new key %d generated for publishing", domain, nextkey->tag);
+ }
+ else
+ {
+ error ("\tcould not generate new ZSK: \"%s\"\n", dki_geterrstr());
+ lg_mesg (LG_ERROR, "\"%s\": can't generate new ZSK: \"%s\"",
+ domain, dki_geterrstr());
+ }
+ }
+ return keychange;
+}
+
diff --git a/contrib/zkt/rollover.h b/contrib/zkt/rollover.h
new file mode 100644
index 0000000..8d53293
--- /dev/null
+++ b/contrib/zkt/rollover.h
@@ -0,0 +1,52 @@
+/*****************************************************************
+**
+** @(#) rollover.h (c) 2005 - 2008 Holger Zuleger hznet.de
+**
+** Copyright (c) 2005 - 2008, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+#ifndef ROLLOVER_H
+# define ROLLOVER_H
+# include <sys/types.h>
+# include <stdarg.h>
+# include <stdio.h>
+
+#ifndef ZCONF_H
+# include "zconf.h"
+#endif
+
+# define OFFSET ((int) (2.5 * MINSEC))
+
+extern int ksk5011status (dki_t **listp, const char *dir, const char *domain, const zconf_t *z);
+extern int kskstatus (zone_t *zonelist, zone_t *zp);
+extern int zskstatus (dki_t **listp, const char *dir, const char *domain, const zconf_t *z);
+#endif
diff --git a/contrib/zkt/strlist.c b/contrib/zkt/strlist.c
new file mode 100644
index 0000000..81a84bc
--- /dev/null
+++ b/contrib/zkt/strlist.c
@@ -0,0 +1,166 @@
+/*****************************************************************
+**
+** @(#) strlist.c (c) Mar 2005 Holger Zuleger
+**
+** TODO: Maybe we should use a special type for the list:
+** typedef struct { char cnt; char list[0+1]; } strlist__t;
+** This results in better type control of the function parameters
+**
+** Copyright (c) Mar 2005, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+
+#ifdef TEST
+# include <stdio.h>
+#endif
+#include <string.h>
+#include <stdlib.h>
+#include "strlist.h"
+
+
+/*****************************************************************
+** prepstrlist (str, delim)
+** prepare a string with delimeters to a so called strlist.
+** 'str' is a list of substrings delimeted by 'delim'
+** The # of strings is stored at the first byte of the allocated
+** memory. Every substring is stored as a '\0' terminated C-String.
+** The function returns a pointer to dynamic allocated memory
+*****************************************************************/
+char *prepstrlist (const char *str, const char *delim)
+{
+ char *p;
+ char *new;
+ int len;
+ int cnt;
+
+ if ( str == NULL )
+ return NULL;
+
+ len = strlen (str);
+ if ( (new = malloc (len + 2)) == NULL )
+ return new;
+
+ cnt = 0;
+ p = new;
+ for ( *p++ = '\0'; *str; str++ )
+ {
+ if ( strchr (delim, *str) == NULL )
+ *p++ = *str;
+ else if ( p[-1] != '\0' )
+ {
+ *p++ = '\0';
+ cnt++;
+ }
+ }
+ *p = '\0'; /*terminate string */
+ if ( p[-1] != '\0' )
+ cnt++;
+ *new = cnt & 0xFF;
+
+ return new;
+}
+
+/*****************************************************************
+** isinlist (str, list)
+** check if 'list' contains 'str'
+*****************************************************************/
+int isinlist (const char *str, const char *list)
+{
+ int cnt;
+
+ if ( list == NULL || *list == '\0' )
+ return 1;
+ if ( str == NULL || *str == '\0' )
+ return 0;
+
+ cnt = *list;
+ while ( cnt-- > 0 )
+ {
+ list++;
+ if ( strcmp (str, list) == 0 )
+ return 1;
+ list += strlen (list);
+ }
+
+ return 0;
+}
+
+/*****************************************************************
+** unprepstrlist (list, delimc)
+*****************************************************************/
+char *unprepstrlist (char *list, char delimc)
+{
+ char *p;
+ int cnt;
+
+ cnt = *list & 0xFF;
+ p = list;
+ for ( *p++ = delimc; cnt > 1; p++ )
+ if ( *p == '\0' )
+ {
+ *p = delimc;
+ cnt--;
+ }
+
+ return list;
+}
+
+#ifdef TEST
+main (int argc, char *argv[])
+{
+ FILE *fp;
+ char *p;
+ char *searchlist = NULL;
+ char group[255];
+
+ if ( argc > 1 )
+ searchlist = prepstrlist (argv[1], LISTDELIM);
+
+ printf ("searchlist: %d entrys: \n", searchlist[0]);
+ if ( (fp = fopen ("/etc/group", "r")) == NULL )
+ exit (fprintf (stderr, "can't open file\n"));
+
+ while ( fscanf (fp, "%[^:]:%*[^\n]\n", group) != EOF )
+ if ( isinlist (group, searchlist) )
+ printf ("%s\n", group);
+
+ fclose (fp);
+
+ printf ("searchlist: \"%s\"\n", unprepstrlist (searchlist, *LISTDELIM));
+ for ( p = searchlist; *p; p++ )
+ if ( *p < 32 )
+ printf ("<%d>", *p);
+ else
+ printf ("%c", *p);
+ printf ("\n");
+}
+#endif
diff --git a/contrib/zkt/strlist.h b/contrib/zkt/strlist.h
new file mode 100644
index 0000000..fb87356
--- /dev/null
+++ b/contrib/zkt/strlist.h
@@ -0,0 +1,46 @@
+/*****************************************************************
+**
+** @(#) strlist.h (c) Mar 2005 Holger Zuleger
+**
+** Copyright (c) May 2005 Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+
+#ifndef STRLIST_H
+# define STRLIST_H
+
+# define LISTDELIM " ,:;|^\t"
+
+char *prepstrlist (const char *str, const char *delim);
+int isinlist (const char *str, const char *list);
+char *unprepstrlist (char *list, char delimc);
+#endif
diff --git a/contrib/zkt/tags b/contrib/zkt/tags
new file mode 100644
index 0000000..1471aff
--- /dev/null
+++ b/contrib/zkt/tags
@@ -0,0 +1,324 @@
+!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
+!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
+!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
+!_TAG_PROGRAM_NAME Exuberant Ctags //
+!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
+!_TAG_PROGRAM_VERSION 5.5.4 //
+CONF_ALGO zconf.c /^ CONF_ALGO,$/;" e file:
+CONF_BOOL zconf.c /^ CONF_BOOL,$/;" e file:
+CONF_COMMENT zconf.c /^ CONF_COMMENT,$/;" e file:
+CONF_END zconf.c /^ CONF_END = 0,$/;" e file:
+CONF_FACILITY zconf.c /^ CONF_FACILITY,$/;" e file:
+CONF_INT zconf.c /^ CONF_INT,$/;" e file:
+CONF_LEVEL zconf.c /^ CONF_LEVEL,$/;" e file:
+CONF_SERIAL zconf.c /^ CONF_SERIAL,$/;" e file:
+CONF_STRING zconf.c /^ CONF_STRING,$/;" e file:
+CONF_TIMEINT zconf.c /^ CONF_TIMEINT,$/;" e file:
+ISCOMMENT zconf.c 68;" d file:
+ISDELIM zconf.c 70;" d file:
+ISTRUE zconf.c 66;" d file:
+KEYSET_FILE_PFX dnssec-signer.c 669;" d file:
+KeyWords ncparse.c /^static struct KeyWords {$/;" s file:
+MAXFNAME log.c 97;" d file:
+STRCONFIG_DELIMITER zconf.c 505;" d file:
+TAINTEDCHARS misc.c 60;" d file:
+TOK_DELEGATION ncparse.c 59;" d file:
+TOK_DIR ncparse.c 49;" d file:
+TOK_FILE ncparse.c 62;" d file:
+TOK_FORWARD ncparse.c 58;" d file:
+TOK_HINT ncparse.c 57;" d file:
+TOK_INCLUDE ncparse.c 50;" d file:
+TOK_MASTER ncparse.c 54;" d file:
+TOK_SLAVE ncparse.c 55;" d file:
+TOK_STRING ncparse.c 48;" d file:
+TOK_STUB ncparse.c 56;" d file:
+TOK_TYPE ncparse.c 53;" d file:
+TOK_UNKNOWN ncparse.c 64;" d file:
+TOK_VIEW ncparse.c 60;" d file:
+TOK_ZONE ncparse.c 52;" d file:
+a domaincmp.c /^ char *a;$/;" m file:
+add2zonelist dnssec-signer.c /^static int add2zonelist (const char *dir, const char *view, const char *zone, const char *file)$/;" f file:
+age2str misc.c /^char *age2str (time_t sec)$/;" f
+ageflag dnssec-zkt.c /^int ageflag = 0;$/;" v
+b domaincmp.c /^ char *b;$/;" m file:
+bool2str zconf.c /^static const char *bool2str (int val)$/;" f file:
+check_keydb_timestamp dnssec-signer.c /^static int check_keydb_timestamp (dki_t *keylist, time_t reftime)$/;" f file:
+checkconfig zconf.c /^int checkconfig (const zconf_t *z)$/;" f
+cmdline zconf.c /^ int cmdline; \/* is this a command line parameter ? *\/$/;" m file:
+cmpfile misc.c /^int cmpfile (const char *file1, const char *file2)$/;" f
+config dnssec-signer.c /^static zconf_t *config;$/;" v file:
+config zconf.c /^static zconf_t *config;$/;" v file:
+confpara zconf.c /^static zconf_para_t confpara[] = {$/;" v file:
+copy_keyset dnssec-signer.c /^static void copy_keyset (const char *dir, const char *domain, const zconf_t *conf)$/;" f file:
+copyfile misc.c /^int copyfile (const char *fromfile, const char *tofile, const char *dnskeyfile)$/;" f
+copyzonefile misc.c /^int copyzonefile (const char *fromfile, const char *tofile, const char *dnskeyfile)$/;" f
+create_parent_file dnssec-zkt.c /^static int create_parent_file (const char *fname, int phase, int ttl, const dki_t *dkp)$/;" f file:
+create_parent_file rollover.c /^static int create_parent_file (const char *fname, int phase, int ttl, const dki_t *dkp)$/;" f file:
+createkey dnssec-zkt.c /^static void createkey (const char *keyname, const dki_t *list, const zconf_t *conf)$/;" f file:
+ctype_t zconf.c /^} ctype_t;$/;" t file:
+def zconf.c /^static zconf_t def = {$/;" v file:
+dirflag dnssec-zkt.c /^static int dirflag = 0;$/;" v file:
+dirname dnssec-signer.c /^const char *dirname = NULL;$/;" v
+dist_and_reload dnssec-signer.c /^static int dist_and_reload (const zone_t *zp)$/;" f file:
+dki_add dki.c /^dki_t *dki_add (dki_t **list, dki_t *new)$/;" f
+dki_age dki.c /^int dki_age (const dki_t *dkp, time_t curr)$/;" f
+dki_algo2str dki.c /^char *dki_algo2str (int algo)$/;" f
+dki_allcmp dki.c /^int dki_allcmp (const dki_t *a, const dki_t *b)$/;" f
+dki_alloc dki.c /^static dki_t *dki_alloc ()$/;" f file:
+dki_cmp dki.c /^int dki_cmp (const dki_t *a, const dki_t *b)$/;" f
+dki_destroy dki.c /^dki_t *dki_destroy (dki_t *dkp)$/;" f
+dki_estr dki.c /^static char dki_estr[255+1];$/;" v file:
+dki_exptime dki.c /^time_t dki_exptime (const dki_t *dkp)$/;" f
+dki_find dki.c /^const dki_t *dki_find (const dki_t *list, int ksk, int status, int no)$/;" f
+dki_free dki.c /^void dki_free (dki_t *dkp)$/;" f
+dki_freelist dki.c /^void dki_freelist (dki_t **listp)$/;" f
+dki_gentime dki.c /^time_t dki_gentime (const dki_t *dkp)$/;" f
+dki_geterrstr dki.c /^const char *dki_geterrstr ()$/;" f
+dki_getflag dki.c /^dk_flag_t dki_getflag (const dki_t *dkp, time_t curr)$/;" f
+dki_isactive dki.c /^int dki_isactive (const dki_t *dkp)$/;" f
+dki_isdepreciated dki.c /^int dki_isdepreciated (const dki_t *dkp)$/;" f
+dki_isksk dki.c /^int dki_isksk (const dki_t *dkp)$/;" f
+dki_ispublished dki.c /^int dki_ispublished (const dki_t *dkp)$/;" f
+dki_isrevoked dki.c /^int dki_isrevoked (const dki_t *dkp)$/;" f
+dki_lifetime dki.c /^time_t dki_lifetime (const dki_t *dkp)$/;" f
+dki_lifetimedays dki.c /^ushort dki_lifetimedays (const dki_t *dkp)$/;" f
+dki_namecmp dki.c /^int dki_namecmp (const dki_t *a, const dki_t *b)$/;" f
+dki_new dki.c /^dki_t *dki_new (const char *dir, const char *name, int ksk, int algo, int bitsize, const char *rfile, int lf_days)$/;" f
+dki_prt_comment dki.c /^int dki_prt_comment (const dki_t *dkp, FILE *fp)$/;" f
+dki_prt_dnskey dki.c /^int dki_prt_dnskey (const dki_t *dkp, FILE *fp)$/;" f
+dki_prt_dnskey_raw dki.c /^int dki_prt_dnskey_raw (const dki_t *dkp, FILE *fp)$/;" f
+dki_prt_dnskeyttl dki.c /^int dki_prt_dnskeyttl (const dki_t *dkp, FILE *fp, int ttl)$/;" f
+dki_prt_trustedkey dki.c /^int dki_prt_trustedkey (const dki_t *dkp, FILE *fp)$/;" f
+dki_read dki.c /^dki_t *dki_read (const char *dirname, const char *filename)$/;" f
+dki_readdir dki.c /^int dki_readdir (const char *dir, dki_t **listp, int recursive)$/;" f
+dki_readfile dki.c /^static int dki_readfile (FILE *fp, dki_t *dkp)$/;" f file:
+dki_remove dki.c /^dki_t *dki_remove (dki_t *dkp)$/;" f
+dki_search dki.c /^const dki_t *dki_search (const dki_t *list, int tag, const char *name)$/;" f
+dki_setexptime dki.c /^time_t dki_setexptime (dki_t *dkp, time_t sec)$/;" f
+dki_setflag dki.c /^dk_flag_t dki_setflag (dki_t *dkp, dk_flag_t flag)$/;" f
+dki_setlifetime dki.c /^ushort dki_setlifetime (dki_t *dkp, int days)$/;" f
+dki_setstat dki.c /^static int dki_setstat (dki_t *dkp, int status, int preserve_time)$/;" f file:
+dki_setstatus dki.c /^int dki_setstatus (dki_t *dkp, int status)$/;" f
+dki_setstatus_preservetime dki.c /^int dki_setstatus_preservetime (dki_t *dkp, int status)$/;" f
+dki_status dki.c /^dk_status_t dki_status (const dki_t *dkp)$/;" f
+dki_statusstr dki.c /^const char *dki_statusstr (const dki_t *dkp)$/;" f
+dki_tadd dki.c /^dki_t *dki_tadd (dki_t **tree, dki_t *new)$/;" f
+dki_tagcmp dki.c /^int dki_tagcmp (const dki_t *a, const dki_t *b)$/;" f
+dki_tfree dki.c /^void dki_tfree (dki_t **tree)$/;" f
+dki_time dki.c /^time_t dki_time (const dki_t *dkp)$/;" f
+dki_timecmp dki.c /^int dki_timecmp (const dki_t *a, const dki_t *b)$/;" f
+dki_tsearch dki.c /^const dki_t *dki_tsearch (const dki_t *tree, int tag, const char *name)$/;" f
+dki_unsetflag dki.c /^dk_flag_t dki_unsetflag (dki_t *dkp, dk_flag_t flag)$/;" f
+dki_writeinfo dki.c /^static int dki_writeinfo (const dki_t *dkp, const char *path)$/;" f file:
+domaincmp domaincmp.c /^int domaincmp (const char *a, const char *b)$/;" f
+dosigning dnssec-signer.c /^static int dosigning (zone_t *zonelist, zone_t *zp)$/;" f file:
+dupconfig zconf.c /^zconf_t *dupconfig (const zconf_t *conf)$/;" f
+dyn_update_freeze dnssec-signer.c /^static int dyn_update_freeze (const char *domain, const zconf_t *z, int freeze)$/;" f file:
+dynamic_zone dnssec-signer.c /^static int dynamic_zone = 0; \/* dynamic zone ? *\/$/;" v file:
+error misc.c /^void error (char *fmt, ...)$/;" f
+ex domaincmp.c /^} ex[] = {$/;" v file:
+exptimeflag dnssec-zkt.c /^int exptimeflag = 0;$/;" v
+extern dki.c 59;" d file:
+extern dki.c 61;" d file:
+extern domaincmp.c 42;" d file:
+extern domaincmp.c 44;" d file:
+extern log.c 55;" d file:
+extern log.c 57;" d file:
+extern misc.c 56;" d file:
+extern misc.c 58;" d file:
+extern ncparse.c 44;" d file:
+extern ncparse.c 46;" d file:
+extern rollover.c 57;" d file:
+extern rollover.c 59;" d file:
+extern zconf.c 61;" d file:
+extern zconf.c 63;" d file:
+extern zkt.c 47;" d file:
+extern zkt.c 49;" d file:
+extern zone.c 53;" d file:
+extern zone.c 55;" d file:
+fatal misc.c /^void fatal (char *fmt, ...)$/;" f
+file_age misc.c /^int file_age (const char *fname)$/;" f
+file_mtime misc.c /^time_t file_mtime (const char *fname)$/;" f
+fileexist misc.c /^int fileexist (const char *name)$/;" f
+filesize misc.c /^size_t filesize (const char *name)$/;" f
+force dnssec-signer.c /^static int force = 0;$/;" v file:
+genkey rollover.c /^static dki_t *genkey (dki_t **listp, const char *dir, const char *domain, int ksk, const zconf_t *conf, int status)$/;" f file:
+get_exptime rollover.c /^static time_t get_exptime (dki_t *key, const zconf_t *z)$/;" f file:
+get_parent_phase dnssec-zkt.c /^static int get_parent_phase (const char *file)$/;" f file:
+get_parent_phase rollover.c /^static int get_parent_phase (const char *file)$/;" f file:
+getdefconfname misc.c /^const char *getdefconfname (const char *view)$/;" f
+getnameappendix misc.c /^const char *getnameappendix (const char *progname, const char *basename)$/;" f
+gettok ncparse.c /^static int gettok (FILE *fp, char *val, size_t valsize)$/;" f file:
+goto_labelstart domaincmp.c 47;" d file:
+headerflag dnssec-zkt.c /^int headerflag = 1;$/;" v
+in_strarr misc.c /^int in_strarr (const char *str, char *const arr[], int cnt)$/;" f
+inc_errstr misc.c /^const char *inc_errstr (int err)$/;" f
+inc_serial misc.c /^int inc_serial (const char *fname, int use_unixtime)$/;" f
+inc_soa_serial misc.c /^static int inc_soa_serial (FILE *fp, int use_unixtime)$/;" f file:
+is_directory misc.c /^int is_directory (const char *name)$/;" f
+is_dotfile misc.c /^int is_dotfile (const char *name)$/;" f
+is_exec_ok misc.c /^int is_exec_ok (const char *prog)$/;" f
+is_keyfilename misc.c /^int is_keyfilename (const char *name)$/;" f
+is_parentdirsigned rollover.c /^static int is_parentdirsigned (const zone_t *zonelist, const zone_t *zp)$/;" f file:
+isinlist strlist.c /^int isinlist (const char *str, const char *list)$/;" f
+ksk5011status rollover.c /^int ksk5011status (dki_t **listp, const char *dir, const char *domain, const zconf_t *z)$/;" f
+ksk_roll dnssec-zkt.c /^static void ksk_roll (const char *keyname, int phase, const dki_t *list, const zconf_t *conf)$/;" f file:
+kskdomain dnssec-zkt.c /^static char *kskdomain = "";$/;" v file:
+kskflag dnssec-zkt.c /^int kskflag = 1;$/;" v
+kskrollover rollover.c /^static int kskrollover (dki_t *ksk, zone_t *zonelist, zone_t *zp)$/;" f file:
+kskstatus rollover.c /^int kskstatus (zone_t *zonelist, zone_t *zp)$/;" f
+kw ncparse.c /^} kw[] = {$/;" v file:
+label zconf.c /^ char *label; \/* the name of the paramter *\/$/;" m file:
+labellist dnssec-zkt.c /^char *labellist = NULL;$/;" v
+level log.c /^ lg_lvl_t level;$/;" m file:
+lg_args log.c /^void lg_args (lg_lvl_t level, int argc, char * const argv[])$/;" f
+lg_close log.c /^int lg_close ()$/;" f
+lg_errcnt log.c /^static long lg_errcnt;$/;" v file:
+lg_fileopen log.c /^static FILE *lg_fileopen (const char *path, const char *name)$/;" f file:
+lg_fp log.c /^static FILE *lg_fp;$/;" v file:
+lg_geterrcnt log.c /^long lg_geterrcnt ()$/;" f
+lg_lvl2str log.c /^const char *lg_lvl2str (lg_lvl_t level)$/;" f
+lg_lvl2syslog log.c /^lg_lvl_t lg_lvl2syslog (lg_lvl_t level)$/;" f
+lg_mesg log.c /^void lg_mesg (int priority, char *fmt, ...)$/;" f
+lg_minfilelevel log.c /^static int lg_minfilelevel;$/;" v file:
+lg_minsyslevel log.c /^static int lg_minsyslevel;$/;" v file:
+lg_open log.c /^int lg_open (const char *progname, const char *facility, const char *syslevel, const char *path, const char *file, const char *filelevel)$/;" f
+lg_progname log.c /^static const char *lg_progname;$/;" v file:
+lg_reseterrcnt log.c /^long lg_reseterrcnt ()$/;" f
+lg_seterrcnt log.c /^long lg_seterrcnt (long value)$/;" f
+lg_str2lvl log.c /^lg_lvl_t lg_str2lvl (const char *name)$/;" f
+lg_str2syslog log.c /^int lg_str2syslog (const char *facility)$/;" f
+lg_symtbl_t log.c /^} lg_symtbl_t;$/;" t file:
+lg_syslogging log.c /^static int lg_syslogging;$/;" v file:
+lifetime dnssec-zkt.c /^int lifetime = 0;$/;" v
+lifetimeflag dnssec-zkt.c /^int lifetimeflag = 0;$/;" v
+linkfile misc.c /^int linkfile (const char *fromfile, const char *tofile)$/;" f
+list_dnskey zkt.c /^static void list_dnskey (const dki_t **nodep, const VISIT which, int depth)$/;" f file:
+list_key zkt.c /^static void list_key (const dki_t **nodep, const VISIT which, int depth)$/;" f file:
+list_trustedkey zkt.c /^static void list_trustedkey (const dki_t **nodep, const VISIT which, int depth)$/;" f file:
+ljustflag dnssec-zkt.c /^int ljustflag = 0;$/;" v
+loadconfig zconf.c /^zconf_t *loadconfig (const char *filename, zconf_t *z)$/;" f
+loadconfig_fromstr zconf.c /^zconf_t *loadconfig_fromstr (const char *str, zconf_t *z)$/;" f
+logfile dnssec-signer.c /^const char *logfile = NULL;$/;" v
+logflush misc.c /^void logflush ()$/;" f
+logmesg misc.c /^void logmesg (char *fmt, ...)$/;" f
+long_options dnssec-signer.c /^static struct option long_options[] = {$/;" v file:
+long_options dnssec-zkt.c /^static struct option long_options[] = {$/;" v file:
+lopt_usage dnssec-signer.c 302;" d file:
+lopt_usage dnssec-signer.c 305;" d file:
+lopt_usage dnssec-zkt.c 410;" d file:
+lopt_usage dnssec-zkt.c 413;" d file:
+loptstr dnssec-signer.c 303;" d file:
+loptstr dnssec-signer.c 306;" d file:
+loptstr dnssec-zkt.c 411;" d file:
+loptstr dnssec-zkt.c 414;" d file:
+main dnssec-signer.c /^int main (int argc, char *const argv[])$/;" f
+main dnssec-zkt.c /^int main (int argc, char *argv[])$/;" f
+main domaincmp.c /^main (int argc, char *argv[])$/;" f
+main log.c /^int main (int argc, char *argv[])$/;" f
+main misc.c /^main (int argc, char *argv[])$/;" f
+main ncparse.c /^main (int argc, char *argv[])$/;" f
+main strlist.c /^main (int argc, char *argv[])$/;" f
+main zconf.c /^main (int argc, char *argv[])$/;" f
+main zkt-soaserial.c /^int main (int argc, char *argv[])$/;" f
+name ncparse.c /^ char *name;$/;" m struct:KeyWords file:
+namedconf dnssec-signer.c /^const char *namedconf = NULL;$/;" v
+new_keysetfiles dnssec-signer.c /^static int new_keysetfiles (const char *dir, time_t zone_signing_time)$/;" f file:
+noexec dnssec-signer.c /^static int noexec = 0;$/;" v file:
+origin dnssec-signer.c /^const char *origin = NULL;$/;" v
+parse_namedconf ncparse.c /^int parse_namedconf (const char *filename, char *dir, size_t dirsize, int (*func) ())$/;" f
+parseconfigline zconf.c /^static void parseconfigline (char *buf, unsigned int line, zconf_t *z)$/;" f file:
+parsedir dnssec-signer.c /^static int parsedir (const char *dir, zone_t **zp, const zconf_t *conf)$/;" f file:
+parsedirectory dnssec-zkt.c /^static int parsedirectory (const char *dir, dki_t **listp)$/;" f file:
+parsefile dnssec-zkt.c /^static void parsefile (const char *file, dki_t **listp)$/;" f file:
+parsetag dnssec-zkt.c /^static const char *parsetag (const char *str, int *tagp)$/;" f file:
+parseurl misc.c /^void parseurl (char *url, char **proto, char **host, char **port, char **para)$/;" f
+pathflag dnssec-zkt.c /^int pathflag = 0;$/;" v
+pathname misc.c /^char *pathname (char *path, size_t size, const char *dir, const char *file, const char *ext)$/;" f
+prepstrlist strlist.c /^char *prepstrlist (const char *str, const char *delim)$/;" f
+printconfig zconf.c /^int printconfig (const char *fname, const zconf_t *z)$/;" f
+printconfigline zconf.c /^static void printconfigline (FILE *fp, zconf_para_t *cp)$/;" f file:
+printkeyinfo zkt.c /^static void printkeyinfo (const dki_t *dkp, const char *oldpath)$/;" f file:
+printserial zkt-soaserial.c /^static void printserial (const char *fname, unsigned long serial)$/;" f file:
+printzone ncparse.c /^int printzone (const char *dir, const char *view, const char *zone, const char *file)$/;" f
+progname dnssec-signer.c /^const char *progname;$/;" v
+progname dnssec-zkt.c /^const char *progname;$/;" v
+progname domaincmp.c /^const char *progname;$/;" v
+progname log.c /^const char *progname;$/;" v
+progname misc.c /^const char *progname;$/;" v
+progname ncparse.c /^char *progname;$/;" v
+progname zconf.c /^const char *progname;$/;" v
+progname zkt-soaserial.c /^static const char *progname;$/;" v file:
+read_serial_fromfile zkt-soaserial.c /^static int read_serial_fromfile (const char *fname, unsigned long *serial)$/;" f file:
+recflag dnssec-zkt.c /^static int recflag = RECURSIVE;$/;" v file:
+register_key dnssec-signer.c /^static void register_key (dki_t *list, const zconf_t *z)$/;" f file:
+reload_zone dnssec-signer.c /^static int reload_zone (const char *domain, const zconf_t *z)$/;" f file:
+reloadflag dnssec-signer.c /^static int reloadflag = 0;$/;" v file:
+res domaincmp.c /^ int res;$/;" m file:
+searchitem zkt.c /^static int searchitem;$/;" v file:
+searchkw ncparse.c /^static int searchkw (const char *keyword)$/;" f file:
+searchresult zkt.c /^static const dki_t *searchresult;$/;" v file:
+set_all_varptr zconf.c /^static void set_all_varptr (zconf_t *cp)$/;" f file:
+set_keylifetime zkt.c /^static void set_keylifetime (const dki_t **nodep, const VISIT which, int depth)$/;" f file:
+set_varptr zconf.c /^static int set_varptr (char *entry, void *ptr)$/;" f file:
+setconfigpar zconf.c /^int setconfigpar (zconf_t *config, char *entry, const void *pval)$/;" f
+setglobalflags dnssec-zkt.c /^static void setglobalflags (zconf_t *config)$/;" f file:
+short_options dnssec-signer.c 66;" d file:
+short_options dnssec-signer.c 68;" d file:
+short_options dnssec-zkt.c 89;" d file:
+sign_zone dnssec-signer.c /^static int sign_zone (const char *dir, const char *domain, const char *file, const zconf_t *conf)$/;" f file:
+sopt_usage dnssec-signer.c 300;" d file:
+sopt_usage dnssec-zkt.c 408;" d file:
+splitpath misc.c /^const char *splitpath (char *path, size_t size, const char *filename)$/;" f
+start_timer misc.c /^time_t start_timer ()$/;" f
+stop_timer misc.c /^time_t stop_timer (time_t start)$/;" f
+str log.c /^ const char *str;$/;" m file:
+str_chop misc.c /^char *str_chop (char *str, char c)$/;" f
+str_delspace misc.c /^char *str_delspace (char *s)$/;" f
+str_tolowerdup misc.c /^char *str_tolowerdup (const char *s)$/;" f
+str_untaint misc.c /^char *str_untaint (char *str)$/;" f
+symtbl log.c /^static lg_symtbl_t symtbl[] = {$/;" v file:
+syslog_level log.c /^ int syslog_level;$/;" m file:
+tag_search zkt.c /^static void tag_search (const dki_t **nodep, const VISIT which, int depth)$/;" f file:
+time2isostr misc.c /^char *time2isostr (time_t sec, int precision)$/;" f
+time2str misc.c /^char *time2str (time_t sec, int precision)$/;" f
+timeflag dnssec-zkt.c /^int timeflag = 1;$/;" v
+timeint2str zconf.c /^static const char *timeint2str (ulong val)$/;" f file:
+timestr zkt-soaserial.c /^static char *timestr (time_t sec)$/;" f file:
+timestr2time misc.c /^time_t timestr2time (const char *timestr)$/;" f
+today_serialtime misc.c /^static ulong today_serialtime ()$/;" f file:
+tok ncparse.c /^ int tok;$/;" m struct:KeyWords file:
+tok2str ncparse.c /^static const char *tok2str (int tok)$/;" f file:
+touch misc.c /^int touch (const char *fname, time_t sec)$/;" f
+trustedkeyflag dnssec-zkt.c /^static int trustedkeyflag = 0;$/;" v file:
+type zconf.c /^ ctype_t type; \/* the parameter type *\/$/;" m file:
+unprepstrlist strlist.c /^char *unprepstrlist (char *list, char delimc)$/;" f
+usage dnssec-signer.c /^static void usage (char *mesg, zconf_t *conf)$/;" f file:
+usage dnssec-zkt.c /^static void usage (char *mesg, zconf_t *cp)$/;" f file:
+usage zkt-soaserial.c /^static void usage (const char *msg)$/;" f file:
+var zconf.c /^ void *var; \/* pointer to the parameter variable *\/$/;" m file:
+verbmesg misc.c /^void verbmesg (int verblvl, const zconf_t *conf, char *fmt, ...)$/;" f
+verbose dnssec-signer.c /^static int verbose = 0;$/;" v file:
+view dnssec-zkt.c /^static const char *view = "";$/;" v file:
+viewname dnssec-signer.c /^const char *viewname = NULL;$/;" v
+writekeyfile dnssec-signer.c /^static int writekeyfile (const char *fname, const dki_t *list, int key_ttl)$/;" f file:
+zconf_para_t zconf.c /^} zconf_para_t;$/;" t file:
+zkt_list_dnskeys zkt.c /^void zkt_list_dnskeys (const dki_t *data)$/;" f
+zkt_list_keys zkt.c /^void zkt_list_keys (const dki_t *data)$/;" f
+zkt_list_trustedkeys zkt.c /^void zkt_list_trustedkeys (const dki_t *data)$/;" f
+zkt_search zkt.c /^const dki_t *zkt_search (const dki_t *data, int searchtag, const char *keyname)$/;" f
+zkt_setkeylifetime zkt.c /^void zkt_setkeylifetime (dki_t *data)$/;" f
+zone_add zone.c /^zone_t *zone_add (zone_t **list, zone_t *new)$/;" f
+zone_alloc zone.c /^static zone_t *zone_alloc ()$/;" f file:
+zone_cmp zone.c /^static int zone_cmp (const zone_t *a, const zone_t *b)$/;" f file:
+zone_estr zone.c /^static char zone_estr[255+1];$/;" v file:
+zone_free zone.c /^void zone_free (zone_t *zp)$/;" f
+zone_freelist zone.c /^void zone_freelist (zone_t **listp)$/;" f
+zone_geterrstr zone.c /^const char *zone_geterrstr ()$/;" f
+zone_new zone.c /^zone_t *zone_new (zone_t **zp, const char *zone, const char *dir, const char *file, const char *signed_ext, const zconf_t *cp)$/;" f
+zone_print zone.c /^int zone_print (const char *mesg, const zone_t *z)$/;" f
+zone_readdir zone.c /^int zone_readdir (const char *dir, const char *zone, const char *zfile, zone_t **listp, const zconf_t *conf, int dyn_zone)$/;" f
+zone_search zone.c /^const zone_t *zone_search (const zone_t *list, const char *zone)$/;" f
+zonelist dnssec-signer.c /^static zone_t *zonelist = NULL; \/* must be static global because add2zonelist use it *\/$/;" v file:
+zskflag dnssec-zkt.c /^int zskflag = 1;$/;" v
+zskstatus rollover.c /^int zskstatus (dki_t **listp, const char *dir, const char *domain, const zconf_t *z)$/;" f
diff --git a/contrib/zkt/zconf.c b/contrib/zkt/zconf.c
new file mode 100644
index 0000000..1dee484
--- /dev/null
+++ b/contrib/zkt/zconf.c
@@ -0,0 +1,775 @@
+/****************************************************************
+**
+** @(#) zconf.c -- configuration file parser for dnssec.conf
+**
+** Most of the code is from the SixXS Heartbeat Client
+** written by Jeroen Massar <jeroen@sixxs.net>
+**
+** New config types and some slightly code changes
+** by Holger Zuleger
+**
+** Copyright (c) Aug 2005, Jeroen Massar, Holger Zuleger.
+** All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Jeroen Masar or Holger Zuleger nor the
+** names of its contributors may be used to endorse or promote products
+** derived from this software without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+****************************************************************/
+# include <sys/types.h>
+# include <stdio.h>
+# include <errno.h>
+# include <unistd.h>
+# include <stdlib.h>
+# include <stdarg.h>
+# include <string.h>
+# include <strings.h>
+# include <assert.h>
+# include <ctype.h>
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+# include "config_zkt.h"
+# include "debug.h"
+# include "misc.h"
+#define extern
+# include "zconf.h"
+#undef extern
+# include "dki.h"
+
+# define ISTRUE(val) (strcasecmp (val, "yes") == 0 || \
+ strcasecmp (val, "true") == 0 )
+# define ISCOMMENT(cp) (*(cp) == '#' || *(cp) == ';' || \
+ (*(cp) == '/' && *((cp)+1) == '/') )
+# define ISDELIM(c) ( isspace (c) || (c) == ':' || (c) == '=' )
+
+
+typedef enum {
+ CONF_END = 0,
+ CONF_STRING,
+ CONF_INT,
+ CONF_TIMEINT,
+ CONF_BOOL,
+ CONF_ALGO,
+ CONF_SERIAL,
+ CONF_FACILITY,
+ CONF_LEVEL,
+ CONF_COMMENT,
+} ctype_t;
+
+/*****************************************************************
+** private (static) variables
+*****************************************************************/
+static zconf_t def = {
+ ZONEDIR, RECURSIVE,
+ PRINTTIME, PRINTAGE, LJUST,
+ SIG_VALIDITY, MAX_TTL, KEY_TTL, PROPTIME, Incremental,
+ RESIGN_INT,
+ KSK_LIFETIME, KSK_ALGO, KSK_BITS, KSK_RANDOM,
+ ZSK_LIFETIME, ZSK_ALGO, ZSK_BITS, ZSK_RANDOM,
+ NULL, /* viewname cmdline paramter */
+ LOGFILE, LOGLEVEL, SYSLOGFACILITY, SYSLOGLEVEL, VERBOSELOG, 0,
+ DNSKEYFILE, ZONEFILE, KEYSETDIR,
+ LOOKASIDEDOMAIN,
+ SIG_RANDOM, SIG_PSEUDO, SIG_GENDS, SIG_PARAM,
+ DIST_CMD /* deafults to NULL which means to run "rndc reload" */
+};
+
+typedef struct {
+ char *label; /* the name of the paramter */
+ int cmdline; /* is this a command line parameter ? */
+ ctype_t type; /* the parameter type */
+ void *var; /* pointer to the parameter variable */
+} zconf_para_t;
+
+static zconf_para_t confpara[] = {
+ { "", 0, CONF_COMMENT, ""},
+ { "", 0, CONF_COMMENT, "\t@(#) dnssec.conf " ZKT_VERSION },
+ { "", 0, CONF_COMMENT, ""},
+ { "", 0, CONF_COMMENT, NULL },
+
+ { "", 0, CONF_COMMENT, "dnssec-zkt options" },
+ { "Zonedir", 0, CONF_STRING, &def.zonedir },
+ { "Recursive", 0, CONF_BOOL, &def.recursive },
+ { "PrintTime", 0, CONF_BOOL, &def.printtime },
+ { "PrintAge", 0, CONF_BOOL, &def.printage },
+ { "LeftJustify", 0, CONF_BOOL, &def.ljust },
+
+ { "", 0, CONF_COMMENT, NULL },
+ { "", 0, CONF_COMMENT, "zone specific values" },
+ { "ResignInterval", 0, CONF_TIMEINT, &def.resign },
+ { "Sigvalidity", 0, CONF_TIMEINT, &def.sigvalidity },
+ { "Max_TTL", 0, CONF_TIMEINT, &def.max_ttl },
+ { "Propagation", 0, CONF_TIMEINT, &def.proptime },
+ { "KEY_TTL", 0, CONF_TIMEINT, &def.key_ttl },
+#if defined (DEF_TTL)
+ { "def_ttl", 0, CONF_TIMEINT, &def.def_ttl },
+#endif
+ { "Serialformat", 0, CONF_SERIAL, &def.serialform },
+
+ { "", 0, CONF_COMMENT, NULL },
+ { "", 0, CONF_COMMENT, "signing key parameters"},
+ { "KSK_lifetime", 0, CONF_TIMEINT, &def.k_life },
+ { "KSK_algo", 0, CONF_ALGO, &def.k_algo },
+ { "KSK_bits", 0, CONF_INT, &def.k_bits },
+ { "KSK_randfile", 0, CONF_STRING, &def.k_random },
+ { "ZSK_lifetime", 0, CONF_TIMEINT, &def.z_life },
+ { "ZSK_algo", 0, CONF_ALGO, &def.z_algo },
+ { "ZSK_bits", 0, CONF_INT, &def.z_bits },
+ { "ZSK_randfile", 0, CONF_STRING, &def.z_random },
+
+ { "", 0, CONF_COMMENT, NULL },
+ { "", 0, CONF_COMMENT, "dnssec-signer options"},
+ { "--view", 1, CONF_STRING, &def.view },
+ { "LogFile", 0, CONF_STRING, &def.logfile },
+ { "LogLevel", 0, CONF_LEVEL, &def.loglevel },
+ { "SyslogFacility", 0, CONF_FACILITY, &def.syslogfacility },
+ { "SyslogLevel", 0, CONF_LEVEL, &def.sysloglevel },
+ { "VerboseLog", 0, CONF_INT, &def.verboselog },
+ { "-v", 1, CONF_INT, &def.verbosity },
+ { "Keyfile", 0, CONF_STRING, &def.keyfile },
+ { "Zonefile", 0, CONF_STRING, &def.zonefile },
+ { "KeySetDir", 0, CONF_STRING, &def.keysetdir },
+ { "DLV_Domain", 0, CONF_STRING, &def.lookaside },
+ { "Sig_Randfile", 0, CONF_STRING, &def.sig_random },
+ { "Sig_Pseudorand", 0, CONF_BOOL, &def.sig_pseudo },
+ { "Sig_GenerateDS", 1, CONF_BOOL, &def.sig_gends },
+ { "Sig_Parameter", 0, CONF_STRING, &def.sig_param },
+ { "Distribute_Cmd", 0, CONF_STRING, &def.dist_cmd },
+
+ { NULL, 0, CONF_END, NULL},
+};
+
+/*****************************************************************
+** private (static) function deklaration and definition
+*****************************************************************/
+static const char *bool2str (int val)
+{
+ return val ? "True" : "False";
+}
+
+static const char *timeint2str (ulong val)
+{
+ static char str[20+1];
+
+ if ( val == 0 )
+ snprintf (str, sizeof (str), "%lu", val / YEARSEC);
+ else if ( val % YEARSEC == 0 )
+ snprintf (str, sizeof (str), "%luy", val / YEARSEC);
+ else if ( val % WEEKSEC == 0 )
+ snprintf (str, sizeof (str), "%luw", val / WEEKSEC);
+ else if ( val % DAYSEC == 0 )
+ snprintf (str, sizeof (str), "%lud", val / DAYSEC);
+ else if ( val % HOURSEC == 0 )
+ snprintf (str, sizeof (str), "%luh", val / HOURSEC);
+ else if ( val % MINSEC == 0 )
+ snprintf (str, sizeof (str), "%lum", val / MINSEC);
+ else
+ snprintf (str, sizeof (str), "%lus", val);
+
+ return str;
+}
+
+static int set_varptr (char *entry, void *ptr)
+{
+ zconf_para_t *c;
+
+ for ( c = confpara; c->label; c++ )
+ if ( strcasecmp (entry, c->label) == 0 )
+ {
+ c->var = ptr;
+ return 1;
+ }
+ return 0;
+}
+
+static void set_all_varptr (zconf_t *cp)
+{
+ set_varptr ("zonedir", &cp->zonedir);
+ set_varptr ("recursive", &cp->recursive);
+ set_varptr ("printage", &cp->printage);
+ set_varptr ("printtime", &cp->printtime);
+ set_varptr ("leftjustify", &cp->ljust);
+
+ set_varptr ("resigninterval", &cp->resign);
+ set_varptr ("sigvalidity", &cp->sigvalidity);
+ set_varptr ("max_ttl", &cp->max_ttl);
+ set_varptr ("key_ttl", &cp->key_ttl);
+ set_varptr ("propagation", &cp->proptime);
+#if defined (DEF_TTL)
+ set_varptr ("def_ttl", &cp->def_ttl);
+#endif
+ set_varptr ("serialformat", &cp->serialform);
+
+ set_varptr ("ksk_lifetime", &cp->k_life);
+ set_varptr ("ksk_algo", &cp->k_algo);
+ set_varptr ("ksk_bits", &cp->k_bits);
+ set_varptr ("ksk_randfile", &cp->k_random);
+
+ set_varptr ("zsk_lifetime", &cp->z_life);
+ set_varptr ("zsk_algo", &cp->z_algo);
+ set_varptr ("zsk_bits", &cp->z_bits);
+ set_varptr ("zsk_randfile", &cp->z_random);
+
+ set_varptr ("--view", &cp->view);
+ set_varptr ("logfile", &cp->logfile);
+ set_varptr ("loglevel", &cp->loglevel);
+ set_varptr ("syslogfacility", &cp->syslogfacility);
+ set_varptr ("sysloglevel", &cp->sysloglevel);
+ set_varptr ("verboselog", &cp->verboselog);
+ set_varptr ("-v", &cp->verbosity);
+ set_varptr ("keyfile", &cp->keyfile);
+ set_varptr ("zonefile", &cp->zonefile);
+ set_varptr ("keysetdir", &cp->keysetdir);
+ set_varptr ("dlv_domain", &cp->lookaside);
+ set_varptr ("sig_randfile", &cp->sig_random);
+ set_varptr ("sig_pseudorand", &cp->sig_pseudo);
+ set_varptr ("sig_generateds", &cp->sig_gends);
+ set_varptr ("sig_parameter", &cp->sig_param);
+ set_varptr ("distribute_cmd", &cp->dist_cmd);
+}
+
+static void parseconfigline (char *buf, unsigned int line, zconf_t *z)
+{
+ char *end, *val, *p;
+ char *tag;
+ unsigned int len, found;
+ zconf_para_t *c;
+
+ p = &buf[strlen(buf)-1]; /* Chop off white space at eol */
+ while ( p >= buf && isspace (*p) )
+ *p-- = '\0';
+
+ for (p = buf; isspace (*p); p++ ) /* Ignore leading white space */
+ ;
+
+ /* Ignore comments and emtpy lines */
+ if ( *p == '\0' || ISCOMMENT (p) )
+ return;
+
+ tag = p;
+ /* Get the end of the first argument */
+ end = &buf[strlen(buf)-1];
+ while ( p < end && !ISDELIM (*p) ) /* Skip until delim */
+ p++;
+ *p++ = '\0'; /* Terminate this argument */
+ dbg_val1 ("Parsing \"%s\"\n", tag);
+
+
+ while ( p < end && ISDELIM (*p) ) /* Skip delim chars */
+ p++;
+
+ val = p; /* Start of the value */
+ dbg_val1 ("\tgot value \"%s\"\n", val);
+
+ /* If starting with quote, skip until next quote */
+ if ( *p == '"' || *p == '\'' )
+ {
+ p++; /* Find next quote */
+ while ( p <= end && *p && *p != *val )
+ p++;
+ *p = '\0';
+ val++; /* Skip the first quote */
+ }
+ else /* Otherwise check if there is any comment char at the end */
+ {
+ while ( p < end && *p && !ISCOMMENT(p) )
+ p++;
+ if ( ISCOMMENT (p) )
+ {
+ do /* Chop off white space before comment */
+ *p-- = '\0';
+ while ( p >= val && isspace (*p) );
+ }
+ }
+
+ /* Otherwise it is already terminated above */
+
+ found = 0;
+ c = confpara;
+ while ( !found && c->type != CONF_END )
+ {
+ len = strlen (c->label);
+ if ( strcasecmp (tag, c->label) == 0 )
+ {
+ char **str;
+ char quantity;
+ int ival;
+
+ found = 1;
+ switch ( c->type )
+ {
+ case CONF_LEVEL:
+ case CONF_FACILITY:
+ case CONF_STRING:
+ str = (char **)c->var;
+ *str = strdup (val);
+ str_untaint (*str); /* remove "bad" characters */
+ break;
+ case CONF_INT:
+ sscanf (val, "%d", (int *)c->var);
+ break;
+ case CONF_TIMEINT:
+ quantity = 'd';
+ sscanf (val, "%d%c", &ival, &quantity);
+ if ( quantity == 'm' )
+ ival *= MINSEC;
+ else if ( quantity == 'h' )
+ ival *= HOURSEC;
+ else if ( quantity == 'd' )
+ ival *= DAYSEC;
+ else if ( quantity == 'w' )
+ ival *= WEEKSEC;
+ else if ( quantity == 'y' )
+ ival *= YEARSEC;
+ (*(int *)c->var) = ival;
+ break;
+ case CONF_ALGO:
+ if ( strcasecmp (val, "rsa") == 0 || strcasecmp (val, "rsamd5") == 0 )
+ *((int *)c->var) = DK_ALGO_RSA;
+ else if ( strcasecmp (val, "dsa") == 0 )
+ *((int *)c->var) = DK_ALGO_DSA;
+ else if ( strcasecmp (val, "rsasha1") == 0 )
+ *((int *)c->var) = DK_ALGO_RSASHA1;
+ else
+ error ("Illegal algorithm \"%s\" "
+ "in line %d.\n" , val, line);
+ break;
+ case CONF_SERIAL:
+ if ( strcasecmp (val, "unixtime") == 0 )
+ *((serial_form_t *)c->var) = Unixtime;
+ else if ( strcasecmp (val, "incremental") == 0 )
+ *((serial_form_t *)c->var) = Incremental;
+ else
+ error ("Illegal serial no format \"%s\" "
+ "in line %d.\n" , val, line);
+ break;
+ case CONF_BOOL:
+ *((int *)c->var) = ISTRUE (val);
+ break;
+ default:
+ fatal ("Illegal configuration type in line %d.\n", line);
+ }
+ }
+ c++;
+ }
+ if ( !found )
+ error ("Unknown configuration statement: %s \"%s\"\n", tag, val);
+ return;
+}
+
+static void printconfigline (FILE *fp, zconf_para_t *cp)
+{
+ int i;
+
+ assert (fp != NULL);
+ assert (cp != NULL);
+
+ switch ( cp->type )
+ {
+ case CONF_COMMENT:
+ if ( cp->var )
+ fprintf (fp, "# %s\n", (char *)cp->var);
+ else
+ fprintf (fp, "\n");
+ break;
+ case CONF_LEVEL:
+ case CONF_FACILITY:
+ if ( *(char **)cp->var != NULL )
+ {
+ if ( **(char **)cp->var != '\0' )
+ {
+ char *p;
+
+ fprintf (fp, "%s:\t", cp->label);
+ for ( p = *(char **)cp->var; *p; p++ )
+ putc (toupper (*p), fp);
+ fprintf (fp, "\n");
+ }
+ else
+ fprintf (fp, "%s:\tNONE", cp->label);
+ }
+ break;
+ case CONF_STRING:
+ if ( *(char **)cp->var )
+ fprintf (fp, "%s:\t\"%s\"\n", cp->label, *(char **)cp->var);
+ break;
+ case CONF_BOOL:
+ fprintf (fp, "%s:\t%s\n", cp->label, bool2str ( *(int*)cp->var ));
+ break;
+ case CONF_TIMEINT:
+ i = *(ulong*)cp->var;
+ fprintf (fp, "%s:\t%s", cp->label, timeint2str (i));
+ if ( i )
+ fprintf (fp, "\t# (%d seconds)", i);
+ putc ('\n', fp);
+ break;
+ case CONF_ALGO:
+ i = *(int*)cp->var;
+ fprintf (fp, "%s:\t%s", cp->label, dki_algo2str (i));
+ fprintf (fp, "\t# (Algorithm ID %d)\n", i);
+ break;
+ case CONF_SERIAL:
+ fprintf (fp, "%s:\t", cp->label);
+ if ( *(serial_form_t*)cp->var == Unixtime )
+ fprintf (fp, "unixtime\n");
+ else
+ fprintf (fp, "incremental\n");
+ break;
+ case CONF_INT:
+ fprintf (fp, "%s:\t%d\n", cp->label, *(int *)cp->var);
+ break;
+ case CONF_END:
+ /* NOTREACHED */
+ break;
+ }
+}
+
+/*****************************************************************
+** public function definition
+*****************************************************************/
+
+/*****************************************************************
+** loadconfig (file, conf)
+** Loads a config file into the "conf" structure pointed to by "z".
+** If "z" is NULL then a new conf struct will be dynamically
+** allocated.
+** If no filename is given the conf struct will be initialized
+** by the builtin default config
+*****************************************************************/
+zconf_t *loadconfig (const char *filename, zconf_t *z)
+{
+ FILE *fp;
+ char buf[1023+1];
+ unsigned int line;
+
+ if ( z == NULL ) /* allocate new memory for zconf_t */
+ {
+ if ( (z = calloc (1, sizeof (zconf_t))) == NULL )
+ return NULL;
+
+ if ( filename && *filename )
+ memcpy (z, &def, sizeof (*z)); /* init new struct with defaults */
+ }
+
+ if ( filename == NULL || *filename == '\0' ) /* no file name given... */
+ {
+ dbg_val0("loadconfig (NULL)\n");
+ memcpy (z, &def, sizeof (*z)); /* ..then init with defaults */
+ return z;
+ }
+
+ dbg_val1 ("loadconfig (%s)\n", filename);
+ set_all_varptr (z);
+
+ if ( (fp = fopen(filename, "r")) == NULL )
+ fatal ("Could not open config file \"%s\"\n", filename);
+
+ line = 0;
+ while (fgets(buf, sizeof(buf), fp))
+ {
+ line++;
+
+ parseconfigline (buf, line, z);
+ }
+ fclose(fp);
+ return z;
+}
+
+# define STRCONFIG_DELIMITER ";\r\n"
+zconf_t *loadconfig_fromstr (const char *str, zconf_t *z)
+{
+ char *buf;
+ char *tok, *toksave;
+ unsigned int line;
+
+ if ( z == NULL )
+ {
+ if ( (z = calloc (1, sizeof (zconf_t))) == NULL )
+ return NULL;
+ memcpy (z, &def, sizeof (*z)); /* init with defaults */
+ }
+
+ if ( str == NULL || *str == '\0' )
+ {
+ dbg_val0("loadconfig_fromstr (NULL)\n");
+ memcpy (z, &def, sizeof (*z)); /* init with defaults */
+ return z;
+ }
+
+ dbg_val1 ("loadconfig_fromstr (\"%s\")\n", str);
+ set_all_varptr (z);
+
+ /* str is const, so we have to copy it into a new buffer */
+ if ( (buf = strdup (str)) == NULL )
+ fatal ("loadconfig_fromstr: Out of memory");
+
+ line = 0;
+ tok = strtok_r (buf, STRCONFIG_DELIMITER, &toksave);
+ while ( tok )
+ {
+ line++;
+ parseconfigline (tok, line, z);
+ tok = strtok_r (NULL, STRCONFIG_DELIMITER, &toksave);
+ }
+ free (buf);
+ return z;
+}
+
+/*****************************************************************
+** dupconfig (config)
+** duplicate config struct and return a ptr to the new struct
+*****************************************************************/
+zconf_t *dupconfig (const zconf_t *conf)
+{
+ zconf_t *z;
+
+ assert (conf != NULL);
+
+ if ( (z = calloc (1, sizeof (zconf_t))) == NULL )
+ return NULL;
+
+ memcpy (z, conf, sizeof (*conf));
+
+ return z;
+}
+
+/*****************************************************************
+** setconfigpar (entry, pval)
+*****************************************************************/
+int setconfigpar (zconf_t *config, char *entry, const void *pval)
+{
+ char *str;
+ zconf_para_t *c;
+
+ set_all_varptr (config);
+
+ for ( c = confpara; c->type != CONF_END; c++ )
+ if ( strcasecmp (entry, c->label) == 0 )
+ {
+ switch ( c->type )
+ {
+ case CONF_LEVEL:
+ case CONF_FACILITY:
+ case CONF_STRING:
+ if ( pval )
+ {
+ str = strdup ((char *)pval);
+ str_untaint (str); /* remove "bad" characters */
+ }
+ else
+ str = NULL;
+ *((char **)c->var) = str;
+ break;
+ case CONF_BOOL:
+ /* fall through */
+ case CONF_ALGO:
+ /* fall through */
+ case CONF_TIMEINT:
+ /* fall through */
+ case CONF_INT:
+ *((int *)c->var) = *((int *)pval);
+ break;
+ case CONF_SERIAL:
+ *((serial_form_t *)c->var) = *((serial_form_t *)pval);
+ break;
+ case CONF_COMMENT:
+ case CONF_END:
+ /* NOTREACHED */
+ break;
+ }
+ return 1;
+ }
+ return 0;
+}
+
+/*****************************************************************
+** printconfig (fname, config)
+*****************************************************************/
+int printconfig (const char *fname, const zconf_t *z)
+{
+ zconf_para_t *cp;
+ FILE *fp;
+
+ if ( z == NULL )
+ return 0;
+
+ fp = stdout;
+ if ( fname && *fname )
+ {
+ if ( strcmp (fname, "stdout") == 0 )
+ fp = stdout;
+ else if ( strcmp (fname, "stderr") == 0 )
+ fp = stderr;
+ else if ( (fp = fopen(fname, "w")) == NULL )
+ {
+ error ("Could not open config file \"%s\" for writing\n", fname);
+ return -1;
+ }
+ }
+
+ set_all_varptr ((zconf_t *)z);
+
+ for ( cp = confpara; cp->type != CONF_END; cp++ ) /* loop through all parameter */
+ if ( !cp->cmdline ) /* if this is not a command line parameter ? */
+ printconfigline (fp, cp); /* print it out */
+
+ if ( fp && fp != stdout && fp != stderr )
+ fclose (fp);
+
+ return 1;
+}
+
+#if 0
+/*****************************************************************
+** printconfigdiff (fname, conf_a, conf_b)
+*****************************************************************/
+int printconfigdiff (const char *fname, const zconf_t *ref, const zconf_t *z)
+{
+ zconf_para_t *cp;
+ FILE *fp;
+
+ if ( ref == NULL || z == NULL )
+ return 0;
+
+ fp = NULL;
+ if ( fname && *fname )
+ {
+ if ( strcmp (fname, "stdout") == 0 )
+ fp = stdout;
+ else if ( strcmp (fname, "stderr") == 0 )
+ fp = stderr;
+ else if ( (fp = fopen(fname, "w")) == NULL )
+ {
+ error ("Could not open config file \"%s\" for writing\n", fname);
+ return -1;
+ }
+ }
+
+ set_all_varptr ((zconf_t *)z);
+
+ for ( cp = confpara; cp->type != CONF_END; cp++ ) /* loop through all parameter */
+ {
+ if ( cp->cmdline )
+ continue;
+
+
+ printconfigline (fp, cp); /* print it out */
+ }
+
+ if ( fp && fp != stdout && fp != stderr )
+ fclose (fp);
+
+ return 1;
+}
+#endif
+
+/*****************************************************************
+** checkconfig (config)
+*****************************************************************/
+int checkconfig (const zconf_t *z)
+{
+ if ( z == NULL )
+ return 1;
+
+ if ( z->sigvalidity < (1 * DAYSEC) || z->sigvalidity > (12 * WEEKSEC) )
+ {
+ fprintf (stderr, "Signature should be valid for at least 1 day and no longer than 3 month (12 weeks)\n");
+ fprintf (stderr, "The current value is %s\n", timeint2str (z->sigvalidity));
+ }
+
+ if ( z->resign > (z->sigvalidity*5/6) - (z->max_ttl + z->proptime) )
+ {
+ fprintf (stderr, "Re-signing interval (%s) should be less than ", timeint2str (z->resign));
+ fprintf (stderr, "5/6 of sigvalidity\n");
+ }
+ if ( z->resign < (z->max_ttl + z->proptime) )
+ {
+ fprintf (stderr, "Re-signing interval (%s) should be ", timeint2str (z->resign));
+ fprintf (stderr, "greater than max_ttl (%d) plus ", z->max_ttl);
+ fprintf (stderr, "propagation time (%d)\n", z->proptime);
+ }
+
+ if ( z->max_ttl >= z->sigvalidity )
+ fprintf (stderr, "Max TTL (%d) should be less than signatur validity (%d)\n",
+ z->max_ttl, z->sigvalidity);
+
+ if ( z->z_life > (12 * WEEKSEC) * (z->z_bits / 512.) )
+ {
+ fprintf (stderr, "Lifetime of zone signing key (%s) ", timeint2str (z->z_life));
+ fprintf (stderr, "seems a little bit high ");
+ fprintf (stderr, "(In respect of key size (%d))\n", z->z_bits);
+ }
+
+ if ( z->k_life > 0 && z->k_life <= z->z_life )
+ {
+ fprintf (stderr, "Lifetime of key signing key (%s) ", timeint2str (z->k_life));
+ fprintf (stderr, "should be greater than lifetime of zsk\n");
+ }
+ if ( z->k_life > 0 && z->k_life > (26 * WEEKSEC) * (z->k_bits / 512.) )
+ {
+ fprintf (stderr, "Lifetime of key signing key (%s) ", timeint2str (z->k_life));
+ fprintf (stderr, "seems a little bit high ");
+ fprintf (stderr, "(In respect of key size (%d))\n", z->k_bits);
+ }
+
+ return 1;
+}
+
+#ifdef CONF_TEST
+const char *progname;
+static zconf_t *config;
+
+main (int argc, char *argv[])
+{
+ char *optstr;
+ int val;
+
+ progname = *argv;
+
+ config = loadconfig ("", (zconf_t *) NULL); /* load built in defaults */
+
+ while ( --argc >= 1 )
+ {
+ optstr = *++argv;
+ config = loadconfig_fromstr (optstr, config);
+ }
+
+ val = 1;
+ setconfigpar (config, "-v", &val);
+ val = 2;
+ setconfigpar (config, "verboselog", &val);
+ val = 1;
+ setconfigpar (config, "recursive", &val);
+ val = 1200;
+ setconfigpar (config, "propagation", &val);
+
+ printconfig ("stdout", config);
+}
+#endif
diff --git a/contrib/zkt/zconf.h b/contrib/zkt/zconf.h
new file mode 100644
index 0000000..de8b2ef
--- /dev/null
+++ b/contrib/zkt/zconf.h
@@ -0,0 +1,173 @@
+/*****************************************************************
+**
+** @(#) zconf.h
+**
+** Copyright (c) Jan 2005, Jeroen Masar, Holger Zuleger.
+** All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Jeroen Masar and Holger Zuleger nor the
+** names of its contributors may be used to endorse or promote products
+** derived from this software without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+#ifndef ZCONF_H
+# define ZCONF_H
+
+
+# define MINSEC 60
+# define HOURSEC (MINSEC * 60)
+# define DAYSEC (HOURSEC * 24)
+# define WEEKSEC (DAYSEC * 7)
+# define YEARSEC (DAYSEC * 365)
+# define DAY (1)
+# define WEEK (DAY * 7)
+# define MONTH (DAY * 30)
+# define YEAR (DAY * 365)
+
+# define SIG_VALID_DAYS (10) /* or 3 Weeks ? */
+# define SIG_VALIDITY (SIG_VALID_DAYS * DAYSEC)
+# define MAX_TTL ( 8 * HOURSEC) /* default value of maximum ttl time */
+# define KEY_TTL ( 4 * HOURSEC) /* default value of KEY TTL */
+# define PROPTIME ( 5 * MINSEC) /* expected slave propagation time */
+ /* should be small if notify is used */
+#if defined (DEF_TTL)
+# define DEF_TTL (MAX_TTL/2) /* currently not used */
+#endif
+
+# define RESIGN_INT ((SIG_VALID_DAYS - (SIG_VALID_DAYS / 3)) * DAYSEC)
+# define KSK_LIFETIME (1 * YEARSEC)
+#if 0
+# define ZSK_LIFETIME ((SIG_VALID_DAYS * 3) * DAYSEC) /* set to three times the sig validity */
+#else
+# define ZSK_LIFETIME ((MONTH * 3) * DAYSEC) /* set fixed to 3 month */
+#endif
+
+# define KSK_ALGO (DK_ALGO_RSASHA1)
+# define KSK_BITS (1300)
+# define KSK_RANDOM "/dev/urandom" /* was NULL before v0.94 */
+# define ZSK_ALGO (DK_ALGO_RSASHA1)
+# define ZSK_BITS (512)
+# define ZSK_RANDOM "/dev/urandom"
+
+# define ZONEDIR "."
+# define RECURSIVE 0
+# define PRINTTIME 1
+# define PRINTAGE 0
+# define LJUST 0
+# define KEYSETDIR NULL /* keysets */
+# define LOGFILE ""
+# define LOGLEVEL "error"
+# define SYSLOGFACILITY "none"
+# define SYSLOGLEVEL "notice"
+# define VERBOSELOG 0
+# define ZONEFILE "zone.db"
+# define DNSKEYFILE "dnskey.db"
+# define LOOKASIDEDOMAIN "" /* "dlv.trusted-keys.de" */
+# define SIG_RANDOM NULL /* "/dev/urandom" */
+# define SIG_PSEUDO 1
+# define SIG_GENDS 1
+# define SIG_PARAM ""
+# define DIST_CMD NULL /* default is to run "rndc reload" */
+
+#ifndef CONFIG_PATH
+# define CONFIG_PATH "/var/named/"
+#endif
+# define CONFIG_FILE CONFIG_PATH "dnssec.conf"
+# define LOCALCONF_FILE "dnssec.conf"
+
+/* external command execution path (should be set via config.h) */
+#ifndef BIND_UTIL_PATH
+# define BIND_UTIL_PATH "/usr/local/sbin/" /* beware of trailing '/' */
+#endif
+# define SIGNCMD BIND_UTIL_PATH "dnssec-signzone"
+# define KEYGENCMD BIND_UTIL_PATH "dnssec-keygen"
+# define RELOADCMD BIND_UTIL_PATH "rndc"
+
+typedef enum {
+ Unixtime = 1,
+ Incremental
+} serial_form_t;
+
+typedef enum {
+ none = 0,
+ user,
+ local0, local1, local2, local3, local4, local5, local6, local7
+} syslog_facility_t;
+
+typedef struct zconf {
+ char *zonedir;
+ int recursive;
+ int printtime;
+ int printage;
+ int ljust;
+ int sigvalidity; /* should be less than expire time */
+ int max_ttl; /* should be set to the maximum used ttl in the zone */
+ int key_ttl;
+ int proptime; /* expected time offset for zone propagation */
+#if defined (DEF_TTL)
+ int def_ttl; /* default ttl set in soa record */
+#endif
+ serial_form_t serialform; /* format of serial no */
+ int resign; /* resign interval */
+
+ int k_life;
+ int k_algo;
+ int k_bits;
+ char *k_random;
+ int z_life;
+ int z_algo;
+ int z_bits;
+ char *z_random;
+
+ char *view;
+ // char *errlog;
+ char *logfile;
+ char *loglevel;
+ char *syslogfacility;
+ char *sysloglevel;
+ int verboselog;
+ int verbosity;
+ char *keyfile;
+ char *zonefile;
+ char *keysetdir;
+ char *lookaside;
+ char *sig_random;
+ int sig_pseudo;
+ int sig_gends;
+ char *sig_param;
+ char *dist_cmd; /* cmd to run instead of "rndc reload" */
+} zconf_t;
+
+extern zconf_t *loadconfig (const char *filename, zconf_t *z);
+extern zconf_t *loadconfig_fromstr (const char *str, zconf_t *z);
+extern zconf_t *dupconfig (const zconf_t *conf);
+extern int setconfigpar (zconf_t *conf, char *entry, const void *pval);
+extern int printconfig (const char *fname, const zconf_t *cp);
+extern int checkconfig (const zconf_t *z);
+
+#endif
diff --git a/contrib/zkt/zkt-soaserial.c b/contrib/zkt/zkt-soaserial.c
new file mode 100644
index 0000000..ff107d9
--- /dev/null
+++ b/contrib/zkt/zkt-soaserial.c
@@ -0,0 +1,222 @@
+/*****************************************************************
+**
+** @(#) zkt-soaserial.c (c) Oct 2007 Holger Zuleger hznet.de
+**
+** A small utility to print out the (unixtime) soa serial
+** number in a human readable form
+**
+** Copyright (c) Oct 2007, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+# include <stdio.h>
+# include <string.h>
+# include <sys/types.h>
+# include <time.h>
+# include <utime.h>
+# include <assert.h>
+# include <stdlib.h>
+# include <ctype.h>
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+# include "config_zkt.h"
+
+static const char *progname;
+
+static char *timestr (time_t sec);
+static int read_serial_fromfile (const char *fname, unsigned long *serial);
+static void printserial (const char *fname, unsigned long serial);
+static void usage (const char *msg);
+
+/*****************************************************************
+** timestr (sec)
+*****************************************************************/
+static char *timestr (time_t sec)
+{
+ struct tm *t;
+ static char timestr[31+1]; /* 27+1 should be enough */
+
+#if defined(HAVE_STRFTIME) && HAVE_STRFTIME
+ t = localtime (&sec);
+ strftime (timestr, sizeof (timestr), "%b %d %Y %T %z", t);
+#else
+ static char *mstr[] = {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+ };
+ int h, s;
+
+ t = localtime (&sec);
+ s = abs (t->tm_gmtoff);
+ h = t->tm_gmtoff / 3600;
+ s = t->tm_gmtoff % 3600;
+ snprintf (timestr, sizeof (timestr), "%s %2d %4d %02d:%02d:%02d %c%02d%02d",
+ mstr[t->tm_mon], t->tm_mday, t->tm_year + 1900,
+ t->tm_hour, t->tm_min, t->tm_sec,
+ t->tm_gmtoff < 0 ? '-': '+',
+ h, s);
+#endif
+
+ return timestr;
+}
+
+
+/****************************************************************
+**
+** int read_serial_fromfile (filename)
+**
+** This function depends on a special syntax formating the
+** SOA record in the zone file!!
+**
+** To match the SOA record, the SOA RR must be formatted
+** like this:
+** @ IN SOA <master.fq.dn.> <hostmaster.fq.dn.> (
+** <SPACEes or TABs> 1234567890; serial number
+** <SPACEes or TABs> 86400 ; other values
+** ...
+**
+****************************************************************/
+static int read_serial_fromfile (const char *fname, unsigned long *serial)
+{
+ FILE *fp;
+ char buf[4095+1];
+ char master[254+1];
+ int c;
+ int soafound;
+
+ if ( (fp = fopen (fname, "r")) == NULL )
+ return -1; /* file not found */
+
+ /* read until the line matches the beginning of a soa record ... */
+ soafound = 0;
+ while ( !soafound && fgets (buf, sizeof buf, fp) )
+ {
+ if ( sscanf (buf, "%*s %*d IN SOA %255s %*s (\n", master) == 1 )
+ soafound = 1;
+ else if ( sscanf (buf, "%*s IN SOA %255s %*s (\n", master) == 1 )
+ soafound = 1;
+ }
+
+ if ( !soafound )
+ return -2; /* no zone file (soa not found) */
+
+ /* move forward until any non ws is reached */
+ while ( (c = getc (fp)) != EOF && isspace (c) )
+ ;
+ ungetc (c, fp); /* pushback the non ws */
+
+ *serial = 0L; /* read in the current serial number */
+ if ( fscanf (fp, "%lu", serial) != 1 ) /* try to get serial no */
+ return -3; /* no serial number found */
+
+ fclose (fp);
+
+ return 0; /* ok! */
+}
+
+/*****************************************************************
+** printserial()
+*****************************************************************/
+static void printserial (const char *fname, unsigned long serial)
+{
+ if ( fname && *fname )
+ printf ("%-30s\t", fname);
+
+ printf ("%10lu", serial);
+
+ /* try to guess the soa serial format */
+ if ( serial < 1136070000L ) /* plain integer (this is 2006-1-1 00:00 in unixtime format) */
+ ;
+ else if ( serial > 2006010100L ) /* date format */
+ {
+ int y, m, d, v;
+
+ v = serial % 100;
+ serial /= 100;
+ d = serial % 100;
+ serial /= 100;
+ m = serial % 100;
+ serial /= 100;
+ y = serial;
+
+ printf ("\t%d-%02d-%02d Version %02d", y, m, d, v);
+ }
+ else /* unixtime */
+ printf ("\t%s\n", timestr (serial) );
+
+ printf ("\n");
+}
+
+/*****************************************************************
+** usage (msg)
+*****************************************************************/
+static void usage (const char *msg)
+{
+ if ( msg && *msg )
+ fprintf (stderr, "%s\n", msg);
+ fprintf (stderr, "usage: %s {-s serial | signed_zonefile [...]}\n", progname);
+
+ exit (1);
+}
+
+/*****************************************************************
+** main()
+*****************************************************************/
+int main (int argc, char *argv[])
+{
+ unsigned long serial;
+
+ progname = *argv;
+
+ if ( --argc == 0 )
+ usage ("");
+
+ if ( argv[1][0] == '-' )
+ {
+ if ( argv[1][1] != 's' )
+ usage ("illegal option");
+
+ if ( argc != 2 )
+ usage ("Option -s requires an argument");
+
+ serial = atol (argv[2]);
+ printserial ("", serial);
+ }
+ else
+ while ( argc-- > 0 )
+ if ( (read_serial_fromfile (*++argv, &serial)) != 0 )
+ fprintf (stderr, "couldn't read serial number from file %s\n", *argv);
+ else
+ printserial (*argv, serial);
+
+ return 0;
+}
diff --git a/contrib/zkt/zkt.c b/contrib/zkt/zkt.c
new file mode 100644
index 0000000..e699842
--- /dev/null
+++ b/contrib/zkt/zkt.c
@@ -0,0 +1,354 @@
+/*****************************************************************
+**
+** @(#) zkt.c -- A library for managing a list of dns zone files.
+**
+** Copyright (c) 2005 - 2008, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+# include <stdio.h>
+# include <string.h>
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+# include "config_zkt.h"
+# include "dki.h"
+# include "misc.h"
+# include "strlist.h"
+# include "zconf.h"
+#define extern
+# include "zkt.h"
+#undef extern
+
+extern char *labellist;
+extern int headerflag;
+extern int timeflag;
+extern int exptimeflag;
+extern int lifetime;
+extern int ageflag;
+extern int lifetimeflag;
+extern int kskflag;
+extern int zskflag;
+extern int pathflag;
+extern int ljustflag;
+
+static void printkeyinfo (const dki_t *dkp, const char *oldpath);
+
+static void printkeyinfo (const dki_t *dkp, const char *oldpath)
+{
+ time_t currtime;
+
+ if ( dkp == NULL ) /* print headline */
+ {
+ if ( headerflag )
+ {
+ printf ("%-33.33s %5s %3s %3.3s %-7s", "Keyname",
+ "Tag", "Typ", "Status", "Algorit");
+ if ( timeflag )
+ printf (" %-20s", "Generation Time");
+ if ( exptimeflag )
+ printf (" %-20s", "Expiration Time");
+ if ( ageflag )
+ printf (" %16s", "Age");
+ if ( lifetimeflag )
+ printf (" %4s", "LfTm");
+ putchar ('\n');
+ }
+ return;
+ }
+ time (&currtime);
+
+ /* TODO: use next line if dname is dynamically allocated */
+ /* if ( pathflag && dkp->dname && strcmp (oldpath, dkp->dname) != 0 ) */
+ if ( pathflag && strcmp (oldpath, dkp->dname) != 0 )
+ printf ("%s/\n", dkp->dname);
+
+ if ( (kskflag && dki_isksk (dkp)) || (zskflag && !dki_isksk (dkp)) )
+ {
+ if ( ljustflag )
+ printf ("%-33.33s ", dkp->name);
+ else
+ printf ("%33.33s ", dkp->name);
+ printf ("%05d ", dkp->tag);
+ printf ("%3s ", dki_isksk (dkp) ? "KSK" : "ZSK");
+ printf ("%-3.3s ", dki_statusstr (dkp) );
+ printf ("%-7s", dki_algo2str(dkp->algo));
+ if ( timeflag )
+ printf (" %-20s", time2str (dkp->gentime ? dkp->gentime: dkp->time, 's'));
+ if ( exptimeflag )
+ printf (" %-20s", time2str (dkp->exptime, 's'));
+ if ( ageflag )
+ printf (" %16s", age2str (dki_age (dkp, currtime)));
+ if ( lifetimeflag && dkp->lifetime )
+ {
+ if ( dkp->status == 'a' )
+ printf ("%c", (currtime < dkp->time + dkp->lifetime) ? '<' : '!');
+ else
+ putchar (' ');
+ printf ("%hdd", dki_lifetimedays (dkp));
+ }
+ putchar ('\n');
+ }
+}
+
+#if defined(USE_TREE) && USE_TREE
+static void list_key (const dki_t **nodep, const VISIT which, int depth)
+{
+ const dki_t *dkp;
+ static const char *oldpath = "";
+
+ if ( nodep == NULL )
+ return;
+//fprintf (stderr, "listkey %d %d %s\n", which, depth, dkp->name);
+
+ if ( which == INORDER || which == LEAF )
+ {
+ dkp = *nodep;
+ while ( dkp ) /* loop through list */
+ {
+ if ( labellist == NULL || isinlist (dkp->name, labellist) )
+ printkeyinfo (dkp, oldpath); /* print entry */
+ oldpath = dkp->dname;
+ dkp = dkp->next;
+ }
+ }
+}
+#endif
+
+void zkt_list_keys (const dki_t *data)
+{
+#if ! defined(USE_TREE) || !USE_TREE
+ const dki_t *dkp;
+ const char *oldpath;
+#endif
+
+ if ( data ) /* print headline if list is not empty */
+ printkeyinfo (NULL, "");
+
+#if defined(USE_TREE) && USE_TREE
+ twalk (data, list_key);
+#else
+ oldpath = "";
+ for ( dkp = data; dkp; dkp = dkp->next ) /* loop through list */
+ {
+ if ( labellist == NULL || isinlist (dkp->name, labellist) )
+ printkeyinfo (dkp, oldpath); /* print entry */
+ oldpath = dkp->dname;
+ }
+#endif
+}
+
+#if defined(USE_TREE) && USE_TREE
+static void list_trustedkey (const dki_t **nodep, const VISIT which, int depth)
+{
+ const dki_t *dkp;
+
+ if ( nodep == NULL )
+ return;
+
+ dkp = *nodep;
+//fprintf (stderr, "list_trustedkey %d %d %s\n", which, depth, dkp->name);
+ if ( which == INORDER || which == LEAF )
+ while ( dkp ) /* loop through list */
+ {
+ if ( (dki_isksk (dkp) || zskflag) &&
+ (labellist == NULL || isinlist (dkp->name, labellist)) )
+ dki_prt_trustedkey (dkp, stdout);
+ dkp = dkp->next;
+ }
+}
+#endif
+
+void zkt_list_trustedkeys (const dki_t *data)
+{
+#if !defined(USE_TREE) || !USE_TREE
+ const dki_t *dkp;
+#endif
+ /* print headline if list is not empty */
+ if ( data && headerflag )
+ printf ("trusted-keys {\n");
+
+#if defined(USE_TREE) && USE_TREE
+ twalk (data, list_trustedkey);
+#else
+
+ for ( dkp = data; dkp; dkp = dkp->next ) /* loop through list */
+ if ( (dki_isksk (dkp) || zskflag) &&
+ (labellist == NULL || isinlist (dkp->name, labellist)) )
+ dki_prt_trustedkey (dkp, stdout);
+#endif
+
+ /* print end of trusted-key section */
+ if ( data && headerflag )
+ printf ("};\n");
+}
+
+#if defined(USE_TREE) && USE_TREE
+static void list_dnskey (const dki_t **nodep, const VISIT which, int depth)
+{
+ const dki_t *dkp;
+ int ksk;
+
+ if ( nodep == NULL )
+ return;
+
+ if ( which == INORDER || which == LEAF )
+ for ( dkp = *nodep; dkp; dkp = dkp->next )
+ {
+ ksk = dki_isksk (dkp);
+ if ( (ksk && !kskflag) || (!ksk && !zskflag) )
+ continue;
+
+ if ( labellist == NULL || isinlist (dkp->name, labellist) )
+ {
+ if ( headerflag )
+ dki_prt_comment (dkp, stdout);
+ dki_prt_dnskey (dkp, stdout);
+ }
+ }
+}
+#endif
+
+void zkt_list_dnskeys (const dki_t *data)
+{
+#if defined(USE_TREE) && USE_TREE
+ twalk (data, list_dnskey);
+#else
+ const dki_t *dkp;
+ int ksk;
+
+ for ( dkp = data; dkp; dkp = dkp->next )
+ {
+ ksk = dki_isksk (dkp);
+ if ( (ksk && !kskflag) || (!ksk && !zskflag) )
+ continue;
+
+ if ( labellist == NULL || isinlist (dkp->name, labellist) )
+ {
+ if ( headerflag )
+ dki_prt_comment (dkp, stdout);
+ dki_prt_dnskey (dkp, stdout);
+ }
+ }
+#endif
+}
+
+#if defined(USE_TREE) && USE_TREE
+static void set_keylifetime (const dki_t **nodep, const VISIT which, int depth)
+{
+ const dki_t *dkp;
+ int ksk;
+
+ if ( nodep == NULL )
+ return;
+
+ if ( which == INORDER || which == LEAF )
+ for ( dkp = *nodep; dkp; dkp = dkp->next )
+ {
+ ksk = dki_isksk (dkp);
+ if ( (ksk && !kskflag) || (!ksk && !zskflag) )
+ continue;
+
+ if ( labellist == NULL || isinlist (dkp->name, labellist) )
+ dki_setlifetime ((dki_t *)dkp, lifetime);
+ }
+}
+#endif
+
+void zkt_setkeylifetime (dki_t *data)
+{
+#if defined(USE_TREE) && USE_TREE
+ twalk (data, set_keylifetime);
+#else
+ dki_t *dkp;
+ int ksk;
+
+ for ( dkp = data; dkp; dkp = dkp->next )
+ {
+ ksk = dki_isksk (dkp);
+ if ( (ksk && !kskflag) || (!ksk && !zskflag) )
+ continue;
+
+ if ( labellist == NULL || isinlist (dkp->name, labellist) )
+ {
+ dki_setlifetime (dkp, lifetime);
+ }
+ }
+#endif
+}
+
+
+#if defined(USE_TREE) && USE_TREE
+static const dki_t *searchresult;
+static int searchitem;
+static void tag_search (const dki_t **nodep, const VISIT which, int depth)
+{
+ const dki_t *dkp;
+
+ if ( nodep == NULL )
+ return;
+
+ if ( which == PREORDER || which == LEAF )
+ for ( dkp = *nodep; dkp; dkp = dkp->next )
+ {
+ if ( dkp->tag == searchitem )
+ {
+ if ( searchresult == NULL )
+ searchresult = dkp;
+ else
+ searchitem = 0;
+ }
+ }
+}
+#endif
+const dki_t *zkt_search (const dki_t *data, int searchtag, const char *keyname)
+{
+ const dki_t *dkp = NULL;
+
+#if defined(USE_TREE) && USE_TREE
+ if ( keyname == NULL || *keyname == '\0' )
+ {
+ searchresult = NULL;
+ searchitem = searchtag;
+ twalk (data, tag_search);
+ if ( searchresult != NULL && searchitem == 0 )
+ dkp = (void *)01;
+ else
+ dkp = searchresult;
+ }
+ else
+ dkp = (dki_t*)dki_tsearch (data, searchtag, keyname);
+#else
+ dkp = (dki_t*)dki_search (data, searchtag, keyname);
+#endif
+ return dkp;
+}
+
diff --git a/contrib/zkt/zkt.h b/contrib/zkt/zkt.h
new file mode 100644
index 0000000..2f3398d
--- /dev/null
+++ b/contrib/zkt/zkt.h
@@ -0,0 +1,46 @@
+/*****************************************************************
+**
+** @(#) zkt.h (c) 2005 - 2008 Holger Zuleger hznet.de
+**
+** Copyright (c) 2005 - 2008, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+#ifndef ZKT_H
+# define ZKT_H
+
+extern const dki_t *zkt_search (const dki_t *data, int searchtag, const char *keyname);
+extern void zkt_list_keys (const dki_t *data);
+extern void zkt_list_trustedkeys (const dki_t *data);
+extern void zkt_list_dnskeys (const dki_t *data);
+extern void zkt_setkeylifetime (dki_t *data);
+
+#endif
diff --git a/contrib/zkt/zone.c b/contrib/zkt/zone.c
new file mode 100644
index 0000000..dec214e
--- /dev/null
+++ b/contrib/zkt/zone.c
@@ -0,0 +1,336 @@
+/*****************************************************************
+**
+** @(#) zone.c (c) Mar 2005 Holger Zuleger hznet.de
+**
+** Copyright (c) Mar 2005, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+# include <stdio.h>
+# include <string.h>
+# include <stdlib.h>
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <dirent.h>
+# include <assert.h>
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+# include "config_zkt.h"
+# include "debug.h"
+# include "domaincmp.h"
+# include "misc.h"
+# include "zconf.h"
+# include "dki.h"
+#define extern
+# include "zone.h"
+#undef extern
+
+/*****************************************************************
+** private (static) function declaration and definition
+*****************************************************************/
+static char zone_estr[255+1];
+
+/*****************************************************************
+** zone_alloc ()
+*****************************************************************/
+static zone_t *zone_alloc ()
+{
+ zone_t *zp;
+
+ if ( (zp = malloc (sizeof (zone_t))) )
+ {
+ memset (zp, 0, sizeof (zone_t));
+ return zp;
+ }
+
+ snprintf (zone_estr, sizeof (zone_estr),
+ "zone_alloc: Out of memory");
+ return NULL;
+}
+
+/*****************************************************************
+** zone_cmp () return <0 | 0 | >0
+*****************************************************************/
+static int zone_cmp (const zone_t *a, const zone_t *b)
+{
+ if ( a == NULL ) return -1;
+ if ( b == NULL ) return 1;
+
+ return domaincmp (a->zone, b->zone);
+}
+
+
+/*****************************************************************
+** public function definition
+*****************************************************************/
+
+/*****************************************************************
+** zone_free ()
+*****************************************************************/
+void zone_free (zone_t *zp)
+{
+ assert (zp != NULL);
+
+ if ( zp->zone ) free ((char *)zp->zone);
+ if ( zp->dir ) free ((char *)zp->dir);
+ if ( zp->file ) free ((char *)zp->file);
+ if ( zp->sfile ) free ((char *)zp->sfile);
+#if 0
+ /* TODO: actually there are some problems freeing the config :-( */
+ if ( zp->conf ) free ((zconf_t *)zp->conf);
+#endif
+ if ( zp->keys ) dki_freelist (&zp->keys);
+ free (zp);
+}
+
+/*****************************************************************
+** zone_freelist ()
+*****************************************************************/
+void zone_freelist (zone_t **listp)
+{
+ zone_t *curr;
+ zone_t *next;
+
+ assert (listp != NULL);
+
+ curr = *listp;
+ while ( curr )
+ {
+ next = curr->next;
+ zone_free (curr);
+ curr = next;
+ }
+ if ( *listp )
+ *listp = NULL;
+}
+
+/*****************************************************************
+** zone_new ()
+** allocate memory for new zone structure and initialize it
+*****************************************************************/
+zone_t *zone_new (zone_t **zp, const char *zone, const char *dir, const char *file, const char *signed_ext, const zconf_t *cp)
+{
+ char path[MAX_PATHSIZE+1];
+ zone_t *new;
+
+ assert (zp != NULL);
+ assert (zone != NULL && *zone != '\0');
+
+ dbg_val3 ("zone_new: (zp, zone: %s, dir: %s, file: %s, cp)\n", zone, dir, file);
+ if ( dir == NULL || *dir == '\0' )
+ dir = ".";
+
+ if ( file == NULL || *file == '\0' )
+ file = cp->zonefile;
+ else
+ { /* check if file contains a path */
+ const char *p;
+ if ( (p = strrchr (file, '/')) != NULL )
+ {
+ snprintf (path, sizeof (path), "%s/%.*s", dir, p-file, file);
+ dir = path;
+ file = p+1;
+ }
+ }
+
+ if ( (new = zone_alloc ()) != NULL )
+ {
+ char *p;
+
+ new->zone = str_tolowerdup (zone);
+ new->dir = strdup (dir);
+ new->file = strdup (file);
+ /* check if file ends with ".signed" ? */
+ if ( (p = strrchr (new->file, '.')) != NULL && strcmp (p, signed_ext) == 0 )
+ {
+ new->sfile = strdup (new->file);
+ *p = '\0';
+ }
+ else
+ {
+ snprintf (path, sizeof (path), "%s%s", file, signed_ext);
+ new->sfile = strdup (path);
+ }
+ new->conf = cp;
+ new->keys = NULL;
+ dki_readdir (new->dir, &new->keys, 0);
+ new->next = NULL;
+ }
+
+ return zone_add (zp, new);
+}
+
+/*****************************************************************
+** zone_readdir ()
+*****************************************************************/
+int zone_readdir (const char *dir, const char *zone, const char *zfile, zone_t **listp, const zconf_t *conf, int dyn_zone)
+{
+ char *p;
+ char path[MAX_PATHSIZE+1];
+ char *signed_ext = ".signed";
+
+ assert (dir != NULL && *dir != '\0');
+ assert (conf != NULL);
+
+ if ( zone == NULL ) /* zone not given ? */
+ {
+ if ( (zone = strrchr (dir, '/')) ) /* try to extract zone name out of directory */
+ zone++;
+ else
+ zone = dir;
+ }
+ dbg_val4 ("zone_readdir: (dir: %s, zone: %s, zfile: %s zp, cp, dyn_zone = %d)\n",
+ dir, zone, zfile ? zfile: "NULL", dyn_zone);
+
+ if ( dyn_zone )
+ signed_ext = ".dsigned";
+
+ if ( zfile && (p = strrchr (zfile, '/')) ) /* check if zfile contains a directory */
+ {
+ char subdir[MAX_PATHSIZE+1];
+
+ snprintf (subdir, sizeof (subdir), "%s/%.*s", dir, p - zfile, zfile);
+ pathname (path, sizeof (path), subdir, LOCALCONF_FILE, NULL);
+ }
+ else
+ pathname (path, sizeof (path), dir, LOCALCONF_FILE, NULL);
+ dbg_val1 ("zone_readdir: check local config file %s\n", path);
+ if ( fileexist (path) ) /* load local config file */
+ {
+ zconf_t *localconf;
+
+ localconf = dupconfig (conf);
+ conf = loadconfig (path, localconf);
+ }
+
+ if ( zfile == NULL )
+ {
+ zfile = conf->zonefile;
+ pathname (path, sizeof (path), dir, zfile, signed_ext);
+ }
+ else
+ {
+ dbg_val2("zone_readdir: add %s to zonefile if not already there ? (%s)\n", signed_ext, zfile);
+ if ( (p = strrchr (zfile, '.')) == NULL || strcmp (p, signed_ext) != 0 )
+ pathname (path, sizeof (path), dir, zfile, signed_ext);
+ else
+ pathname (path, sizeof (path), dir, zfile, NULL);
+ }
+
+ dbg_val1("zone_readdir: fileexist (%s): ", path);
+ if ( !fileexist (path) ) /* no .signed file found ? ... */
+ {
+ dbg_val0("no!\n");
+ return 0; /* ... not a secure zone ! */
+ }
+ dbg_val0("yes!\n");
+
+ dbg_val("zone_readdir: add zone (%s)\n", zone);
+ zone_new (listp, zone, dir, zfile, signed_ext, conf);
+
+ return 1;
+}
+
+
+/*****************************************************************
+** zone_geterrstr ()
+** return error string
+*****************************************************************/
+const char *zone_geterrstr ()
+{
+ return zone_estr;
+}
+
+/*****************************************************************
+** zone_add ()
+*****************************************************************/
+zone_t *zone_add (zone_t **list, zone_t *new)
+{
+ zone_t *curr;
+ zone_t *last;
+
+ if ( list == NULL )
+ return NULL;
+ if ( new == NULL )
+ return *list;
+
+ last = curr = *list;
+ while ( curr && zone_cmp (curr, new) < 0 )
+ {
+ last = curr;
+ curr = curr->next;
+ }
+
+ if ( curr == *list ) /* add node at the beginning of the list */
+ *list = new;
+ else /* add node at end or between two nodes */
+ last->next = new;
+ new->next = curr;
+
+ return new;
+}
+
+/*****************************************************************
+** zone_search ()
+*****************************************************************/
+const zone_t *zone_search (const zone_t *list, const char *zone)
+{
+ if ( zone == NULL || *zone == '\0' )
+ return NULL;
+
+ while ( list && strcmp (zone, list->zone) != 0 )
+ list = list->next;
+
+ return list;
+}
+
+/*****************************************************************
+** zone_print ()
+*****************************************************************/
+int zone_print (const char *mesg, const zone_t *z)
+{
+ dki_t *dkp;
+
+ if ( !z )
+ return 0;
+ fprintf (stderr, "%s: zone\t %s\n", mesg, z->zone);
+ fprintf (stderr, "%s: dir\t %s\n", mesg, z->dir);
+ fprintf (stderr, "%s: file\t %s\n", mesg, z->file);
+ fprintf (stderr, "%s: sfile\t %s\n", mesg, z->sfile);
+
+ for ( dkp = z->keys; dkp; dkp = dkp->next )
+ {
+ dki_prt_comment (dkp, stderr);
+ }
+
+ return 1;
+}
diff --git a/contrib/zkt/zone.h b/contrib/zkt/zone.h
new file mode 100644
index 0000000..e785796
--- /dev/null
+++ b/contrib/zkt/zone.h
@@ -0,0 +1,66 @@
+/*****************************************************************
+**
+** @(#) zone.h -- Header file for zone info
+**
+** Copyright (c) Mar 2005, Holger Zuleger HZnet. All rights reserved.
+**
+** This software is open source.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+**
+** Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+**
+** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
+** be used to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************/
+#ifndef ZONE_H
+# define ZONE_H
+
+# include <sys/types.h>
+# include <stdio.h>
+# include <time.h>
+# include "dki.h"
+
+/* all we have to know about a zone */
+typedef struct Zone {
+ const char *zone; /* domain name or label */
+ const char *dir; /* directory of zone data */
+ const char *file; /* file name (zone.db) */
+ const char *sfile; /* file name of secured zone (zone.db.signed) */
+ const zconf_t *conf; /* ptr to config */ /* TODO: Should this be only a ptr to a local config ? */
+ dki_t *keys; /* ptr to keylist */
+ struct Zone *next; /* ptr to next entry in list */
+} zone_t;
+
+extern void zone_free (zone_t *zp);
+extern void zone_freelist (zone_t **listp);
+extern zone_t *zone_new (zone_t **zp, const char *zone, const char *dir, const char *file, const char *signed_ext, const zconf_t *cp);
+extern const char *zone_geterrstr ();
+extern zone_t *zone_add (zone_t **list, zone_t *new);
+extern const zone_t *zone_search (const zone_t *list, const char *name);
+extern int zone_readdir (const char *dir, const char *zone, const char *zfile, zone_t **listp, const zconf_t *conf, int dyn_zone);
+extern const char *zone_geterrstr (void);
+extern int zone_print (const char *mesg, const zone_t *z);
+
+#endif