The branch, master has been updated via 1210b8a dns: Do as BIND and MS DNS and drop quries with qdcount != 1 via f98ebcf dns: The QCLASS is called IN, not IP via da0cae0 s3 net: Fix a discard const warning via df88e66 errormap: Add unix_to_werror() function from e8ed54d s3:libsmb: remove unused TALLOC_FREE(subreq) calls in
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 1210b8abe73f39f85f363cbbfa2a990e2ccd4517 Author: Kai Blin <k...@samba.org> Date: Mon Sep 26 22:31:46 2011 -0700 dns: Do as BIND and MS DNS and drop quries with qdcount != 1 Autobuild-User: Kai Blin <k...@samba.org> Autobuild-Date: Wed Sep 28 03:37:22 CEST 2011 on sn-devel-104 commit f98ebcf43f9b77266ef900a12b019f62d107096a Author: Kai Blin <k...@samba.org> Date: Mon Sep 26 23:37:06 2011 -0700 dns: The QCLASS is called IN, not IP commit da0cae010a4a4050bb1d740a3df68776cc3c7b0e Author: Kai Blin <k...@samba.org> Date: Sun Sep 25 13:24:50 2011 -0700 s3 net: Fix a discard const warning commit df88e66250375fec2d0991bf379f4fe6f2550a7c Author: Kai Blin <k...@samba.org> Date: Wed Jan 26 22:17:43 2011 +0100 errormap: Add unix_to_werror() function While this function technically is closest to the map_nt_status_from_unix() function, I think it is better to keep the new function in line with our usual fooerror_to_barerror() naming scheme. Signed-off-by: Kai Blin <k...@samba.org> ----------------------------------------------------------------------- Summary of changes: libcli/util/error.h | 5 +++++ libcli/util/errormap.c | 5 +++++ librpc/idl/dns.idl | 2 +- source3/utils/net_dns.c | 2 +- source4/dns_server/dns_query.c | 28 +++++++++++++++++----------- 5 files changed, 29 insertions(+), 13 deletions(-) Changeset truncated at 500 lines: diff --git a/libcli/util/error.h b/libcli/util/error.h index 5c4dc10..0972601 100644 --- a/libcli/util/error.h +++ b/libcli/util/error.h @@ -45,4 +45,9 @@ NTSTATUS map_nt_error_from_unix_common(int unix_error); NTSTATUS nt_status_squash(NTSTATUS nt_status); +/***************************************************************************** +convert a Unix error to a WERROR + *****************************************************************************/ +WERROR unix_to_werror(int unix_error); + #endif /* _SAMBA_ERROR_H */ diff --git a/libcli/util/errormap.c b/libcli/util/errormap.c index f96d83f..714e62c 100644 --- a/libcli/util/errormap.c +++ b/libcli/util/errormap.c @@ -1238,3 +1238,8 @@ WERROR ntstatus_to_werror(NTSTATUS error) return W_ERROR(NT_STATUS_V(error) & 0xffff); } +/* Convert a Unix error code to a WERROR. */ +WERROR unix_to_werror(int unix_error) +{ + return ntstatus_to_werror(map_nt_error_from_unix_common(unix_error)); +} diff --git a/librpc/idl/dns.idl b/librpc/idl/dns.idl index 90ac47a..66390b8 100644 --- a/librpc/idl/dns.idl +++ b/librpc/idl/dns.idl @@ -60,7 +60,7 @@ interface dns } dns_rcode; typedef [public,enum16bit] enum { - DNS_QCLASS_IP = 0x0001, + DNS_QCLASS_IN = 0x0001, DNS_QCLASS_NONE = 0x00FE, DNS_QCLASS_ANY = 0x00FF } dns_qclass; diff --git a/source3/utils/net_dns.c b/source3/utils/net_dns.c index f146f29..559c14d 100644 --- a/source3/utils/net_dns.c +++ b/source3/utils/net_dns.c @@ -166,7 +166,7 @@ int get_my_ip_address( struct sockaddr_storage **pp_ss ) continue; /* Don't register loopback addresses */ - if (is_loopback_addr((struct sockaddr *)nic_sa_storage)) { + if (is_loopback_addr((const struct sockaddr *)nic_sa_storage)) { continue; } diff --git a/source4/dns_server/dns_query.c b/source4/dns_server/dns_query.c index f730a70..2153ad9 100644 --- a/source4/dns_server/dns_query.c +++ b/source4/dns_server/dns_query.c @@ -86,7 +86,7 @@ static WERROR handle_question(struct dns_server *dns, ZERO_STRUCT(ans[ai]); ans[ai].name = talloc_strdup(ans, question->name); ans[ai].rr_type = DNS_QTYPE_CNAME; - ans[ai].rr_class = DNS_QCLASS_IP; + ans[ai].rr_class = DNS_QCLASS_IN; ans[ai].ttl = recs[ri].dwTtlSeconds; ans[ai].length = UINT16_MAX; ans[ai].rdata.cname_record = talloc_strdup(ans, recs[ri].data.cname); @@ -104,7 +104,7 @@ static WERROR handle_question(struct dns_server *dns, ZERO_STRUCT(ans[ai]); ans[ai].name = talloc_strdup(ans, question->name); ans[ai].rr_type = DNS_QTYPE_A; - ans[ai].rr_class = DNS_QCLASS_IP; + ans[ai].rr_class = DNS_QCLASS_IN; ans[ai].ttl = recs[ri].dwTtlSeconds; ans[ai].length = UINT16_MAX; ans[ai].rdata.ipv4_record = talloc_strdup(ans, recs[ri].data.ipv4); @@ -120,7 +120,7 @@ static WERROR handle_question(struct dns_server *dns, ZERO_STRUCT(ans[ai]); ans[ai].name = talloc_strdup(ans, question->name); ans[ai].rr_type = DNS_QTYPE_AAAA; - ans[ai].rr_class = DNS_QCLASS_IP; + ans[ai].rr_class = DNS_QCLASS_IN; ans[ai].ttl = recs[ri].dwTtlSeconds; ans[ai].length = UINT16_MAX; ans[ai].rdata.ipv6_record = recs[ri].data.ipv6; @@ -136,7 +136,7 @@ static WERROR handle_question(struct dns_server *dns, ZERO_STRUCT(ans[ai]); ans[ai].name = question->name; ans[ai].rr_type = DNS_QTYPE_NS; - ans[ai].rr_class = DNS_QCLASS_IP; + ans[ai].rr_class = DNS_QCLASS_IN; ans[ai].ttl = recs[ri].dwTtlSeconds; ans[ai].length = UINT16_MAX; ans[ai].rdata.ns_record = recs[ri].data.ns; @@ -152,7 +152,7 @@ static WERROR handle_question(struct dns_server *dns, ZERO_STRUCT(ans[ai]); ans[ai].name = question->name; ans[ai].rr_type = DNS_QTYPE_SRV; - ans[ai].rr_class = DNS_QCLASS_IP; + ans[ai].rr_class = DNS_QCLASS_IN; ans[ai].ttl = recs[ri].dwTtlSeconds; ans[ai].length = UINT16_MAX; ans[ai].rdata.srv_record.priority = recs[ri].data.srv.wPriority; @@ -171,7 +171,7 @@ static WERROR handle_question(struct dns_server *dns, ZERO_STRUCT(ans[ai]); ans[ai].name = question->name; ans[ai].rr_type = DNS_QTYPE_SOA; - ans[ai].rr_class = DNS_QCLASS_IP; + ans[ai].rr_class = DNS_QCLASS_IN; ans[ai].ttl = recs[ri].dwTtlSeconds; ans[ai].length = UINT16_MAX; ans[ai].rdata.soa_record.mname = recs[ri].data.soa.mname; @@ -206,17 +206,19 @@ WERROR dns_server_process_query(struct dns_server *dns, struct dns_res_rec **nsrecs, uint16_t *nscount, struct dns_res_rec **additional, uint16_t *arcount) { - uint16_t i, num_answers=0; + uint16_t num_answers=0; struct dns_res_rec *ans=NULL; WERROR werror; + if (in->qdcount != 1) { + return DNS_ERR(FORMAT_ERROR); + } + ans = talloc_array(mem_ctx, struct dns_res_rec, 0); W_ERROR_HAVE_NO_MEMORY(ans); - for (i = 0; i < in->qdcount; ++i) { - werror = handle_question(dns, mem_ctx, &in->questions[i], &ans, &num_answers); - W_ERROR_NOT_OK_RETURN(werror); - } + werror = handle_question(dns, mem_ctx, &in->questions[0], &ans, &num_answers); + W_ERROR_NOT_OK_GOTO(werror, query_failed); *answers = ans; *ancount = num_answers; @@ -229,4 +231,8 @@ WERROR dns_server_process_query(struct dns_server *dns, *arcount = 0; return WERR_OK; + +query_failed: + /*FIXME: add our SOA record to nsrecs */ + return werror; } -- Samba Shared Repository