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

383 Commits

Author SHA1 Message Date
Gary Lockyer
0840252670 source4/smbd: Do not overstamp the process model with "single"
Instead, except in RPC which is a special SNOWFLAKE, we rely on the struct
service_details in the init function.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-10-19 05:33:10 +02:00
Gary Lockyer
b852ad044b source4/smbd: refactor the process model for prefork
Refactor the process model code to allow the addition of a prefork
    process model.

    - Add a process context to contain process model specific state
    - Add a service details structure to allow service to indicate which
      process model options they can support.

    In the new code the services advertise the features they support to the
    process model.  The process model context is plumbed through to allow the
    process model to keep track of the supported options, and any state
    the process model may require.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-10-19 05:33:09 +02:00
Andrew Bartlett
c1e41d489d samdb: Rework samdb_connect_url() to return LDB error code and an error string
This allows debugging of why the LDB failed to start up.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2017-09-20 02:25:30 +02:00
Andreas Schneider
bf64939d22 s4:bind_dlz: Try the 'binddns dir' first
The directory is normally empty if you did not provision or call
samba_upgradedns for the bind_dlz module.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2017-09-16 00:57:24 +02:00
Andreas Schneider
3fa7c43ef7 s4:bind_dlz: Use the 'binddns dir' if possible
The code makes sure we are backwards compatible. It will first check if
we still have files in the private directory, if yes it will use those.

If the the file is not in the private directory it will try the binddns
dir.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
2017-09-05 23:58:20 +02:00
Gary Lockyer
edcbc99125 dnsserver: Add support for dns wildcards
Add support for dns wildcard records. i.e. if the following records
exist

  exact.samba.example.com 3600 A 1.1.1.1
  *.samba.example.com     3600 A 1.1.1.2

look up on exact.samba.example.com will return 1.1.1.1
look up on *.samba.example.com     will return 1.1.1.2
look up on other.samba.example.com will return 1.1.1.2

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12952
2017-08-15 08:07:10 +02:00
Gary Lockyer
34acf5a992 dnsserver: Tighten DNS name checking
Add checks for the maximum permitted length, maximum number of labels
and the maximum label length.  These extra checks will be used by the
DNS wild card handling.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12952
2017-08-15 08:07:10 +02:00
Marc Muehlfeld
4b56f80379 Set log level for "Not authorative for" from 2 to 5
Signed-off-by: Marc Muehlfeld <mmuehlfeld@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Marc Muehlfeld <mmuehlfeld@samba.org>
Autobuild-Date(master): Wed Jul 26 21:34:48 CEST 2017 on sn-devel-144
2017-07-26 21:34:48 +02:00
Andrew Bartlett
1319f19958 dns_server: Only install common library if AD DC is enabled.
The library is used in selftest, so must still be built

This reverts commit d32b66b40c and
replaces the behaviour.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-07-04 06:57:20 +02:00
Garming Sam
73a7d154a8 dnsserver/common: Use cached dnsHostName to reduce database reads
The code to clobber the host name appears to have caused DNS requests to use 3x as much resources

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

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Jun 22 13:06:07 CEST 2017 on sn-devel-144
2017-06-22 13:06:07 +02:00
Andrew Bartlett
c1bf6d2493 dns_server: clobber MNAME in the SOA
Otherwise, we always report the first server we created/provisioned the AD domain on
which does not match AD behaviour.  AD is multi-master so all RW servers are a master.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-10 21:48:21 +02:00
Andrew Bartlett
970fdfae6a pydsdb_dns: Allow the partition DN to be specified into py_dsdb_dns_lookup
This allows lookups to be confined to one partition, which in turn avoids issues
when running this against MS Windows, which does not match Samba behaviour
for dns_common_zones()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-10 21:48:20 +02:00
Andrew Bartlett
f5e945c810 pydsdb_dns: Use TypeError not LdbError for mismatched types
This avoids the samba-tool command handling code blowing up when trying to parse an LdbError

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-10 21:48:20 +02:00
Andrew Bartlett
e7bc974333 pydns: Also return the DN of the LDB object when finding a DNS record
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-10 21:48:20 +02:00
Andrew Bartlett
9186cc7143 pydns: Fix leak of talloc_stackframe() in python bindings
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-10 21:48:20 +02:00
Stefan Metzmacher
c198dee8ea s4:dlz_bind9: assert SPNEGO/KRB5 and use gensec_update()
This avoids using gensec_update_ev() with a nested event loop.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-05-21 21:05:12 +02:00
Stefan Metzmacher
186543a727 s4:dns_server: use samba_server_gensec_krb5_start() and gensec_update() in dns_query.c
This avoids using gensec_update_ev() with a nested event loop.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-05-21 21:05:12 +02:00
Jeremy Allison
560c37524b s4: Add TALLOC_CTX * to register_server_service().
Use the passed in context from callers. Remove one
talloc_autofree_context().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2017-05-11 20:30:13 +02:00
Jeremy Allison
306783d6f5 lib: modules: Change XXX_init interface from XXX_init(void) to XXX_init(TALLOC_CTX *)
Not currently used - no logic changes inside.

