Commit 7fee051b authored by Ondrej Sury's avatar Ondrej Sury

Imported Upstream version 1.6.9

parent fe892c88
1.6.9 2011-03-16
* Fix creating NSEC(3) bitmaps: make array size 65536,
don't add doubles.
* Fix printout of escaped binary in TXT records.
* Parsing TXT records: don't skip starting whitespace that is quoted.
* bugfix #358: Check if memory was successfully allocated in
ldns_rdf2str().
* Added more memory allocation checks in host2str.c
* python wrapper for ldns_fetch_valid_domain_keys by Bedrich Kosata.
* fix to compile python wrapper with swig 2.0.2.
* Don't fallback to SHA-1 when creating NSEC3 hash with another
algorithm identifier, fail instead (no other algorithm identifiers
are assigned yet).
1.6.8 2011-01-24
* Fix ldns zone, so that $TTL definition match RFC 2308.
* Fix lots of missing checks on allocation failures and parse of
NSEC with many types and max parse length in hosts_frm_fp routine
and off by one in read_anchor_file routine (thanks Dan Kaminsky and
Justin Ferguson).
* bugfix #355: Drill: Print both SHA-1 and SHA-256 corresponding DS
* bugfix #335: Drill: Print both SHA-1 and SHA-256 corresponding DS
records.
* Print correct WHEN in query packet (is not always 1-1-1970)
* ldns-test-edns: new example tool that detects EDNS support.
......
......@@ -53,7 +53,18 @@ LIBTOOL = $(libtool) --tag=CC --quiet
INSTALL_LDNS_CONFIG = @INSTALL_LDNS_CONFIG@
LINT = splint
LINTFLAGS = +quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -D__u16=uint16_t -fixedformalarray
LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list
#-Dglob64=glob -Dglobfree64=globfree
# compat with openssl linux edition.
LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned -fixedformalarray -D"ENGINE=unsigned" -D"RSA=unsigned" -D"DSA=unsigned" -D"EVP_PKEY=unsigned" -D"EVP_MD=unsigned" -D"SSL=unsigned" -D"SSL_CTX=unsigned" -D"X509=unsigned" -D"RC4_KEY=unsigned" -D"EVP_MD_CTX=unsigned" -D"EC_KEY=unsigned" -D"EC_POINT=unsigned" -D"EC_GROUP=unsigned"
# compat with NetBSD
ifeq "$(shell uname)" "NetBSD"
LINTFLAGS+="-D__RENAME(x)=" -D_NETINET_IN_H_
endif
# compat with OpenBSD
LINTFLAGS+="-Dsigset_t=long"
# FreeBSD8
LINTFLAGS+="-D__uint16_t=uint16_t"
INSTALL = $(srcdir)/install-sh
......@@ -103,7 +114,7 @@ LINK_LIB = $(LIBTOOL) --mode=link $(CC) $(strip $(CFLAGS) $(LDFLAGS) $(LIBS) -ve
%.o: $(srcdir)/%.c $(LIBDNS_HEADERS) ldns/net.h ldns/util.h ldns/config.h
$(COMP_LIB) $(LIBSSL_CPPFLAGS) -c $<
.PHONY: clean realclean docclean manpages doc lint all lib pyldns
.PHONY: clean realclean docclean manpages doc lint all lib pyldns test
.PHONY: install uninstall install-doc uninstall-doc uninstall-pyldns
.PHONY: install-h uninstall-h install-lib uninstall-lib install-pyldns
......@@ -304,6 +315,9 @@ timegm$U.o: $(srcdir)/compat/timegm.c
isblank$U.o: $(srcdir)/compat/isblank.c
$(COMP_LIB) -c $(srcdir)/compat/isblank.c -o $@
isasciik$U.o: $(srcdir)/compat/isascii.c
$(COMP_LIB) -c $(srcdir)/compat/isascii.c -o $@
strlcpy$U.o: $(srcdir)/compat/strlcpy.c
$(COMP_LIB) -c $(srcdir)/compat/strlcpy.c -o $@
......@@ -342,6 +356,9 @@ allclean: test-clean clean
test-clean:
tpkg -b test clean
test:
if test -x "`which bash`"; then bash test/test_all.sh; else sh test/test_all.sh; fi
#-include $(ALL_SOURCES:.c=.d)
# Recreate symbols file, only needed when API changes
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/* Just a replacement, if the original isascii is not
present */
#if HAVE_CONFIG_H
#include <ldns/config.h>
#endif
int isascii(int c);
/* true if character is ascii. */
int
isascii(int c)
{
return c >= 0 && c < 128;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -6,7 +6,7 @@ sinclude(acx_nlnetlabs.m4)
# must be numbers. ac_defun because of later processing.
m4_define([VERSION_MAJOR],[1])
m4_define([VERSION_MINOR],[6])
m4_define([VERSION_MICRO],[8])
m4_define([VERSION_MICRO],[9])
AC_INIT(ldns, m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]), libdns@nlnetlabs.nl, libdns)
AC_CONFIG_SRCDIR([packet.c])
# needed to build correct soname
......@@ -312,6 +312,7 @@ AC_REPLACE_FUNCS(timegm)
AC_REPLACE_FUNCS(gmtime_r)
AC_REPLACE_FUNCS(ctime_r)
AC_REPLACE_FUNCS(isblank)
AC_REPLACE_FUNCS(isascii)
AC_REPLACE_FUNCS(inet_aton)
AC_REPLACE_FUNCS(inet_pton)
AC_REPLACE_FUNCS(inet_ntop)
......@@ -444,6 +445,9 @@ struct tm *gmtime_r(const time_t *timep, struct tm *result);
#ifndef HAVE_ISBLANK
int isblank(int c);
#endif /* !HAVE_ISBLANK */
#ifndef HAVE_ISASCII
int isascii(int c);
#endif /* !HAVE_ISASCII */
#ifndef HAVE_SNPRINTF
#include <stdarg.h>
int snprintf (char *str, size_t count, const char *fmt, ...);
......
......@@ -113,13 +113,13 @@ uint32_t ldns_read_timeval_usec(struct timeval* t) {
%include <ldns/higher.h>
%include <ldns/host2str.h>
%include <ldns/host2wire.h>
%include <ldns/net.h>//ruzne fce
%include <ldns/net.h>
%include <ldns/packet.h>
%include <ldns/rdata.h>
%include <ldns/resolver.h>
%include <ldns/rr.h>
%include <ldns/str2host.h>
%include <ldns/tsig.h> //potrebuje wire
%include <ldns/tsig.h>
%include <ldns/update.h>
%include <ldns/wire2host.h>
%include <ldns/rr_functions.h>
......@@ -237,4 +237,31 @@ typedef struct ldns_dnssec_zone { };
return tuple;
}
PyObject* ldns_fetch_valid_domain_keys_(const ldns_resolver * res, const ldns_rdf * domain,
const ldns_rr_list * keys)
//returns tuple (status, result)
{
PyObject* tuple;
ldns_rr_list *rrl = 0;
ldns_status st = 0;
rrl = ldns_fetch_valid_domain_keys(res, domain, keys, &st);
tuple = PyTuple_New(2);
PyTuple_SetItem(tuple, 0, SWIG_From_int(st));
PyTuple_SetItem(tuple, 1, (st == LDNS_STATUS_OK) ?
SWIG_NewPointerObj(SWIG_as_voidptr(rrl), SWIGTYPE_p_ldns_struct_rr_list, SWIG_POINTER_OWN | 0 ) :
Py_None);
return tuple;
}
%}
%pythoncode %{
def ldns_fetch_valid_domain_keys(res, domain, keys):
return _ldns.ldns_fetch_valid_domain_keys_(res, domain, keys)
%}
......@@ -378,10 +378,12 @@ ldns_key_buf2dsa_raw(unsigned char* key, size_t len)
BN_free(Y);
return NULL;
}
#ifndef S_SPLINT_S
dsa->p = P;
dsa->q = Q;
dsa->g = G;
dsa->pub_key = Y;
#endif /* splint */
return dsa;
}
......@@ -444,8 +446,10 @@ ldns_key_buf2rsa_raw(unsigned char* key, size_t len)
BN_free(modulus);
return NULL;
}
#ifndef S_SPLINT_S
rsa->n = modulus;
rsa->e = exponent;
#endif /* splint */
return rsa;
}
......@@ -623,7 +627,7 @@ ldns_key_rr2ds(const ldns_rr *key, ldns_hash h)
return NULL;
}
tmp = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_HEX,
EVP_MD_size(md),
(size_t)EVP_MD_size(md),
digest);
ldns_rr_push_rdf(ds, tmp);
#endif
......@@ -780,7 +784,7 @@ ldns_dnssec_create_nsec(ldns_dnssec_name *from,
ldns_rr_type nsec_type)
{
ldns_rr *nsec_rr;
ldns_rr_type types[65535];
ldns_rr_type types[65536];
size_t type_count = 0;
ldns_dnssec_rrsets *cur_rrsets;
......@@ -800,9 +804,13 @@ ldns_dnssec_create_nsec(ldns_dnssec_name *from,
cur_rrsets = cur_rrsets->next;
continue;
}
types[type_count] = cur_rrsets->type;
type_count++;
if (cur_rrsets->type != LDNS_RR_TYPE_RRSIG &&
cur_rrsets->type != LDNS_RR_TYPE_NSEC) {
types[type_count] = cur_rrsets->type;
type_count++;
}
cur_rrsets = cur_rrsets->next;
}
types[type_count] = LDNS_RR_TYPE_RRSIG;
type_count++;
......@@ -827,7 +835,7 @@ ldns_dnssec_create_nsec3(ldns_dnssec_name *from,
uint8_t *salt)
{
ldns_rr *nsec_rr;
ldns_rr_type types[65535];
ldns_rr_type types[65536];
size_t type_count = 0;
ldns_dnssec_rrsets *cur_rrsets;
ldns_status status;
......@@ -863,8 +871,10 @@ ldns_dnssec_create_nsec3(ldns_dnssec_name *from,
cur_rrsets = cur_rrsets->next;
continue;
}
types[type_count] = cur_rrsets->type;
type_count++;
if (cur_rrsets->type != LDNS_RR_TYPE_RRSIG) {
types[type_count] = cur_rrsets->type;
type_count++;
}
cur_rrsets = cur_rrsets->next;
}
/* always add rrsig type if this is not an unsigned
......@@ -909,8 +919,8 @@ ldns_create_nsec(ldns_rdf *cur_owner, ldns_rdf *next_owner, ldns_rr_list *rrs)
uint16_t i_type;
ldns_rr *nsec = NULL;
ldns_rr_type i_type_list[65535];
int type_count = 0;
ldns_rr_type i_type_list[65536];
size_t type_count = 0;
nsec = ldns_rr_new();
ldns_rr_set_type(nsec, LDNS_RR_TYPE_NSEC);
......@@ -922,9 +932,11 @@ ldns_create_nsec(ldns_rdf *cur_owner, ldns_rdf *next_owner, ldns_rr_list *rrs)
if (ldns_rdf_compare(cur_owner,
ldns_rr_owner(i_rr)) == 0) {
i_type = ldns_rr_get_type(i_rr);
if (type_count == 0 || i_type_list[type_count-1] != i_type) {
i_type_list[type_count] = i_type;
type_count++;
if (i_type != LDNS_RR_TYPE_RRSIG && i_type != LDNS_RR_TYPE_NSEC) {
if (type_count == 0 || i_type_list[type_count-1] != i_type) {
i_type_list[type_count] = i_type;
type_count++;
}
}
}
}
......@@ -960,6 +972,11 @@ ldns_nsec3_hash_name(ldns_rdf *name,
unsigned char hash[LDNS_SHA1_DIGEST_LENGTH];
ldns_status status;
/* TODO: mnemonic list for hash algs SHA-1, default to 1 now (sha1) */
if (algorithm != LDNS_SHA1) {
return NULL;
}
/* prepare the owner name according to the draft section bla */
cann = ldns_rdf_clone(name);
if(!cann) {
......@@ -968,9 +985,6 @@ ldns_nsec3_hash_name(ldns_rdf *name,
}
ldns_dname2canonical(cann);
/* TODO: mnemonic list for hash algs SHA-1, default to 1 now (sha1) */
algorithm = algorithm;
hashed_owner_str_len = salt_length + ldns_rdf_size(cann);
hashed_owner_str = LDNS_XMALLOC(unsigned char, hashed_owner_str_len);
if(!hashed_owner_str) {
......@@ -1124,7 +1138,7 @@ ldns_create_nsec3(ldns_rdf *cur_owner,
ldns_status status;
ldns_rr_type i_type_list[1024];
int type_count = 0;
size_t type_count = 0;
hashed_owner = ldns_nsec3_hash_name(cur_owner,
algorithm,
......@@ -1651,6 +1665,7 @@ ldns_convert_dsa_rrsig_rdf2asn1(ldns_buffer *target_buffer,
}
#ifdef USE_ECDSA
#ifndef S_SPLINT_S
ldns_rdf *
ldns_convert_ecdsa_rrsig_asn12rdf(const ldns_buffer *sig, const long sig_len)
{
......@@ -1669,8 +1684,8 @@ ldns_convert_ecdsa_rrsig_asn12rdf(const ldns_buffer *sig, const long sig_len)
}
BN_bn2bin(ecdsa_sig->r, data);
BN_bn2bin(ecdsa_sig->s, data+BN_num_bytes(ecdsa_sig->r));
rdf = ldns_rdf_new(LDNS_RDF_TYPE_B64,
BN_num_bytes(ecdsa_sig->r) + BN_num_bytes(ecdsa_sig->s), data);
rdf = ldns_rdf_new(LDNS_RDF_TYPE_B64, (size_t)(
BN_num_bytes(ecdsa_sig->r) + BN_num_bytes(ecdsa_sig->s)), data);
ECDSA_SIG_free(ecdsa_sig);
return rdf;
}
......@@ -1681,7 +1696,7 @@ ldns_convert_ecdsa_rrsig_rdf2asn1(ldns_buffer *target_buffer,
{
ECDSA_SIG* sig;
int raw_sig_len;
long bnsize = ldns_rdf_size(sig_rdf) / 2;
long bnsize = (long)ldns_rdf_size(sig_rdf) / 2;
/* if too short, or not even length, do not bother */
if(bnsize < 16 || (size_t)bnsize*2 != ldns_rdf_size(sig_rdf))
return LDNS_STATUS_ERR;
......@@ -1700,14 +1715,16 @@ ldns_convert_ecdsa_rrsig_rdf2asn1(ldns_buffer *target_buffer,
raw_sig_len = i2d_ECDSA_SIG(sig, NULL);
if (ldns_buffer_reserve(target_buffer, (size_t) raw_sig_len)) {
unsigned char* pp = ldns_buffer_current(target_buffer);
unsigned char* pp = (unsigned char*)
ldns_buffer_current(target_buffer);
raw_sig_len = i2d_ECDSA_SIG(sig, &pp);
ldns_buffer_skip(target_buffer, (size_t) raw_sig_len);
ldns_buffer_skip(target_buffer, (ssize_t) raw_sig_len);
}
ECDSA_SIG_free(sig);
return ldns_buffer_status(target_buffer);
}
#endif /* S_SPLINT_S */
#endif /* USE_ECDSA */
#endif /* HAVE_SSL */
......@@ -120,7 +120,7 @@ ldns_sign_public_buffer(ldns_buffer *sign_buf, ldns_key *current_key)
switch(ldns_key_algorithm(current_key)) {
case LDNS_SIGN_DSA:
case LDNS_DSA_NSEC3:
case LDNS_SIGN_DSA_NSEC3:
b64rdf = ldns_sign_public_evp(
sign_buf,
ldns_key_evp_key(current_key),
......@@ -357,6 +357,7 @@ ldns_sign_public_dsa(ldns_buffer *to_sign, DSA *key)
}
#ifdef USE_ECDSA
#ifndef S_SPLINT_S
static int
ldns_pkey_is_ecdsa(EVP_PKEY* pkey)
{
......@@ -380,6 +381,7 @@ ldns_pkey_is_ecdsa(EVP_PKEY* pkey)
EC_KEY_free(ec);
return 0;
}
#endif /* splint */
#endif /* USE_ECDSA */
ldns_rdf *
......@@ -431,6 +433,7 @@ ldns_sign_public_evp(ldns_buffer *to_sign,
}
/* unfortunately, OpenSSL output is differenct from DNS DSA format */
#ifndef S_SPLINT_S
if (EVP_PKEY_type(key->type) == EVP_PKEY_DSA) {
sigdata_rdf = ldns_convert_dsa_rrsig_asn12rdf(b64sig, siglen);
#ifdef USE_ECDSA
......@@ -443,6 +446,7 @@ ldns_sign_public_evp(ldns_buffer *to_sign,
sigdata_rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, siglen,
ldns_buffer_begin(b64sig));
}
#endif /* splint */
ldns_buffer_free(b64sig);
EVP_MD_CTX_cleanup(&ctx);
return sigdata_rdf;
......@@ -640,7 +644,10 @@ ldns_dnssec_zone_create_nsecs(ldns_dnssec_zone *zone,
next_name,
LDNS_RR_TYPE_NSEC);
ldns_rr_set_ttl(nsec_rr, nsec_ttl);
ldns_dnssec_name_add_rr(cur_name, nsec_rr);
if(ldns_dnssec_name_add_rr(cur_name, nsec_rr)!=LDNS_STATUS_OK){
ldns_rr_free(nsec_rr);
return LDNS_STATUS_ERR;
}
ldns_rr_list_push_rr(new_rrs, nsec_rr);
cur_node = next_node;
if (cur_node) {
......@@ -656,7 +663,10 @@ ldns_dnssec_zone_create_nsecs(ldns_dnssec_zone *zone,
next_name,
LDNS_RR_TYPE_NSEC);
ldns_rr_set_ttl(nsec_rr, nsec_ttl);
ldns_dnssec_name_add_rr(cur_name, nsec_rr);
if(ldns_dnssec_name_add_rr(cur_name, nsec_rr)!=LDNS_STATUS_OK){
ldns_rr_free(nsec_rr);
return LDNS_STATUS_ERR;
}
ldns_rr_list_push_rr(new_rrs, nsec_rr);
} else {
printf("error\n");
......@@ -727,15 +737,18 @@ ldns_dnssec_zone_create_nsec3s(ldns_dnssec_zone *zone,
ldns_rdf_deep_free(ldns_rr_pop_rdf(nsec_rr));
}
ldns_rr_set_ttl(nsec_rr, nsec_ttl);
ldns_dnssec_name_add_rr(current_name, nsec_rr);
result = ldns_dnssec_name_add_rr(current_name, nsec_rr);
ldns_rr_list_push_rr(new_rrs, nsec_rr);
ldns_rr_list_push_rr(nsec3_list, nsec_rr);
current_name_node = ldns_dnssec_name_node_next_nonglue(
ldns_rbtree_next(current_name_node));
}
if (result != LDNS_STATUS_OK) {
return result;
}
ldns_rr_list_sort_nsec3(nsec3_list);
ldns_dnssec_chain_nsec3_list(nsec3_list);
result = ldns_dnssec_chain_nsec3_list(nsec3_list);
if (result != LDNS_STATUS_OK) {
return result;
}
......@@ -963,7 +976,7 @@ ldns_dnssec_zone_create_rrsigs_flg(ldns_dnssec_zone *zone,
siglist = ldns_sign_public(rr_list, key_list);
for (i = 0; i < ldns_rr_list_rr_count(siglist); i++) {
if (cur_rrset->signatures) {
ldns_dnssec_rrs_add_rr(cur_rrset->signatures,
result = ldns_dnssec_rrs_add_rr(cur_rrset->signatures,
ldns_rr_list_rr(siglist,
i));
} else {
......@@ -998,7 +1011,7 @@ ldns_dnssec_zone_create_rrsigs_flg(ldns_dnssec_zone *zone,
for (i = 0; i < ldns_rr_list_rr_count(siglist); i++) {
if (cur_name->nsec_signatures) {
ldns_dnssec_rrs_add_rr(cur_name->nsec_signatures,
result = ldns_dnssec_rrs_add_rr(cur_name->nsec_signatures,
ldns_rr_list_rr(siglist, i));
} else {
cur_name->nsec_signatures = ldns_dnssec_rrs_new();
......@@ -1044,7 +1057,10 @@ ldns_dnssec_zone_sign_flg(ldns_dnssec_zone *zone,
}
/* zone is already sorted */
ldns_dnssec_zone_mark_glue(zone);
result = ldns_dnssec_zone_mark_glue(zone);
if (result != LDNS_STATUS_OK) {
return result;
}
/* check whether we need to add nsecs */
if (zone->names && !((ldns_dnssec_name *)zone->names->root->data)->nsec) {
......@@ -1097,14 +1113,20 @@ ldns_dnssec_zone_sign_nsec3_flg(ldns_dnssec_zone *zone,
ldns_status result = LDNS_STATUS_OK;
/* zone is already sorted */
ldns_dnssec_zone_mark_glue(zone);
result = ldns_dnssec_zone_mark_glue(zone);
if (result != LDNS_STATUS_OK) {
return result;
}
/* TODO if there are already nsec3s presents and their
* parameters are the same as these, we don't have to recreate
*/
if (zone->names) {
/* add empty nonterminals */
ldns_dnssec_zone_add_empty_nonterminals(zone);
result = ldns_dnssec_zone_add_empty_nonterminals(zone);
if (result != LDNS_STATUS_OK) {
return result;
}
nsec3 = ((ldns_dnssec_name *)zone->names->root->data)->nsec;
if (nsec3 && ldns_rr_get_type(nsec3) == LDNS_RR_TYPE_NSEC3) {
......@@ -1127,7 +1149,10 @@ ldns_dnssec_zone_sign_nsec3_flg(ldns_dnssec_zone *zone,
/* always set bit 7 of the flags to zero, according to
* rfc5155 section 11 */
ldns_set_bit(ldns_rdf_data(ldns_rr_rdf(nsec3params, 1)), 7, 0);
ldns_dnssec_zone_add_rr(zone, nsec3params);
result = ldns_dnssec_zone_add_rr(zone, nsec3params);
if (result != LDNS_STATUS_OK) {
return result;
}
ldns_rr_list_push_rr(new_rrs, nsec3params);
}
result = ldns_dnssec_zone_create_nsec3s(zone,
......
......@@ -1536,7 +1536,7 @@ ldns_gost2pkey_raw(unsigned char* key, size_t keylen)
memmove(encoded+37, key, 64);
pp = (unsigned char*)&encoded[0];
return d2i_PUBKEY(NULL, &pp, sizeof(encoded));
return d2i_PUBKEY(NULL, &pp, (int)sizeof(encoded));
}
static ldns_status
......@@ -1585,7 +1585,7 @@ ldns_ecdsa2pkey_raw(unsigned char* key, size_t keylen, uint8_t algo)
* of openssl) for uncompressed data */
buf[0] = POINT_CONVERSION_UNCOMPRESSED;
memmove(buf+1, key, keylen);
if(!o2i_ECPublicKey(&ec, &pp, keylen+1)) {
if(!o2i_ECPublicKey(&ec, &pp, (int)keylen+1)) {
EC_KEY_free(ec);
return NULL;
}
......
......@@ -320,7 +320,10 @@ ldns_dnssec_name_new_frm_rr(ldns_rr *rr)
ldns_dnssec_name *new_name = ldns_dnssec_name_new();
new_name->name = ldns_rr_owner(rr);
ldns_dnssec_name_add_rr(new_name, rr);
if(ldns_dnssec_name_add_rr(new_name, rr) != LDNS_STATUS_OK) {
ldns_dnssec_name_free(new_name);
return NULL;
}
return new_name;
}
......@@ -458,7 +461,7 @@ ldns_dnssec_name_add_rr(ldns_dnssec_name *name,
} else if (typecovered == LDNS_RR_TYPE_NSEC ||
typecovered == LDNS_RR_TYPE_NSEC3) {
if (name->nsec_signatures) {
ldns_dnssec_rrs_add_rr(name->nsec_signatures, rr);
result = ldns_dnssec_rrs_add_rr(name->nsec_signatures, rr);
} else {
name->nsec_signatures = ldns_dnssec_rrs_new();
name->nsec_signatures->rr = rr;
......@@ -516,15 +519,6 @@ ldns_dnssec_zone_find_rrset(ldns_dnssec_zone *zone,
}
}
static inline void
print_indent(FILE *out, int c)
{
int i;
for (i=0; i<c; i++) {
fprintf(out, " ");
}
}
void
ldns_dnssec_name_print_soa(FILE *out, ldns_dnssec_name *name, bool show_soa)
{
......@@ -686,10 +680,10 @@ ldns_dnssec_zone_add_rr(ldns_dnssec_zone *zone, ldns_rr *rr)
}
cur_node->key = ldns_rr_owner(rr);
cur_node->data = cur_name;
ldns_rbtree_insert(zone->names, cur_node);
(void)ldns_rbtree_insert(zone->names, cur_node);
} else {
cur_name = (ldns_dnssec_name *) cur_node->data;
ldns_dnssec_name_add_rr(cur_name, rr);
result = ldns_dnssec_name_add_rr(cur_name, rr);
}
if (result != LDNS_STATUS_OK) {
......@@ -793,9 +787,9 @@ ldns_dnssec_zone_add_empty_nonterminals(ldns_dnssec_zone *zone)
* label in the current name (counting from the end)
*/
for (i = 1; i < next_label_count - soa_label_count; i++) {
lpos = cur_label_count - next_label_count + i;
lpos = (int)cur_label_count - (int)next_label_count + (int)i;
if (lpos >= 0) {
l1 = ldns_dname_label(cur_name, lpos);
l1 = ldns_dname_label(cur_name, (uint8_t)lpos);
} else {
l1 = NULL;
}
......@@ -823,7 +817,7 @@ ldns_dnssec_zone_add_empty_nonterminals(ldns_dnssec_zone *zone)
}
new_node->key = new_name->name;
new_node->data = new_name;
ldns_rbtree_insert(zone->names, new_node);
(void)ldns_rbtree_insert(zone->names, new_node);
}
ldns_rdf_deep_free(l1);
ldns_rdf_deep_free(l2);
......
......@@ -24,7 +24,19 @@ COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) -I. -I$(srcdir)
LINK = $(CC) $(CFLAGS) $(LDFLAGS)
LINT = splint
LINTFLAGS = +quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -D__signed__=signed -I../ -fixedformalarray
LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list
#-Dglob64=glob -Dglobfree64=globfree
# compat with openssl linux edition.
LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned -fixedformalarray -D"ENGINE=unsigned" -D"RSA=unsigned" -D"DSA=unsigned" -D"EVP_PKEY=unsigned" -D"EVP_MD=unsigned" -D"SSL=unsigned" -D"SSL_CTX=unsigned" -D"X509=unsigned" -D"RC4_KEY=unsigned" -D"EVP_MD_CTX=unsigned"
# compat with NetBSD
ifeq "$(shell uname)" "NetBSD"
LINTFLAGS+="-D__RENAME(x)=" -D_NETINET_IN_H_
endif
# compat with OpenBSD
LINTFLAGS+="-Dsigset_t=long"
# FreeBSD8
LINTFLAGS+="-D__uint16_t=uint16_t"
LINTFLAGS+=-D__signed__=signed "-D__packed=" "-D__aligned(x)="
OBJ=drill.o drill_util.o error.o root.o work.o chasetrace.o dnssec.o securetrace.o
SRC=$(OBJ:.o=.c)
......@@ -97,7 +109,7 @@ uninstall:
lint:
@for i in $(SRC) ; do \
$(LINT) $(LINTFLAGS) -I$(srcdir) $(srcdir)/$$i ; \
$(LINT) $(LINTFLAGS) $(CPPFLAGS) -I$(srcdir) $(srcdir)/$$i ; \
if [ $$? -ne 0 ] ; then exit 1 ; fi ; \
done
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.56)
AC_INIT(ldns, 1.6.8, libdns@nlnetlabs.nl,libdns)
AC_INIT(ldns, 1.6.9, libdns@nlnetlabs.nl,libdns)
AC_CONFIG_SRCDIR([drill.c])
sinclude(../acx_nlnetlabs.m4)
......
......@@ -866,8 +866,8 @@ main(int argc, char *argv[])
for(key_count = 0; key_count < ldns_rr_list_rr_count(key_verified);
key_count++) {
if (verbosity != -1) {
printf("; VALIDATED by id = %d, owner = ",
(int)ldns_calc_keytag(
printf("; VALIDATED by id = %u, owner = ",
(unsigned int)ldns_calc_keytag(
ldns_rr_list_rr(key_verified, key_count)));
ldns_rdf_print(stdout, ldns_rr_owner(
ldns_rr_list_rr(key_list, key_count)));
......@@ -878,9 +878,9 @@ main(int argc, char *argv[])
for(key_count = 0; key_count < ldns_rr_list_rr_count(key_list);
key_count++) {
if (verbosity != -1) {
printf("; %s for id = %d, owner = ",
printf("; %s for id = %u, owner = ",
ldns_get_errorstr_by_id(result),
(int)ldns_calc_keytag(
(unsigned int)ldns_calc_keytag(
ldns_rr_list_rr(key_list, key_count)));
ldns_rdf_print(stdout, ldns_rr_owner(
......
......@@ -125,7 +125,7 @@ print_ds_of_keys(ldns_pkt *p)
if (keys) {
for (i = 0; i < ldns_rr_list_rr_count(keys); i++) {
fprintf(stdout, ";\n; equivalent DS records for key %u:\n",
ldns_calc_keytag(ldns_rr_list_rr(keys, i)));
(unsigned int)ldns_calc_keytag(ldns_rr_list_rr(keys, i)));
ds = ldns_key_rr2ds(ldns_rr_list_rr(keys, i), LDNS_SHA1);
local_print_ds(stdout, "; sha1: ", ds);
......@@ -226,16 +226,16 @@ print_dnskey_abbr(FILE *fp, ldns_rr *key)
ldns_rdf_print(fp, ldns_rr_rdf(key, 2));
if (ldns_rdf2native_int16(ldns_rr_rdf(key, 0)) == 256) {
fprintf(fp, " ;{id = %d (zsk), size = %db}", (int)ldns_calc_keytag(key),
fprintf(fp, " ;{id = %u (zsk), size = %db}", (unsigned int)ldns_calc_keytag(key),
(int)ldns_rr_dnskey_key_size(key));
return;
}
if (ldns_rdf2native_int16(ldns_rr_rdf(key, 0)) == 257) {
fprintf(fp, " ;{id = %d (ksk), size = %db}", (int)ldns_calc_keytag(key),
fprintf(fp, " ;{id = %u (ksk), size = %db}", (unsigned int)ldns_calc_keytag(key),
(int)ldns_rr_dnskey_key_size(key));
return;
}
fprintf(fp, " ;{id = %d, size = %db}", (int)ldns_calc_keytag(key),
fprintf(fp, " ;{id = %u, size = %db}", (unsigned int)ldns_calc_keytag(key),
(int)ldns_rr_dnskey_key_size(key));
}
......
......@@ -29,8 +29,19 @@ LINK = $(libtool) --tag=CC --quiet --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LIB
LINK_STATIC = $(libtool) --tag=CC --quiet --mode=link $(CC) $(CFLAGS) -static $(LDFLAGS) $(LIBS) $(RUNTIME_PATH)
LINT = splint
LINTFLAGS = +quiet -weak -warnposix -unrecog -formatcode -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -D__u16=uint16_t -D__u32=uint32_t -preproc -D__signed__=signed -fixedformalarray
LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list
#-Dglob64=glob -Dglobfree64=globfree
# compat with openssl linux edition.
LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned -fixedformalarray -D"ENGINE=unsigned" -D"RSA=unsigned" -D"DSA=unsigned" -D"EVP_PKEY=unsigned" -D"EVP_MD=unsigned" -D"SSL=unsigned" -D"SSL_CTX=unsigned" -D"X509=unsigned" -D"RC4_KEY=unsigned" -D"EVP_MD_CTX=unsigned"
# compat with NetBSD
ifeq "$(shell uname)" "NetBSD"
LINTFLAGS+="-D__RENAME(x)=" -D_NETINET_IN_H_
endif
# compat with OpenBSD
LINTFLAGS+="-Dsigset_t=long"
# FreeBSD8
LINTFLAGS+="-D__uint16_t=uint16_t"
LINTFLAGS+=-D__signed__=signed "-D__packed=" "-D__aligned(x)="
HEADER = config.h
MAIN_SOURCES = ldns-read-zone.c \
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.56)
AC_INIT(ldns, 1.6.8, libdns@nlnetlabs.nl,libdns)
AC_INIT(ldns, 1.6.9, libdns@nlnetlabs.nl,libdns)
AC_CONFIG_SRCDIR([ldns-read-zone.c])
sinclude(../acx_nlnetlabs.m4)
......
......@@ -370,7 +370,9 @@ print_match_operation(FILE *output, match_operation *mc)
}
break;
case TYPE_TIMESTAMP:
#ifndef S_SPLINT_S
time.tv_sec = (long int) atol(mc->value);
#endif
time_tt = (time_t)time.tv_sec;
tmp = ctime(&time_tt);
tmp2 = malloc(strlen(tmp) + 1);
......
......@@ -687,7 +687,8 @@ main(int argc, char *argv[])
outputfile_buffer = ldns_buffer_new(300);
domain_str = ldns_rdf2str(ldns_rr_owner(k));
ldns_buffer_printf(outputfile_buffer, "K%s+%03u+%05u.key", domain_str, ldns_rdf2native_int8(ldns_rr_rdf(k, 2)), ldns_calc_keytag(k));
ldns_buffer_printf(outputfile_buffer, "K%s+%03u+%05u.key", domain_str, ldns_rdf2native_int8(ldns_rr_rdf(k, 2)),
(unsigned int) ldns_calc_keytag(k));
outputfile_str = ldns_buffer_export(outputfile_buffer);
if (verbosity >= 1) {
......
......@@ -85,7 +85,9 @@ notify_host(int s, struct addrinfo* res, uint8_t* wire, size_t wiresize,
/* wait for ACK packet */
FD_ZERO(&rfds);
FD_SET(s, &rfds);
#ifndef S_SPLINT_S
tv.tv_sec = timeout_retry; /* seconds */
#endif
tv.tv_usec = 0; /* microseconds */
retval = select(s + 1, &rfds, NULL, NULL, &tv);
if (retval == -1) {
......
......@@ -21,17 +21,17 @@ convert_addr(char* str, int p, struct sockaddr_storage* addr, socklen_t* len)
{
#ifdef AF_INET6
if(strchr(str, ':')) {
*len = sizeof(struct sockaddr_in6