From: Johannes Maximilian Kuehn Date: Fri, 30 Oct 2009 21:38:39 +0000 (+0900) Subject: .del-netutils.c~1f7e234e73bebdf5: X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fa2bf86aa538f2b7fc20524240bdfea18611c5d;p=thirdparty%2Fntp.git .del-netutils.c~1f7e234e73bebdf5: Delete: sntp/netutils.c .del-COPYRIGHT~cdd0795ee52aa7b5: Delete: sntp/COPYRIGHT .del-netutils.h~b347f6069a2cfce1: Delete: sntp/netutils.h Many files: Removed copyright statement bk: 4aeb5cdf7qGf9ZKuKh5Yloef1P-NdQ --- diff --git a/sntp/COPYRIGHT b/sntp/COPYRIGHT deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/sntp/crypto.c b/sntp/crypto.c index d3dcf33acf..3a795ce364 100644 --- a/sntp/crypto.c +++ b/sntp/crypto.c @@ -1,20 +1,3 @@ -/* - * Copyright (C) 2008 Johannes Maximilian Kühn - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - #include "crypto.h" struct key *key_ptr; diff --git a/sntp/crypto.h b/sntp/crypto.h index 70018ef0c3..41fe1b1a2e 100644 --- a/sntp/crypto.h +++ b/sntp/crypto.h @@ -1,20 +1,3 @@ -/* - * Copyright (C) 2008 Johannes Maximilian Kühn - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - #ifndef CRYPTO_H #define CRYPTO_H diff --git a/sntp/kod_management.c b/sntp/kod_management.c index 0835af7493..b94ffeb287 100644 --- a/sntp/kod_management.c +++ b/sntp/kod_management.c @@ -1,21 +1,3 @@ -/* - * Copyright (C) 2008 Johannes Maximilian Kühn - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* TODO check for memory leaks */ #include #include #include diff --git a/sntp/kod_management.h b/sntp/kod_management.h index 239c078cd0..70903a52a2 100644 --- a/sntp/kod_management.h +++ b/sntp/kod_management.h @@ -1,20 +1,3 @@ -/* - * Copyright (C) 2008 Johannes Maximilian Kühn - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - #ifndef KOD_MANAGEMENT_H #define KOD_MANAGEMENT_H diff --git a/sntp/log.c b/sntp/log.c index 1584e9669d..2fedd80962 100644 --- a/sntp/log.c +++ b/sntp/log.c @@ -1,20 +1,3 @@ -/* - * Copyright (C) 2008 Johannes Maximilian Kühn - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - #include "log.h" #include "sntp-opts.h" diff --git a/sntp/log.h b/sntp/log.h index 746c8a5d4e..328d961842 100644 --- a/sntp/log.h +++ b/sntp/log.h @@ -1,20 +1,3 @@ -/* - * Copyright (C) 2008 Johannes Maximilian Kühn - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - #ifndef LOG_H #define LOG_H diff --git a/sntp/netutils.c b/sntp/netutils.c deleted file mode 100644 index 185250573e..0000000000 --- a/sntp/netutils.c +++ /dev/null @@ -1,320 +0,0 @@ -/* TODO!!! - * adopt type spefication of ntp for portability - */ - -#include "netutils.h" - -unsigned int dns_query_count = 0; - -/* Datatype for the DNS header. They are ordered as in a actual "message" */ -typedef struct dns_header { - unsigned short id; /* Identifier */ - - bool qr; /* Query (=0) or response (=1) */ - - char opcode; /* Specifies what kind of message this is. Only 4 bits are - relevant. */ - bool aa; /* In a server reply this indicates if the asked server is a authority - for the domain name in question. */ - - bool tc; /* Indicates truncation */ - - bool rd; /* Recursion desired bit (relevant obviously only for queries */ - - bool ra; /* Recursion available (set by the DNS server) */ - - bool z; /* 1 bit of whatever */ - - bool ad; /* Set by the server if the data is authenticated */ - - bool cd; /* Checking disabled bit */ - - char rcode; /* Return code */ - - unsigned short qdcount; /* Number of entries in the question section */ - - unsigned short ancount; /* Number of entries in the answer section */ - - unsigned short nscount; /* Number of entries in the answer section */ - - unsigned short arcount; /* Number of resource records */ -} dns_header_t; - -typedef struct dns_query { - char *domain_name; /* *domain_name and *ength will be used to generate - the QNAME field that consists of a domain name - in octets of labels and their size. */ - unsigned short length; /* Indicates the length of the domain name - (must be smaller or equal than 63) */ - - unsigned short qtype; - unsigned short qclass; -} dns_query_t; - - -typedef struct dns_resource_record { - char *name; /* A domainname to which this resource belongs */ - unsigned short type; /* The type of this resouce (RDATA) */ - unsigned short class; /* The class of this resource (RDATA) */ - unsigned int ttl; /* The TTL of the resource before it should be discharged */ - unsigned short rdlength; /* Length of the octets in the RDATA fields */ - char *rdata; /* RDATA types that describe the resource */ -} dns_resource_record_t; - - -int async_resolve ( - char *hname, - char *adr_ptr[] - ) -{ - register int a; - - /* Prepare a dns header */ - dns_header_t header; - header.id = dns_query_count; dns_query_count++; - header.qr = false; - header.opcode = 0; - header.aa = false; - header.tc = false; - header.rd = false; - header.ra = false; - header.z = false; - header.ad = false; - header.cd = false; - header.rcode = 0; - header.qdcount = 1; - header.ancount = 0; - header.nscount = 0; - header.arcount = 0; - - /* Prepare a dns query */ - dns_query_t query; - - query.domain_name = hname; - - query.domain_name = hname; - query.length = (short) strlen(hname); - query.qtype = 0; - query.class = 1; /* 1 = IN = Internet ... or better 255 = ANY? */ - - char **header; char **query; - - size_t header_s = compile_header(&header); - size_t query_s = compile_header(&query); - -} - -/* Translate the header structure into the header format. Always returns 96 - * bits of data. Consumes a header structure and a destination pointer - */ -void compile_header ( - dns_header_t *header, - char **dst - ) -{ - unsigned char *comph = (unsigned char *) emalloc(sizeof(char) * 12); - - /* When declaring id_high unsigned char, will the char cast on the right side - * convert to unsigned char, too? - */ - - /* Split 16 bit into two 8bit unsinged chars */ - comph[0] = (unsigned char) ((header->id & 0xff00) >> 8); - comph[1] = (unsigned char) (header->id & 0x00ff); - - /* 8 bits from qr to rd */ - unsigned char qr_rd = 0; - - if(header->qr) - qr_rd = ((char) 1) << 7; - - header->opcode &= 0x0f; - header->opcode <<= 3; - - qr_rd |= header->opcode; - - if(header->aa) - qr_rd |= ((char) 1) << 2; - - if(header->tc) - qr_rd |= ((char) 1) << 1; - - if(header->rd) - qr_rd |= 1; - - comph[2] = qr_rd; - - unsigned char ra_rcode = 0; - - if(header->ra) - ra_rcode = ((char) 1) << 7; - - if(header->z) - ra_rcode |= ((char) 1) << 6; - - if(header->ad) - ra_rcode |= ((char) 1) << 5; - - if(header->cd) - ra_rcode |= ((char) 1) << 4; - - header->rcode &= 0x0f; - - ra_rcode |= header->rcode; - - comph[3] = ra_rcde; - - comph[4] = (char) ((header->qdcount & 0xff00) >> 8); - comph[5] = (char) (header->qdcount & 0x00ff); - comph[6] = (char) ((header->ancount & 0xff00) >> 8); - comph[7] = (char) (header->ancount & 0x00ff); - comph[8] = (char) ((header->nscount & 0xff00) >> 8); - comph[9] = (char) (header->nscount & 0x00ff); - comph[10] = (char) ((header->arcount & 0xff00) >> 8); - comph[11] = (char) (header->arcount & 0x00ff); - - *dst = comph; - - return; -} - -/* Translate the query into the query format. It is of variable length so - * it'll return the queries size in bytes - */ - -size_t compile_query ( - dns_query_t *query, - char **dst - ) -{ - register int a; - - char **qname; - size_t dlength = domain_to_name(query->domain_name, qname); - size_t length = dlength; - - - char qtype_high = (char) ((query->qtype & 0xff00) >> 8); - char qtype_low = (char) (query->qtype & 0x00ff); - char qclass_high = (char) ((query->qclass & 0xff00) >> 8); - char qclass_low = (char) (query->qclass & 0x00ff); - - length += 4; - - char *res = (char *) emalloc(sizeof(char) * length); - - for(a=0; aname, qname); - - size_t length = (dlength + 10 + rdlength); - - char *res = (char *) emalloc(sizeof(char) * length); - - for(a=0; atype & 0xff00) >> 8); - res[a+2] = (char) (resc->type & 0x00ff); - res[a+3] = (char) ((resc->class & 0xff00) >> 8); - res[a+4] = (char) (resc->class & 0x00ff); - - res[a+5] = (char) ((resc->ttl & 0xff000000) >> 24); - res[a+6] = (char) ((resc->ttl & 0x00ff0000) >> 16); - res[a+7] = (char) ((resc->ttl & 0x0000ff00) >> 8); - res[a+8] = (char) (resc->ttl & 0x000000ff); - - res[a+9] = (char) ((resc->rdlength & 0xff00) >> 8); - res[a+10] = (char) (resc->rdlength & 0x00ff); - - a += 11; - - for(b=0; brd_length; b++, a++) { - res[a] = resc->rdata[b]; - } - - *dst = res; - - return length; -} - -size_t domain_to_qname ( - char *hostname, - char **dst - ) -{ - register int a, b, c, dotc; - - for(a=0, dotc=0; a 10) { - num /= 10; - length++; - } - - return length; -} - -int retrv_dnsadr ( - char *adr_ptr[] - ) -{} - diff --git a/sntp/netutils.h b/sntp/netutils.h deleted file mode 100644 index fdcabc5cb1..0000000000 --- a/sntp/netutils.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef NETUTILS_H -#define NETUTILS_H - -#include -#include - -int async_resolve (int hnamec, char *hnamev[], char *adr_ptr[]); -int retrv_dnsadr (char *adr_ptr[]); - -#endif diff --git a/sntp/networking.c b/sntp/networking.c index 66c39ebe24..3b762c1e38 100644 --- a/sntp/networking.c +++ b/sntp/networking.c @@ -1,20 +1,3 @@ -/* - * Copyright (C) 2008 Johannes Maximilian Kühn - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - #include "networking.h" char adr_buf[INET6_ADDRSTRLEN]; diff --git a/sntp/networking.h b/sntp/networking.h index c8a0870cfa..811246a519 100644 --- a/sntp/networking.h +++ b/sntp/networking.h @@ -1,20 +1,3 @@ -/* - * Copyright (C) 2008 Johannes Maximilian Kühn - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - #ifndef NETWORKING_H #define NETWORKING_H diff --git a/sntp/utilities.c b/sntp/utilities.c index e3a14aed64..23d957f3c0 100644 --- a/sntp/utilities.c +++ b/sntp/utilities.c @@ -1,20 +1,3 @@ -/* - * Copyright (C) 2008 Johannes Maximilian Kühn - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - #include "utilities.h" /* Display a NTP packet in hex with leading address offset diff --git a/sntp/utilities.h b/sntp/utilities.h index 604ac69ef8..79fd774777 100644 --- a/sntp/utilities.h +++ b/sntp/utilities.h @@ -1,37 +1,3 @@ -/* - * Copyright (C) 2008 Johannes Maximilian Kühn - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * Copyright (C) 2008 Johannes Maximilian Kühn - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - #ifndef UTILITIES_H #define UTILITIES_H