This will make it possible to pass down a long-lived talloc
context from the loading function for modules to use instead
of having them internally all use talloc_autofree_context()
which is a hidden global.

Updated all known module interface numbers, and added a
WHATSNEW.

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Ralph Böhme <slow@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Apr 22 01:17:00 CEST 2017 on sn-devel-144
2017-04-22 01:17:00 +02:00
Andrew Bartlett
59ed188ede dns: Provide local and remote socket address to GENSEC
This can be used for logging and for Kerberos channel bindings

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
2017-03-29 02:37:27 +02:00
Bob Campbell
eacba34a27 dnsserver_common: Add name check in name2dn
Fills in the missing TODO. Note that this may also prevent deletion of
existing corrupted records, 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:19 +01: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
Amitay Isaacs
c8c330d5f4 dlz-bind: Add support for BIND 9.11.x
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12366

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-10-27 23:53:13 +02:00
Amitay Isaacs
e63e51a2cf dlz-bind: Set DNS_CLIENTINFO_VERSION based on BIND version
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12366

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-10-27 23:53:13 +02:00
Amitay Isaacs
370d6baaa6 dlz-bind: Fix initialization of DLZ_DLOPEN_AGE
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12366

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-10-27 23:53:13 +02:00
Amitay Isaacs
fbafd2699b dlz-bind: Fix preprocessor checks for BIND versions
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12366

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-10-27 23:53:13 +02:00
Günther Deschner
8416a97b30 werror: replace WERR_INVALID_PARAM with WERR_INVALID_PARAMETER in source4/dns_server/
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-28 00:04:23 +02:00
Günther Deschner
c1c079cf3d werror: replace WERR_NOMEM with WERR_NOT_ENOUGH_MEMORY in source4/dns_server/
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-28 00:04:19 +02:00
Jeremy Allison
c3dfeb3aa6 s4: dns: Correctly check for talloc failure.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Jun 16 16:55:15 CEST 2016 on sn-devel-144
2016-06-16 16:55:15 +02:00
Garming Sam
9394e14626 dns_server: Fix typo in dns_authoritative_for_zone() name.
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-06-16 04:40:14 +02:00
Ralph Boehme
88700e7d89 s4/dns_server: enable sending of TSIG error records
This final patch enables sending TSIG error records by adding
DNS_RCODE_NOTAUTH to the set of error conditions that are allowed to
trigger sending a full generated response.

See RFC 2845 "4.5.1. KEY check and error handling" and "4.5.3. MAC check
and error handling".

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-06-16 00:06:28 +02:00
Ralph Boehme
ba683d459e s4/dns_server: prepare sending correct error responses for dns_verify_tsig() errors
Call dns_verify_tsig() after updating state.flags and assign and use
out_packet for dns_verify_tsig().

We will need the updated flags when sending TSIG error responses when
TSIG request MAC verification fails and dns_verify_tsig() uses the
passed in packet as response, so we have to make sure we copy in_packet
to out_packet before calling out and pass out_packet.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-06-16 00:06:28 +02:00
Ralph Boehme
8f46bf2102 s4/dns_server: don't compute TSIG MAC in TSIG error records
See RFC 2845 "4.3. TSIG on TSIG Error returns".

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-06-16 00:06:28 +02:00
Ralph Boehme
8b4a2dcf38 s4/dns_server: error codes for failing MAC verification in TSIG requests
According to RFC 2845 "4.5.3. MAC check and error handling" we must
return NOTAUTH and DNS_RCODE_BADSIG when MAC verification fails.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-06-16 00:06:27 +02:00
Ralph Boehme
77c5bfdce4 s4/dns_server: ensure we store the key name in error code paths
We need the TKEY name when adding TSIG records to error responses.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-06-16 00:06:27 +02:00
Ralph Boehme
c1fca8fa39 s4/dns_server: not finding the key here is a fatal error
Bug: https://bugzilla.samba.org/show_bug.cgi?id=11520

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-06-16 00:06:27 +02:00
Ralph Boehme
830316ce84 s4/dns_server: split out function that does the MAC computation
Split out function that does the MAC computation from the TSIG record
creating function. This will later simplify the code when creating error
responsed to TSIG requests with bad MACs where we have to add the TSIG
record with an empty MAC.

No functional behaviour change besides hard coding "gss-tsig" algorithm
name: later when sending a TSIG error response for a TKEY request with a
bad keyname, we won't have a tkey to fetch the algorithm name from.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-06-16 00:06:27 +02:00
Ralph Boehme
8ed125e8bb s4/dns_server: include request MAC in TSIG response MAC calculation
According to RFC 2845 "4.2 TSIG on Answers", when the request is signed,
the request MAC must be included in the response MAC calculation.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-06-16 00:06:27 +02:00
Ralph Boehme
bea4aec521 librpc/dns: remove original_id from dns_fake_tsig_rec
Cf RFC2845, 3.4.2. "TSIG Variables", the request id (original_id) is not
used in the MAC calculation. This also explains the mysterious 2 bytes
padding.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-06-16 00:06:27 +02:00
Garming Sam
5caebde11d dns: modify dns forwarder param to be multi-valued
This allows a secondary DNS forwarder for a trivial failover. Requests
which fail/timeout at the primary DNS forwarder will be restarted
entirely with the next forwarder in the list.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-05-03 08:10:09 +02:00
Garming Sam
ac4dd94e3f dnsserver: Remove C++ style comment
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-05-03 08:10:09 +02:00
Garming Sam
7b431eba22 build: mark explicit dependencies on pytalloc-util
All subsystems that include pytalloc.h need to link against
pytalloc-util.

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

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

