Update 'Kanzlei-Kiel'.
This commit is contained in:
		
							
								
								
									
										376
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/CHANGES
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										376
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/CHANGES
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,376 @@ | ||||
| 19991129 | ||||
| 	version: dnscache 0.50, alpha. not released yet. | ||||
| 19991223 | ||||
| 	version: dnscache 0.60, alpha. | ||||
| 19991224 | ||||
| 	internal: dns_sortip() takes length argument. | ||||
| 	api: dns_ip4() sorts output. currently this means just random. | ||||
| 	api: added socket_bind4_reuse(). removed reuse from bind4(). | ||||
| 	ui: used bind4_reuse() for port 53, bind4() otherwise. | ||||
| 	internal: eliminated some unused variables. | ||||
| 	internal: prototypes in cdb.h, cdbmake.h, cdbmss.h. | ||||
| 	internal: prototypes in case.h, env.h, fmt.h, scan.h, str.h. | ||||
| 	internal: prototypes in stralloc.h. | ||||
| 	internal: prototypes in error.h, strerr.h. | ||||
| 	internal: prototypes in ndelay.h, open.h, seek.h. | ||||
| 	internal: prototypes in sgetopt.h, subgetopt.h. | ||||
| 	internal: prototypes in tai.h, taia.h. | ||||
| 	internal: added some missing declarations. | ||||
| 	bug: query.c checked void response_finishanswer() return code. | ||||
| 		impact: cached responses were dropped on systems that | ||||
| 		didn't follow the traditional C return behavior. fix: | ||||
| 		obvious. tnx Giles Lean. | ||||
| 	internal: switched from taia_addsec() to taia_uint(). | ||||
| 	api: switched to uint16 for socket_* port numbers. | ||||
| 	internal: integrated uint16_pack() and friends. | ||||
| 	ui: dnscache allows (recursive) queries from port 53. | ||||
| 	ui: dnscache has 10-second idle timer on TCP read/write. | ||||
| 	ui: dnscache limits itself to 20 concurrent TCP connections. | ||||
| 	internal: moved dns_domain_fromdot() to separate file. | ||||
| 	ui: supported \X, \1, \12, \123 in dns_domain_fromdot(). | ||||
| 	ui: supported \123 in dns_domain_todot_append(). | ||||
| 	version: dnscache 0.61, alpha. | ||||
| 19991230 | ||||
| 	api: added dns_ip4_qualify(). | ||||
| 	api: added dns_resolvconfrewrite(). | ||||
| 	ui: added dnsipq. | ||||
| 	api: dns_ip4() checks for (strings of) IP addresses. | ||||
| 20000106 | ||||
| 	port: Solaris needs /dev/udp, not just /dev/tcp. impact: | ||||
| 		dnscache and tinydns would stop immediately under | ||||
| 		Solaris. fix: create /dev/udp in configure; and have | ||||
| 		tinydns create socket before chroot. tnx Louis Theran. | ||||
| 	internal: moved dns_name4_domain() to dns_nd.c. | ||||
| 	ui: tinydns no longer excludes screwy queries from its log. | ||||
| 	internal: moved respond() to tdlookup.c under new name. | ||||
| 	ui: added tinydns-get. | ||||
| 	ui: rewrote tinydns-data for new data format. | ||||
| 	internal: expanded rts to cover tinydns-data using tinydns-get. | ||||
| 20000107 | ||||
| 	ui: tinydns-data allows arbitrary case in domain names. | ||||
| 	ui: dnscache supports preconfigured servers for non-root | ||||
| 		domains. | ||||
| 	ui: dnscache uses textual addresses for preconfigured servers. | ||||
| 20000108 | ||||
| 	ui: tinydns-data excludes the additional and authority sections | ||||
| 		if doing so helps meet the 512-byte UDP limit. | ||||
| 	version: dnscache 0.70, beta. | ||||
| 20000114 | ||||
| 	internal: in log.c, ulong() now prints a uint64. | ||||
| 	internal: added cache_motion, query_count, log_stats. | ||||
| 	ui: dnscache now prints queries/motion stats after typical | ||||
| 		response packets. | ||||
| 20000115 | ||||
| 	internal: added droproot.c. used in tinydns and dnscache. | ||||
| 	internal: moved tinydns log() to qlog.c under new name. | ||||
| 	ui: added walldns, configure-wd. | ||||
| 	ui: configure-td now creates an empty root/data. | ||||
| 	ui: added tinydns-edit. | ||||
| 	ui: configure-td now sets up root/add-{ns,childns,host,mx}. | ||||
| 20000116 | ||||
| 	ui: renamed configure* as *-conf. | ||||
| 	ui: added axfrdns, axfrdns-conf. | ||||
| 	ui: added axfr-get. | ||||
| 	ui: dnscache-conf 10.* or 192.168.* now sets IPSEND=0.0.0.0. | ||||
| 20000117 | ||||
| 	ui: added pickdns, pickdns-conf, pickdns-data. | ||||
| 	version: dnscache 0.75, beta. | ||||
| 20000118 | ||||
| 	internal: address* -> address_* in pickdns-data.c. | ||||
| 	internal: start writing cdb earlier in pickdns-data.c. | ||||
| 	internal: keep track of namelen in pickdns-data.c. | ||||
| 	ui: added client-location variability to pickdns, pickdns-data. | ||||
| 	ui: qlog logs short packets. | ||||
| 	ui: qlog logs header if RD or other unusual bits are set. | ||||
| 	ui: qlog logs non-Internet classes. | ||||
| 	api: dns_domain_todot_append() -> dns_domain_todot_cat(). | ||||
| 	ui: axfr-get prints A records more nicely. tnx Russ Nelson. | ||||
| 	ui: tinydns, pickdns, and walldns respond REFUSED to multiple | ||||
| 		queries, strange classes, and strange header bits. | ||||
| 		pickdns and walldns also respond REFUSED to unrecognized | ||||
| 		domain names. | ||||
| 20000120 | ||||
| 	ui: dns_resolvconfip() and dns_resolvconfrewrite() reread after | ||||
| 		10 minutes or 10000 uses. | ||||
| 	ui: dns_resolvconfrewrite() treats "domain" like "search". | ||||
| 	ui: dns_resolvconfrewrite() supports $LOCALDOMAIN. | ||||
| 	ui: dns_resolvconfrewrite() supports gethostname(). | ||||
| 	api: dns_ip4_qualify() -> dns_ip4_qualify_rules(). new function | ||||
| 		under the old name uses dns_resolvconfrewrite(). | ||||
| 	internal: cleaned up log.h. | ||||
| 20000121 | ||||
| 	port: the gcc 2.95.2 -O2 optimizer can destroy parameters in a | ||||
| 		function that calls another function with a long long | ||||
| 		argument. impact: gcc 2.95.2 kills dnscache in | ||||
| 		log_query(). fix: pass log_stats() inputs by reference, | ||||
| 		and pass uint64's through a variable inside log.c. | ||||
| 	internal: introduced x_* in axfr-get. | ||||
| 	internal: more format verification in axfr-get. | ||||
| 	ui: minimal Z support in tinydns-data. | ||||
| 	ui: axfr-get prints Z lines. | ||||
| 	ui: juggled axfr-get to support BIND 8's many-answers option. | ||||
| 	ui: axfr-get prints common characters readably rather than in | ||||
| 		octal. tnx Karsten Thygesen. | ||||
| 	ui: install copies VERSION into .../etc. | ||||
| 20000122 | ||||
| 	ui: dns_domain_todot_cat() now lowercases everything. | ||||
| 	internal: split printrecord.c out of tinydns-get. | ||||
| 	ui: added dnstrace. | ||||
| 20000123 | ||||
| 	version: dnscache 0.76, beta. | ||||
| 20000124 | ||||
| 	port: Solaris needs socket libraries for dnstrace. impact: | ||||
| 		couldn't compile under Solaris. fix: use socket.lib. | ||||
| 		tnx Karsten Thygesen. | ||||
| 20000126 | ||||
| 	ui: dns_resolvconfip() supports $DNSCACHEIP. | ||||
| 	ui: changed tinydns-get arg order. | ||||
| 	internal: split printpacket.c out of tinydns-get. | ||||
| 	ui: added dnsquery. | ||||
| 	internal: merged case.a, fs.a, str.a, uint.a, ip4.a into byte.a. | ||||
| 	internal: merged strerr.a into buffer.a. | ||||
| 	internal: merged stralloc.a, getln.a into alloc.a. | ||||
| 	internal: merged error.a, open.a, seek.a, ndelay.a, socket.a | ||||
| 		into unix.a. | ||||
| 	internal: used catulong in axfr-get.c. | ||||
| 	ui: packet-parsing errors produce error_proto. | ||||
| 	ui: axfr-get goes out of its way to reject wildcards. | ||||
| 	internal: introduced generic-conf.c. | ||||
| 	internal: upgraded timeoutread and timeoutwrite to iopause. | ||||
| 20000127 | ||||
| 	ui: revamped details of the log formats. | ||||
| 	ui: full Z support in tinydns-data. | ||||
| 	ui: axfr-get accepts authority records and additional records. | ||||
| 	ui: axfrdns tries to imitate BIND's handling of glue. | ||||
| 	internal: expanded rts to try out the servers and *-conf. | ||||
| 	ui: added rbldns. | ||||
| 20000128 | ||||
| 	ui: increased MAXNS to 16 in query.h. | ||||
| 20000129 | ||||
| 	version: DNScache 0.80, beta. | ||||
| 20000205 | ||||
| 	ui: tinydns-data supports ^, for the benefit of people stuck | ||||
| 		behind reverse CNAMEs. tnx Petr Novotny. | ||||
| 20000206 | ||||
| 	ui: rbldns supports $. | ||||
| 	ui: tinydns-data supports C. CNAME is overridden by NS; CNAME | ||||
| 		overrides other records; no multiple CNAMEs. | ||||
| 	ui: axfr-get supports C. | ||||
| 	ui: axfr-get no longer rejects wildcards, except for NS. | ||||
| 	internal: eliminated flagempty from tinydns-data. | ||||
| 	internal: cleaned up delegation/NXDOMAIN loops in tinydns-data. | ||||
| 	internal: reorganized packet_start interface in tinydns-data. | ||||
| 	ui: tinydns-data supports BIND-style wildcards, except for NS. | ||||
| 	version: DNScache 0.81, beta. | ||||
| 20000207 | ||||
| 	ui: renamed dnsquery as dnsq, to eliminate name conflict with | ||||
| 		Beecher dnsquery program. tnx Anand Buddhdev. | ||||
| 20000208 | ||||
| 	ui: tinydns-edit supports add alias. | ||||
| 	ui: tinydns-conf sets up root/add-alias. | ||||
| 20000209 | ||||
| 	ui: dnscache-conf now sets IPSEND=0.0.0.0 in all cases. | ||||
| 	ui: dnsq and dnstrace allow server names. | ||||
| 	ui: dnsq and dnstrace allow type names. | ||||
| 20000210 | ||||
| 	internal: response_tc() reduces len, simplifying udprespond(). | ||||
| 	ui: response_tc() now truncates immediately after query. this | ||||
| 		should work around the Squid parsing bug reported by | ||||
| 		Stuart Henderson. | ||||
| 20000211 | ||||
| 	ui: tinydns-get allows type names. | ||||
| 	ui: tinydns-data prints query name for >512 error. tnx Uwe Ohse. | ||||
| 	version: DNScache 0.82, beta. | ||||
| 20000212 | ||||
| 	ui: dns_transmit starts with loop 1 for recursive queries. | ||||
| 	ui: dnscache tries to allocate 128K of incoming UDP buffer | ||||
| 		space. tnx Jeremy Hansen. | ||||
| 20000213 | ||||
| 	ui: tinydns tries to allocate 64K of incoming UDP buffer space. | ||||
| 	internal: renamed response_*answer as response_r*. | ||||
| 	internal: expanded response_rfinish to allow au and ar. | ||||
| 	internal: expanded response_rstart to allow any ttl. | ||||
| 	internal: rewrote tinydns-data, tinydns, tinydns-get, axfrdns | ||||
| 		for compact new data.cdb format. a few ui effects: empty | ||||
| 		nodes produce NXDOMAIN; wildcards affect empty nodes. | ||||
| 	ui: response_addname() tries more extensive compression. | ||||
| 20000215 | ||||
| 	ui: tinydns-edit takes fn arguments. tnx Jason R. Mastaler. | ||||
| 20000218 | ||||
| 	internal: upgraded to new cdb library. | ||||
| 	internal: added globalip(). | ||||
| 	ui: dnscache assigns IP addresses to dotted-decimal domain | ||||
| 		names in canonical form. | ||||
| 	internal: merged handling of C and ^ in tinydns-data. | ||||
| 	port: FreeBSD 3.4-RELEASE poll() doesn't think that regular | ||||
| 		files are readable. impact: under FreeBSD 3.4-RELEASE, | ||||
| 		dnsfilter hangs waiting to read from regular files. tnx | ||||
| 		Kenji Rikitake. fix: check for this bug in trypoll.c. | ||||
| 20000219 | ||||
| 	ui: tinydns-data supports time-to-die. | ||||
| 	ui: changed home directory from /usr/local/dnscache to | ||||
| 		/usr/local; moved @ from home/etc to home/etc/dnscache. | ||||
| 	internal: reorganized response.c. | ||||
| 20000220 | ||||
| 	ui: tinydns-data allows omitted numeric fields in Z lines. tnx | ||||
| 		Timothy L. Mayo. | ||||
| 	version: DNScache 0.85, beta. | ||||
| 20000222 | ||||
| 	ui: dns_transmit_get() pauses after server failure, if udploop | ||||
| 		is 2. | ||||
| 	internal: sped up name handling in response.c. | ||||
| 20000223 | ||||
| 	ui: dnscache ignores some garbage in queries: AA, !RD, RA, Z, | ||||
| 		RCODE, AN, AU, AR. (note that responses still say RD.) | ||||
| 		this allows bogus queries from Ultrix versions of BIND. | ||||
| 	internal: split dd.c out of query.c. | ||||
| 	internal: split server.c out of tinydns. | ||||
| 	internal: rewrote walldns, pickdns, rbldns to use server.c. | ||||
| 	ui: server.c allows some garbage in queries: RA, Z, RCODE, AN, | ||||
| 		AU, AR. | ||||
| 	ui: axfrdns logs packets. | ||||
| 	ui: walldns supports dotted-decimal IP addresses. | ||||
| 20000224 | ||||
| 	ui: revamped qlog, again. | ||||
| 	ui: better error message in dnscache-conf.c. tnx Chris Johnson. | ||||
| 20000225 | ||||
| 	version: DNScache 0.90, gamma. | ||||
| 20000226 | ||||
| 	internal: dnscache-conf sets up dnscache/run to avoid env. tnx | ||||
| 		Chris Cappuccio. | ||||
| 20000227 | ||||
| 	ui: tinydns-data uses server name instead of a.ns.domain for | ||||
| 		automatic primary in SOA. tnx Frank Tegtmeyer. | ||||
| 20000228 | ||||
| 	bug: axfrdns doesn't set aa bit in responses. impact: named-xfer | ||||
| 		refuses to do zone transfers from axfrdns. fix: set aa | ||||
| 		bit. tnx Peter Hunter. | ||||
| 	ui: server.c now accepts packets from low ports. sigh. | ||||
| 20000229 | ||||
| 	version: DNScache 0.91, gamma. | ||||
| 20000307 | ||||
| 	internal: switched from slurp to openreadclose. | ||||
| 20000308 | ||||
| 	ui: dns_transmit_get() pauses after recv() failure (such as | ||||
| 		connection-refused), if udploop is 2. | ||||
| 	ui: tinydns-data uses refresh 16384, retry 2048, expire 1048576. | ||||
| 		tnx Frank Tegtmeyer. | ||||
| 	version: DNScache 0.92, gamma. | ||||
| 20000314 | ||||
| 	portability problem: the poll() emulation in RedHat 5.1 doesn't | ||||
| 		clear revents when select() returns 0. tnx Petr Novotny. | ||||
| 		impact: dns_transmit_get() never times out; | ||||
| 		dns_resolve() busy-loops. fix: clear revents before | ||||
| 		poll(). | ||||
| 20000315 | ||||
| 	ui: axfr-get grabs zones when serials drop. tnx Frank Tegtmeyer. | ||||
| 	version: DNScache 0.93, gamma. | ||||
| 20000323 | ||||
| 	ui: dns_rcip() accepts 0.0.0.0 in /etc/resolv.conf as 127.0.0.1. | ||||
| 		tnx Chris Saia. | ||||
| 20000325 | ||||
| 	version: DNScache 1.00. | ||||
| 20000914 | ||||
| 	ui: axfr-get decodes PTR. tnx to various people. | ||||
| 	ui: added dnsqr. | ||||
| 20000915 | ||||
| 	portability problem: on some buggy kernels, accept() fails to | ||||
| 		copy O_NONBLOCK. tnx Pavel Kankovsky. impact: with these | ||||
| 		kernels, dnscache hangs if a TCP connection times out. | ||||
| 		fix: ndelay_on() after accept(). | ||||
| 	ui: dnscache discards non-recursive queries. | ||||
| 	ui: *-conf use envdir in */run. | ||||
| 	internal: reorganized seed_addtime() calls in dnscache-conf. | ||||
| 	ui: tinydns-data prohibits PTR in generic records. | ||||
| 20000917 | ||||
| 	ui: dns_transmit_get() does not pause after most recv() errors. | ||||
| 		still pauses after connection-refused when udploop is 2. | ||||
| 	version: djbdns 1.01. | ||||
| 20000922 | ||||
| 	portability problem: Linux distributions use bash as /bin/sh; | ||||
| 		bash destroys $UID. dorks. impact: dnscache and axfrdns | ||||
| 		run as root. fix: envdir, then sh, then envuidgid. but | ||||
| 		/bin/sh really has to stop polluting the environment. | ||||
| 20000923 | ||||
| 	ui: install /etc/dnsroots.global. dnscache-conf tries | ||||
| 		dnsroots.local, then dnsroots.global. | ||||
| 	ui: no longer install home/etc/dnscache. | ||||
| 	version: djbdns 1.02. | ||||
| 20001224 | ||||
| 	ui: new dnstrace output format. | ||||
| 	ui: dnstrace shows all servers providing each ns/a line. | ||||
| 	ui: added dnstracesort. | ||||
| 20001225 | ||||
| 	internal: response_rstart() and response_cname() use uint32 ttl. | ||||
| 	internal: added response_hidettl(). | ||||
| 	internal: cache_get() returns ttl. | ||||
| 	internal: dnscache keeps track of ttls for aliases. | ||||
| 	ui: dnscache returns ttl unless $HIDETTL is set. | ||||
| 	ui: dnscache returns ttl 655360 for localhost et al. | ||||
| 20001226 | ||||
| 	ui: dnscache supports $FORWARDONLY. tnx to several people for | ||||
| 		the suggestion. tnx Dan Peterson for sample code. | ||||
| 	ui: dnscache now logs sequential query numbers, not indices. | ||||
| 	internal: revamped dnscache to separate udp from tcp. | ||||
| 	ui: dnscache reports uactive, tactive separately. | ||||
| 	ui: dnscache reports tcpopen/tcpclose by port and ip. | ||||
| 	ui: dnscache artificially times out oldest UDP query if UDP | ||||
| 		table is full, and oldest TCP connection if TCP table is | ||||
| 		full. | ||||
| 	ui: dnscache reports broken pipe when a TCP client sends FIN. | ||||
| 20001228 | ||||
| 	ui: dnstrace supports dd. | ||||
| 	ui: dnscache logs stats when it handles 1.0.0.127.in-addr.arpa. | ||||
| 	ui: pickdns actively refuses queries for unknown types. | ||||
| 	ui: pickdns responds to MX queries. tnx Mike Batchelor. | ||||
| 	internal: added const at various places. | ||||
| 	internal: removed some unused variables. | ||||
| 	internal: used time_t in tai_now.c. | ||||
| 	internal: used stdlib.h in alloc.c. | ||||
| 	api: split dns_domain_suffix() into suffix(), suffixpos(). | ||||
| 	internal: switched to buffer_unix*. | ||||
| 	internal: included unistd.h for various declarations. | ||||
| 20010103 | ||||
| 	ui: increased maximum data size from 512 bytes to 32767 bytes in | ||||
| 		tinydns, tinydns-get, axfrdns. allows big TXT records. | ||||
| 	ui: dnsmx reformats name when it prints an artificial 0 MX. | ||||
| 20010105 | ||||
| 	ui: increased MAXLEVEL to 5. the Internet is becoming more | ||||
| 		glueless every day. | ||||
| 20010106 | ||||
| 	version: djbdns 1.03. | ||||
| 20010113 | ||||
| 	ui: increased MAXALIAS to 16. | ||||
| 	ui: dnscache no longer caches SERVFAIL. per-ip is obviously the | ||||
| 		way to go. | ||||
| 	ui: tinydns et al. now respond FORMERR to non-Internet-class | ||||
| 		queries. | ||||
| 	ui: tdlookup now returns A records in a random order in the | ||||
| 		answer section, and truncates the list after 8 records. | ||||
| 	ui: tinydns-data skips lines starting -. | ||||
| 20010114 | ||||
| 	internal: documented the tinydns data.cdb format. | ||||
| 	ui: tinydns-data, tinydns, tinydns-get, axfrdns support client | ||||
| 		differentiation. | ||||
| 	ui: dnsqr aborts if it is given an extra argument. | ||||
| 20010117 | ||||
| 	ui: dnstracesort removes duplicate lines. | ||||
| 	ui: dnstracesort prints glue. | ||||
| 	ui: dnstrace uses a ``start'' IP address for the root glue. | ||||
| 20010121 | ||||
| 	version: djbdns 1.04. | ||||
| 20010206 | ||||
| 	internal: response_query() takes a class argument. | ||||
| 	internal: query_start() takes a class argument. | ||||
| 	internal: packetquery() takes a class argument. | ||||
| 	ui: tinydns et al., axfrdns, and dnscache repeat qclass * in | ||||
| 		response to bogus * queries. tnx Mike Batchelor. | ||||
| 	ui: axfrdns rejects queries for weird classes. | ||||
| 	ui: axfrdns uses query ID instead of ID 0 in the series of AXFR | ||||
| 		response messages between the SOAs, to support the AXFR | ||||
| 		client in BIND 9. | ||||
| 	ui: axfrdns sets AA in the series of AXFR response messages. | ||||
| 20010211 | ||||
| 	ui: servers print starting message. | ||||
| 	internal: some respond() declarations. | ||||
| 	version: djbdns 1.05. | ||||
							
								
								
									
										254
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/FILES
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										254
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/FILES
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,254 @@ | ||||
| README | ||||
| TODO | ||||
| CHANGES | ||||
| VERSION | ||||
| FILES | ||||
| SYSDEPS | ||||
| TARGETS | ||||
| Makefile | ||||
| dnsroots.global | ||||
| TINYDNS | ||||
| conf-cc | ||||
| conf-ld | ||||
| conf-home | ||||
| rts.sh | ||||
| rts.tests | ||||
| rts.exp | ||||
| dnscache-conf.c | ||||
| hasdevtcp.h1 | ||||
| hasdevtcp.h2 | ||||
| dnscache.c | ||||
| server.c | ||||
| walldns-conf.c | ||||
| walldns.c | ||||
| rbldns-conf.c | ||||
| rbldns.c | ||||
| rbldns-data.c | ||||
| pickdns-conf.c | ||||
| pickdns.c | ||||
| pickdns-data.c | ||||
| dnsipq.c | ||||
| tinydns-conf.c | ||||
| tinydns.c | ||||
| tdlookup.c | ||||
| tinydns-get.c | ||||
| tinydns-data.c | ||||
| tinydns-edit.c | ||||
| axfrdns-conf.c | ||||
| axfrdns.c | ||||
| axfr-get.c | ||||
| dnsip.c | ||||
| dnsname.c | ||||
| dnstxt.c | ||||
| dnsmx.c | ||||
| dnsfilter.c | ||||
| random-ip.c | ||||
| dnsqr.c | ||||
| dnsq.c | ||||
| dnstrace.c | ||||
| dnstracesort.sh | ||||
| utime.c | ||||
| cachetest.c | ||||
| generic-conf.h | ||||
| generic-conf.c | ||||
| dd.h | ||||
| dd.c | ||||
| droproot.h | ||||
| droproot.c | ||||
| response.h | ||||
| response.c | ||||
| query.h | ||||
| query.c | ||||
| cache.h | ||||
| cache.c | ||||
| log.h | ||||
| log.c | ||||
| okclient.h | ||||
| okclient.c | ||||
| roots.h | ||||
| roots.c | ||||
| qlog.h | ||||
| qlog.c | ||||
| printrecord.h | ||||
| printrecord.c | ||||
| printpacket.h | ||||
| printpacket.c | ||||
| parsetype.h | ||||
| parsetype.c | ||||
| dns.h | ||||
| dns_dfd.c | ||||
| dns_domain.c | ||||
| dns_dtda.c | ||||
| dns_ip.c | ||||
| dns_ipq.c | ||||
| dns_mx.c | ||||
| dns_name.c | ||||
| dns_nd.c | ||||
| dns_packet.c | ||||
| dns_random.c | ||||
| dns_rcip.c | ||||
| dns_rcrw.c | ||||
| dns_resolve.c | ||||
| dns_sortip.c | ||||
| dns_transmit.c | ||||
| dns_txt.c | ||||
| choose.sh | ||||
| warn-auto.sh | ||||
| find-systype.sh | ||||
| trycpp.c | ||||
| x86cpuid.c | ||||
| alloc.c | ||||
| alloc.h | ||||
| alloc_re.c | ||||
| auto-str.c | ||||
| auto_home.h | ||||
| buffer.c | ||||
| buffer.h | ||||
| buffer_1.c | ||||
| buffer_2.c | ||||
| buffer_copy.c | ||||
| buffer_get.c | ||||
| buffer_put.c | ||||
| byte.h | ||||
| byte_chr.c | ||||
| byte_copy.c | ||||
| byte_cr.c | ||||
| byte_diff.c | ||||
| byte_zero.c | ||||
| case.h | ||||
| case_diffb.c | ||||
| case_diffs.c | ||||
| case_lowerb.c | ||||
| cdb.c | ||||
| cdb.h | ||||
| cdb_hash.c | ||||
| cdb_make.c | ||||
| cdb_make.h | ||||
| chkshsgr.c | ||||
| direntry.h1 | ||||
| direntry.h2 | ||||
| env.c | ||||
| env.h | ||||
| error.c | ||||
| error.h | ||||
| error_str.c | ||||
| exit.h | ||||
| fmt.h | ||||
| fmt_ulong.c | ||||
| fmt_xlong.c | ||||
| gen_alloc.h | ||||
| gen_allocdefs.h | ||||
| getln.c | ||||
| getln.h | ||||
| getln2.c | ||||
| hasshsgr.h1 | ||||
| hasshsgr.h2 | ||||
| hier.c | ||||
| install.c | ||||
| instcheck.c | ||||
| iopause.c | ||||
| iopause.h1 | ||||
| iopause.h2 | ||||
| ip4.h | ||||
| ip4_fmt.c | ||||
| ip4_scan.c | ||||
| ip6.h | ||||
| ip6_fmt.c | ||||
| ip6_scan.c | ||||
| ndelay.h | ||||
| ndelay_off.c | ||||
| ndelay_on.c | ||||
| open.h | ||||
| open_read.c | ||||
| open_trunc.c | ||||
| openreadclose.c | ||||
| openreadclose.h | ||||
| prot.c | ||||
| prot.h | ||||
| readclose.c | ||||
| readclose.h | ||||
| scan.h | ||||
| scan_0x.c | ||||
| scan_ulong.c | ||||
| seek.h | ||||
| seek_set.c | ||||
| select.h1 | ||||
| select.h2 | ||||
| sgetopt.c | ||||
| sgetopt.h | ||||
| socket.h | ||||
| socket_accept.c | ||||
| socket_bind.c | ||||
| socket_conn.c | ||||
| socket_listen.c | ||||
| socket_recv.c | ||||
| socket_send.c | ||||
| socket_tcp.c | ||||
| socket_udp.c | ||||
| str.h | ||||
| str_chr.c | ||||
| str_diff.c | ||||
| str_len.c | ||||
| str_rchr.c | ||||
| str_start.c | ||||
| stralloc.h | ||||
| stralloc_cat.c | ||||
| stralloc_catb.c | ||||
| stralloc_cats.c | ||||
| stralloc_copy.c | ||||
| stralloc_eady.c | ||||
| stralloc_num.c | ||||
| stralloc_opyb.c | ||||
| stralloc_opys.c | ||||
| stralloc_pend.c | ||||
| strerr.h | ||||
| strerr_die.c | ||||
| strerr_sys.c | ||||
| subgetopt.c | ||||
| subgetopt.h | ||||
| tai.h | ||||
| tai_add.c | ||||
| tai_now.c | ||||
| tai_pack.c | ||||
| tai_sub.c | ||||
| tai_uint.c | ||||
| tai_unpack.c | ||||
| taia.h | ||||
| taia_add.c | ||||
| taia_approx.c | ||||
| taia_frac.c | ||||
| taia_less.c | ||||
| taia_now.c | ||||
| taia_pack.c | ||||
| taia_sub.c | ||||
| taia_tai.c | ||||
| taia_uint.c | ||||
| timeoutread.c | ||||
| timeoutread.h | ||||
| timeoutwrite.c | ||||
| timeoutwrite.h | ||||
| trydrent.c | ||||
| trylsock.c | ||||
| trypoll.c | ||||
| tryshsgr.c | ||||
| trysysel.c | ||||
| tryulong32.c | ||||
| tryulong64.c | ||||
| uint16.h | ||||
| uint16_pack.c | ||||
| uint16_unpack.c | ||||
| uint32.h1 | ||||
| uint32.h2 | ||||
| uint32_pack.c | ||||
| uint32_unpack.c | ||||
| uint64.h1 | ||||
| uint64.h2 | ||||
| warn-shsgr | ||||
| buffer_read.c | ||||
| buffer_write.c | ||||
| dns_nd6.c | ||||
| socket_udp6.c | ||||
| socket_getifidx.c | ||||
| tryn2i.c | ||||
| haven2i.h1 | ||||
| haven2i.h2 | ||||
							
								
								
									
										1226
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1226
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/Makefile
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										7
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/README
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/README
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| djbdns 1.05 | ||||
| 20010211 | ||||
| Copyright 2001 | ||||
| D. J. Bernstein | ||||
|  | ||||
| djbdns home page: http://cr.yp.to/djbdns.html | ||||
| Installation instructions: http://cr.yp.to/djbdns/install.html | ||||
							
								
								
									
										10
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/SYSDEPS
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/SYSDEPS
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| VERSION | ||||
| systype | ||||
| uint32.h | ||||
| uint64.h | ||||
| select.h | ||||
| iopause.h | ||||
| direntry.h | ||||
| hasshsgr.h | ||||
| hasdevtcp.h | ||||
| socket.lib | ||||
							
								
								
									
										241
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/TARGETS
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										241
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/TARGETS
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,241 @@ | ||||
| load | ||||
| compile | ||||
| systype | ||||
| hasdevtcp.h | ||||
| uint32.h | ||||
| choose | ||||
| uint64.h | ||||
| dnscache-conf.o | ||||
| generic-conf.o | ||||
| auto-str.o | ||||
| makelib | ||||
| buffer.o | ||||
| buffer_1.o | ||||
| buffer_2.o | ||||
| buffer_copy.o | ||||
| buffer_get.o | ||||
| buffer_put.o | ||||
| strerr_die.o | ||||
| strerr_sys.o | ||||
| buffer.a | ||||
| buffer_read.o | ||||
| buffer_write.o | ||||
| error.o | ||||
| error_str.o | ||||
| ndelay_off.o | ||||
| ndelay_on.o | ||||
| open_read.o | ||||
| open_trunc.o | ||||
| openreadclose.o | ||||
| readclose.o | ||||
| seek_set.o | ||||
| socket_accept.o | ||||
| socket_bind.o | ||||
| socket_conn.o | ||||
| socket_listen.o | ||||
| socket_recv.o | ||||
| socket_send.o | ||||
| socket_tcp.o | ||||
| socket_udp.o | ||||
| unix.a | ||||
| byte_chr.o | ||||
| byte_copy.o | ||||
| byte_cr.o | ||||
| byte_diff.o | ||||
| byte_zero.o | ||||
| case_diffb.o | ||||
| case_diffs.o | ||||
| case_lowerb.o | ||||
| fmt_ulong.o | ||||
| ip4_fmt.o | ||||
| ip4_scan.o | ||||
| scan_ulong.o | ||||
| str_chr.o | ||||
| str_diff.o | ||||
| str_len.o | ||||
| str_rchr.o | ||||
| str_start.o | ||||
| uint16_pack.o | ||||
| uint16_unpack.o | ||||
| uint32_pack.o | ||||
| uint32_unpack.o | ||||
| byte.a | ||||
| auto-str | ||||
| auto_home.c | ||||
| auto_home.o | ||||
| tai_add.o | ||||
| tai_now.o | ||||
| tai_pack.o | ||||
| tai_sub.o | ||||
| tai_uint.o | ||||
| tai_unpack.o | ||||
| taia_add.o | ||||
| taia_approx.o | ||||
| taia_frac.o | ||||
| taia_less.o | ||||
| taia_now.o | ||||
| taia_pack.o | ||||
| taia_sub.o | ||||
| taia_tai.o | ||||
| taia_uint.o | ||||
| libtai.a | ||||
| dnscache-conf | ||||
| iopause.h | ||||
| dnscache.o | ||||
| droproot.o | ||||
| okclient.o | ||||
| log.o | ||||
| cache.o | ||||
| query.o | ||||
| response.o | ||||
| dd.o | ||||
| direntry.h | ||||
| roots.o | ||||
| select.h | ||||
| iopause.o | ||||
| chkshsgr.o | ||||
| chkshsgr | ||||
| hasshsgr.h | ||||
| prot.o | ||||
| dns_dfd.o | ||||
| dns_domain.o | ||||
| dns_dtda.o | ||||
| dns_ip.o | ||||
| dns_ipq.o | ||||
| dns_ipq6.o | ||||
| dns_mx.o | ||||
| dns_name.o | ||||
| dns_nd.o | ||||
| dns_packet.o | ||||
| dns_random.o | ||||
| dns_rcip.o | ||||
| dns_rcrw.o | ||||
| dns_resolve.o | ||||
| dns_sortip.o | ||||
| dns_transmit.o | ||||
| dns_txt.o | ||||
| dns.a | ||||
| env.o | ||||
| env.a | ||||
| alloc.o | ||||
| alloc_re.o | ||||
| getln.o | ||||
| getln2.o | ||||
| stralloc_cat.o | ||||
| stralloc_catb.o | ||||
| stralloc_cats.o | ||||
| stralloc_copy.o | ||||
| stralloc_eady.o | ||||
| stralloc_num.o | ||||
| stralloc_opyb.o | ||||
| stralloc_opys.o | ||||
| stralloc_pend.o | ||||
| alloc.a | ||||
| socket.lib | ||||
| dnscache | ||||
| walldns-conf.o | ||||
| walldns-conf | ||||
| walldns.o | ||||
| server.o | ||||
| qlog.o | ||||
| cdb.o | ||||
| cdb_hash.o | ||||
| cdb_make.o | ||||
| cdb.a | ||||
| walldns | ||||
| rbldns-conf.o | ||||
| rbldns-conf | ||||
| rbldns.o | ||||
| rbldns | ||||
| rbldns-data.o | ||||
| rbldns-data | ||||
| pickdns-conf.o | ||||
| pickdns-conf | ||||
| pickdns.o | ||||
| pickdns | ||||
| pickdns-data.o | ||||
| pickdns-data | ||||
| tinydns-conf.o | ||||
| tinydns-conf | ||||
| tinydns.o | ||||
| tdlookup.o | ||||
| tinydns | ||||
| tinydns-data.o | ||||
| tinydns-data | ||||
| tinydns-get.o | ||||
| printpacket.o | ||||
| printrecord.o | ||||
| parsetype.o | ||||
| tinydns-get | ||||
| tinydns-edit.o | ||||
| tinydns-edit | ||||
| axfr-get.o | ||||
| timeoutread.o | ||||
| timeoutwrite.o | ||||
| axfr-get | ||||
| axfrdns-conf.o | ||||
| axfrdns-conf | ||||
| axfrdns.o | ||||
| axfrdns | ||||
| dnsip.o | ||||
| dnsip | ||||
| dnsipq.o | ||||
| dnsipq | ||||
| dnsip6q.o | ||||
| dnsip6q | ||||
| dnsname.o | ||||
| dnsname | ||||
| dnstxt.o | ||||
| dnstxt | ||||
| dnsmx.o | ||||
| dnsmx | ||||
| dnsfilter.o | ||||
| sgetopt.o | ||||
| subgetopt.o | ||||
| getopt.a | ||||
| dnsfilter | ||||
| random-ip.o | ||||
| random-ip | ||||
| dnsqr.o | ||||
| dnsqr | ||||
| dnsq.o | ||||
| dnsq | ||||
| dnstrace.o | ||||
| dnstrace | ||||
| dnstracesort | ||||
| cachetest.o | ||||
| cachetest | ||||
| utime.o | ||||
| utime | ||||
| rts | ||||
| prog | ||||
| install.o | ||||
| hier.o | ||||
| install | ||||
| instcheck.o | ||||
| instcheck | ||||
| it | ||||
| setup | ||||
| check | ||||
| scan_0x.o | ||||
| fmt_xlong.o | ||||
| ip6_scan.o | ||||
| ip6_fmt.o | ||||
| dnsip6.o | ||||
| dns_ip6.o | ||||
| dns_sortip6.o | ||||
| dnsip6 | ||||
| dns_nd6.o | ||||
| socket_udp6.o | ||||
| socket_getifidx.o | ||||
| socket_bind6.o | ||||
| socket_noipv6.o | ||||
| socket_recv6.o | ||||
| socket_send6.o | ||||
| haveip6.h | ||||
| haven2i.h | ||||
| sockaddr_in6.h | ||||
| scan_xlong.o | ||||
| socket_accept6.o | ||||
| socket_connect6.o | ||||
| socket_tcp6.o | ||||
							
								
								
									
										25
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/TINYDNS
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/TINYDNS
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| The tinydns data.cdb format is subject to change. If you want to write | ||||
| code that relies on something here, let me know. | ||||
|  | ||||
| Keys starting with the two bytes \000\045 are locations. The rest of the | ||||
| key is an IP prefix, normally between 0 and 4 bytes long. The data is a | ||||
| 2-byte location. | ||||
|  | ||||
| Other keys are owner names for DNS records. The data begins with a | ||||
| header in the following format: | ||||
|  | ||||
|    * a 2-byte type; | ||||
|    * either \075, or \076 with a 2-byte location; | ||||
|    * a 4-byte TTL; | ||||
|    * an 8-byte timestamp. | ||||
|  | ||||
| (Exception: Wildcard records replace \075 with \052 and \076 with \053; | ||||
| also, the owner name omits the wildcard.) The data continues in a | ||||
| type-specific format: | ||||
|  | ||||
|    * SOA: first domain name, second domain name, 20-byte miscellany. | ||||
|    * NS or PTR or CNAME: domain name. | ||||
|    * MX: 2-byte preference, domain name. | ||||
|    * Other types: no special structure. | ||||
|  | ||||
| Domain names, types, and numbers are in DNS packet format. | ||||
							
								
								
									
										12
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/TODO
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/TODO
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| end-to-end nym-based security | ||||
| link-level security | ||||
|  | ||||
| try to get the root authorities to set up a secure, usable NS-list system | ||||
| have dnscache-conf keep track of copies of dnsroots.global | ||||
| incorporate automatic NS-list upgrades | ||||
|  | ||||
| consider dead-server table in dnscache or in kernel | ||||
|  | ||||
| IPv6 lookups | ||||
| maybe reverse IPv6 lookups; what a mess | ||||
| DNS over IPv6 | ||||
							
								
								
									
										1
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/VERSION
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/VERSION
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| djbdns 1.05 | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/alloc.a
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/alloc.a
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										31
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/alloc.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/alloc.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| #include <stdlib.h> | ||||
| #include "alloc.h" | ||||
| #include "error.h" | ||||
|  | ||||
| #define ALIGNMENT 16 /* XXX: assuming that this alignment is enough */ | ||||
| #define SPACE 2048 /* must be multiple of ALIGNMENT */ | ||||
|  | ||||
| typedef union { char irrelevant[ALIGNMENT]; double d; } aligned; | ||||
| static aligned realspace[SPACE / ALIGNMENT]; | ||||
| #define space ((char *) realspace) | ||||
| static unsigned int avail = SPACE; /* multiple of ALIGNMENT; 0<=avail<=SPACE */ | ||||
|  | ||||
| /*@null@*//*@out@*/char *alloc(n) | ||||
| unsigned int n; | ||||
| { | ||||
|   char *x; | ||||
|   n = ALIGNMENT + n - (n & (ALIGNMENT - 1)); /* XXX: could overflow */ | ||||
|   if (n <= avail) { avail -= n; return space + avail; } | ||||
|   x = malloc(n); | ||||
|   if (!x) errno = error_nomem; | ||||
|   return x; | ||||
| } | ||||
|  | ||||
| void alloc_free(x) | ||||
| char *x; | ||||
| { | ||||
|   if (x >= space) | ||||
|     if (x < space + SPACE) | ||||
|       return; /* XXX: assuming that pointers are flat */ | ||||
|   free(x); | ||||
| } | ||||
							
								
								
									
										8
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/alloc.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/alloc.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| #ifndef ALLOC_H | ||||
| #define ALLOC_H | ||||
|  | ||||
| extern /*@null@*//*@out@*/char *alloc(); | ||||
| extern void alloc_free(); | ||||
| extern int alloc_re(); | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/alloc.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/alloc.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										17
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/alloc_re.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/alloc_re.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| #include "alloc.h" | ||||
| #include "byte.h" | ||||
|  | ||||
| int alloc_re(x,m,n) | ||||
| char **x; | ||||
| unsigned int m; | ||||
| unsigned int n; | ||||
| { | ||||
|   char *y; | ||||
|   | ||||
|   y = alloc(n); | ||||
|   if (!y) return 0; | ||||
|   byte_copy(y,m,*x); | ||||
|   alloc_free(*x); | ||||
|   *x = y; | ||||
|   return 1; | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/alloc_re.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/alloc_re.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/auto-str
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/auto-str
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										40
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/auto-str.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/auto-str.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | ||||
| #include "buffer.h" | ||||
| #include "exit.h" | ||||
|  | ||||
| char bspace[256]; | ||||
| buffer b = BUFFER_INIT(buffer_unixwrite,1,bspace,sizeof bspace); | ||||
|  | ||||
| void puts(const char *s) | ||||
| { | ||||
|   if (buffer_puts(&b,s) == -1) _exit(111); | ||||
| } | ||||
|  | ||||
| int main(int argc,char **argv) | ||||
| { | ||||
|   char *name; | ||||
|   char *value; | ||||
|   unsigned char ch; | ||||
|   char octal[4]; | ||||
|  | ||||
|   name = argv[1]; | ||||
|   if (!name) _exit(100); | ||||
|   value = argv[2]; | ||||
|   if (!value) _exit(100); | ||||
|  | ||||
|   puts("const char "); | ||||
|   puts(name); | ||||
|   puts("[] = \"\\\n"); | ||||
|  | ||||
|   while (ch = *value++) { | ||||
|     puts("\\"); | ||||
|     octal[3] = 0; | ||||
|     octal[2] = '0' + (ch & 7); ch >>= 3; | ||||
|     octal[1] = '0' + (ch & 7); ch >>= 3; | ||||
|     octal[0] = '0' + (ch & 7); | ||||
|     puts(octal); | ||||
|   } | ||||
|  | ||||
|   puts("\\\n\";\n"); | ||||
|   if (buffer_flush(&b) == -1) _exit(111); | ||||
|   _exit(0); | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/auto-str.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/auto-str.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										3
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/auto_home.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/auto_home.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| const char auto_home[] = "\ | ||||
| \057\165\163\162\057\154\157\143\141\154\ | ||||
| "; | ||||
							
								
								
									
										6
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/auto_home.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/auto_home.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| #ifndef AUTO_HOME_H | ||||
| #define AUTO_HOME_H | ||||
|  | ||||
| extern const char auto_home[]; | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/auto_home.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/auto_home.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/axfr-get
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/axfr-get
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										382
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/axfr-get.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										382
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/axfr-get.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,382 @@ | ||||
| #include <stdio.h> | ||||
| #include <unistd.h> | ||||
| #include "uint32.h" | ||||
| #include "uint16.h" | ||||
| #include "stralloc.h" | ||||
| #include "error.h" | ||||
| #include "strerr.h" | ||||
| #include "getln.h" | ||||
| #include "buffer.h" | ||||
| #include "exit.h" | ||||
| #include "open.h" | ||||
| #include "scan.h" | ||||
| #include "byte.h" | ||||
| #include "str.h" | ||||
| #include "ip4.h" | ||||
| #include "ip6.h" | ||||
| #include "timeoutread.h" | ||||
| #include "timeoutwrite.h" | ||||
| #include "dns.h" | ||||
|  | ||||
| #define FATAL "axfr-get: fatal: " | ||||
|  | ||||
| void die_usage(void) | ||||
| { | ||||
|   strerr_die1x(100,"axfr-get: usage: axfr-get zone fn fn.tmp"); | ||||
| } | ||||
| void die_generate(void) | ||||
| { | ||||
|   strerr_die2sys(111,FATAL,"unable to generate AXFR query: "); | ||||
| } | ||||
| void die_parse(void) | ||||
| { | ||||
|   strerr_die2sys(111,FATAL,"unable to parse AXFR results: "); | ||||
| } | ||||
| unsigned int x_copy(char *buf,unsigned int len,unsigned int pos,char *out,unsigned int outlen) | ||||
| { | ||||
|   pos = dns_packet_copy(buf,len,pos,out,outlen); | ||||
|   if (!pos) die_parse(); | ||||
|   return pos; | ||||
| } | ||||
| unsigned int x_getname(char *buf,unsigned int len,unsigned int pos,char **out) | ||||
| { | ||||
|   pos = dns_packet_getname(buf,len,pos,out); | ||||
|   if (!pos) die_parse(); | ||||
|   return pos; | ||||
| } | ||||
| unsigned int x_skipname(char *buf,unsigned int len,unsigned int pos) | ||||
| { | ||||
|   pos = dns_packet_skipname(buf,len,pos); | ||||
|   if (!pos) die_parse(); | ||||
|   return pos; | ||||
| } | ||||
|  | ||||
| static char *zone; | ||||
| unsigned int zonelen; | ||||
| char *fn; | ||||
| char *fntmp; | ||||
|  | ||||
| void die_netread(void) | ||||
| { | ||||
|   strerr_die2sys(111,FATAL,"unable to read from network: "); | ||||
| } | ||||
| void die_netwrite(void) | ||||
| { | ||||
|   strerr_die2sys(111,FATAL,"unable to write to network: "); | ||||
| } | ||||
| void die_read(void) | ||||
| { | ||||
|   strerr_die4sys(111,FATAL,"unable to read ",fn,": "); | ||||
| } | ||||
| void die_write(void) | ||||
| { | ||||
|   strerr_die4sys(111,FATAL,"unable to write ",fntmp,": "); | ||||
| } | ||||
|  | ||||
| int saferead(int fd,char *buf,unsigned int len) | ||||
| { | ||||
|   int r; | ||||
|   r = timeoutread(60,fd,buf,len); | ||||
|   if (r == 0) { errno = error_proto; die_parse(); } | ||||
|   if (r <= 0) die_netread(); | ||||
|   return r; | ||||
| } | ||||
| int safewrite(int fd,char *buf,unsigned int len) | ||||
| { | ||||
|   int r; | ||||
|   r = timeoutwrite(60,fd,buf,len); | ||||
|   if (r <= 0) die_netwrite(); | ||||
|   return r; | ||||
| } | ||||
| char netreadspace[1024]; | ||||
| buffer netread = BUFFER_INIT(saferead,6,netreadspace,sizeof netreadspace); | ||||
| char netwritespace[1024]; | ||||
| buffer netwrite = BUFFER_INIT(safewrite,7,netwritespace,sizeof netwritespace); | ||||
|  | ||||
| void netget(char *buf,unsigned int len) | ||||
| { | ||||
|   int r; | ||||
|  | ||||
|   while (len > 0) { | ||||
|     r = buffer_get(&netread,buf,len); | ||||
|     buf += r; len -= r; | ||||
|   } | ||||
| } | ||||
|  | ||||
| int fd; | ||||
| buffer b; | ||||
| char bspace[1024]; | ||||
|  | ||||
| void put(char *buf,unsigned int len) | ||||
| { | ||||
|   if (buffer_put(&b,buf,len) == -1) die_write(); | ||||
| } | ||||
|  | ||||
| int printable(char ch) | ||||
| { | ||||
|   if (ch == '.') return 1; | ||||
|   if ((ch >= 'a') && (ch <= 'z')) return 1; | ||||
|   if ((ch >= '0') && (ch <= '9')) return 1; | ||||
|   if ((ch >= 'A') && (ch <= 'Z')) return 1; | ||||
|   if (ch == '-') return 1; | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| static char *d1; | ||||
| static char *d2; | ||||
| static char *d3; | ||||
|  | ||||
| stralloc line; | ||||
| int match; | ||||
|  | ||||
| int numsoa; | ||||
|  | ||||
| unsigned int doit(char *buf,unsigned int len,unsigned int pos) | ||||
| { | ||||
|   char data[20]; | ||||
|   uint32 ttl; | ||||
|   uint16 dlen; | ||||
|   uint16 typenum; | ||||
|   uint32 u32; | ||||
|   int i; | ||||
|  | ||||
|   pos = x_getname(buf,len,pos,&d1); | ||||
|   pos = x_copy(buf,len,pos,data,10); | ||||
|   uint16_unpack_big(data,&typenum); | ||||
|   uint32_unpack_big(data + 4,&ttl); | ||||
|   uint16_unpack_big(data + 8,&dlen); | ||||
|   if (len - pos < dlen) { errno = error_proto; return 0; } | ||||
|   len = pos + dlen; | ||||
|  | ||||
|   if (!dns_domain_suffix(d1,zone)) return len; | ||||
|   if (byte_diff(data + 2,2,DNS_C_IN)) return len; | ||||
|  | ||||
|   if (byte_equal(data,2,DNS_T_SOA)) { | ||||
|     if (++numsoa >= 2) return len; | ||||
|     pos = x_getname(buf,len,pos,&d2); | ||||
|     pos = x_getname(buf,len,pos,&d3); | ||||
|     x_copy(buf,len,pos,data,20); | ||||
|     uint32_unpack_big(data,&u32); | ||||
|     if (!stralloc_copys(&line,"#")) return 0; | ||||
|     if (!stralloc_catulong0(&line,u32,0)) return 0; | ||||
|     if (!stralloc_cats(&line," auto axfr-get\n")) return 0; | ||||
|     if (!stralloc_cats(&line,"Z")) return 0; | ||||
|     if (!dns_domain_todot_cat(&line,d1)) return 0; | ||||
|     if (!stralloc_cats(&line,":")) return 0; | ||||
|     if (!dns_domain_todot_cat(&line,d2)) return 0; | ||||
|     if (!stralloc_cats(&line,".:")) return 0; | ||||
|     if (!dns_domain_todot_cat(&line,d3)) return 0; | ||||
|     if (!stralloc_cats(&line,".")) return 0; | ||||
|     for (i = 0;i < 5;++i) { | ||||
|       uint32_unpack_big(data + 4 * i,&u32); | ||||
|       if (!stralloc_cats(&line,":")) return 0; | ||||
|       if (!stralloc_catulong0(&line,u32,0)) return 0; | ||||
|     } | ||||
|   } | ||||
|   else if (byte_equal(data,2,DNS_T_NS)) { | ||||
|     if (!stralloc_copys(&line,"&")) return 0; | ||||
|     if (byte_equal(d1,2,"\1*")) { errno = error_proto; return 0; } | ||||
|     if (!dns_domain_todot_cat(&line,d1)) return 0; | ||||
|     if (!stralloc_cats(&line,"::")) return 0; | ||||
|     x_getname(buf,len,pos,&d1); | ||||
|     if (!dns_domain_todot_cat(&line,d1)) return 0; | ||||
|     if (!stralloc_cats(&line,".")) return 0; | ||||
|   } | ||||
|   else if (byte_equal(data,2,DNS_T_CNAME)) { | ||||
|     if (!stralloc_copys(&line,"C")) return 0; | ||||
|     if (!dns_domain_todot_cat(&line,d1)) return 0; | ||||
|     if (!stralloc_cats(&line,":")) return 0; | ||||
|     x_getname(buf,len,pos,&d1); | ||||
|     if (!dns_domain_todot_cat(&line,d1)) return 0; | ||||
|     if (!stralloc_cats(&line,".")) return 0; | ||||
|   } | ||||
|   else if (byte_equal(data,2,DNS_T_PTR)) { | ||||
|     if (!stralloc_copys(&line,"^")) return 0; | ||||
|     if (!dns_domain_todot_cat(&line,d1)) return 0; | ||||
|     if (!stralloc_cats(&line,":")) return 0; | ||||
|     x_getname(buf,len,pos,&d1); | ||||
|     if (!dns_domain_todot_cat(&line,d1)) return 0; | ||||
|     if (!stralloc_cats(&line,".")) return 0; | ||||
|   } | ||||
|   else if (byte_equal(data,2,DNS_T_MX)) { | ||||
|     uint16 dist; | ||||
|     if (!stralloc_copys(&line,"@")) return 0; | ||||
|     if (!dns_domain_todot_cat(&line,d1)) return 0; | ||||
|     if (!stralloc_cats(&line,"::")) return 0; | ||||
|     pos = x_copy(buf,len,pos,data,2); | ||||
|     uint16_unpack_big(data,&dist); | ||||
|     x_getname(buf,len,pos,&d1); | ||||
|     if (!dns_domain_todot_cat(&line,d1)) return 0; | ||||
|     if (!stralloc_cats(&line,".:")) return 0; | ||||
|     if (!stralloc_catulong0(&line,dist,0)) return 0; | ||||
|   } | ||||
|   else if (byte_equal(data,2,DNS_T_A) && (dlen == 4)) { | ||||
|     char ipstr[IP4_FMT]; | ||||
|     if (!stralloc_copys(&line,"+")) return 0; | ||||
|     if (!dns_domain_todot_cat(&line,d1)) return 0; | ||||
|     if (!stralloc_cats(&line,":")) return 0; | ||||
|     x_copy(buf,len,pos,data,4); | ||||
|     if (!stralloc_catb(&line,ipstr,ip4_fmt(ipstr,data))) return 0; | ||||
|   } | ||||
|   else if (byte_equal(data,2,DNS_T_AAAA)) { | ||||
|     char ipstr[IP6_FMT]; | ||||
|     if (!stralloc_copys(&line,"3")) return 0; | ||||
|     if (!dns_domain_todot_cat(&line,d1)) return 0; | ||||
|     if (!stralloc_cats(&line,":")) return 0; | ||||
|     x_copy(buf,len,pos,data,16); | ||||
|     if (!stralloc_catb(&line,ipstr,ip6_fmt_flat(ipstr,data))) return 0; | ||||
|   } | ||||
|   else { | ||||
|     unsigned char ch; | ||||
|     unsigned char ch2; | ||||
|     if (!stralloc_copys(&line,":")) return 0; | ||||
|     if (!dns_domain_todot_cat(&line,d1)) return 0; | ||||
|     if (!stralloc_cats(&line,":")) return 0; | ||||
|     if (!stralloc_catulong0(&line,typenum,0)) return 0; | ||||
|     if (!stralloc_cats(&line,":")) return 0; | ||||
|     for (i = 0;i < dlen;++i) { | ||||
|       pos = x_copy(buf,len,pos,data,1); | ||||
|       ch = data[0]; | ||||
|       if (printable(ch)) { | ||||
|         if (!stralloc_catb(&line,&ch,1)) return 0; | ||||
|       } | ||||
|       else { | ||||
|         if (!stralloc_cats(&line,"\\")) return 0; | ||||
|         ch2 = '0' + ((ch >> 6) & 7); | ||||
|         if (!stralloc_catb(&line,&ch2,1)) return 0; | ||||
|         ch2 = '0' + ((ch >> 3) & 7); | ||||
|         if (!stralloc_catb(&line,&ch2,1)) return 0; | ||||
|         ch2 = '0' + (ch & 7); | ||||
|         if (!stralloc_catb(&line,&ch2,1)) return 0; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   if (!stralloc_cats(&line,":")) return 0; | ||||
|   if (!stralloc_catulong0(&line,ttl,0)) return 0; | ||||
|   if (!stralloc_cats(&line,"\n")) return 0; | ||||
|   put(line.s,line.len); | ||||
|  | ||||
|   return len; | ||||
| } | ||||
|  | ||||
| stralloc packet; | ||||
|  | ||||
| int main(int argc,char **argv) | ||||
| { | ||||
|   char out[20]; | ||||
|   unsigned long u; | ||||
|   uint16 dlen; | ||||
|   unsigned int pos; | ||||
|   uint32 oldserial = 0; | ||||
|   uint32 newserial = 0; | ||||
|   uint16 numqueries; | ||||
|   uint16 numanswers; | ||||
|  | ||||
|   if (!*argv) die_usage(); | ||||
|  | ||||
|   if (!*++argv) die_usage(); | ||||
|   if (!dns_domain_fromdot(&zone,*argv,str_len(*argv))) die_generate(); | ||||
|   zonelen = dns_domain_length(zone); | ||||
|  | ||||
|   if (!*++argv) die_usage(); | ||||
|   fn = *argv; | ||||
|   if (!*++argv) die_usage(); | ||||
|   fntmp = *argv; | ||||
|  | ||||
|   fd = open_read(fn); | ||||
|   if (fd == -1) { | ||||
|     if (errno != error_noent) die_read(); | ||||
|   } | ||||
|   else { | ||||
|     buffer_init(&b,buffer_unixread,fd,bspace,sizeof bspace); | ||||
|     if (getln(&b,&line,&match,'\n') == -1) die_read(); | ||||
|     if (!stralloc_0(&line)) die_read(); | ||||
|     if (line.s[0] == '#') { | ||||
|       scan_ulong(line.s + 1,&u); | ||||
|       oldserial = u; | ||||
|     } | ||||
|     close(fd); | ||||
|   } | ||||
|  | ||||
|   if (!stralloc_copyb(&packet,"\0\0\0\0\0\1\0\0\0\0\0\0",12)) die_generate(); | ||||
|   if (!stralloc_catb(&packet,zone,zonelen)) die_generate(); | ||||
|   if (!stralloc_catb(&packet,DNS_T_SOA DNS_C_IN,4)) die_generate(); | ||||
|   uint16_pack_big(out,packet.len); | ||||
|   buffer_put(&netwrite,out,2); | ||||
|   buffer_put(&netwrite,packet.s,packet.len); | ||||
|   buffer_flush(&netwrite); | ||||
|  | ||||
|   netget(out,2); | ||||
|   uint16_unpack_big(out,&dlen); | ||||
|   if (!stralloc_ready(&packet,dlen)) die_parse(); | ||||
|   netget(packet.s,dlen); | ||||
|   packet.len = dlen; | ||||
|  | ||||
|   pos = x_copy(packet.s,packet.len,0,out,12); | ||||
|   uint16_unpack_big(out + 4,&numqueries); | ||||
|   uint16_unpack_big(out + 6,&numanswers); | ||||
|  | ||||
|   while (numqueries) { | ||||
|     --numqueries; | ||||
|     pos = x_skipname(packet.s,packet.len,pos); | ||||
|     pos += 4; | ||||
|   } | ||||
|  | ||||
|   if (!numanswers) { errno = error_proto; die_parse(); } | ||||
|   pos = x_getname(packet.s,packet.len,pos,&d1); | ||||
|   if (!dns_domain_equal(zone,d1)) { errno = error_proto; die_parse(); } | ||||
|   pos = x_copy(packet.s,packet.len,pos,out,10); | ||||
|   if (byte_diff(out,4,DNS_T_SOA DNS_C_IN)) { errno = error_proto; die_parse(); } | ||||
|   pos = x_skipname(packet.s,packet.len,pos); | ||||
|   pos = x_skipname(packet.s,packet.len,pos); | ||||
|   pos = x_copy(packet.s,packet.len,pos,out,4); | ||||
|  | ||||
|   uint32_unpack_big(out,&newserial); | ||||
|  | ||||
|  | ||||
|   if (oldserial && newserial) /* allow 0 for very recently modified zones */ | ||||
|     if (oldserial == newserial) /* allow serial numbers to move backwards */ | ||||
|       _exit(0); | ||||
|  | ||||
|  | ||||
|   fd = open_trunc(fntmp); | ||||
|   if (fd == -1) die_write(); | ||||
|   buffer_init(&b,buffer_unixwrite,fd,bspace,sizeof bspace); | ||||
|  | ||||
|   if (!stralloc_copyb(&packet,"\0\0\0\0\0\1\0\0\0\0\0\0",12)) die_generate(); | ||||
|   if (!stralloc_catb(&packet,zone,zonelen)) die_generate(); | ||||
|   if (!stralloc_catb(&packet,DNS_T_AXFR DNS_C_IN,4)) die_generate(); | ||||
|   uint16_pack_big(out,packet.len); | ||||
|   buffer_put(&netwrite,out,2); | ||||
|   buffer_put(&netwrite,packet.s,packet.len); | ||||
|   buffer_flush(&netwrite); | ||||
|  | ||||
|   numsoa = 0; | ||||
|   while (numsoa < 2) { | ||||
|     netget(out,2); | ||||
|     uint16_unpack_big(out,&dlen); | ||||
|     if (!stralloc_ready(&packet,dlen)) die_parse(); | ||||
|     netget(packet.s,dlen); | ||||
|     packet.len = dlen; | ||||
|  | ||||
|     pos = x_copy(packet.s,packet.len,0,out,12); | ||||
|     uint16_unpack_big(out + 4,&numqueries); | ||||
|  | ||||
|     while (numqueries) { | ||||
|       --numqueries; | ||||
|       pos = x_skipname(packet.s,packet.len,pos); | ||||
|       pos += 4; | ||||
|     } | ||||
|     while (pos < packet.len) { | ||||
|       pos = doit(packet.s,packet.len,pos); | ||||
|       if (!pos) die_parse(); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   if (buffer_flush(&b) == -1) die_write(); | ||||
|   if (fsync(fd) == -1) die_write(); | ||||
|   if (close(fd) == -1) die_write(); /* NFS dorks */ | ||||
|   if (rename(fntmp,fn) == -1) | ||||
|     strerr_die6sys(111,FATAL,"unable to move ",fntmp," to ",fn,": "); | ||||
|   _exit(0); | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/axfr-get.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/axfr-get.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/axfrdns
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/axfrdns
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/axfrdns-conf
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/axfrdns-conf
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										71
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/axfrdns-conf.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/axfrdns-conf.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,71 @@ | ||||
| #include <unistd.h> | ||||
| #include <pwd.h> | ||||
| #include "strerr.h" | ||||
| #include "exit.h" | ||||
| #include "auto_home.h" | ||||
| #include "generic-conf.h" | ||||
|  | ||||
| #define FATAL "axfrdns-conf: fatal: " | ||||
|  | ||||
| void usage(void) | ||||
| { | ||||
|   strerr_die1x(100,"axfrdns-conf: usage: axfrdns-conf acct logacct /axfrdns /tinydns myip"); | ||||
| } | ||||
|  | ||||
| char *dir; | ||||
| char *user; | ||||
| char *loguser; | ||||
| struct passwd *pw; | ||||
| char *myip; | ||||
| char *tinydns; | ||||
|  | ||||
| int main(int argc,char **argv) | ||||
| { | ||||
|   user = argv[1]; | ||||
|   if (!user) usage(); | ||||
|   loguser = argv[2]; | ||||
|   if (!loguser) usage(); | ||||
|   dir = argv[3]; | ||||
|   if (!dir) usage(); | ||||
|   if (dir[0] != '/') usage(); | ||||
|   tinydns = argv[4]; | ||||
|   if (!tinydns) usage(); | ||||
|   if (tinydns[0] != '/') usage(); | ||||
|   myip = argv[5]; | ||||
|   if (!myip) usage(); | ||||
|  | ||||
|   pw = getpwnam(loguser); | ||||
|   if (!pw) | ||||
|     strerr_die3x(111,FATAL,"unknown account ",loguser); | ||||
|  | ||||
|   init(dir,FATAL); | ||||
|   makelog(loguser,pw->pw_uid,pw->pw_gid); | ||||
|  | ||||
|   makedir("env"); | ||||
|   perm(02755); | ||||
|   start("env/ROOT"); outs(tinydns); outs("/root\n"); finish(); | ||||
|   perm(0644); | ||||
|   start("env/IP"); outs(myip); outs("\n"); finish(); | ||||
|   perm(0644); | ||||
|  | ||||
|   start("run"); | ||||
|   outs("#!/bin/sh\nexec 2>&1\nexec envdir ./env sh -c '\n  exec envuidgid "); outs(user); | ||||
|   outs(" softlimit -d300000 tcpserver -vDRHl0 -x tcp.cdb -- \"$IP\" 53 "); | ||||
|   outs(auto_home); outs("/bin/axfrdns\n'\n"); | ||||
|   finish(); | ||||
|   perm(0755); | ||||
|  | ||||
|   start("Makefile"); | ||||
|   outs("tcp.cdb: tcp\n"); | ||||
|   outs("\ttcprules tcp.cdb tcp.tmp < tcp\n"); | ||||
|   finish(); | ||||
|   perm(0644); | ||||
|  | ||||
|   start("tcp"); | ||||
|   outs("# sample line:  1.2.3.4:allow,AXFR=\"heaven.af.mil/3.2.1.in-addr.arpa\"\n"); | ||||
|   outs(":deny\n"); | ||||
|   finish(); | ||||
|   perm(0644); | ||||
|  | ||||
|   _exit(0); | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/axfrdns-conf.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/axfrdns-conf.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										378
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/axfrdns.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										378
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/axfrdns.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,378 @@ | ||||
| #include <unistd.h> | ||||
| #include "droproot.h" | ||||
| #include "exit.h" | ||||
| #include "env.h" | ||||
| #include "uint32.h" | ||||
| #include "uint16.h" | ||||
| #include "ip4.h" | ||||
| #include "tai.h" | ||||
| #include "buffer.h" | ||||
| #include "timeoutread.h" | ||||
| #include "timeoutwrite.h" | ||||
| #include "open.h" | ||||
| #include "seek.h" | ||||
| #include "cdb.h" | ||||
| #include "stralloc.h" | ||||
| #include "strerr.h" | ||||
| #include "str.h" | ||||
| #include "byte.h" | ||||
| #include "case.h" | ||||
| #include "dns.h" | ||||
| #include "scan.h" | ||||
| #include "qlog.h" | ||||
| #include "response.h" | ||||
|  | ||||
| extern int respond(char *,char *,char *); | ||||
|  | ||||
| #define FATAL "axfrdns: fatal: " | ||||
|  | ||||
| void nomem() | ||||
| { | ||||
|   strerr_die2x(111,FATAL,"out of memory"); | ||||
| } | ||||
| void die_truncated() | ||||
| { | ||||
|   strerr_die2x(111,FATAL,"truncated request"); | ||||
| } | ||||
| void die_netwrite() | ||||
| { | ||||
|   strerr_die2sys(111,FATAL,"unable to write to network: "); | ||||
| } | ||||
| void die_netread() | ||||
| { | ||||
|   strerr_die2sys(111,FATAL,"unable to read from network: "); | ||||
| } | ||||
| void die_outside() | ||||
| { | ||||
|   strerr_die2x(111,FATAL,"unable to locate information in data.cdb"); | ||||
| } | ||||
| void die_cdbread() | ||||
| { | ||||
|   strerr_die2sys(111,FATAL,"unable to read data.cdb: "); | ||||
| } | ||||
| void die_cdbformat() | ||||
| { | ||||
|   strerr_die3x(111,FATAL,"unable to read data.cdb: ","format error"); | ||||
| } | ||||
|  | ||||
| int safewrite(int fd,char *buf,unsigned int len) | ||||
| { | ||||
|   int w; | ||||
|  | ||||
|   w = timeoutwrite(60,fd,buf,len); | ||||
|   if (w <= 0) die_netwrite(); | ||||
|   return w; | ||||
| } | ||||
|  | ||||
| char netwritespace[1024]; | ||||
| buffer netwrite = BUFFER_INIT(safewrite,1,netwritespace,sizeof netwritespace); | ||||
|  | ||||
| void print(char *buf,unsigned int len) | ||||
| { | ||||
|   char tcpheader[2]; | ||||
|   uint16_pack_big(tcpheader,len); | ||||
|   buffer_put(&netwrite,tcpheader,2); | ||||
|   buffer_put(&netwrite,buf,len); | ||||
|   buffer_flush(&netwrite); | ||||
| } | ||||
|  | ||||
| char *axfr; | ||||
| static char *axfrok; | ||||
|  | ||||
| void axfrcheck(char *q) | ||||
| { | ||||
|   int i; | ||||
|   int j; | ||||
|  | ||||
|   if (!axfr) return; | ||||
|  | ||||
|   i = j = 0; | ||||
|   for (;;) { | ||||
|     if (!axfr[i] || (axfr[i] == '/')) { | ||||
|       if (i > j) { | ||||
|         if (!dns_domain_fromdot(&axfrok,axfr + j,i - j)) nomem(); | ||||
|         if (dns_domain_equal(q,axfrok)) return; | ||||
|       } | ||||
|       j = i + 1; | ||||
|     } | ||||
|     if (!axfr[i]) break; | ||||
|     ++i; | ||||
|   } | ||||
|  | ||||
|   strerr_die2x(111,FATAL,"disallowed zone transfer request"); | ||||
| } | ||||
|  | ||||
| static char *zone; | ||||
| unsigned int zonelen; | ||||
| char typeclass[4]; | ||||
|  | ||||
| int fdcdb; | ||||
| buffer bcdb; | ||||
| char bcdbspace[1024]; | ||||
|  | ||||
| void get(char *buf,unsigned int len) | ||||
| { | ||||
|   int r; | ||||
|  | ||||
|   while (len > 0) { | ||||
|     r = buffer_get(&bcdb,buf,len); | ||||
|     if (r < 0) die_cdbread(); | ||||
|     if (!r) die_cdbformat(); | ||||
|     buf += r; | ||||
|     len -= r; | ||||
|   } | ||||
| } | ||||
|  | ||||
| char ip[4]; | ||||
| unsigned long port; | ||||
| char clientloc[2]; | ||||
|  | ||||
| struct tai now; | ||||
| char data[32767]; | ||||
| uint32 dlen; | ||||
| uint32 dpos; | ||||
|  | ||||
| void copy(char *buf,unsigned int len) | ||||
| { | ||||
|   dpos = dns_packet_copy(data,dlen,dpos,buf,len); | ||||
|   if (!dpos) die_cdbread(); | ||||
| } | ||||
|  | ||||
| void doname(stralloc *sa) | ||||
| { | ||||
|   static char *d; | ||||
|   dpos = dns_packet_getname(data,dlen,dpos,&d); | ||||
|   if (!dpos) die_cdbread(); | ||||
|   if (!stralloc_catb(sa,d,dns_domain_length(d))) nomem(); | ||||
| } | ||||
|  | ||||
| int build(stralloc *sa,char *q,int flagsoa,char id[2]) | ||||
| { | ||||
|   unsigned int rdatapos; | ||||
|   char misc[20]; | ||||
|   char type[2]; | ||||
|   char recordloc[2]; | ||||
|   char ttl[4]; | ||||
|   char ttd[8]; | ||||
|   struct tai cutoff; | ||||
|  | ||||
|   dpos = 0; | ||||
|   copy(type,2); | ||||
|   if (flagsoa) if (byte_diff(type,2,DNS_T_SOA)) return 0; | ||||
|   if (!flagsoa) if (byte_equal(type,2,DNS_T_SOA)) return 0; | ||||
|  | ||||
|   if (!stralloc_copyb(sa,id,2)) nomem(); | ||||
|   if (!stralloc_catb(sa,"\204\000\0\0\0\1\0\0\0\0",10)) nomem(); | ||||
|   copy(misc,1); | ||||
|   if ((misc[0] == '=' + 1) || (misc[0] == '*' + 1)) { | ||||
|     --misc[0]; | ||||
|     copy(recordloc,2); | ||||
|     if (byte_diff(recordloc,2,clientloc)) return 0; | ||||
|   } | ||||
|   if (misc[0] == '*') { | ||||
|     if (flagsoa) return 0; | ||||
|     if (!stralloc_catb(sa,"\1*",2)) nomem(); | ||||
|   } | ||||
|   if (!stralloc_catb(sa,q,dns_domain_length(q))) nomem(); | ||||
|   if (!stralloc_catb(sa,type,2)) nomem(); | ||||
|  | ||||
|   copy(ttl,4); | ||||
|   copy(ttd,8); | ||||
|   if (byte_diff(ttd,8,"\0\0\0\0\0\0\0\0")) { | ||||
|     tai_unpack(ttd,&cutoff); | ||||
|     if (byte_equal(ttl,4,"\0\0\0\0")) { | ||||
|       if (tai_less(&cutoff,&now)) return 0; | ||||
|       uint32_pack_big(ttl,2); | ||||
|     } | ||||
|     else | ||||
|       if (!tai_less(&cutoff,&now)) return 0; | ||||
|   } | ||||
|  | ||||
|   if (!stralloc_catb(sa,DNS_C_IN,2)) nomem(); | ||||
|   if (!stralloc_catb(sa,ttl,4)) nomem(); | ||||
|   if (!stralloc_catb(sa,"\0\0",2)) nomem(); | ||||
|   rdatapos = sa->len; | ||||
|  | ||||
|   if (byte_equal(type,2,DNS_T_SOA)) { | ||||
|     doname(sa); | ||||
|     doname(sa); | ||||
|     copy(misc,20); | ||||
|     if (!stralloc_catb(sa,misc,20)) nomem(); | ||||
|   } | ||||
|   else if (byte_equal(type,2,DNS_T_NS) || byte_equal(type,2,DNS_T_PTR) || byte_equal(type,2,DNS_T_CNAME)) { | ||||
|     doname(sa); | ||||
|   } | ||||
|   else if (byte_equal(type,2,DNS_T_MX)) { | ||||
|     copy(misc,2); | ||||
|     if (!stralloc_catb(sa,misc,2)) nomem(); | ||||
|     doname(sa); | ||||
|   } | ||||
|   else | ||||
|     if (!stralloc_catb(sa,data + dpos,dlen - dpos)) nomem(); | ||||
|  | ||||
|   if (sa->len > 65535) die_cdbformat(); | ||||
|   uint16_pack_big(sa->s + rdatapos - 2,sa->len - rdatapos); | ||||
|   return 1; | ||||
| } | ||||
|  | ||||
| static struct cdb c; | ||||
| static char *q; | ||||
| static stralloc soa; | ||||
| static stralloc message; | ||||
|  | ||||
| void doaxfr(char id[2]) | ||||
| { | ||||
|   char key[512]; | ||||
|   uint32 klen; | ||||
|   char num[4]; | ||||
|   uint32 eod; | ||||
|   uint32 pos; | ||||
|   int r; | ||||
|  | ||||
|   axfrcheck(zone); | ||||
|  | ||||
|   tai_now(&now); | ||||
|   cdb_init(&c,fdcdb); | ||||
|  | ||||
|   byte_zero(clientloc,2); | ||||
|   key[0] = 0; | ||||
|   key[1] = '%'; | ||||
|   byte_copy(key + 2,4,ip); | ||||
|   r = cdb_find(&c,key,6); | ||||
|   if (!r) r = cdb_find(&c,key,5); | ||||
|   if (!r) r = cdb_find(&c,key,4); | ||||
|   if (!r) r = cdb_find(&c,key,3); | ||||
|   if (!r) r = cdb_find(&c,key,2); | ||||
|   if (r == -1) die_cdbread(); | ||||
|   if (r && (cdb_datalen(&c) == 2)) | ||||
|     if (cdb_read(&c,clientloc,2,cdb_datapos(&c)) == -1) die_cdbread(); | ||||
|  | ||||
|   cdb_findstart(&c); | ||||
|   for (;;) { | ||||
|     r = cdb_findnext(&c,zone,zonelen); | ||||
|     if (r == -1) die_cdbread(); | ||||
|     if (!r) die_outside(); | ||||
|     dlen = cdb_datalen(&c); | ||||
|     if (dlen > sizeof data) die_cdbformat(); | ||||
|     if (cdb_read(&c,data,dlen,cdb_datapos(&c)) == -1) die_cdbformat(); | ||||
|     if (build(&soa,zone,1,id)) break; | ||||
|   } | ||||
|  | ||||
|   cdb_free(&c); | ||||
|   print(soa.s,soa.len); | ||||
|  | ||||
|   seek_begin(fdcdb); | ||||
|   buffer_init(&bcdb,buffer_unixread,fdcdb,bcdbspace,sizeof bcdbspace); | ||||
|  | ||||
|   pos = 0; | ||||
|   get(num,4); pos += 4; | ||||
|   uint32_unpack(num,&eod); | ||||
|   while (pos < 2048) { get(num,4); pos += 4; } | ||||
|  | ||||
|   while (pos < eod) { | ||||
|     if (eod - pos < 8) die_cdbformat(); | ||||
|     get(num,4); pos += 4; | ||||
|     uint32_unpack(num,&klen); | ||||
|     get(num,4); pos += 4; | ||||
|     uint32_unpack(num,&dlen); | ||||
|     if (eod - pos < klen) die_cdbformat(); | ||||
|     pos += klen; | ||||
|     if (eod - pos < dlen) die_cdbformat(); | ||||
|     pos += dlen; | ||||
|  | ||||
|     if (klen > sizeof key) die_cdbformat(); | ||||
|     get(key,klen); | ||||
|     if (dlen > sizeof data) die_cdbformat(); | ||||
|     get(data,dlen); | ||||
|  | ||||
|     if ((klen > 1) && (key[0] == 0)) continue; /* location */ | ||||
|     if (klen < 1) die_cdbformat(); | ||||
|     if (dns_packet_getname(key,klen,0,&q) != klen) die_cdbformat(); | ||||
|     if (!dns_domain_suffix(q,zone)) continue; | ||||
|     if (!build(&message,q,0,id)) continue; | ||||
|     print(message.s,message.len); | ||||
|   } | ||||
|  | ||||
|   print(soa.s,soa.len); | ||||
| } | ||||
|  | ||||
| void netread(char *buf,unsigned int len) | ||||
| { | ||||
|   int r; | ||||
|  | ||||
|   while (len > 0) { | ||||
|     r = timeoutread(60,0,buf,len); | ||||
|     if (r == 0) _exit(0); | ||||
|     if (r < 0) die_netread(); | ||||
|     buf += r; len -= r; | ||||
|   } | ||||
| } | ||||
|  | ||||
| char tcpheader[2]; | ||||
| char buf[512]; | ||||
| uint16 len; | ||||
|  | ||||
| static char seed[128]; | ||||
|  | ||||
| int main() | ||||
| { | ||||
|   unsigned int pos; | ||||
|   char header[12]; | ||||
|   char qtype[2]; | ||||
|   char qclass[2]; | ||||
|   const char *x; | ||||
|  | ||||
|   droproot(FATAL); | ||||
|   dns_random_init(seed); | ||||
|  | ||||
|   axfr = env_get("AXFR"); | ||||
|    | ||||
|   x = env_get("TCPREMOTEIP"); | ||||
|   if (x && ip4_scan(x,ip)) | ||||
|     ; | ||||
|   else | ||||
|     byte_zero(ip,4); | ||||
|  | ||||
|   x = env_get("TCPREMOTEPORT"); | ||||
|   if (!x) x = "0"; | ||||
|   scan_ulong(x,&port); | ||||
|  | ||||
|   for (;;) { | ||||
|     netread(tcpheader,2); | ||||
|     uint16_unpack_big(tcpheader,&len); | ||||
|     if (len > 512) strerr_die2x(111,FATAL,"excessively large request"); | ||||
|     netread(buf,len); | ||||
|  | ||||
|     pos = dns_packet_copy(buf,len,0,header,12); if (!pos) die_truncated(); | ||||
|     if (header[2] & 254) strerr_die2x(111,FATAL,"bogus query"); | ||||
|     if (header[4] || (header[5] != 1)) strerr_die2x(111,FATAL,"bogus query"); | ||||
|  | ||||
|     pos = dns_packet_getname(buf,len,pos,&zone); if (!pos) die_truncated(); | ||||
|     zonelen = dns_domain_length(zone); | ||||
|     pos = dns_packet_copy(buf,len,pos,qtype,2); if (!pos) die_truncated(); | ||||
|     pos = dns_packet_copy(buf,len,pos,qclass,2); if (!pos) die_truncated(); | ||||
|  | ||||
|     if (byte_diff(qclass,2,DNS_C_IN) && byte_diff(qclass,2,DNS_C_ANY)) | ||||
|       strerr_die2x(111,FATAL,"bogus query: bad class"); | ||||
|  | ||||
|     qlog(ip,port,header,zone,qtype," "); | ||||
|  | ||||
|     if (byte_equal(qtype,2,DNS_T_AXFR)) { | ||||
|       case_lowerb(zone,zonelen); | ||||
|       fdcdb = open_read("data.cdb"); | ||||
|       if (fdcdb == -1) die_cdbread(); | ||||
|       doaxfr(header); | ||||
|       close(fdcdb); | ||||
|     } | ||||
|     else { | ||||
|       if (!response_query(zone,qtype,qclass)) nomem(); | ||||
|       response[2] |= 4; | ||||
|       case_lowerb(zone,zonelen); | ||||
|       response_id(header); | ||||
|       response[3] &= ~128; | ||||
|       if (!(header[2] & 1)) response[2] &= ~1; | ||||
|       if (!respond(zone,qtype,ip)) die_outside(); | ||||
|       print(response,response_len); | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/axfrdns.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/axfrdns.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer.a
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer.a
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										10
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| #include "buffer.h" | ||||
|  | ||||
| void buffer_init(buffer *s,int (*op)(),int fd,char *buf,unsigned int len) | ||||
| { | ||||
|   s->x = buf; | ||||
|   s->fd = fd; | ||||
|   s->op = op; | ||||
|   s->p = 0; | ||||
|   s->n = len; | ||||
| } | ||||
							
								
								
									
										59
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,59 @@ | ||||
| #ifndef BUFFER_H | ||||
| #define BUFFER_H | ||||
|  | ||||
| typedef struct buffer { | ||||
|   char *x; | ||||
|   unsigned int p; | ||||
|   unsigned int n; | ||||
|   int fd; | ||||
|   int (*op)(); | ||||
| } buffer; | ||||
|  | ||||
| #define BUFFER_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (op) } | ||||
| #define BUFFER_INSIZE 8192 | ||||
| #define BUFFER_OUTSIZE 8192 | ||||
|  | ||||
| extern void buffer_init(buffer *,int (*)(),int,char *,unsigned int); | ||||
|  | ||||
| extern int buffer_flush(buffer *); | ||||
| extern int buffer_put(buffer *,const char *,unsigned int); | ||||
| extern int buffer_putalign(buffer *,const char *,unsigned int); | ||||
| extern int buffer_putflush(buffer *,const char *,unsigned int); | ||||
| extern int buffer_puts(buffer *,const char *); | ||||
| extern int buffer_putsalign(buffer *,const char *); | ||||
| extern int buffer_putsflush(buffer *,const char *); | ||||
|  | ||||
| #define buffer_PUTC(s,c) \ | ||||
|   ( ((s)->n != (s)->p) \ | ||||
|     ? ( (s)->x[(s)->p++] = (c), 0 ) \ | ||||
|     : buffer_put((s),&(c),1) \ | ||||
|   ) | ||||
|  | ||||
| extern int buffer_get(buffer *,char *,unsigned int); | ||||
| extern int buffer_bget(buffer *,char *,unsigned int); | ||||
| extern int buffer_feed(buffer *); | ||||
|  | ||||
| extern char *buffer_peek(buffer *); | ||||
| extern void buffer_seek(buffer *,unsigned int); | ||||
|  | ||||
| #define buffer_PEEK(s) ( (s)->x + (s)->n ) | ||||
| #define buffer_SEEK(s,len) ( ( (s)->p -= (len) ) , ( (s)->n += (len) ) ) | ||||
|  | ||||
| #define buffer_GETC(s,c) \ | ||||
|   ( ((s)->p > 0) \ | ||||
|     ? ( *(c) = (s)->x[(s)->n], buffer_SEEK((s),1), 1 ) \ | ||||
|     : buffer_get((s),(c),1) \ | ||||
|   ) | ||||
|  | ||||
| extern int buffer_copy(buffer *,buffer *); | ||||
|  | ||||
| extern int buffer_unixread(int,char *,unsigned int); | ||||
| extern int buffer_unixwrite(int,const char *,unsigned int); | ||||
|  | ||||
| extern buffer *buffer_0; | ||||
| extern buffer *buffer_0small; | ||||
| extern buffer *buffer_1; | ||||
| extern buffer *buffer_1small; | ||||
| extern buffer *buffer_2; | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										5
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_1.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_1.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| #include "buffer.h" | ||||
|  | ||||
| char buffer_1_space[BUFFER_OUTSIZE]; | ||||
| static buffer it = BUFFER_INIT(buffer_unixwrite,1,buffer_1_space,sizeof buffer_1_space); | ||||
| buffer *buffer_1 = ⁢ | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_1.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_1.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										5
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_2.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_2.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| #include "buffer.h" | ||||
|  | ||||
| char buffer_2_space[256]; | ||||
| static buffer it = BUFFER_INIT(buffer_unixwrite,2,buffer_2_space,sizeof buffer_2_space); | ||||
| buffer *buffer_2 = ⁢ | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_2.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_2.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										16
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_copy.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_copy.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| #include "buffer.h" | ||||
|  | ||||
| int buffer_copy(buffer *bout,buffer *bin) | ||||
| { | ||||
|   int n; | ||||
|   char *x; | ||||
|  | ||||
|   for (;;) { | ||||
|     n = buffer_feed(bin); | ||||
|     if (n < 0) return -2; | ||||
|     if (!n) return 0; | ||||
|     x = buffer_PEEK(bin); | ||||
|     if (buffer_put(bout,x,n) == -1) return -3; | ||||
|     buffer_SEEK(bin,n); | ||||
|   } | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_copy.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_copy.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										67
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_get.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_get.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,67 @@ | ||||
| #include "buffer.h" | ||||
| #include "byte.h" | ||||
| #include "error.h" | ||||
|  | ||||
| static int oneread(int (*op)(),int fd,char *buf,unsigned int len) | ||||
| { | ||||
|   int r; | ||||
|  | ||||
|   for (;;) { | ||||
|     r = op(fd,buf,len); | ||||
|     if (r == -1) if (errno == error_intr) continue; | ||||
|     return r; | ||||
|   } | ||||
| } | ||||
|  | ||||
| static int getthis(buffer *s,char *buf,unsigned int len) | ||||
| { | ||||
|   if (len > s->p) len = s->p; | ||||
|   s->p -= len; | ||||
|   byte_copy(buf,len,s->x + s->n); | ||||
|   s->n += len; | ||||
|   return len; | ||||
| } | ||||
|  | ||||
| int buffer_feed(buffer *s) | ||||
| { | ||||
|   int r; | ||||
|  | ||||
|   if (s->p) return s->p; | ||||
|   r = oneread(s->op,s->fd,s->x,s->n); | ||||
|   if (r <= 0) return r; | ||||
|   s->p = r; | ||||
|   s->n -= r; | ||||
|   if (s->n > 0) byte_copyr(s->x + s->n,r,s->x); | ||||
|   return r; | ||||
| } | ||||
|  | ||||
| int buffer_bget(buffer *s,char *buf,unsigned int len) | ||||
| { | ||||
|   int r; | ||||
|   | ||||
|   if (s->p > 0) return getthis(s,buf,len); | ||||
|   if (s->n <= len) return oneread(s->op,s->fd,buf,s->n); | ||||
|   r = buffer_feed(s); if (r <= 0) return r; | ||||
|   return getthis(s,buf,len); | ||||
| } | ||||
|  | ||||
| int buffer_get(buffer *s,char *buf,unsigned int len) | ||||
| { | ||||
|   int r; | ||||
|   | ||||
|   if (s->p > 0) return getthis(s,buf,len); | ||||
|   if (s->n <= len) return oneread(s->op,s->fd,buf,len); | ||||
|   r = buffer_feed(s); if (r <= 0) return r; | ||||
|   return getthis(s,buf,len); | ||||
| } | ||||
|  | ||||
| char *buffer_peek(buffer *s) | ||||
| { | ||||
|   return s->x + s->n; | ||||
| } | ||||
|  | ||||
| void buffer_seek(buffer *s,unsigned int len) | ||||
| { | ||||
|   s->n += len; | ||||
|   s->p -= len; | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_get.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_get.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										88
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_put.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										88
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_put.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,88 @@ | ||||
| #include "buffer.h" | ||||
| #include "str.h" | ||||
| #include "byte.h" | ||||
| #include "error.h" | ||||
|  | ||||
| static int allwrite(int (*op)(),int fd,const char *buf,unsigned int len) | ||||
| { | ||||
|   int w; | ||||
|  | ||||
|   while (len) { | ||||
|     w = op(fd,buf,len); | ||||
|     if (w == -1) { | ||||
|       if (errno == error_intr) continue; | ||||
|       return -1; /* note that some data may have been written */ | ||||
|     } | ||||
|     if (w == 0) ; /* luser's fault */ | ||||
|     buf += w; | ||||
|     len -= w; | ||||
|   } | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| int buffer_flush(buffer *s) | ||||
| { | ||||
|   int p; | ||||
|   | ||||
|   p = s->p; | ||||
|   if (!p) return 0; | ||||
|   s->p = 0; | ||||
|   return allwrite(s->op,s->fd,s->x,p); | ||||
| } | ||||
|  | ||||
| int buffer_putalign(buffer *s,const char *buf,unsigned int len) | ||||
| { | ||||
|   unsigned int n; | ||||
|   | ||||
|   while (len > (n = s->n - s->p)) { | ||||
|     byte_copy(s->x + s->p,n,buf); s->p += n; buf += n; len -= n; | ||||
|     if (buffer_flush(s) == -1) return -1; | ||||
|   } | ||||
|   /* now len <= s->n - s->p */ | ||||
|   byte_copy(s->x + s->p,len,buf); | ||||
|   s->p += len; | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| int buffer_put(buffer *s,const char *buf,unsigned int len) | ||||
| { | ||||
|   unsigned int n; | ||||
|   | ||||
|   n = s->n; | ||||
|   if (len > n - s->p) { | ||||
|     if (buffer_flush(s) == -1) return -1; | ||||
|     /* now s->p == 0 */ | ||||
|     if (n < BUFFER_OUTSIZE) n = BUFFER_OUTSIZE; | ||||
|     while (len > s->n) { | ||||
|       if (n > len) n = len; | ||||
|       if (allwrite(s->op,s->fd,buf,n) == -1) return -1; | ||||
|       buf += n; | ||||
|       len -= n; | ||||
|     } | ||||
|   } | ||||
|   /* now len <= s->n - s->p */ | ||||
|   byte_copy(s->x + s->p,len,buf); | ||||
|   s->p += len; | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| int buffer_putflush(buffer *s,const char *buf,unsigned int len) | ||||
| { | ||||
|   if (buffer_flush(s) == -1) return -1; | ||||
|   return allwrite(s->op,s->fd,buf,len); | ||||
| } | ||||
|  | ||||
| int buffer_putsalign(buffer *s,const char *buf) | ||||
| { | ||||
|   return buffer_putalign(s,buf,str_len(buf)); | ||||
| } | ||||
|  | ||||
| int buffer_puts(buffer *s,const char *buf) | ||||
| { | ||||
|   return buffer_put(s,buf,str_len(buf)); | ||||
| } | ||||
|  | ||||
| int buffer_putsflush(buffer *s,const char *buf) | ||||
| { | ||||
|   return buffer_putflush(s,buf,str_len(buf)); | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_put.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_put.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										7
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_read.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_read.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| #include <unistd.h> | ||||
| #include "buffer.h" | ||||
|  | ||||
| int buffer_unixread(int fd,char *buf,unsigned int len) | ||||
| { | ||||
|   return read(fd,buf,len); | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_read.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_read.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										7
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_write.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_write.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| #include <unistd.h> | ||||
| #include "buffer.h" | ||||
|  | ||||
| int buffer_unixwrite(int fd,const char *buf,unsigned int len) | ||||
| { | ||||
|   return write(fd,buf,len); | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_write.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/buffer_write.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte.a
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte.a
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										13
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| #ifndef BYTE_H | ||||
| #define BYTE_H | ||||
|  | ||||
| extern unsigned int byte_chr(); | ||||
| extern unsigned int byte_rchr(); | ||||
| extern void byte_copy(); | ||||
| extern void byte_copyr(); | ||||
| extern int byte_diff(); | ||||
| extern void byte_zero(); | ||||
|  | ||||
| #define byte_equal(s,n,t) (!byte_diff((s),(n),(t))) | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										20
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_chr.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_chr.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| #include "byte.h" | ||||
|  | ||||
| unsigned int byte_chr(s,n,c) | ||||
| char *s; | ||||
| register unsigned int n; | ||||
| int c; | ||||
| { | ||||
|   register char ch; | ||||
|   register char *t; | ||||
|  | ||||
|   ch = c; | ||||
|   t = s; | ||||
|   for (;;) { | ||||
|     if (!n) break; if (*t == ch) break; ++t; --n; | ||||
|     if (!n) break; if (*t == ch) break; ++t; --n; | ||||
|     if (!n) break; if (*t == ch) break; ++t; --n; | ||||
|     if (!n) break; if (*t == ch) break; ++t; --n; | ||||
|   } | ||||
|   return t - s; | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_chr.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_chr.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										14
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_copy.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_copy.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| #include "byte.h" | ||||
|  | ||||
| void byte_copy(to,n,from) | ||||
| register char *to; | ||||
| register unsigned int n; | ||||
| register char *from; | ||||
| { | ||||
|   for (;;) { | ||||
|     if (!n) return; *to++ = *from++; --n; | ||||
|     if (!n) return; *to++ = *from++; --n; | ||||
|     if (!n) return; *to++ = *from++; --n; | ||||
|     if (!n) return; *to++ = *from++; --n; | ||||
|   } | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_copy.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_copy.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										16
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_cr.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_cr.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| #include "byte.h" | ||||
|  | ||||
| void byte_copyr(to,n,from) | ||||
| register char *to; | ||||
| register unsigned int n; | ||||
| register char *from; | ||||
| { | ||||
|   to += n; | ||||
|   from += n; | ||||
|   for (;;) { | ||||
|     if (!n) return; *--to = *--from; --n; | ||||
|     if (!n) return; *--to = *--from; --n; | ||||
|     if (!n) return; *--to = *--from; --n; | ||||
|     if (!n) return; *--to = *--from; --n; | ||||
|   } | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_cr.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_cr.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										16
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_diff.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_diff.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| #include "byte.h" | ||||
|  | ||||
| int byte_diff(s,n,t) | ||||
| register char *s; | ||||
| register unsigned int n; | ||||
| register char *t; | ||||
| { | ||||
|   for (;;) { | ||||
|     if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; | ||||
|     if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; | ||||
|     if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; | ||||
|     if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; | ||||
|   } | ||||
|   return ((int)(unsigned int)(unsigned char) *s) | ||||
|        - ((int)(unsigned int)(unsigned char) *t); | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_diff.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_diff.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										13
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_zero.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_zero.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| #include "byte.h" | ||||
|  | ||||
| void byte_zero(s,n) | ||||
| char *s; | ||||
| register unsigned int n; | ||||
| { | ||||
|   for (;;) { | ||||
|     if (!n) break; *s++ = 0; --n; | ||||
|     if (!n) break; *s++ = 0; --n; | ||||
|     if (!n) break; *s++ = 0; --n; | ||||
|     if (!n) break; *s++ = 0; --n; | ||||
|   } | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_zero.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/byte_zero.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										207
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cache.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										207
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cache.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,207 @@ | ||||
| #include "alloc.h" | ||||
| #include "byte.h" | ||||
| #include "uint32.h" | ||||
| #include "exit.h" | ||||
| #include "tai.h" | ||||
| #include "cache.h" | ||||
|  | ||||
| uint64 cache_motion = 0; | ||||
|  | ||||
| static char *x = 0; | ||||
| static uint32 size; | ||||
| static uint32 hsize; | ||||
| static uint32 writer; | ||||
| static uint32 oldest; | ||||
| static uint32 unused; | ||||
|  | ||||
| /* | ||||
| 100 <= size <= 1000000000. | ||||
| 4 <= hsize <= size/16. | ||||
| hsize is a power of 2. | ||||
|  | ||||
| hsize <= writer <= oldest <= unused <= size. | ||||
| If oldest == unused then unused == size. | ||||
|  | ||||
| x is a hash table with the following structure: | ||||
| x[0...hsize-1]: hsize/4 head links. | ||||
| x[hsize...writer-1]: consecutive entries, newest entry on the right. | ||||
| x[writer...oldest-1]: free space for new entries. | ||||
| x[oldest...unused-1]: consecutive entries, oldest entry on the left. | ||||
| x[unused...size-1]: unused. | ||||
|  | ||||
| Each hash bucket is a linked list containing the following items: | ||||
| the head link, the newest entry, the second-newest entry, etc. | ||||
| Each link is a 4-byte number giving the xor of | ||||
| the positions of the adjacent items in the list. | ||||
|  | ||||
| Entries are always inserted immediately after the head and removed at the tail. | ||||
|  | ||||
| Each entry contains the following information: | ||||
| 4-byte link; 4-byte keylen; 4-byte datalen; 8-byte expire time; key; data. | ||||
| */ | ||||
|  | ||||
| #define MAXKEYLEN 1000 | ||||
| #define MAXDATALEN 1000000 | ||||
|  | ||||
| static void cache_impossible(void) | ||||
| { | ||||
|   _exit(111); | ||||
| } | ||||
|  | ||||
| static void set4(uint32 pos,uint32 u) | ||||
| { | ||||
|   if (pos > size - 4) cache_impossible(); | ||||
|   uint32_pack(x + pos,u); | ||||
| } | ||||
|  | ||||
| static uint32 get4(uint32 pos) | ||||
| { | ||||
|   uint32 result; | ||||
|   if (pos > size - 4) cache_impossible(); | ||||
|   uint32_unpack(x + pos,&result); | ||||
|   return result; | ||||
| } | ||||
|  | ||||
| static unsigned int hash(const char *key,unsigned int keylen) | ||||
| { | ||||
|   unsigned int result = 5381; | ||||
|  | ||||
|   while (keylen) { | ||||
|     result = (result << 5) + result; | ||||
|     result ^= (unsigned char) *key; | ||||
|     ++key; | ||||
|     --keylen; | ||||
|   } | ||||
|   result <<= 2; | ||||
|   result &= hsize - 4; | ||||
|   return result; | ||||
| } | ||||
|  | ||||
| char *cache_get(const char *key,unsigned int keylen,unsigned int *datalen,uint32 *ttl) | ||||
| { | ||||
|   struct tai expire; | ||||
|   struct tai now; | ||||
|   uint32 pos; | ||||
|   uint32 prevpos; | ||||
|   uint32 nextpos; | ||||
|   uint32 u; | ||||
|   unsigned int loop; | ||||
|   double d; | ||||
|  | ||||
|   if (!x) return 0; | ||||
|   if (keylen > MAXKEYLEN) return 0; | ||||
|  | ||||
|   prevpos = hash(key,keylen); | ||||
|   pos = get4(prevpos); | ||||
|   loop = 0; | ||||
|  | ||||
|   while (pos) { | ||||
|     if (get4(pos + 4) == keylen) { | ||||
|       if (pos + 20 + keylen > size) cache_impossible(); | ||||
|       if (byte_equal(key,keylen,x + pos + 20)) { | ||||
|         tai_unpack(x + pos + 12,&expire); | ||||
|         tai_now(&now); | ||||
|         if (tai_less(&expire,&now)) return 0; | ||||
|  | ||||
|         tai_sub(&expire,&expire,&now); | ||||
|         d = tai_approx(&expire); | ||||
|         if (d > 604800) d = 604800; | ||||
|         *ttl = d; | ||||
|  | ||||
|         u = get4(pos + 8); | ||||
|         if (u > size - pos - 20 - keylen) cache_impossible(); | ||||
|         *datalen = u; | ||||
|  | ||||
|         return x + pos + 20 + keylen; | ||||
|       } | ||||
|     } | ||||
|     nextpos = prevpos ^ get4(pos); | ||||
|     prevpos = pos; | ||||
|     pos = nextpos; | ||||
|     if (++loop > 100) return 0; /* to protect against hash flooding */ | ||||
|   } | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| void cache_set(const char *key,unsigned int keylen,const char *data,unsigned int datalen,uint32 ttl) | ||||
| { | ||||
|   struct tai now; | ||||
|   struct tai expire; | ||||
|   unsigned int entrylen; | ||||
|   unsigned int keyhash; | ||||
|   uint32 pos; | ||||
|  | ||||
|   if (!x) return; | ||||
|   if (keylen > MAXKEYLEN) return; | ||||
|   if (datalen > MAXDATALEN) return; | ||||
|  | ||||
|   if (!ttl) return; | ||||
|   if (ttl > 604800) ttl = 604800; | ||||
|  | ||||
|   entrylen = keylen + datalen + 20; | ||||
|  | ||||
|   while (writer + entrylen > oldest) { | ||||
|     if (oldest == unused) { | ||||
|       if (writer <= hsize) return; | ||||
|       unused = writer; | ||||
|       oldest = hsize; | ||||
|       writer = hsize; | ||||
|     } | ||||
|  | ||||
|     pos = get4(oldest); | ||||
|     set4(pos,get4(pos) ^ oldest); | ||||
|    | ||||
|     oldest += get4(oldest + 4) + get4(oldest + 8) + 20; | ||||
|     if (oldest > unused) cache_impossible(); | ||||
|     if (oldest == unused) { | ||||
|       unused = size; | ||||
|       oldest = size; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   keyhash = hash(key,keylen); | ||||
|  | ||||
|   tai_now(&now); | ||||
|   tai_uint(&expire,ttl); | ||||
|   tai_add(&expire,&expire,&now); | ||||
|  | ||||
|   pos = get4(keyhash); | ||||
|   if (pos) | ||||
|     set4(pos,get4(pos) ^ keyhash ^ writer); | ||||
|   set4(writer,pos ^ keyhash); | ||||
|   set4(writer + 4,keylen); | ||||
|   set4(writer + 8,datalen); | ||||
|   tai_pack(x + writer + 12,&expire); | ||||
|   byte_copy(x + writer + 20,keylen,key); | ||||
|   byte_copy(x + writer + 20 + keylen,datalen,data); | ||||
|  | ||||
|   set4(keyhash,writer); | ||||
|   writer += entrylen; | ||||
|   cache_motion += entrylen; | ||||
| } | ||||
|  | ||||
| int cache_init(unsigned int cachesize) | ||||
| { | ||||
|   if (x) { | ||||
|     alloc_free(x); | ||||
|     x = 0; | ||||
|   } | ||||
|  | ||||
|   if (cachesize > 1000000000) cachesize = 1000000000; | ||||
|   if (cachesize < 100) cachesize = 100; | ||||
|   size = cachesize; | ||||
|  | ||||
|   hsize = 4; | ||||
|   while (hsize <= (size >> 5)) hsize <<= 1; | ||||
|  | ||||
|   x = alloc(size); | ||||
|   if (!x) return 0; | ||||
|   byte_zero(x,size); | ||||
|  | ||||
|   writer = hsize; | ||||
|   oldest = size; | ||||
|   unused = size; | ||||
|  | ||||
|   return 1; | ||||
| } | ||||
							
								
								
									
										12
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cache.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cache.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| #ifndef CACHE_H | ||||
| #define CACHE_H | ||||
|  | ||||
| #include "uint32.h" | ||||
| #include "uint64.h" | ||||
|  | ||||
| extern uint64 cache_motion; | ||||
| extern int cache_init(unsigned int); | ||||
| extern void cache_set(const char *,unsigned int,const char *,unsigned int,uint32); | ||||
| extern char *cache_get(const char *,unsigned int,unsigned int *,uint32 *); | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cache.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cache.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cachetest
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cachetest
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										32
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cachetest.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cachetest.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | ||||
| #include "buffer.h" | ||||
| #include "exit.h" | ||||
| #include "cache.h" | ||||
| #include "str.h" | ||||
|  | ||||
| int main(int argc,char **argv) | ||||
| { | ||||
|   int i; | ||||
|   char *x; | ||||
|   char *y; | ||||
|   unsigned int u; | ||||
|   uint32 ttl; | ||||
|  | ||||
|   if (!cache_init(200)) _exit(111); | ||||
|  | ||||
|   if (*argv) ++argv; | ||||
|  | ||||
|   while (x = *argv++) { | ||||
|     i = str_chr(x,':'); | ||||
|     if (x[i]) | ||||
|       cache_set(x,i,x + i + 1,str_len(x) - i - 1,86400); | ||||
|     else { | ||||
|       y = cache_get(x,i,&u,&ttl); | ||||
|       if (y) | ||||
|         buffer_put(buffer_1,y,u); | ||||
|       buffer_puts(buffer_1,"\n"); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   buffer_flush(buffer_1); | ||||
|   _exit(0); | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cachetest.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cachetest.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										13
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/case.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/case.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| #ifndef CASE_H | ||||
| #define CASE_H | ||||
|  | ||||
| extern void case_lowers(char *); | ||||
| extern void case_lowerb(char *,unsigned int); | ||||
| extern int case_diffs(const char *,const char *); | ||||
| extern int case_diffb(const char *,unsigned int,const char *); | ||||
| extern int case_starts(const char *,const char *); | ||||
| extern int case_startb(const char *,unsigned int,const char *); | ||||
|  | ||||
| #define case_equals(s,t) (!case_diffs((s),(t))) | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										18
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/case_diffb.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/case_diffb.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| #include "case.h" | ||||
|  | ||||
| int case_diffb(register const char *s,register unsigned int len,register const char *t) | ||||
| { | ||||
|   register unsigned char x; | ||||
|   register unsigned char y; | ||||
|  | ||||
|   while (len > 0) { | ||||
|     --len; | ||||
|     x = *s++ - 'A'; | ||||
|     if (x <= 'Z' - 'A') x += 'a'; else x += 'A'; | ||||
|     y = *t++ - 'A'; | ||||
|     if (y <= 'Z' - 'A') y += 'a'; else y += 'A'; | ||||
|     if (x != y) | ||||
|       return ((int)(unsigned int) x) - ((int)(unsigned int) y); | ||||
|   } | ||||
|   return 0; | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/case_diffb.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/case_diffb.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										17
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/case_diffs.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/case_diffs.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| #include "case.h" | ||||
|  | ||||
| int case_diffs(register const char *s,register const char *t) | ||||
| { | ||||
|   register unsigned char x; | ||||
|   register unsigned char y; | ||||
|  | ||||
|   for (;;) { | ||||
|     x = *s++ - 'A'; | ||||
|     if (x <= 'Z' - 'A') x += 'a'; else x += 'A'; | ||||
|     y = *t++ - 'A'; | ||||
|     if (y <= 'Z' - 'A') y += 'a'; else y += 'A'; | ||||
|     if (x != y) break; | ||||
|     if (!x) break; | ||||
|   } | ||||
|   return ((int)(unsigned int) x) - ((int)(unsigned int) y); | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/case_diffs.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/case_diffs.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										12
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/case_lowerb.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/case_lowerb.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| #include "case.h" | ||||
|  | ||||
| void case_lowerb(char *s,unsigned int len) | ||||
| { | ||||
|   unsigned char x; | ||||
|   while (len > 0) { | ||||
|     --len; | ||||
|     x = *s - 'A'; | ||||
|     if (x <= 'Z' - 'A') *s = x + 'a'; | ||||
|     ++s; | ||||
|   } | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/case_lowerb.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/case_lowerb.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cdb.a
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cdb.a
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										136
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cdb.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										136
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cdb.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,136 @@ | ||||
| /* Public domain. */ | ||||
|  | ||||
| #include <sys/types.h> | ||||
| #include <sys/stat.h> | ||||
| #include <sys/mman.h> | ||||
| #include <unistd.h> | ||||
| #include "error.h" | ||||
| #include "seek.h" | ||||
| #include "byte.h" | ||||
| #include "cdb.h" | ||||
|  | ||||
| void cdb_free(struct cdb *c) | ||||
| { | ||||
|   if (c->map) { | ||||
|     munmap(c->map,c->size); | ||||
|     c->map = 0; | ||||
|   } | ||||
| } | ||||
|  | ||||
| void cdb_findstart(struct cdb *c) | ||||
| { | ||||
|   c->loop = 0; | ||||
| } | ||||
|  | ||||
| void cdb_init(struct cdb *c,int fd) | ||||
| { | ||||
|   struct stat st; | ||||
|   char *x; | ||||
|  | ||||
|   cdb_free(c); | ||||
|   cdb_findstart(c); | ||||
|   c->fd = fd; | ||||
|  | ||||
|   if (fstat(fd,&st) == 0) | ||||
|     if (st.st_size <= 0xffffffff) { | ||||
|       x = mmap(0,st.st_size,PROT_READ,MAP_SHARED,fd,0); | ||||
|       if (x + 1) { | ||||
| 	c->size = st.st_size; | ||||
| 	c->map = x; | ||||
|       } | ||||
|     } | ||||
| } | ||||
|  | ||||
| int cdb_read(struct cdb *c,char *buf,unsigned int len,uint32 pos) | ||||
| { | ||||
|   if (c->map) { | ||||
|     if ((pos > c->size) || (c->size - pos < len)) goto FORMAT; | ||||
|     byte_copy(buf,len,c->map + pos); | ||||
|   } | ||||
|   else { | ||||
|     if (seek_set(c->fd,pos) == -1) return -1; | ||||
|     while (len > 0) { | ||||
|       int r; | ||||
|       do | ||||
|         r = read(c->fd,buf,len); | ||||
|       while ((r == -1) && (errno == error_intr)); | ||||
|       if (r == -1) return -1; | ||||
|       if (r == 0) goto FORMAT; | ||||
|       buf += r; | ||||
|       len -= r; | ||||
|     } | ||||
|   } | ||||
|   return 0; | ||||
|  | ||||
|   FORMAT: | ||||
|   errno = error_proto; | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| static int match(struct cdb *c,const char *key,unsigned int len,uint32 pos) | ||||
| { | ||||
|   char buf[32]; | ||||
|   int n; | ||||
|  | ||||
|   while (len > 0) { | ||||
|     n = sizeof buf; | ||||
|     if (n > len) n = len; | ||||
|     if (cdb_read(c,buf,n,pos) == -1) return -1; | ||||
|     if (byte_diff(buf,n,key)) return 0; | ||||
|     pos += n; | ||||
|     key += n; | ||||
|     len -= n; | ||||
|   } | ||||
|   return 1; | ||||
| } | ||||
|  | ||||
| int cdb_findnext(struct cdb *c,const char *key,unsigned int len) | ||||
| { | ||||
|   char buf[8]; | ||||
|   uint32 pos; | ||||
|   uint32 u; | ||||
|  | ||||
|   if (!c->loop) { | ||||
|     u = cdb_hash(key,len); | ||||
|     if (cdb_read(c,buf,8,(u << 3) & 2047) == -1) return -1; | ||||
|     uint32_unpack(buf + 4,&c->hslots); | ||||
|     if (!c->hslots) return 0; | ||||
|     uint32_unpack(buf,&c->hpos); | ||||
|     c->khash = u; | ||||
|     u >>= 8; | ||||
|     u %= c->hslots; | ||||
|     u <<= 3; | ||||
|     c->kpos = c->hpos + u; | ||||
|   } | ||||
|  | ||||
|   while (c->loop < c->hslots) { | ||||
|     if (cdb_read(c,buf,8,c->kpos) == -1) return -1; | ||||
|     uint32_unpack(buf + 4,&pos); | ||||
|     if (!pos) return 0; | ||||
|     c->loop += 1; | ||||
|     c->kpos += 8; | ||||
|     if (c->kpos == c->hpos + (c->hslots << 3)) c->kpos = c->hpos; | ||||
|     uint32_unpack(buf,&u); | ||||
|     if (u == c->khash) { | ||||
|       if (cdb_read(c,buf,8,pos) == -1) return -1; | ||||
|       uint32_unpack(buf,&u); | ||||
|       if (u == len) | ||||
| 	switch(match(c,key,len,pos + 8)) { | ||||
| 	  case -1: | ||||
| 	    return -1; | ||||
| 	  case 1: | ||||
| 	    uint32_unpack(buf + 4,&c->dlen); | ||||
| 	    c->dpos = pos + 8 + len; | ||||
| 	    return 1; | ||||
| 	} | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| int cdb_find(struct cdb *c,const char *key,unsigned int len) | ||||
| { | ||||
|   cdb_findstart(c); | ||||
|   return cdb_findnext(c,key,len); | ||||
| } | ||||
							
								
								
									
										37
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cdb.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cdb.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| /* Public domain. */ | ||||
|  | ||||
| #ifndef CDB_H | ||||
| #define CDB_H | ||||
|  | ||||
| #include "uint32.h" | ||||
|  | ||||
| #define CDB_HASHSTART 5381 | ||||
| extern uint32 cdb_hashadd(uint32,unsigned char); | ||||
| extern uint32 cdb_hash(const char *,unsigned int); | ||||
|  | ||||
| struct cdb { | ||||
|   char *map; /* 0 if no map is available */ | ||||
|   int fd; | ||||
|   uint32 size; /* initialized if map is nonzero */ | ||||
|   uint32 loop; /* number of hash slots searched under this key */ | ||||
|   uint32 khash; /* initialized if loop is nonzero */ | ||||
|   uint32 kpos; /* initialized if loop is nonzero */ | ||||
|   uint32 hpos; /* initialized if loop is nonzero */ | ||||
|   uint32 hslots; /* initialized if loop is nonzero */ | ||||
|   uint32 dpos; /* initialized if cdb_findnext() returns 1 */ | ||||
|   uint32 dlen; /* initialized if cdb_findnext() returns 1 */ | ||||
| } ; | ||||
|  | ||||
| extern void cdb_free(struct cdb *); | ||||
| extern void cdb_init(struct cdb *,int fd); | ||||
|  | ||||
| extern int cdb_read(struct cdb *,char *,unsigned int,uint32); | ||||
|  | ||||
| extern void cdb_findstart(struct cdb *); | ||||
| extern int cdb_findnext(struct cdb *,const char *,unsigned int); | ||||
| extern int cdb_find(struct cdb *,const char *,unsigned int); | ||||
|  | ||||
| #define cdb_datapos(c) ((c)->dpos) | ||||
| #define cdb_datalen(c) ((c)->dlen) | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cdb.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cdb.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										21
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cdb_hash.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cdb_hash.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| /* Public domain. */ | ||||
|  | ||||
| #include "cdb.h" | ||||
|  | ||||
| uint32 cdb_hashadd(uint32 h,unsigned char c) | ||||
| { | ||||
|   h += (h << 5); | ||||
|   return h ^ c; | ||||
| } | ||||
|  | ||||
| uint32 cdb_hash(const char *buf,unsigned int len) | ||||
| { | ||||
|   uint32 h; | ||||
|  | ||||
|   h = CDB_HASHSTART; | ||||
|   while (len) { | ||||
|     h = cdb_hashadd(h,*buf++); | ||||
|     --len; | ||||
|   } | ||||
|   return h; | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cdb_hash.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cdb_hash.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										152
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cdb_make.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										152
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cdb_make.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,152 @@ | ||||
| /* Public domain. */ | ||||
|  | ||||
| #include "seek.h" | ||||
| #include "error.h" | ||||
| #include "alloc.h" | ||||
| #include "cdb.h" | ||||
| #include "cdb_make.h" | ||||
|  | ||||
| int cdb_make_start(struct cdb_make *c,int fd) | ||||
| { | ||||
|   c->head = 0; | ||||
|   c->split = 0; | ||||
|   c->hash = 0; | ||||
|   c->numentries = 0; | ||||
|   c->fd = fd; | ||||
|   c->pos = sizeof c->final; | ||||
|   buffer_init(&c->b,buffer_unixwrite,fd,c->bspace,sizeof c->bspace); | ||||
|   return seek_set(fd,c->pos); | ||||
| } | ||||
|  | ||||
| static int posplus(struct cdb_make *c,uint32 len) | ||||
| { | ||||
|   uint32 newpos = c->pos + len; | ||||
|   if (newpos < len) { errno = error_nomem; return -1; } | ||||
|   c->pos = newpos; | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| int cdb_make_addend(struct cdb_make *c,unsigned int keylen,unsigned int datalen,uint32 h) | ||||
| { | ||||
|   struct cdb_hplist *head; | ||||
|  | ||||
|   head = c->head; | ||||
|   if (!head || (head->num >= CDB_HPLIST)) { | ||||
|     head = (struct cdb_hplist *) alloc(sizeof(struct cdb_hplist)); | ||||
|     if (!head) return -1; | ||||
|     head->num = 0; | ||||
|     head->next = c->head; | ||||
|     c->head = head; | ||||
|   } | ||||
|   head->hp[head->num].h = h; | ||||
|   head->hp[head->num].p = c->pos; | ||||
|   ++head->num; | ||||
|   ++c->numentries; | ||||
|   if (posplus(c,8) == -1) return -1; | ||||
|   if (posplus(c,keylen) == -1) return -1; | ||||
|   if (posplus(c,datalen) == -1) return -1; | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| int cdb_make_addbegin(struct cdb_make *c,unsigned int keylen,unsigned int datalen) | ||||
| { | ||||
|   char buf[8]; | ||||
|  | ||||
|   if (keylen > 0xffffffff) { errno = error_nomem; return -1; } | ||||
|   if (datalen > 0xffffffff) { errno = error_nomem; return -1; } | ||||
|  | ||||
|   uint32_pack(buf,keylen); | ||||
|   uint32_pack(buf + 4,datalen); | ||||
|   if (buffer_putalign(&c->b,buf,8) == -1) return -1; | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| int cdb_make_add(struct cdb_make *c,const char *key,unsigned int keylen,const char *data,unsigned int datalen) | ||||
| { | ||||
|   if (cdb_make_addbegin(c,keylen,datalen) == -1) return -1; | ||||
|   if (buffer_putalign(&c->b,key,keylen) == -1) return -1; | ||||
|   if (buffer_putalign(&c->b,data,datalen) == -1) return -1; | ||||
|   return cdb_make_addend(c,keylen,datalen,cdb_hash(key,keylen)); | ||||
| } | ||||
|  | ||||
| int cdb_make_finish(struct cdb_make *c) | ||||
| { | ||||
|   char buf[8]; | ||||
|   int i; | ||||
|   uint32 len; | ||||
|   uint32 u; | ||||
|   uint32 memsize; | ||||
|   uint32 count; | ||||
|   uint32 where; | ||||
|   struct cdb_hplist *x; | ||||
|   struct cdb_hp *hp; | ||||
|  | ||||
|   for (i = 0;i < 256;++i) | ||||
|     c->count[i] = 0; | ||||
|  | ||||
|   for (x = c->head;x;x = x->next) { | ||||
|     i = x->num; | ||||
|     while (i--) | ||||
|       ++c->count[255 & x->hp[i].h]; | ||||
|   } | ||||
|  | ||||
|   memsize = 1; | ||||
|   for (i = 0;i < 256;++i) { | ||||
|     u = c->count[i] * 2; | ||||
|     if (u > memsize) | ||||
|       memsize = u; | ||||
|   } | ||||
|  | ||||
|   memsize += c->numentries; /* no overflow possible up to now */ | ||||
|   u = (uint32) 0 - (uint32) 1; | ||||
|   u /= sizeof(struct cdb_hp); | ||||
|   if (memsize > u) { errno = error_nomem; return -1; } | ||||
|  | ||||
|   c->split = (struct cdb_hp *) alloc(memsize * sizeof(struct cdb_hp)); | ||||
|   if (!c->split) return -1; | ||||
|  | ||||
|   c->hash = c->split + c->numentries; | ||||
|  | ||||
|   u = 0; | ||||
|   for (i = 0;i < 256;++i) { | ||||
|     u += c->count[i]; /* bounded by numentries, so no overflow */ | ||||
|     c->start[i] = u; | ||||
|   } | ||||
|  | ||||
|   for (x = c->head;x;x = x->next) { | ||||
|     i = x->num; | ||||
|     while (i--) | ||||
|       c->split[--c->start[255 & x->hp[i].h]] = x->hp[i]; | ||||
|   } | ||||
|  | ||||
|   for (i = 0;i < 256;++i) { | ||||
|     count = c->count[i]; | ||||
|  | ||||
|     len = count + count; /* no overflow possible */ | ||||
|     uint32_pack(c->final + 8 * i,c->pos); | ||||
|     uint32_pack(c->final + 8 * i + 4,len); | ||||
|  | ||||
|     for (u = 0;u < len;++u) | ||||
|       c->hash[u].h = c->hash[u].p = 0; | ||||
|  | ||||
|     hp = c->split + c->start[i]; | ||||
|     for (u = 0;u < count;++u) { | ||||
|       where = (hp->h >> 8) % len; | ||||
|       while (c->hash[where].p) | ||||
| 	if (++where == len) | ||||
| 	  where = 0; | ||||
|       c->hash[where] = *hp++; | ||||
|     } | ||||
|  | ||||
|     for (u = 0;u < len;++u) { | ||||
|       uint32_pack(buf,c->hash[u].h); | ||||
|       uint32_pack(buf + 4,c->hash[u].p); | ||||
|       if (buffer_putalign(&c->b,buf,8) == -1) return -1; | ||||
|       if (posplus(c,8) == -1) return -1; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   if (buffer_flush(&c->b) == -1) return -1; | ||||
|   if (seek_begin(c->fd) == -1) return -1; | ||||
|   return buffer_putflush(&c->b,c->final,sizeof c->final); | ||||
| } | ||||
							
								
								
									
										39
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cdb_make.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cdb_make.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | ||||
| /* Public domain. */ | ||||
|  | ||||
| #ifndef CDB_MAKE_H | ||||
| #define CDB_MAKE_H | ||||
|  | ||||
| #include "buffer.h" | ||||
| #include "uint32.h" | ||||
|  | ||||
| #define CDB_HPLIST 1000 | ||||
|  | ||||
| struct cdb_hp { uint32 h; uint32 p; } ; | ||||
|  | ||||
| struct cdb_hplist { | ||||
|   struct cdb_hp hp[CDB_HPLIST]; | ||||
|   struct cdb_hplist *next; | ||||
|   int num; | ||||
| } ; | ||||
|  | ||||
| struct cdb_make { | ||||
|   char bspace[8192]; | ||||
|   char final[2048]; | ||||
|   uint32 count[256]; | ||||
|   uint32 start[256]; | ||||
|   struct cdb_hplist *head; | ||||
|   struct cdb_hp *split; /* includes space for hash */ | ||||
|   struct cdb_hp *hash; | ||||
|   uint32 numentries; | ||||
|   buffer b; | ||||
|   uint32 pos; | ||||
|   int fd; | ||||
| } ; | ||||
|  | ||||
| extern int cdb_make_start(struct cdb_make *,int); | ||||
| extern int cdb_make_addbegin(struct cdb_make *,unsigned int,unsigned int); | ||||
| extern int cdb_make_addend(struct cdb_make *,unsigned int,unsigned int,uint32); | ||||
| extern int cdb_make_add(struct cdb_make *,const char *,unsigned int,const char *,unsigned int); | ||||
| extern int cdb_make_finish(struct cdb_make *); | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cdb_make.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/cdb_make.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/chkshsgr
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/chkshsgr
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										10
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/chkshsgr.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/chkshsgr.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| #include "exit.h" | ||||
|  | ||||
| int main() | ||||
| { | ||||
|   short x[4]; | ||||
|  | ||||
|   x[0] = x[1] = 0; | ||||
|   if (getgroups(1,x) == 0) if (setgroups(1,x) == -1) _exit(1); | ||||
|   _exit(0); | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/chkshsgr.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/chkshsgr.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										20
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/choose
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										20
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/choose
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| #!/bin/sh | ||||
| # WARNING: This file was auto-generated. Do not edit! | ||||
|  | ||||
| result="$4" | ||||
|  | ||||
| case "$1" in | ||||
|   *c*) ./compile $2.c >/dev/null 2>&1 || result="$3" ;; | ||||
| esac | ||||
|  | ||||
| case "$1" in | ||||
|   *l*) ./load $2 >/dev/null 2>&1 || result="$3" ;; | ||||
| esac | ||||
|  | ||||
| case "$1" in | ||||
|   *r*) ./$2 >/dev/null 2>&1 || result="$3" ;; | ||||
| esac | ||||
|  | ||||
| rm -f $2.o $2 | ||||
|  | ||||
| exec cat "$result" | ||||
							
								
								
									
										18
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/choose.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/choose.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
|  | ||||
| result="$4" | ||||
|  | ||||
| case "$1" in | ||||
|   *c*) ./compile $2.c >/dev/null 2>&1 || result="$3" ;; | ||||
| esac | ||||
|  | ||||
| case "$1" in | ||||
|   *l*) ./load $2 >/dev/null 2>&1 || result="$3" ;; | ||||
| esac | ||||
|  | ||||
| case "$1" in | ||||
|   *r*) ./$2 >/dev/null 2>&1 || result="$3" ;; | ||||
| esac | ||||
|  | ||||
| rm -f $2.o $2 | ||||
|  | ||||
| exec cat "$result" | ||||
							
								
								
									
										3
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/compile
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										3
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/compile
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| #!/bin/sh | ||||
| # WARNING: This file was auto-generated. Do not edit! | ||||
| exec gcc -O2 -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings -c ${1+"$@"} | ||||
							
								
								
									
										3
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/conf-cc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/conf-cc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| gcc -O2 -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings | ||||
|  | ||||
| This will be used to compile .c files. | ||||
							
								
								
									
										4
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/conf-home
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/conf-home
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| /usr/local | ||||
|  | ||||
| This is the dnscache home directory. Programs will be installed in | ||||
| .../bin. | ||||
							
								
								
									
										3
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/conf-ld
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/conf-ld
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| gcc -s | ||||
|  | ||||
| This will be used to link .o files into an executable. | ||||
							
								
								
									
										36
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/dd.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/dd.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| #include "dns.h" | ||||
| #include "dd.h" | ||||
|  | ||||
| int dd(const char *q,const char *base,char ip[4]) | ||||
| { | ||||
|   int j; | ||||
|   unsigned int x; | ||||
|  | ||||
|   for (j = 0;;++j) { | ||||
|     if (dns_domain_equal(q,base)) return j; | ||||
|     if (j >= 4) return -1; | ||||
|  | ||||
|     if (*q <= 0) return -1; | ||||
|     if (*q >= 4) return -1; | ||||
|     if ((q[1] < '0') || (q[1] > '9')) return -1; | ||||
|     x = q[1] - '0'; | ||||
|     if (*q == 1) { | ||||
|       ip[j] = x; | ||||
|       q += 2; | ||||
|       continue; | ||||
|     } | ||||
|     if (!x) return -1; | ||||
|     if ((q[2] < '0') || (q[2] > '9')) return -1; | ||||
|     x = x * 10 + (q[2] - '0'); | ||||
|     if (*q == 2) { | ||||
|       ip[j] = x; | ||||
|       q += 3; | ||||
|       continue; | ||||
|     } | ||||
|     if ((q[3] < '0') || (q[3] > '9')) return -1; | ||||
|     x = x * 10 + (q[3] - '0'); | ||||
|     if (x > 255) return -1; | ||||
|     ip[j] = x; | ||||
|     q += 4; | ||||
|   } | ||||
| } | ||||
							
								
								
									
										6
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/dd.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/dd.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| #ifndef DD_H | ||||
| #define DD_H | ||||
|  | ||||
| extern int dd(const char *,const char *,char *); | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/dd.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/dd.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										10
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/direntry.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/direntry.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| #ifndef DIRENTRY_H | ||||
| #define DIRENTRY_H | ||||
|  | ||||
| /* sysdep: +dirent */ | ||||
|  | ||||
| #include <sys/types.h> | ||||
| #include <dirent.h> | ||||
| #define direntry struct dirent | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										10
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/direntry.h1
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/direntry.h1
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| #ifndef DIRENTRY_H | ||||
| #define DIRENTRY_H | ||||
|  | ||||
| /* sysdep: -dirent */ | ||||
|  | ||||
| #include <sys/types.h> | ||||
| #include <sys/dir.h> | ||||
| #define direntry struct direct | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										10
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/direntry.h2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/direntry.h2
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| #ifndef DIRENTRY_H | ||||
| #define DIRENTRY_H | ||||
|  | ||||
| /* sysdep: +dirent */ | ||||
|  | ||||
| #include <sys/types.h> | ||||
| #include <dirent.h> | ||||
| #define direntry struct dirent | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/dns.a
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/dns.a
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										97
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/dns.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										97
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/dns.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,97 @@ | ||||
| #ifndef DNS_H | ||||
| #define DNS_H | ||||
|  | ||||
| #include "stralloc.h" | ||||
| #include "iopause.h" | ||||
| #include "taia.h" | ||||
|  | ||||
| #define DNS_C_IN "\0\1" | ||||
| #define DNS_C_ANY "\0\377" | ||||
|  | ||||
| #define DNS_T_A "\0\1" | ||||
| #define DNS_T_NS "\0\2" | ||||
| #define DNS_T_CNAME "\0\5" | ||||
| #define DNS_T_SOA "\0\6" | ||||
| #define DNS_T_PTR "\0\14" | ||||
| #define DNS_T_HINFO "\0\15" | ||||
| #define DNS_T_MX "\0\17" | ||||
| #define DNS_T_TXT "\0\20" | ||||
| #define DNS_T_RP "\0\21" | ||||
| #define DNS_T_SIG "\0\30" | ||||
| #define DNS_T_KEY "\0\31" | ||||
| #define DNS_T_AAAA "\0\34" | ||||
| #define DNS_T_AXFR "\0\374" | ||||
| #define DNS_T_ANY "\0\377" | ||||
|  | ||||
| struct dns_transmit { | ||||
|   char *query; /* 0, or dynamically allocated */ | ||||
|   unsigned int querylen; | ||||
|   char *packet; /* 0, or dynamically allocated */ | ||||
|   unsigned int packetlen; | ||||
|   int s1; /* 0, or 1 + an open file descriptor */ | ||||
|   int tcpstate; | ||||
|   unsigned int udploop; | ||||
|   unsigned int curserver; | ||||
|   struct taia deadline; | ||||
|   unsigned int pos; | ||||
|   const char *servers; | ||||
|   char localip[16]; | ||||
|   unsigned int scope_id; | ||||
|   char qtype[2]; | ||||
| } ; | ||||
|  | ||||
| extern void dns_random_init(const char *); | ||||
| extern unsigned int dns_random(unsigned int); | ||||
|  | ||||
| extern void dns_sortip(char *,unsigned int); | ||||
| extern void dns_sortip6(char *,unsigned int); | ||||
|  | ||||
| extern void dns_domain_free(char **); | ||||
| extern int dns_domain_copy(char **,const char *); | ||||
| extern unsigned int dns_domain_length(const char *); | ||||
| extern int dns_domain_equal(const char *,const char *); | ||||
| extern int dns_domain_suffix(const char *,const char *); | ||||
| extern unsigned int dns_domain_suffixpos(const char *,const char *); | ||||
| extern int dns_domain_fromdot(char **,const char *,unsigned int); | ||||
| extern int dns_domain_todot_cat(stralloc *,const char *); | ||||
|  | ||||
| extern unsigned int dns_packet_copy(const char *,unsigned int,unsigned int,char *,unsigned int); | ||||
| extern unsigned int dns_packet_getname(const char *,unsigned int,unsigned int,char **); | ||||
| extern unsigned int dns_packet_skipname(const char *,unsigned int,unsigned int); | ||||
|  | ||||
| extern int dns_transmit_start(struct dns_transmit *,const char *,int,const char *,const char *,const char *); | ||||
| extern void dns_transmit_free(struct dns_transmit *); | ||||
| extern void dns_transmit_io(struct dns_transmit *,iopause_fd *,struct taia *); | ||||
| extern int dns_transmit_get(struct dns_transmit *,const iopause_fd *,const struct taia *); | ||||
|  | ||||
| extern int dns_resolvconfip(char *); | ||||
| extern int dns_resolve(const char *,const char *); | ||||
| extern struct dns_transmit dns_resolve_tx; | ||||
|  | ||||
| extern int dns_ip4_packet(stralloc *,const char *,unsigned int); | ||||
| extern int dns_ip4(stralloc *,const stralloc *); | ||||
| extern int dns_ip6_packet(stralloc *,char *,unsigned int); | ||||
| extern int dns_ip6(stralloc *,stralloc *); | ||||
| extern int dns_name_packet(stralloc *,const char *,unsigned int); | ||||
| extern void dns_name4_domain(char *,const char *); | ||||
| #define DNS_NAME4_DOMAIN 31 | ||||
| extern int dns_name4(stralloc *,const char *); | ||||
| extern int dns_name6(stralloc *,const char *); | ||||
| extern int dns_txt_packet(stralloc *,const char *,unsigned int); | ||||
| extern int dns_txt(stralloc *,const stralloc *); | ||||
| extern int dns_mx_packet(stralloc *,const char *,unsigned int); | ||||
| extern int dns_mx(stralloc *,const stralloc *); | ||||
|  | ||||
| extern int dns_resolvconfrewrite(stralloc *); | ||||
| extern int dns_ip4_qualify_rules(stralloc *,stralloc *,const stralloc *,const stralloc *); | ||||
| extern int dns_ip4_qualify(stralloc *,stralloc *,const stralloc *); | ||||
| extern int dns_ip6_qualify_rules(stralloc *,stralloc *,const stralloc *,const stralloc *); | ||||
| extern int dns_ip6_qualify(stralloc *,stralloc *,const stralloc *); | ||||
|  | ||||
| #define DNS_IP6_INT 0 | ||||
| #define DNS_IP6_ARPA 1 | ||||
|  | ||||
| extern int dns_name6_domain(char *,const char *,int); | ||||
| #define DNS_NAME6_DOMAIN (4*16+11) | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										69
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/dns_dfd.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								Kanzlei-Kiel/src/djbdns/djbdns-1.05/dns_dfd.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,69 @@ | ||||
| #include "error.h" | ||||
| #include "alloc.h" | ||||
| #include "byte.h" | ||||
| #include "dns.h" | ||||
|  | ||||
| int dns_domain_fromdot(char **out,const char *buf,unsigned int n) | ||||
| { | ||||
|   char label[63]; | ||||
|   unsigned int labellen = 0; /* <= sizeof label */ | ||||
|   char name[255]; | ||||
|   unsigned int namelen = 0; /* <= sizeof name */ | ||||
|   char ch; | ||||
|   char *x; | ||||
|  | ||||
|   errno = error_proto; | ||||
|  | ||||
|   for (;;) { | ||||
|     if (!n) break; | ||||
|     ch = *buf++; --n; | ||||
|     if (ch == '.') { | ||||
|       if (labellen) { | ||||
| 	if (namelen + labellen + 1 > sizeof name) return 0; | ||||
| 	name[namelen++] = labellen; | ||||
| 	byte_copy(name + namelen,labellen,label); | ||||
| 	namelen += labellen; | ||||
| 	labellen = 0; | ||||
|       } | ||||
|       continue; | ||||
|     } | ||||
|     if (ch == '\\') { | ||||
|       if (!n) break; | ||||
|       ch = *buf++; --n; | ||||
|       if ((ch >= '0') && (ch <= '7')) { | ||||
| 	ch -= '0'; | ||||
| 	if (n && (*buf >= '0') && (*buf <= '7')) { | ||||
| 	  ch <<= 3; | ||||
| 	  ch += *buf - '0'; | ||||
| 	  ++buf; --n; | ||||
| 	  if (n && (*buf >= '0') && (*buf <= '7')) { | ||||
| 	    ch <<= 3; | ||||
| 	    ch += *buf - '0'; | ||||
| 	    ++buf; --n; | ||||
| 	  } | ||||
| 	} | ||||
|       } | ||||
|     } | ||||
|     if (labellen >= sizeof label) return 0; | ||||
|     label[labellen++] = ch; | ||||
|   } | ||||
|  | ||||
|   if (labellen) { | ||||
|     if (namelen + labellen + 1 > sizeof name) return 0; | ||||
|     name[namelen++] = labellen; | ||||
|     byte_copy(name + namelen,labellen,label); | ||||
|     namelen += labellen; | ||||
|     labellen = 0; | ||||
|   } | ||||
|  | ||||
|   if (namelen + 1 > sizeof name) return 0; | ||||
|   name[namelen++] = 0; | ||||
|  | ||||
|   x = alloc(namelen); | ||||
|   if (!x) return 0; | ||||
|   byte_copy(x,namelen,name); | ||||
|  | ||||
|   if (*out) alloc_free(*out); | ||||
|   *out = x; | ||||
|   return 1; | ||||
| } | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user