From 255cc9ab36f791c25ad04166d3268e83934de623 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Thu, 14 Jul 2016 15:42:49 +0200 Subject: [PATCH 1/4] First bit of set_from_os loads OS defaults --- src/context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/context.c b/src/context.c index edea6aef..a93e6f14 100644 --- a/src/context.c +++ b/src/context.c @@ -1277,10 +1277,10 @@ getdns_context_create_with_extended_memory_functions( // resolv.conf does not exist on Windows, handle differently #ifndef USE_WINSOCK - if (set_from_os && (r = set_os_defaults(result))) + if ((set_from_os & 1) && (r = set_os_defaults(result))) goto error; #else - if (set_from_os && (r = set_os_defaults_windows(result))) + if ((set_from_os & 1) && (r = set_os_defaults_windows(result))) goto error; #endif From 0736453bed0654a8f54270086391bd9666a51b46 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Thu, 14 Jul 2016 15:53:53 +0200 Subject: [PATCH 2/4] Doxygen fixes --- src/getdns/getdns.h.in | 14 +++++++++----- src/getdns/getdns_extra.h.in | 36 ++++++++++++++++++------------------ 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/getdns/getdns.h.in b/src/getdns/getdns.h.in index fedf9f2f..2a8f7f2a 100644 --- a/src/getdns/getdns.h.in +++ b/src/getdns/getdns.h.in @@ -965,7 +965,8 @@ getdns_service(getdns_context *context, * If used multi-threaded, user must define appropriate OpenSSL callback locking functions * (e.g. CRYPTO_THREADID_set_call) depending on the library version used. * @param context context that can be used immediately with other API calls - * @param set_from_os select to use os defaults or to specify user defined values + * @param set_from_os set to 1 to initialize the context with os defaults + * the second bit set (2) prevents OpenSSL library initialization. * @return GETDNS_RETURN_GOOD on success */ getdns_return_t @@ -977,10 +978,11 @@ getdns_context_create(getdns_context ** context, int set_from_os); * If used multi-threaded, user must define appropriate OpenSSL callback locking functions * (e.g. CRYPTO_THREADID_set_call) depending on the library version used. * @param context context that can be used immediately with other API calls - * @param set_from_os select to use os defaults or to specify user defined values + * @param set_from_os set to 1 to initialize the context with os defaults + * the second bit set (2) prevents OpenSSL library initialization. * @param malloc custom malloc function * @param realloc custom realloc function - * @param malloc custom free function + * @param free custom free function * @return GETDNS_RETURN_GOOD on success */ getdns_return_t @@ -998,10 +1000,12 @@ getdns_context_create_with_memory_functions( * If used multi-threaded, user must define appropriate OpenSSL callback locking functions * (e.g. CRYPTO_THREADID_set_call) depending on the library version used. * @param context context that can be used immediately with other API calls - * @param set_from_os select to use os defaults or to specify user defined values + * @param set_from_os set to 1 to initialize the context with os defaults + * the second bit set (2) prevents OpenSSL library initialization. + * @param userarg parameter passed to the custom malloc, realloc and free functions * @param malloc custom malloc function * @param realloc custom realloc function - * @param malloc custom free function + * @param free custom free function * @return GETDNS_RETURN_GOOD on success */ getdns_return_t diff --git a/src/getdns/getdns_extra.h.in b/src/getdns/getdns_extra.h.in index 3f7647d4..752076a9 100644 --- a/src/getdns/getdns_extra.h.in +++ b/src/getdns/getdns_extra.h.in @@ -361,9 +361,9 @@ getdns_context_get_tls_authentication(getdns_context *context, * "chain" context update callbacks and in this way create a subscription * service catering multiple interested parties. * @param context The context to monitor for changes - * @return userarg A user defined argument to be passed to the callback + * @param userarg A user defined argument to be passed to the callback * function. - * @return value The callback function to be called on context value + * @param value The callback function to be called on context value * changes. * @return GETDNS_RETURN_GOOD on success or an error code on failure. */ @@ -484,7 +484,7 @@ getdns_dict* getdns_pubkey_pin_create_from_string( * * @param pinset the set of public key pins to check for sanity. This * should be a list of dicts. - * @return errorlist if not NULL, a list of human-readable strings is + * @param errorlist if not NULL, a list of human-readable strings is * appended to errorlist. * @return GETDNS_RETURN_GOOD if the pinset passes the sanity check. */ @@ -592,8 +592,8 @@ getdns_snprint_json_list( * Convert rr_dict to wireformat representation of the resource record. * * @param rr_dict The getdns dict representation of the resource record - * @return wire A newly allocated buffer which will contain the wireformat. - * @return wire_sz The size of the allocated buffer and the wireformat. + * @param wire A newly allocated buffer which will contain the wireformat. + * @param wire_sz The size of the allocated buffer and the wireformat. * @return GETDNS_RETURN_GOOD on success or an error code on failure. */ getdns_return_t @@ -644,7 +644,7 @@ getdns_rr_dict2wire_scan( * * @param wire Buffer containing the wireformat rr * @param wire_sz Size of the wire buffer - * @return rr_dict The returned rr_dict + * @param rr_dict The returned rr_dict * @return GETDNS_RETURN_GOOD on success or an error code on failure. */ getdns_return_t @@ -657,7 +657,7 @@ getdns_wire2rr_dict( * @param wire Buffer containing the wireformat rr * @param wire_sz On input the size of the wire buffer * On output the length of the wireformat rr. - * @return rr_dict The returned rr_dict + * @param rr_dict The returned rr_dict * @return GETDNS_RETURN_GOOD on success or an error code on failure. */ getdns_return_t @@ -673,7 +673,7 @@ getdns_wire2rr_dict_buf( * @param wire_sz On input the size of the wire buffer * On output the size is decreased with the length * of the wireformat resource record. - * @return rr_dict The returned rr_dict + * @param rr_dict The returned rr_dict * @return GETDNS_RETURN_GOOD on success or an error code on failure. */ getdns_return_t @@ -685,7 +685,7 @@ getdns_wire2rr_dict_scan( * Convert rr_dict to the string representation of the resource record. * * @param rr_dict The getdns dict representation of the resource record - * @return str A newly allocated string representation of the rr + * @param str A newly allocated string representation of the rr * @return GETDNS_RETURN_GOOD on success or an error code on failure. */ getdns_return_t @@ -735,7 +735,7 @@ getdns_rr_dict2str_scan( * Convert the string representation of the resource record to rr_dict format. * * @param str String representation of the resource record. - * @return rr_dict The result getdns dict representation of the resource record + * @param rr_dict The result getdns dict representation of the resource record * @param origin Default suffix for not fully qualified domain names * @param default_ttl Default ttl * @return GETDNS_RETURN_GOOD on success or an error code on failure. @@ -748,8 +748,8 @@ getdns_str2rr_dict( /** * Read the zonefile and convert to a list of rr_dict's. * - * @param FILE An opened FILE pointer on the zone file. - * @return rr_list The result list of rr_dicts representing the zone file. + * @param in An opened FILE pointer on the zone file. + * @param rr_list The result list of rr_dicts representing the zone file. * @param origin Default suffix for not fully qualified domain names * @param default_ttl Default ttl * @return GETDNS_RETURN_GOOD on success or an error code on failure. @@ -763,8 +763,8 @@ getdns_fp2rr_list( * Convert DNS message dict to wireformat representation. * * @param msg_dict The getdns dict representation of a DNS message - * @return wire A newly allocated buffer which will contain the wireformat. - * @return wire_sz The size of the allocated buffer and the wireformat. + * @param wire A newly allocated buffer which will contain the wireformat. + * @param wire_sz The size of the allocated buffer and the wireformat. * @return GETDNS_RETURN_GOOD on success or an error code on failure. */ getdns_return_t @@ -815,7 +815,7 @@ getdns_msg_dict2wire_scan( * * @param wire Buffer containing the wireformat rr * @param wire_sz Size of the wire buffer - * @return msg_dict The returned DNS message + * @param msg_dict The returned DNS message * @return GETDNS_RETURN_GOOD on success or an error code on failure. */ getdns_return_t @@ -828,7 +828,7 @@ getdns_wire2msg_dict( * @param wire Buffer containing the wireformat rr * @param wire_sz On input the size of the wire buffer * On output the length of the wireformat rr. - * @return msg_dict The returned DNS message + * @param msg_dict The returned DNS message * @return GETDNS_RETURN_GOOD on success or an error code on failure. */ getdns_return_t @@ -844,7 +844,7 @@ getdns_wire2msg_dict_buf( * @param wire_sz On input the size of the wire buffer * On output the size is decreased with the length * of the wireformat DNS message. - * @return msg_dict The returned DNS message + * @param msg_dict The returned DNS message * @return GETDNS_RETURN_GOOD on success or an error code on failure. */ getdns_return_t @@ -856,7 +856,7 @@ getdns_wire2msg_dict_scan( * Convert msg_dict to the string representation of the DNS message. * * @param msg_dict The getdns dict representation of the DNS message - * @return str A newly allocated string representation of the rr + * @param str A newly allocated string representation of the rr * @return GETDNS_RETURN_GOOD on success or an error code on failure. */ getdns_return_t From d9a089a6a0b6cb189d5a178eefa0305711a844d7 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Thu, 14 Jul 2016 16:00:55 +0200 Subject: [PATCH 3/4] Update .so versioning --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index da1dccd3..483c2964 100644 --- a/configure.ac +++ b/configure.ac @@ -76,7 +76,8 @@ GETDNS_COMPILATION_COMMENT="AC_PACKAGE_NAME $GETDNS_VERSION configured on $CURRE # getdns-0.3.3 had libversion 3:6:2 # getdns-0.5.0 had libversion 4:0:3 # getdns-0.5.1 had libversion 4:1:3 (but should have been getdns-0.6.0) -# getdns-0.9.0 will have libversion 5:0:4 +# getdns-0.9.0 had libversion 5:0:4 +# getdns-1.0.0 will have libversion 5:1:4 # GETDNS_LIBVERSION=5:0:4 From f685a0c8b85b89f56c3d179439e8763f58708031 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Thu, 14 Jul 2016 16:18:50 +0200 Subject: [PATCH 4/4] Unsigned expression >= 0 is always true --- src/test/getdns_query.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/test/getdns_query.c b/src/test/getdns_query.c index 05645a5f..5c98d8f9 100644 --- a/src/test/getdns_query.c +++ b/src/test/getdns_query.c @@ -475,7 +475,7 @@ static void parse_config(const char *config_str) getdns_return_t parse_args(int argc, char **argv) { getdns_return_t r = GETDNS_RETURN_GOOD; - size_t i, j; + size_t i, j, klass; char *arg, *c, *endptr; int t, print_api_info = 0, print_trust_anchors = 0; getdns_list *upstream_list = NULL; @@ -486,7 +486,6 @@ getdns_return_t parse_args(int argc, char **argv) getdns_bindata bindata; size_t upstream_count = 0; FILE *fh; - uint32_t klass; char *config_file = NULL; long config_file_sz; @@ -507,7 +506,7 @@ getdns_return_t parse_args(int argc, char **argv) } else if (strncmp(arg+1, "specify_class=", 14) == 0) { if ((klass = get_rrclass(arg+15)) >= 0) r = getdns_dict_set_int(extensions, - "specify_class", klass); + "specify_class", (uint32_t )klass); else fprintf(stderr, "Unknown class: %s\n", arg+15);