Autobuild-User(master): Garming Sam <garming@samba.org>
Autobuild-Date(master): Tue Mar 15 07:08:16 CET 2016 on sn-devel-144
2016-03-15 07:08:16 +01:00
Stefan Metzmacher
ee8d777bbf CVE-2016-0771: s4:dns_server: fix idl for dns_txt_record
From RFC 1035:

    3.3.14. TXT RDATA format

        +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
        /                   TXT-DATA                    /
        +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

    where:

    TXT-DATA        One or more <character-string>s.

    TXT RRs are used to hold descriptive text.  The semantics of the text
    depends on the domain where it is found.

Each record contains an array of strings instead of just one string.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-03-10 06:52:24 +01:00
Michael Adam
476672b647 dlist: remove unneeded type argument from DLIST_ADD_END()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-02-06 21:48:17 +01:00
Jelmer Vernooij
da8674c72a Rename 'errors' to 'samba-errors' and make it public.
This is necessary because it has public headers.

Signed-off-by: Jelmer Vernooij <jelmer@jelmer.uk>
Reviewed-By: Andrew Bartlett <abartlet@samba.org>
Reviewed-By: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date(master): Wed Jan 13 07:47:04 CET 2016 on sn-devel-144
2016-01-13 07:47:04 +01:00
Jelmer Vernooij
773cfba9af Avoid including libds/common/roles.h in public loadparm.h header.
Signed-Off-By: Jelmer Vernooij <jelmer@samba.org>
Reviewed-By: Andrew Bartlett <abartlet@samba.org>
Reviewed-By: Stefan Metzmacher <metze@samba.org>
2016-01-13 04:43:23 +01:00
Volker Lendecke
fc4c2dcd52 bind_dlz: Fix CID 1347318 Unchecked return value
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-01-08 02:37:18 +01:00
Volker Lendecke
5a72a2ed0d dns_server: Remove unused handle_question
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Kai Blin <kai@samba.org>

Autobuild-User(master): Kai Blin <kai@samba.org>
Autobuild-Date(master): Tue Dec 15 17:50:32 CET 2015 on sn-devel-104
2015-12-15 17:50:32 +01:00
Volker Lendecke
6adec9339d dns_server: Add handle_authoritative_send()
An async version of handle_question

