1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
Commit Graph

34 Commits

Author SHA1 Message Date
Douglas Bagnall
b707720325 dns: merge dns_records_match and dns_record_match
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-06-11 08:38:34 +00:00
Douglas Bagnall
d1c47d0c83 rpc/idl dnsserver s/DNS_RPC_DATA/DNS_RPC_RECORD_DATA/
Following MS-DNSP.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Mar 30 00:20:53 UTC 2021 on sn-devel-184
2021-03-30 00:20:53 +00:00
Douglas Bagnall
162e6fb25a librpc/idl: dnsp tombstone timestamp name matches MS-DNSP
MS-DNSP uses the term "EntombedTime" in e.g. "2.2.2.2.4.23 DNS_RPC_RECORD_TS"
which is more descriptive than the generic "timestamp", and less likely to be
confused with dwTimestamp, which has been our curse. Let's make it grep-able,
google-able, and evocative.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-03-29 23:20:37 +00:00
Matthew DeVore
232054c09b lib/util: remove extra safe_string.h file
lib/util/safe_string.h is similar to source3/include/safe_string.h, but
the former has fewer checks. It is missing bcopy, strcasecmp, and
strncasecmp.

Add the missing elements to lib/util/safe_string.h remove the other
safe_string.h which is in the source3-specific path. To accomodate
existing uses of str(n?)casecmp, add #undef lines to source files where
they are used.

Signed-off-by: Matthew DeVore <matvore@google.com>
Reviewed-by: David Mulder <dmulder@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Aug 28 02:18:40 UTC 2020 on sn-devel-184
2020-08-28 02:18:40 +00:00
Andrew Bartlett
defb237325 CVE-2019-14861: s4-rpc/dnsserver: Avoid crash in ldb_qsort() via dcesrv_DnssrvEnumRecords)
dns_name_compare() had logic to put @ and the top record in the tree being
enumerated first, but if a domain had both then this would break the
older qsort() implementation in ldb_qsort() and cause a read of memory
before the base pointer.

By removing this special case (not required as the base pointer
is already seperatly located, no matter were it is in the
returned records) the crash is avoided.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14138

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2019-12-10 09:18:46 +00:00
Andrew Bartlett
4333e41c22 CVE-2019-14861: s4-rpc_server: Remove special case for @ in dns_build_tree()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14138

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2019-12-10 09:18:46 +00:00
Douglas Bagnall
51e4a1e454 rpc/dns: reduce the CID count on temporary variables
CID 1363189 and others.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-05-09 22:39:27 +00:00
Douglas Bagnall
5389df9b4d rpc/dns: leak less on memory failure (CID 1363191)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-05-09 22:39:27 +00:00
Douglas Bagnall
74cd11df83 rpc/dnsdata: avoid crash on missing attr (CID: 1414757)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-05-09 22:39:27 +00:00
Douglas Bagnall
a9e6300a5d rpc/dnsdata: do not crash if message attr missing (CID: 1414773)
This should be hard to trigger, but goto fail is always nicer than sig 11.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-05-09 22:39:27 +00:00
Aaron Haslett
350029bdd8 dns: moving name_equal func into common
This function is duplicated in the BIND9 and RPC DNS servers.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10812

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-07-12 04:31:54 +02:00
Gary Lockyer
b841da04e2 dns: Reformat DNS with clang-format
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10812

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-07-12 04:31:52 +02:00
Volker Lendecke
e7522a4ff8 dnsrpc: Use TALLOC_FREE instead of an explicit if-statement
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-04-11 19:07:24 +02:00
Andreas Schneider
1bd4a0cf27 s4:rpc_server: Fix size types in dcerpc dnsserver
This fixes compilation with -Wstrict-overflow=2

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-03-20 23:16:15 +01:00
Garming Sam
5ccfd38156 dnsserver: Stop dns_name_equal doing OOB read
This has been the cause of a large number of flakey autobuilds. Every
now and again dns_name_equal would not be equal between two empty
strings, thus causing failures.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12813

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Jun  1 19:34:38 CEST 2017 on sn-devel-144
2017-06-01 19:34:38 +02:00
Bob Campbell
4408df2493 dnsserver: add dns name checking
This may also prevent deletion of existing corrupted records through
DNS, but should be resolvable through RPC, or at worst LDAP.

Signed-off-by: Bob Campbell <bobcampbell@catalyst.net.nz>
Pair-programmed-with: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-12-12 05:00:18 +01:00
Günther Deschner
eaee3b85e8 werror: replace WERR_NOMEM with WERR_NOT_ENOUGH_MEMORY in source4/rpc_server/
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-28 00:04:20 +02:00
Guenter Kukkukk
3ac4355f3e s4-rpc: dnsserver: Fix enumeration of IPv4 and IPv6 addresses
In the initial implementation only IPv4 addresses were supported.

Add IPv6 (and mixed IPv4/IPv6) support and all further needed conversion
routines to support w2k, dotnet, longhorn clients.