Bug: https://bugzilla.samba.org/show_bug.cgi?id=9409
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Kai Blin <kai@samba.org>
2015-12-15 14:43:09 +01:00
Volker Lendecke
3b7f99e6f4 dns_server: Add add_dns_res_rec()
Same as add_response_rr(), but it copies over a dns_res_rec

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Kai Blin <kai@samba.org>
2015-12-15 14:43:09 +01:00
Volker Lendecke
b6aaf77897 dns_server: Convert "ask_forwarder" params
Usually we have mem_ctx and ev first when doing a _send function

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Kai Blin <kai@samba.org>
2015-12-15 14:43:09 +01:00
Volker Lendecke
4b54e14b7c dns_server: Simplify array length handling
talloc objects carry an implicit length

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Kai Blin <kai@samba.org>
2015-12-15 14:43:09 +01:00
Volker Lendecke
3f2cbb616f dns_server: Simplify talloc handling
By making sure that the answers are always allocated, we don't have
to pass an explicit mem_ctx anymore

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Kai Blin <kai@samba.org>
2015-12-15 14:43:09 +01:00
Volker Lendecke
9de59c7e3f dns_server: Consolidate talloc_realloc
This puts the talloc_realloc into add_response_rr instead of before
create_response_rr. It is a bit less efficient, but as we do not expect
hundreds of answers, I think this code is a bit easier to understand.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Kai Blin <kai@samba.org>
2015-12-15 14:43:09 +01:00
Volker Lendecke
dfceb51da8 libdns: Convert dns_udp_request to 0/errno
Replaces 5 calls to unix_to_werror with just one

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-12-08 23:01:27 +01:00
Volker Lendecke
609a92362e dns_server: Fix a clang warning
clang complains that '\0' is converted to a NULL pointer. This seems
to work fine, so make this pointer explicitly NULL. If instead we
need a "" here, we could of course do that too.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Nov 10 10:13:18 CET 2015 on sn-devel-104
2015-11-10 10:13:18 +01:00
Andrew Bartlett
3226077627 pydns: Add replace_by_dn()
This allows us to find a DNS record by searching LDB and unpacking the dnsRecord
but replace the record using the common code that will create a tombstone

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2015-10-26 05:11:22 +01:00
Andrew Bartlett
fff09dae6d dns_server: Give WERR_DNS_ERROR_NAME_DOES_NOT_EXIST on empty records
When not looking for tombstones, a record without a dnsRecord value may as
well not be present, so just return WERR_DNS_ERROR_NAME_DOES_NOT_EXIST

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2015-10-26 05:11:22 +01:00
Andrew Bartlett
2191fcaedc dns_server: Add python method to extract a DNS entry from a ldb.MessageElement
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2015-10-26 05:11:21 +01:00
Andrew Bartlett
87cd68c1dc dns_server: Add a python module directly accessing DNS records in sam.ldb
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2015-10-26 05:11:21 +01:00
Andrew Bartlett
0504065948 dns_server: Put more code in common
This will allow a python module to be written to modify DNS entries in sam.ldb directly

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2015-10-26 05:11:21 +01:00
Volker Lendecke
1fcad53d7c dns_server: Fix a small memleak
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Aug  7 12:57:02 CEST 2015 on sn-devel-104
2015-08-07 12:57:02 +02:00
Volker Lendecke
938636886c dns_server: Don't call tevent_req_finish twice
Both tevent_req_werror and tevent_req_done call tevent_req_finish on a request.
This should not be done. We should only call either of both.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-08-07 09:52:13 +02:00
Kai Blin
42f38fe8d9 dns: always add authority records
Signed-off-by: Kai Blin <kai@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Kai Blin <kai@samba.org>
Autobuild-Date(master): Thu Aug  6 14:06:52 CEST 2015 on sn-devel-104
2015-08-06 14:06:52 +02:00
Kai Blin
d9a3f19749 dns: Add a SOA record to error replies
Signed-off-by: Kai Blin <kai@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2015-08-06 11:03:14 +02:00
Kai Blin
bda1a7320f dns: Also pass nsrecs to handle_question()
Signed-off-by: Kai Blin <kai@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2015-08-06 11:03:14 +02:00
Kai Blin
0e11c08d3e dns: Just pass the name to create_response_rr
Signed-off-by: Kai Blin <kai@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2015-08-06 11:03:13 +02:00
Kai Blin
d7a54f33ef dns: Add dns_get_authoritative_zone helper function
Signed-off-by: Kai Blin <kai@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2015-08-06 11:03:13 +02:00
Volker Lendecke
9c48dbde06 dns_server: Fix CNAME handling
recs[i].wtype is == DNS_TYPE_CNAME, and my understanding of the union is that
data.cname is filled. We get away with this, because ipv4 and ipv6 have the
same char * representation, but it's confusing.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Aug  4 13:41:17 CEST 2015 on sn-devel-104
2015-08-04 13:41:17 +02:00
Volker Lendecke
3fbcd78a75 dns_server: Add NULL check
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
2015-08-04 10:35:17 +02:00
Andreas Schneider
8a5db7d2f4 dlz_bind9: Fix keytab location.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-03-20 23:25:52 +01:00
Andrew Bartlett
57a80ebee3 Do not use popt_common.h in dlz_bind9
We do not use popt_common structures here

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-16 06:41:06 +01:00
Samuel Cabrero
4fb29e9347 s4-dns: Reload DNS zones from dsdb when zones are modified through RPC or DRS
Setup a RPC management call on the internal DNS server triggered a new LDB
module which sniffs dnsZone object add, delete and modify operations. This
way the notification is triggered when zones are modified either from RPC or
replicated by inbound DRS.

Signed-off-by: Samuel Cabrero <samuelcabrero@kernevil.me>
(shadowed variable error corrected by abartlet)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2014-12-22 05:57:08 +01:00
Andreas Schneider
d32b66b40c dns_server: Only build common library if AD DC is enabled.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Nov 26 12:11:18 CET 2014 on sn-devel-104
2014-11-26 12:11:18 +01:00
Amitay Isaacs
b7f6b09a13 s4-dns: dlz-bind: Add trailing '.' to all fqdn strings
BIND 9.10.x is strict when sending records via putrr and putnamedrr.

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

Thanks to Guenter Kukkukk for identifying the problem and resolution.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Guenter Kukkukk <kukks@samba.org>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Fri Nov 21 06:14:55 CET 2014 on sn-devel-104
2014-11-21 06:14:55 +01:00
Stefan Metzmacher
0062a2f5fb s4:dns_server: allocate substructures of struct dns_request_state on the correct TALLOC_CTX
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-11-18 04:17:09 +01:00
Stefan Metzmacher
7e301c76ce s4:dns_server: add some const to dns_server_process_update/dns_update_allowed arguments
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-11-18 04:17:09 +01:00
Kai Blin
229f8b324a dns: Fix a compile warning by casting explicitly
Signed-off-by: Kai Blin <kai@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-10-30 06:52:04 +01:00
Amitay Isaacs
faa3423d1a s4-dns: Add support for BIND 9.10
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Matthieu Patou <mat@matws.net>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Sat Oct 25 05:42:19 CEST 2014 on sn-devel-104
2014-10-25 05:42:19 +02:00
Amitay Isaacs
aeb6ad8a9c s4-dns: Update dlz_minimal.h based on BIND release 9.10
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Matthieu Patou <mat@matws.net>
2014-10-25 03:21:04 +02:00
Amitay Isaacs
1e5c14548c s4-dns: Check DLZ_DLOPEN_VERSION for different BIND versions
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Matthieu Patou <mat@matws.net>
2014-10-25 03:21:04 +02:00
Stefan Metzmacher
d68a2ebecd s4:dlz_bind9: let dlz_bind9 use dns_common_lookup() before add/modify
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10749

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Aug 27 15:21:19 CEST 2014 on sn-devel-104
2014-08-27 15:21:19 +02:00
Stefan Metzmacher
11bbfd932c s4:dlz_bind9: let dlz_bind9 use dns_common_lookup() before removing records
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10749

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-08-27 12:55:06 +02:00
Stefan Metzmacher
fd952bf814 s4:dlz_bind9: let dlz_bind9 use dns_common_replace()
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10749

Change-Id: I2fd2503230cbf89445594e49f39ac321769ff06e
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-08-27 12:55:06 +02:00
Stefan Metzmacher
dedcf30fd1 s4:dlz_bind9: let dlz_bind9 use dns_common_extract()
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10749

Change-Id: I7c661964a3da1a1981f022a06b9bef25bbd33479
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-08-27 12:55:06 +02:00
Stefan Metzmacher
96dcebe8c2 s4:dlz_bind9: let dlz_bind9 use dns_common_lookup() for name lookup
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10749

Change-Id: I2632fa0ce120a978f6f400fa5cbf18a7fbbd64a3
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-08-27 12:55:06 +02:00
Stefan Metzmacher
5d397c8198 s4:dlz_bind9: do an early talloc_free(el_ctx) in dlz_allnodes()
We don't have to keep everything arround while walking the whole zone.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-08-26 09:13:06 +02:00
Stefan Metzmacher
fbebe7e756 s4:dlz_bind9: avoid some compiler warnings
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-08-26 09:13:06 +02:00
Stefan Metzmacher
491715399f s4:dns_server: handle tombstones in handle_one_update()
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10749

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-08-26 09:13:06 +02:00
Stefan Metzmacher
bb3ca930cc s4:dns_server: add DNS_TYPE_TOMBSTONE support to dns_common_replace()
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10749

Pair-Programmed-With: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-08-26 09:13:06 +02:00
Stefan Metzmacher
a0a81ab01c s4:dns_server: make sure dns_common_lookup() doesn't return tombstones
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10749

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-08-26 09:13:06 +02:00
Stefan Metzmacher
3ff025a02c s4:dns_server: use .wType = DNS_TYPE_TOMBSTONE instead of ZERO_STRUCT()
The result is the same, but it is clearer.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-08-26 09:13:06 +02:00
Stefan Metzmacher
0689e795e0 s4:dns_server: split out dns_common_replace()
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10749

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-08-26 09:13:06 +02:00
Stefan Metzmacher
7e7df78bd7 s4:dns_server: remove const from dns_replace_records()
All callers are find we the record array gets modified.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-08-26 09:13:06 +02:00
Stefan Metzmacher
342a087349 s4:dns_server: split out dns_common_extract() and dns_common_lookup()
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10749

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-08-26 09:13:06 +02:00
Stefan Metzmacher
99d5a5ead4 s4:dns_server: split out a private 'dnsserver_common' library
This will contain common code for the internal dns server, the dlz_bind9 module
and the rpc dns management server.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-08-26 09:13:06 +02:00
Stefan Metzmacher
d0f424a23d s4:dns_server: map LDB_ERR_NO_SUCH_OBJECT to WERR_DNS_ERROR_NAME_DOES_NOT_EXIST
This is the correct fix for commit 8b24c43b38
and Bug: https://bugzilla.samba.org/show_bug.cgi?id=9559

With this change we have a consistent behavior between internal server
and the bind dlz module. We keep a dangling LDAP object without
dnsRecord attribute arround forever. This will be fixed in the following
commits.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-08-26 09:13:06 +02:00
Stefan Metzmacher
deb21a9afe s4:dns_server: handle WERR_DNS_ERROR_NAME_DOES_NOT_EXIST in werr_to_dns_err()
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10749

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-08-26 09:13:06 +02:00
Jeremy Allison
463311422c s3/s4: smbd, rpc, ldap, cldap, kdc services.
Allow us to start if we bind to *either* :: or 0.0.0.0.

Allows us to cope with systems configured as only IPv4
or only IPv6.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-By: Amitay Isaacs <amitay@gmail.com>
Reviewed-By: Alexander Bokovoy <ab@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Jun  7 01:01:44 CEST 2014 on sn-devel-104
2014-06-07 01:01:43 +02:00
Arvid Requate
5e892fb674 s4-dns: dlz_bind9: improve log message consistency
Change-Id: I0a12c048fd4e667b9aa0777f99c8f8306fc090ea
Signed-off-by: Arvid Requate <requate@univention.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Kai Blin <kai@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon May 26 05:55:46 CEST 2014 on sn-devel-104
2014-05-26 05:55:46 +02:00
Arvid Requate
f15d10df29 s4-dns: dlz_bind9: Fix ipv6 updates
b9_record_match needs to consider all allowed representations of IPv6
addresses (RFC 2373), otherwise DNS subtractrdataset operations fail
due to differences in zero padding between bind9 frontend and ndr_pull
of a dnsp_DnssrvRpcRecord structure.