Signed-off-by: Guenter Kukkukk <linux@kukkukk.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Wed Nov 26 03:44:07 CET 2014 on sn-devel-104
2014-11-26 03:44:06 +01:00
Samuel Cabrero
13f0b6fe77 Initialize dwFlags field of DNS_RPC_NODE structure
This fixes issue #9791, where the MMC shows random data
listing the zone contents.

Signed-off-by: Samuel Cabrero <samuelcabrero@kernevil.me>
Reviewed-by: Kamen Mazdrashki <kamenim@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-10-21 02:37:04 +02:00
Stefan Metzmacher
0b4a3b7611 s4-rpc: dnsserver: return DNS_RANK_NS_GLUE recors when explicitly asked for
NS records should be included in the query for sub-domains.  NS records
got dropped when the rank for NS records was correctly set to NS_GLUE
from ZONE in commit 2036cbd924.

  samba-tool dns query 172.31.9.161 s4xdom.base @ ALL
  =>
  Name=glue, Records=0, Children=0

  samba-tool dns query 172.31.9.161 s4xdom.base glue ALL
  =>
    Name=, Records=1, Children=0
      NS: glue.dns.private. (flags=40000082, serial=21, ttl=900)

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10751

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Thu Sep  4 14:37:51 CEST 2014 on sn-devel-104
2014-09-04 14:37:51 +02:00
Amitay Isaacs
c9169a5e98 s4-rpc: dnsserver: Do not return NS_GLUE records with VIEW_GLUE_DATA filter
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10751

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Aug 21 11:36:55 CEST 2014 on sn-devel-104
2014-08-21 11:36:55 +02:00
Amitay Isaacs
cc103a8187 s4-rpc: dnsserver: dns_name_equal() returns boolean
Remove the remaining check for return value after strcmp() was changed to
dns_name_equal().

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-05-30 10:43:46 +10:00
Amitay Isaacs
b5c3ec0abc s4-rpc: dnsserver: Fix removal of trailing '.' in soa mname
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-05-30 10:43:42 +10:00
Guenter Kukkukk
f67ae788cf samba-tool - MX records cannot be deleted (part2)
I missed this one, also a wrong compare of MX vs. SRV record

Signed-off-by: Guenter Kukkukk <kukks@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sun Apr 14 22:43:07 CEST 2013 on sn-devel-104
2013-04-14 22:43:07 +02:00
Guenter Kukkukk
3434140c09 samba-tool - MX records cannot be deleted (error in called C-program)
Only matching UNION-members should be compared. MX vs. SRV record

Signed-off-by: Guenter Kukkukk <kukks@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sun Apr 14 08:46:07 CEST 2013 on sn-devel-104
2013-04-14 08:46:07 +02:00
Amitay Isaacs
a35da7972e s4-rpc: dnsserver: Fix the typo in comparing two DNS records
Autobuild-User: Amitay Isaacs <amitay@samba.org>
Autobuild-Date: Fri Mar  2 10:27:41 CET 2012 on sn-devel-104
2012-03-02 10:27:41 +01:00
Amitay Isaacs
cf139b4efc s4-rpc: dnsserver: Update data type for TXT DNS records 2012-03-02 00:24:50 +11:00
Amitay Isaacs
44a85e3752 s4-rpc:dnsserver: DNS names are case insensitive 2012-01-12 05:10:08 +01:00
Amitay Isaacs
07639b5023 s4:rpc-dnsserver: Fix the enumeration of DNS records
If a node has data and children, do not return the children unless
the node is the top level node.
2011-12-23 16:18:24 +11:00
Amitay Isaacs
0120a397a7 s4:rpc-dnsserver: For PTR records, use dns_name_equal instead of strcmp to compare 2011-12-23 16:17:09 +11:00
Amitay Isaacs
8dca18a71a s4-dnsserver: Handle the case when the dns name is NULL
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-11-02 15:26:54 +11:00
Amitay Isaacs
6e800bfba7 s4-dnsserver: Build a dns name tree for correct enumeration
The result of EnumRecords/EnumRecords2 RPC calls, is a list of
dns records that are one level below in the name hierarchy starting
from the search name. This patch builds a tree of names to get
the list of records one level below the search names and correctly
count the number of child records for each of those.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-11-02 15:26:54 +11:00
Amitay Isaacs
c1b45afcf2 s4-dnsserver: Compare two dns names using last uncommon name components
When search_name is not NULL, use the second last component of name
instead of the last name.

e.g. To compare following two names,
   _ldap._tcp.gc, and
   _ldap._tcp.Default-First-Site-Name._sites.gc

with search_name=NULL, it is gc and gc
with search_name=gc, it is _tcp and _sites

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-11-02 15:26:54 +11:00
Amitay Isaacs
8df2ed42cc s4-dns: Added DCERPC dns server for DNS management
dnsserver.h - typedefs and prototypes
dnsserver.c - RPC API and implementation methods
dnsdb.c     - samdb operations
dnsdata.c   - functions to manipulate dns structures
dnsutils.c  - function for serverinfo and zoneinfo structures

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-10-20 05:53:05 +02:00