Change-Id: Ic0a1b16008458993dc644646d7f4ae3d3a3c5fed
Signed-off-by: Arvid Requate <requate@univention.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Kai Blin <kai@samba.org>
Reviewed-by: Guenter Kukkukk <kukks@samba.org>
2014-05-26 03:31:28 +02:00
Kai Blin
392ec4d241 bug #10609: CVE-2014-0239 Don't reply to replies
Due to insufficient input checking, the DNS server will reply to a packet that
has the "reply" bit set. Over UDP, this allows to send a packet with a spoofed
sender address and have two servers DOS each other with circular replies.

This patch fixes bug #10609 and adds a test to make sure we don't regress.
CVE-2014-2039 has been assigned to this issue.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10609

Signed-off-by: Kai Blin <kai@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Kai Blin <kai@samba.org>
Autobuild-Date(master): Tue May 20 04:15:44 CEST 2014 on sn-devel-104
2014-05-20 04:15:44 +02:00
Andrew Bartlett
086c06e361 kerberos: Remove un-used event context argument from smb_krb5_init_context()
The event context here was only specified in the server or admin-tool
context, which does not do network communication, so this only caused
a talloc_reference() and never any useful result.

The actual network communication code sets an event context directly
before making the network call.

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Apr 28 02:24:57 CEST 2014 on sn-devel-104
2014-04-28 02:24:57 +02:00
Stefan Metzmacher
31a2ddb361 s4:dns_server: make use of gensec_update_ev()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-03-27 00:36:31 +01:00
Stefan Metzmacher
f7883ae02a s4:lib/socket: simplify iface_list_wildcard() and its callers
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10464
Signed-off-by: Stefan Metzmacher <metze@samba.org>

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

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Mar  7 02:18:17 CET 2014 on sn-devel-104
2014-03-07 02:18:17 +01:00
Kai Blin
d9829df133 bug #10471: Don't respond with NXDOMAIN to records that exist with another type
DNS queries for records with the wrong type need to trigger an empty
response with RCODE_OK instead of returning NXDOMAIN.

This adds a test and fixes bug #10471

Signed-off-by: Kai Blin <kai@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-03-04 13:46:34 +01:00
Amitay Isaacs
97dd673157 s4-dns: Ignore duplicate dns zones from multiple locations in dlz_bind9
BIND DLZ module currently loads DNS zones from DNS partitions and domain
partitions using following prefixes:

   CN=MicrosoftDNS,DC=DomainDnsZones
   CN=MicrosoftDNS,DC=ForestDNSZones
   CN=MicrosoftDNS,CN=System

Windows supports DNS zones duplicated in DNS partitions and domain
partition and updates both of them simultaneously.

BIND DLZ module can handle DNS zones stored either in DNS partitions
or domain partition, but not both.  This patch ignores duplicate zones
from domain partition and allows BIND9 to work with AD with duplicate
DNS zones.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Kai Blin <kai@samba.org>
2013-11-30 14:22:57 +11:00
Kai Blin
45f5ea0b57 dns: Update TODO list
A lot of the todo items have been resolved, avoid confusing people.

Signed-off-by: Kai Blin <kai@samba.org>

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

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Jul 29 09:12:17 CEST 2013 on sn-devel-104
2013-07-29 09:12:17 +02:00
Kai Blin
8b24c43b38 dns: Delete dnsNode objects when they are empty
If an update leaves the dnsNode without any entries, the dnsNode object
should be deleted. Thanks to Günter Kukkukk for his excellent debugging
work on this one.

This should fix bug #9559

Signed-off-by: Kai Blin <kai@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-06-01 18:48:11 +10:00
Kai Blin
df43027bd8 dns: Support larger queries when asking forwarder
This should fix bug #9632

Signed-off-by: Kai Blin <kai@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-05-26 18:13:28 +02:00
Kai Blin
a3a3086a2a dns: Also print packet information for DBGC_DNS
Signed-off-by: Kai Blin <kai@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Kai Blin <kai@samba.org>
Autobuild-Date(master): Sat May 18 12:48:15 CEST 2013 on sn-devel-104
2013-05-18 12:48:15 +02:00
Kai Blin
4364a3faf6 dns: Add support for MX queries
Due to an oversight, the internal DNS server supports MX record updates,
but not MX record queries. Add support for MX queries and tests.

This should fix bug #9485

Signed-off-by: Kai Blin <kai@samba.org>
Reviewed-By: Amitay Isaacs <amitay@gmail.com>
2013-05-16 21:40:35 +10:00
Kai Blin
2e9cf99bce dns: Also add a print-out for the out_packet
Signed-off-by: Kai Blin <kai@samba.org>
Reviewed-By: Amitay Isaacs <amitay@gmail.com>
2013-05-16 21:40:19 +10:00
Kai Blin
f31bda6715 dns: Use new DNS debugclass in DNS server
Signed-off-by: Kai Blin <kai@samba.org>
Reviewed-By: Amitay Isaacs <amitay@gmail.com>
2013-05-16 21:40:15 +10:00
Stefan Gohmann
666a5630ef s4-dns: dlz_bind9: Check result to avoid segfault
We saw this issue in a customer environment with many CNF objects. I
wasn't able to reproduce it, but I got the following core dump:

 (gdb) directory samba4-4.0.0~rc6/source4/dns_server/
 Source directories searched: /root/samba4-4.0.0~rc6/source4/dns_server:$cdir:$cwd
 (gdb) bt
 #0  0xb4b0bc13 in dlz_lookup_types (state=0x9648e48, zone=0xb659b9a8 "xxxxxx.xxxxx.de", name=0xb659bda8 "client9173", lookup=0xb6db7588, types=0x0) at ../source4/dns_server/dlz_bind9.c:830
 #1  0xb4b0bdb8 in dlz_lookup (zone=0xb659b9a8 "xxxxxx.xxxxx.de", name=0xb659bda8 "client9173", dbdata=0x9648e48, lookup=0xb6db7588) at ../source4/dns_server/dlz_bind9.c:875
 #2  0x080b43d8 in dlopen_dlz_lookup ()
 #3  0xb7701755 in findnode () from /usr/lib/libdns.so.81
 #4  0xb7701d22 in find () from /usr/lib/libdns.so.81
 #5  0xb7639e5f in dns_db_find () from /usr/lib/libdns.so.81
 #6  0x08075476 in query_find ()
 #7  0x0807acb9 in ns_query_start ()
 #8  0x08060712 in client_request ()
 #9  0xb743022b in run () from /usr/lib/libisc.so.81
 #10 0xb7216955 in start_thread () from /lib/i686/cmov/libpthread.so.0
 #11 0xb706c1de in clone () from /lib/i686/cmov/libc.so.6
 (gdb) f 0
 #0  0xb4b0bc13 in dlz_lookup_types (state=0x9648e48, zone=0xb659b9a8 "xxxxxx.xxxxx.de", name=0xb659bda8 "client9173", lookup=0xb6db7588, types=0x0) at ../source4/dns_server/dlz_bind9.c:830
 830             el = ldb_msg_find_element(res->msgs[0], "dnsRecord");
 (gdb) p res->msgs
 $1 = (struct ldb_message **) 0x0
 (gdb) p res->count
 $2 = 0
 (gdb)

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-03-09 06:30:21 +01:00
Amitay Isaacs
1f55865f28 s4-dns: Fix format string vulnerability in an error message (bug #9354)
Also, fixes few comments.

Thanks to Bruno Rohée <bruno@rohee.org> for reporting and patch fix.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-By: Kai Blin <kai@samba.org>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Sun Nov  4 16:58:13 CET 2012 on sn-devel-104
2012-11-04 16:58:13 +01:00
Stefan Metzmacher
a9a38415e5 s4:dns_server: fix formatting difference compared to v4-0-test
Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Oct 24 10:12:51 CEST 2012 on sn-devel-104
2012-10-24 10:12:51 +02:00
Andrew Bartlett
83d34bb2bb dns_server: Try and use the dns-SERVER account if we were configured with it 2012-10-17 11:09:17 +02:00
Matthieu Patou
2c3a8081ea s4-dns: Fix the comments about ignoring zones in internal server
Acked-By: Kai Blin <kai@samba.org>

Autobuild-User(master): Kai Blin <kai@samba.org>
Autobuild-Date(master): Sat Oct 13 12:37:53 CEST 2012 on sn-devel-104
2012-10-13 12:37:53 +02:00
Amitay Isaacs
d70f3644a4 s4-dns: dlz_bind9: Ignore zones that are not used by BIND9 DLZ plugin
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
2012-10-09 10:36:32 +11:00
Matthieu Patou
4b83c43ac2 s4-dns: fix a warning
Autobuild-User(master): Matthieu Patou <mat@samba.org>
Autobuild-Date(master): Mon Oct  8 10:45:41 CEST 2012 on sn-devel-104
2012-10-08 10:45:40 +02:00
Matthieu Patou
ffab1d7cb2 s4-dns: Ignore zones that shouldn't be returned currently
RootDNSServers should never be returned (Windows DNS server don't)
..TrustAnchors should never be returned as is, (Windows returns
TrustAnchors) and for the moment we don't support DNSSEC so we'd better
not return this zone.
2012-10-07 22:11:48 -07:00
Matthieu Patou
f4b9007faf s4-dns: fix a non handled memory out of memory
Signed-off-by: Kai Blin <kai@samba.org>

Autobuild-User(master): Kai Blin <kai@samba.org>
Autobuild-Date(master): Tue Oct  2 09:43:52 CEST 2012 on sn-devel-104
2012-10-02 09:43:52 +02:00
Kai Blin
81805222ec s4 dns: Fix return code for deleted records
This fixes bug #9225. We already had a test for this scenario, but the test wasn't
correct. This patch fixes the test, and also fixes the bug.

Signed-off-by: Kai Blin <kai@samba.org>

Autobuild-User(master): Kai Blin <kai@samba.org>
Autobuild-Date(master): Sun Sep 30 13:09:14 CEST 2012 on sn-devel-104
2012-09-30 13:09:14 +02:00
Kai Blin
ecb4a8a824 s4 dns: Get rid of deprecated allocation result check 2012-09-30 10:44:03 +02:00
Matthias Dieter Wallnöfer
5f973631b6 s4:dns_server - introduce the wildcard binding feature
We need the wildcard binding feature otherwise we might get bound to a
private interface in case of multiple interfaces and no "interfaces"
parameter in smb.conf.

Code taken from source4/ldap_server/ldap_server.c

Signed-off-by: Kai Blin <kai@samba.org>

Autobuild-User(master): Kai Blin <kai@samba.org>
Autobuild-Date(master): Sun Sep 23 23:44:03 CEST 2012 on sn-devel-104
2012-09-23 23:44:03 +02:00
Andrew Bartlett
1627fcda3e dns_server: Remove parameter 'dns recursive queries' and base this on 'dns forwarder'
This simplifies a very common configuration.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-09-12 16:51:29 +02:00
Stefan Metzmacher
9583366d1e s4:dns_server: remove wrong and unused dsdb_check_access_on_dn() check
metze
2012-09-12 16:51:29 +02:00
Andrew Bartlett
61a07df824 dns_server: Attempt to SET and UNSET the sessionInfo to match the incoming user
This avoids re-opening the DB as the correct user, but applies all the right ACLs
and resulting owner.

This needs a bit more testing...

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Kai Blin <kai@samba.org>
2012-09-12 16:51:29 +02:00
Kai Blin
cf3aab61fa s4 dns: Improve logging of delegated dns updates 2012-09-12 16:51:29 +02:00
Kai Blin
8ba8020586 s4 dns: Make debug output less noisy
Autobuild-User(master): Kai Blin <kai@samba.org>
Autobuild-Date(master): Fri Sep  7 00:31:56 CEST 2012 on sn-devel-104
2012-09-07 00:31:56 +02:00
Kai Blin
319b239dc4 s4 dns: Check if signing user is allowed to update records
This should fix bug #9142
2012-09-06 22:43:05 +02:00
Andrew Bartlett
52f0dedc1a selftest: Add tests for the dlz_bind9 module
This will help ensure that we do not break the fundemental loading etc.

From here, it should be easy to extend this to more comprehensive tests.

Andrew Bartlett
2012-09-06 15:22:26 +10:00
Kai Blin
5e492f8d32 s4 dns: Allow configuring signed updates
Autobuild-User(master): Kai Blin <kai@samba.org>
Autobuild-Date(master): Wed Sep  5 20:42:46 CEST 2012 on sn-devel-104
2012-09-05 20:42:46 +02:00
Kai Blin
2b17566e89 s4 dns: Make sure to remember incoming tkey name 2012-09-05 19:08:33 +02:00
Kai Blin
53f602c374 s4 dns: Verify incoming TSIG signatures 2012-09-05 19:02:17 +02:00
Kai Blin
7fe5e2cdcb s4 dns: Handle GSS-TSIG signature creation 2012-09-05 19:02:17 +02:00
Kai Blin
956f41bddf s4 dns: When we got a TKEY, we need to remember which key to use for signing 2012-09-05 19:02:17 +02:00
Kai Blin
e81d026576 s4 dns: TKEY record needs to remember incoming algorithm
Samba3 (and older windows versions) use gss.microsoft.com, win7 (and the RFC) use gss-tsig
2012-09-05 19:02:17 +02:00
Kai Blin
c0e6a4b1b0 s4 dns: Move dns_find_tkey to an extra file 2012-09-05 19:02:16 +02:00
Andreas Schneider
58d8d9440f s4-dns: Fix linking the dns service.
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Sep  5 18:40:00 CEST 2012 on sn-devel-104
2012-09-05 18:40:00 +02:00
Kai Blin
558fa4c45a s4 dns: Revert erroneous push from wrong branch
I've pushed the wrong branch for this, sorry about that.

Autobuild-User(master): Kai Blin <kai@samba.org>
Autobuild-Date(master): Wed Sep  5 14:10:54 CEST 2012 on sn-devel-104
2012-09-05 14:10:54 +02:00
Kai Blin
2311a2c9f5 s4 dns: Allow configuring signed updates
Autobuild-User(master): Kai Blin <kai@samba.org>
Autobuild-Date(master): Wed Sep  5 10:45:22 CEST 2012 on sn-devel-104
2012-09-05 10:45:22 +02:00
Kai Blin
b5dd26cc69 s4 dns: Make sure to remember incoming tkey name 2012-09-05 08:41:24 +02:00
Kai Blin
140a8d86ac more tsig_verify stuff 2012-09-05 08:41:24 +02:00
Kai Blin
17c91b5db0 drop me 2012-09-05 08:41:24 +02:00
Kai Blin
cf4333b0cd hack: dns_sign_tsig correct memcpy 2012-09-05 08:41:23 +02:00
Kai Blin
a0c2453405 HACK remove debug statement 2012-09-05 08:41:23 +02:00
Kai Blin
f3e44c390c s4 dns: Verify incoming TSIG signatures 2012-09-05 08:41:23 +02:00
Kai Blin
fc9de26497 s4 dns: Handle GSS-TSIG signatures 2012-09-05 08:41:23 +02:00