The branch, master has been updated
via 5359031 ldb-samba: Use ndr_pull_struct_blob_all_noalloc
via 98712e9 libndr: Add ndr_pull_struct_blob_all_noalloc
via ef0f465 Fix formatting issue on 32bit with _FILE_OFFSET_BITS == 64
via c264935 .gitignore: don;t accidentally ignore some files
via 3751ffb autobuild: Return the last 50 log lines
via 81f4e53 VLV: test using restrictive expressions
via b59b22a VLV: handle empty results correctly
via 34d2bfe VLV: initialise struct using names for clarity
via 26cfd75 tests/dns_forwarder: Add additional testing for no flag
recursive
via 97a7547 tests/dns_forwarder: Add an extra test for inactive
forwarders
via 61f1eaf tests/dns_forwarder: remove statically defined IPs
via 2570f16 tests/dns: Add additional testing of CNAME handling
via 3b2f9f8 tests/dns_forwarder: Add testing for DNS forwarding
via 5caebde dns: modify dns forwarder param to be multi-valued
via 870b74d selftest: Remove an early return in the fl2003dc provision
via ac4dd94 dnsserver: Remove C++ style comment
via 89f5bbc dns: remove double talloc for strings
from a7cfb92 docs: Fix an outdated remark, tdbsam is default
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 5359031e33ade12b56aaafcbc4eb1368d9eaccd1
Author: Andrew Bartlett <[email protected]>
Date: Fri Apr 22 12:03:25 2016 +1200
ldb-samba: Use ndr_pull_struct_blob_all_noalloc
This avoids pointless talloc() calls in a hot code path.
Signed-off-by: Andrew Bartlett <[email protected]>
Reviewed-by: Garming Sam <[email protected]>
Autobuild-User(master): Garming Sam <[email protected]>
Autobuild-Date(master): Tue May 3 11:43:15 CEST 2016 on sn-devel-144
commit 98712e9bda29105ae23de487c3261ebf959408c5
Author: Andrew Bartlett <[email protected]>
Date: Fri Apr 22 12:02:57 2016 +1200
libndr: Add ndr_pull_struct_blob_all_noalloc
This allows us to remove talloc() calls from GUID_from_ndr_blob().
To do this the struct ndr_pull is placed on the stack, and filled in there.
Signed-off-by: Andrew Bartlett <[email protected]>
Reviewed-by: Garming Sam <[email protected]>
commit ef0f4654546fdbfdf7165645f4b2291a753bb480
Author: Douglas Bagnall <[email protected]>
Date: Wed Jul 1 11:43:09 2015 +1200
Fix formatting issue on 32bit with _FILE_OFFSET_BITS == 64
Usually off_t is the same as size_t, but not on a 32 bit machine where
_FILE_OFFSET_BITS is set to 64. In that case size_t stays 32 bit, and
off_t goes to 64.
This only affects debug messages.
Signed-off-by: Douglas Bagnall <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
Reviewed-by: Garming Sam <[email protected]>
commit c2649352e0917c3c2bcf1b7ad74d73d21e73be9c
Author: Douglas Bagnall <[email protected]>
Date: Thu Apr 21 16:13:42 2016 +1200
.gitignore: don;t accidentally ignore some files
The previous first line of .gitignore ("bin/") correctly ignored the
bin/ directory, but it also ignored the git controlled content in
source4/scripting/bin. The correct line is "/bin/", as explained in
these snippets from the gitignore documentation:
If the pattern ends with a slash, it is removed for the purpose
of the following description, but it would only find a match with
a directory. In other words, foo/ will match a directory foo and
paths underneath it, but will not match a regular file or a
symbolic link foo (this is consistent with the way how pathspec
works in general in Git).
A leading slash matches the beginning of the pathname. For example,
"/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
Signed-off-by: Douglas Bagnall <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
Reviewed-by: Garming Sam <[email protected]>
commit 3751ffbbe75524984a822d65f623a040ca79c8f7
Author: Garming Sam <[email protected]>
Date: Mon Mar 14 14:18:54 2016 +1300
autobuild: Return the last 50 log lines
This means that you don't have to deal with tars for quickly determining
the cause of a failure.
Signed-off-by: Garming Sam <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
commit 81f4e5383f1035716da0e9683521492e14cc250b
Author: Douglas Bagnall <[email protected]>
Date: Fri Apr 8 14:00:45 2016 +1200
VLV: test using restrictive expressions
This tests what happens with the VLV if the results are subject to
an expression.
Signed-off-by: Douglas Bagnall <[email protected]>
Reviewed-by: Garming Sam <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
commit b59b22a117f7fc42b66328fbbcd69e9432c19d43
Author: Douglas Bagnall <[email protected]>
Date: Fri Apr 8 13:58:52 2016 +1200
VLV: handle empty results correctly
The VLV was wrongly returning an operations error when the list of
results was empty.
Signed-off-by: Douglas Bagnall <[email protected]>
Pair-programmed-with: Garming Sam <[email protected]>
Reviewed-by: Garming Sam <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
commit 34d2bfe5dee5eafcbedb229fbf1b9044fb0a7c5e
Author: Douglas Bagnall <[email protected]>
Date: Wed Mar 23 12:11:16 2016 +1300
VLV: initialise struct using names for clarity
Signed-off-by: Douglas Bagnall <[email protected]>
Reviewed-by: Garming Sam <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
commit 26cfd75683bda500b79d3fe8f8d4d81be70d62ac
Author: Garming Sam <[email protected]>
Date: Mon Apr 18 16:31:17 2016 +1200
tests/dns_forwarder: Add additional testing for no flag recursive
Signed-off-by: Garming Sam <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
commit 97a7547a417494a407503b441ef07d5de0070565
Author: Garming Sam <[email protected]>
Date: Wed Apr 13 13:09:41 2016 +1200
tests/dns_forwarder: Add an extra test for inactive forwarders
Signed-off-by: Garming Sam <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
commit 61f1eaf0b443bd1dcf5b1a2b3452eb105a391602
Author: Garming Sam <[email protected]>
Date: Mon Apr 11 15:18:34 2016 +1200
tests/dns_forwarder: remove statically defined IPs
Signed-off-by: Garming Sam <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
commit 2570f1649786681630c5329940b5badf9f7cd605
Author: Garming Sam <[email protected]>
Date: Wed Apr 6 15:44:58 2016 +1200
tests/dns: Add additional testing of CNAME handling
RFC 1034, for instance, describes that all intermediate CNAMEs should be
returned. As it is, CNAME do not return all found intermediate results
in the case of straightforward failure. It should be noted that in the
case of forwarding success, ALL intermediate paths are returned,
including the failure ones.
Signed-off-by: Garming Sam <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
commit 3b2f9f87566cc878ef3a31478ac7c104a302f354
Author: Garming Sam <[email protected]>
Date: Thu Mar 17 17:13:28 2016 +1300
tests/dns_forwarder: Add testing for DNS forwarding
The new tests show that single and multiple forwarders work as expected.
They also describe the behaviour encountered when the DNS server
encounters a CNAME from a forwarded request (which is not to pursue any
further).
Signed-off-by: Garming Sam <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
Pair-programmed-with: Douglas Bagnall <[email protected]>
commit 5caebde11d1a25581e5f8d7c7f7deadfeae7759e
Author: Garming Sam <[email protected]>
Date: Wed Feb 17 11:30:21 2016 +1300
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 <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
commit 870b74d73eb6812d2002e4d88a2553d6edd545c4
Author: Garming Sam <[email protected]>
Date: Wed Mar 30 17:13:49 2016 +1300
selftest: Remove an early return in the fl2003dc provision
Signed-off-by: Garming Sam <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
commit ac4dd94e3f56b636d165eaf9edd4f35d39163cdb
Author: Garming Sam <[email protected]>
Date: Mon Apr 11 12:05:20 2016 +1200
dnsserver: Remove C++ style comment
Signed-off-by: Garming Sam <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
commit 89f5bbc971b9fd675fb59cb1924dcd9b97527421
Author: Garming Sam <[email protected]>
Date: Wed Jan 27 11:16:29 2016 +1300
dns: remove double talloc for strings
Signed-off-by: Garming Sam <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 96 ++--
docs-xml/smbdotconf/domain/dnsforwarder.xml | 5 +-
lib/ldb-samba/ldif_handlers.c | 14 +-
librpc/ABI/{ndr-0.0.6.sigs => ndr-0.0.7.sigs} | 1 +
librpc/ndr/libndr.h | 2 +
librpc/ndr/ndr.c | 39 ++
librpc/ndr/ndr_dnsp.c | 4 -
librpc/ndr/uuid.c | 12 +-
librpc/wscript_build | 2 +-
python/samba/tests/dns.py | 91 +++-
python/samba/tests/dns_forwarder.py | 601 +++++++++++++++++++++
python/samba/tests/dns_forwarder_helpers/server.py | 93 ++++
script/autobuild.py | 19 +-
selftest/knownfail | 1 +
selftest/selftest.pl | 2 +
selftest/target/Samba.pm | 2 +
selftest/target/Samba4.pm | 9 +-
source3/modules/vfs_fruit.c | 5 +-
source4/dns_server/dns_query.c | 100 +++-
source4/dns_server/dns_server.c | 6 +-
source4/dns_server/dnsserver_common.c | 2 +-
source4/dsdb/samdb/ldb_modules/vlv_pagination.c | 118 ++--
source4/dsdb/tests/python/vlv.py | 128 ++++-
source4/selftest/tests.py | 2 +
24 files changed, 1185 insertions(+), 169 deletions(-)
copy librpc/ABI/{ndr-0.0.6.sigs => ndr-0.0.7.sigs} (99%)
create mode 100644 python/samba/tests/dns_forwarder.py
create mode 100644 python/samba/tests/dns_forwarder_helpers/server.py
Changeset truncated at 500 lines:
diff --git a/.gitignore b/.gitignore
index a4c2a69..5bad92c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,62 +1,62 @@
-bin/
-st/
+/bin/
+/st/
.waf*
.lock-wscript
*~
*.swp
-tags
-TAGS
+/tags
+/TAGS
GPATH
GRTAGS
GSYMS
GTAGS
cscope*.out
autom4te.cache
-source3/.clang_complete
+/source3/.clang_complete
*.patch
*.pyc
semantic.cache
-pidl/blib
-pidl/cover_db
-pidl/Makefile
-pidl/pm_to_blib
-pidl/MYMETA.yml
-pidl/MYMETA.json
-packaging/RHEL-CTDB/samba.spec
-packaging/RHEL/samba.spec
-packaging/RHEL/makerpms.sh
-docs-xml/build/catalog.xml
-docs-xml/*/images/*.eps
-docs-xml/*/images/*.pdf
-docs-xml/output
-docs-xml/Samba3-ByExample/images/AccountingNetwork.png
-docs-xml/Samba3-ByExample/images/Charity-Network.png
-docs-xml/Samba3-ByExample/images/UNIX-Samba-and-LDAP.png
-docs-xml/Samba3-ByExample/images/acct2net.png
-docs-xml/Samba3-ByExample/images/ch7-dual-additive-LDAP-Ok.png
-docs-xml/Samba3-ByExample/images/ch7-dual-additive-LDAP.png
-docs-xml/Samba3-ByExample/images/ch7-fail-overLDAP.png
-docs-xml/Samba3-ByExample/images/ch7-singleLDAP.png
-docs-xml/Samba3-ByExample/images/ch8-migration.png
-docs-xml/Samba3-ByExample/images/chap4-net.png
-docs-xml/Samba3-ByExample/images/chap5-net.png
-docs-xml/Samba3-ByExample/images/chap6-net.png
-docs-xml/Samba3-ByExample/images/chap7-idresol.png
-docs-xml/Samba3-ByExample/images/chap9-ADSDC.png
-docs-xml/Samba3-ByExample/images/chap9-SambaDC.png
-docs-xml/Samba3-HOWTO/images/access1.png
-docs-xml/Samba3-HOWTO/images/browsing1.png
-docs-xml/Samba3-HOWTO/images/cups1.png
-docs-xml/Samba3-HOWTO/images/cups2.png
-docs-xml/Samba3-HOWTO/images/domain.png
-docs-xml/Samba3-HOWTO/images/idmap-gid2sid.png
-docs-xml/Samba3-HOWTO/images/idmap-sid2gid.png
-docs-xml/Samba3-HOWTO/images/idmap-sid2uid.png
-docs-xml/Samba3-HOWTO/images/idmap-store-gid2sid.png
-docs-xml/Samba3-HOWTO/images/idmap-uid2sid.png
-docs-xml/Samba3-HOWTO/images/pdftoepsonusb.png
-docs-xml/Samba3-HOWTO/images/pdftosocket.png
-docs-xml/Samba3-HOWTO/images/trusts1.png
+/pidl/blib
+/pidl/cover_db
+/pidl/Makefile
+/pidl/pm_to_blib
+/pidl/MYMETA.yml
+/pidl/MYMETA.json
+/packaging/RHEL-CTDB/samba.spec
+/packaging/RHEL/samba.spec
+/packaging/RHEL/makerpms.sh
+/docs-xml/build/catalog.xml
+/docs-xml/*/images/*.eps
+/docs-xml/*/images/*.pdf
+/docs-xml/output
+/docs-xml/Samba3-ByExample/images/AccountingNetwork.png
+/docs-xml/Samba3-ByExample/images/Charity-Network.png
+/docs-xml/Samba3-ByExample/images/UNIX-Samba-and-LDAP.png
+/docs-xml/Samba3-ByExample/images/acct2net.png
+/docs-xml/Samba3-ByExample/images/ch7-dual-additive-LDAP-Ok.png
+/docs-xml/Samba3-ByExample/images/ch7-dual-additive-LDAP.png
+/docs-xml/Samba3-ByExample/images/ch7-fail-overLDAP.png
+/docs-xml/Samba3-ByExample/images/ch7-singleLDAP.png
+/docs-xml/Samba3-ByExample/images/ch8-migration.png
+/docs-xml/Samba3-ByExample/images/chap4-net.png
+/docs-xml/Samba3-ByExample/images/chap5-net.png
+/docs-xml/Samba3-ByExample/images/chap6-net.png
+/docs-xml/Samba3-ByExample/images/chap7-idresol.png
+/docs-xml/Samba3-ByExample/images/chap9-ADSDC.png
+/docs-xml/Samba3-ByExample/images/chap9-SambaDC.png
+/docs-xml/Samba3-HOWTO/images/access1.png
+/docs-xml/Samba3-HOWTO/images/browsing1.png
+/docs-xml/Samba3-HOWTO/images/cups1.png
+/docs-xml/Samba3-HOWTO/images/cups2.png
+/docs-xml/Samba3-HOWTO/images/domain.png
+/docs-xml/Samba3-HOWTO/images/idmap-gid2sid.png
+/docs-xml/Samba3-HOWTO/images/idmap-sid2gid.png
+/docs-xml/Samba3-HOWTO/images/idmap-sid2uid.png
+/docs-xml/Samba3-HOWTO/images/idmap-store-gid2sid.png
+/docs-xml/Samba3-HOWTO/images/idmap-uid2sid.png
+/docs-xml/Samba3-HOWTO/images/pdftoepsonusb.png
+/docs-xml/Samba3-HOWTO/images/pdftosocket.png
+/docs-xml/Samba3-HOWTO/images/trusts1.png
.testrepository
-bin/.confcache/*/*
-bin/.conf_check_*/*
+/bin/.confcache/*/*
+/bin/.conf_check_*/*
diff --git a/docs-xml/smbdotconf/domain/dnsforwarder.xml
b/docs-xml/smbdotconf/domain/dnsforwarder.xml
index 4147ef8..d3c8b76 100644
--- a/docs-xml/smbdotconf/domain/dnsforwarder.xml
+++ b/docs-xml/smbdotconf/domain/dnsforwarder.xml
@@ -1,10 +1,9 @@
<samba:parameter name="dns forwarder"
context="G"
- type="string"
- constant="1"
+ type="cmdlist"
xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
<description>
- <para>This option specifies the DNS server that DNS requests will be
+ <para>This option specifies the list of DNS servers that DNS requests
will be
forwarded to if they can not be handled by Samba itself.
</para>
diff --git a/lib/ldb-samba/ldif_handlers.c b/lib/ldb-samba/ldif_handlers.c
index fc13f07..d1b5bd7 100644
--- a/lib/ldb-samba/ldif_handlers.c
+++ b/lib/ldb-samba/ldif_handlers.c
@@ -106,21 +106,15 @@ static int ldif_read_objectSid(struct ldb_context *ldb,
void *mem_ctx,
int ldif_write_objectSid(struct ldb_context *ldb, void *mem_ctx,
const struct ldb_val *in, struct ldb_val *out)
{
- struct dom_sid *sid;
+ struct dom_sid sid;
enum ndr_err_code ndr_err;
- sid = talloc(mem_ctx, struct dom_sid);
- if (sid == NULL) {
- return -1;
- }
- ndr_err = ndr_pull_struct_blob_all(in, sid, sid,
+ ndr_err = ndr_pull_struct_blob_all_noalloc(in, &sid,
(ndr_pull_flags_fn_t)ndr_pull_dom_sid);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- talloc_free(sid);
return -1;
}
- *out = data_blob_string_const(dom_sid_string(mem_ctx, sid));
- talloc_free(sid);
+ *out = data_blob_string_const(dom_sid_string(mem_ctx, &sid));
if (out->data == NULL) {
return -1;
}
@@ -210,7 +204,7 @@ static int extended_dn_read_SID(struct ldb_context *ldb,
void *mem_ctx,
(const char *)in->data, in->length);
/* Check it looks like a SID */
- ndr_err = ndr_pull_struct_blob_all(out, mem_ctx, &sid,
+ ndr_err = ndr_pull_struct_blob_all_noalloc(out, &sid,
(ndr_pull_flags_fn_t)ndr_pull_dom_sid);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return -1;
diff --git a/librpc/ABI/ndr-0.0.6.sigs b/librpc/ABI/ndr-0.0.7.sigs
similarity index 99%
copy from librpc/ABI/ndr-0.0.6.sigs
copy to librpc/ABI/ndr-0.0.7.sigs
index a9b27a3..c88a56e 100644
--- a/librpc/ABI/ndr-0.0.6.sigs
+++ b/librpc/ABI/ndr-0.0.7.sigs
@@ -142,6 +142,7 @@ ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int,
const char **)
ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char
***)
ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void
*, ndr_pull_flags_fn_t)
ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *,
void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all_noalloc: enum ndr_err_code (const DATA_BLOB *, void
*, ndr_pull_flags_fn_t)
ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull
*, size_t, ssize_t)
ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct
ndr_pull **, size_t, ssize_t)
ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int,
uint32_t *)
diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
index a268f12..1005437 100644
--- a/librpc/ndr/libndr.h
+++ b/librpc/ndr/libndr.h
@@ -550,6 +550,8 @@ uint32_t ndr_print_get_switch_value(struct ndr_print *ndr,
const void *p);
uint32_t ndr_pull_steal_switch_value(struct ndr_pull *ndr, const void *p);
enum ndr_err_code ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX
*mem_ctx, void *p, ndr_pull_flags_fn_t fn);
enum ndr_err_code ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX
*mem_ctx, void *p, ndr_pull_flags_fn_t fn);
+enum ndr_err_code ndr_pull_struct_blob_all_noalloc(const DATA_BLOB *blob,
+ void *p, ndr_pull_flags_fn_t
fn);
enum ndr_err_code ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX
*mem_ctx, void *p, uint32_t level, ndr_pull_flags_fn_t fn);
enum ndr_err_code ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC_CTX
*mem_ctx, void *p, uint32_t level, ndr_pull_flags_fn_t fn);
diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c
index 89bacf7..f66029a 100644
--- a/librpc/ndr/ndr.c
+++ b/librpc/ndr/ndr.c
@@ -1161,6 +1161,45 @@ _PUBLIC_ enum ndr_err_code
ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLO
}
/*
+ pull a struct from a blob using NDR - failing if all bytes are not consumed
+
+ This only works for structures with NO allocated memory, like
+ objectSID and GUID. This helps because we parse these a lot.
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob_all_noalloc(const DATA_BLOB
*blob,
+ void *p,
ndr_pull_flags_fn_t fn)
+{
+ /*
+ * We init this structure on the stack here, to avoid a
+ * talloc() as otherwise this call to the fn() is assured not
+ * to be doing any allocation, eg SIDs and GUIDs.
+ *
+ * This allows us to keep the safety of the PIDL-generated
+ * code without the talloc() overhead.
+ */
+ struct ndr_pull ndr = {
+ .data = blob->data,
+ .data_size = blob->length,
+ .current_mem_ctx = (void *)-1
+ };
+ uint32_t highest_ofs;
+ NDR_CHECK(fn(&ndr, NDR_SCALARS|NDR_BUFFERS, p));
+ if (ndr.offset > ndr.relative_highest_offset) {
+ highest_ofs = ndr.offset;
+ } else {
+ highest_ofs = ndr.relative_highest_offset;
+ }
+ if (highest_ofs < ndr.data_size) {
+ enum ndr_err_code ret;
+ ret = ndr_pull_error(&ndr, NDR_ERR_UNREAD_BYTES,
+ "not all bytes consumed ofs[%u] size[%u]",
+ highest_ofs, ndr.data_size);
+ return ret;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+/*
pull a union from a blob using NDR, given the union discriminator
*/
_PUBLIC_ enum ndr_err_code ndr_pull_union_blob(const DATA_BLOB *blob,
TALLOC_CTX *mem_ctx,
diff --git a/librpc/ndr/ndr_dnsp.c b/librpc/ndr/ndr_dnsp.c
index 3cb96f9..ff77bc7 100644
--- a/librpc/ndr/ndr_dnsp.c
+++ b/librpc/ndr/ndr_dnsp.c
@@ -139,10 +139,6 @@ _PUBLIC_ enum ndr_err_code ndr_pull_dnsp_string(struct
ndr_pull *ndr, int ndr_fl
NDR_CHECK(ndr_pull_uint8(ndr, ndr_flags, &len));
- ret = talloc_strdup(ndr->current_mem_ctx, "");
- if (!ret) {
- return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Failed to pull
dnsp_string");
- }
ret = talloc_zero_array(ndr->current_mem_ctx, char, len + 1);
if (!ret) {
return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Failed to pull
dnsp_string");
diff --git a/librpc/ndr/uuid.c b/librpc/ndr/uuid.c
index 654bebd..9d955ab 100644
--- a/librpc/ndr/uuid.c
+++ b/librpc/ndr/uuid.c
@@ -42,15 +42,9 @@ _PUBLIC_ NTSTATUS GUID_to_ndr_blob(const struct GUID *guid,
TALLOC_CTX *mem_ctx,
*/
_PUBLIC_ NTSTATUS GUID_from_ndr_blob(const DATA_BLOB *b, struct GUID *guid)
{
- enum ndr_err_code ndr_err;
- TALLOC_CTX *mem_ctx;
-
- mem_ctx = talloc_new(NULL);
- NT_STATUS_HAVE_NO_MEMORY(mem_ctx);
-
- ndr_err = ndr_pull_struct_blob_all(b, mem_ctx, guid,
- (ndr_pull_flags_fn_t)ndr_pull_GUID);
- talloc_free(mem_ctx);
+ enum ndr_err_code ndr_err =
+ ndr_pull_struct_blob_all_noalloc(b, guid,
+
(ndr_pull_flags_fn_t)ndr_pull_GUID);
return ndr_map_error2ntstatus(ndr_err);
}
diff --git a/librpc/wscript_build b/librpc/wscript_build
index fc7ada6..f883570 100644
--- a/librpc/wscript_build
+++ b/librpc/wscript_build
@@ -698,7 +698,7 @@ bld.SAMBA_LIBRARY('ndr',
public_deps='samba-errors talloc samba-util',
public_headers='gen_ndr/misc.h gen_ndr/ndr_misc.h ndr/libndr.h:ndr.h',
header_path= [('*gen_ndr*', 'gen_ndr')],
- vnum='0.0.6',
+ vnum='0.0.7',
abi_directory='ABI',
abi_match='ndr_* GUID_*',
)
diff --git a/python/samba/tests/dns.py b/python/samba/tests/dns.py
index 048cd03..babf898 100644
--- a/python/samba/tests/dns.py
+++ b/python/samba/tests/dns.py
@@ -758,33 +758,33 @@ class TestDNSUpdates(DNSTest):
class TestComplexQueries(DNSTest):
-
- def setUp(self):
- super(TestComplexQueries, self).setUp()
+ def make_dns_update(self, key, value, qtype):
p = self.make_name_packet(dns.DNS_OPCODE_UPDATE)
- updates = []
name = self.get_dns_domain()
-
u = self.make_name_question(name, dns.DNS_QTYPE_SOA, dns.DNS_QCLASS_IN)
- updates.append(u)
- self.finish_name_packet(p, updates)
+ self.finish_name_packet(p, [u])
- updates = []
r = dns.res_rec()
- r.name = "cname_test.%s" % self.get_dns_domain()
- r.rr_type = dns.DNS_QTYPE_CNAME
+ r.name = key
+ r.rr_type = qtype
r.rr_class = dns.DNS_QCLASS_IN
r.ttl = 900
r.length = 0xffff
- r.rdata = "%s.%s" % (self.server, self.get_dns_domain())
- updates.append(r)
- p.nscount = len(updates)
+ rdata = value
+ r.rdata = rdata
+ updates = [r]
+ p.nscount = 1
p.nsrecs = updates
-
response = self.dns_transaction_udp(p)
self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
+ def setUp(self):
+ super(TestComplexQueries, self).setUp()
+ name = "cname_test.%s" % self.get_dns_domain()
+ rdata = "%s.%s" % (self.server, self.get_dns_domain())
+ self.make_dns_update(name, rdata, dns.DNS_QTYPE_CNAME)
+
def tearDown(self):
super(TestComplexQueries, self).tearDown()
p = self.make_name_packet(dns.DNS_OPCODE_UPDATE)
@@ -833,6 +833,69 @@ class TestComplexQueries(DNSTest):
self.assertEquals(response.answers[1].rdata,
self.server_ip)
+ def test_cname_two_chain(self):
+ name0 = "cnamechain0.%s" % self.get_dns_domain()
+ name1 = "cnamechain1.%s" % self.get_dns_domain()
+ name2 = "cnamechain2.%s" % self.get_dns_domain()
+ self.make_dns_update(name1, name2, dns.DNS_QTYPE_CNAME)
+ self.make_dns_update(name2, name0, dns.DNS_QTYPE_CNAME)
+ self.make_dns_update(name0, server_ip, dns.DNS_QTYPE_A)
+
+ p = self.make_name_packet(dns.DNS_OPCODE_QUERY)
+ questions = []
+ q = self.make_name_question(name1, dns.DNS_QTYPE_A,
+ dns.DNS_QCLASS_IN)
+ questions.append(q)
+
+ self.finish_name_packet(p, questions)
+ response = self.dns_transaction_udp(p)
+ self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
+ self.assert_dns_opcode_equals(response, dns.DNS_OPCODE_QUERY)
+ self.assertEquals(response.ancount, 3)
+
+ self.assertEquals(response.answers[0].rr_type, dns.DNS_QTYPE_CNAME)
+ self.assertEquals(response.answers[0].name, name1)
+ self.assertEquals(response.answers[0].rdata, name2)
+
+ self.assertEquals(response.answers[1].rr_type, dns.DNS_QTYPE_CNAME)
+ self.assertEquals(response.answers[1].name, name2)
+ self.assertEquals(response.answers[1].rdata, name0)
+
+ self.assertEquals(response.answers[2].rr_type, dns.DNS_QTYPE_A)
+ self.assertEquals(response.answers[2].rdata,
+ self.server_ip)
+
+ def test_cname_two_chain_not_matching_qtype(self):
+ name0 = "cnamechain0.%s" % self.get_dns_domain()
+ name1 = "cnamechain1.%s" % self.get_dns_domain()
+ name2 = "cnamechain2.%s" % self.get_dns_domain()
+ self.make_dns_update(name1, name2, dns.DNS_QTYPE_CNAME)
+ self.make_dns_update(name2, name0, dns.DNS_QTYPE_CNAME)
+ self.make_dns_update(name0, server_ip, dns.DNS_QTYPE_A)
+
+ p = self.make_name_packet(dns.DNS_OPCODE_QUERY)
+ questions = []
+ q = self.make_name_question(name1, dns.DNS_QTYPE_TXT,
+ dns.DNS_QCLASS_IN)
+ questions.append(q)
+
+ self.finish_name_packet(p, questions)
+ response = self.dns_transaction_udp(p)
+ self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
+ self.assert_dns_opcode_equals(response, dns.DNS_OPCODE_QUERY)
+
+ # CNAME should return all intermediate results!
+ # Only the A records exists, not the TXT.
+ self.assertEquals(response.ancount, 2)
+
+ self.assertEquals(response.answers[0].rr_type, dns.DNS_QTYPE_CNAME)
+ self.assertEquals(response.answers[0].name, name1)
+ self.assertEquals(response.answers[0].rdata, name2)
+
+ self.assertEquals(response.answers[1].rr_type, dns.DNS_QTYPE_CNAME)
+ self.assertEquals(response.answers[1].name, name2)
+ self.assertEquals(response.answers[1].rdata, name3)
+
class TestInvalidQueries(DNSTest):
def test_one_a_query(self):
diff --git a/python/samba/tests/dns_forwarder.py
b/python/samba/tests/dns_forwarder.py
new file mode 100644
index 0000000..a90b007
--- /dev/null
+++ b/python/samba/tests/dns_forwarder.py
@@ -0,0 +1,601 @@
+# Unix SMB/CIFS implementation.
+# Copyright (C) Kai Blin <[email protected]> 2011
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+import os
+import sys
+import struct
+import random
+import socket
+import samba
+import time
+import errno
+import samba.ndr as ndr
+from samba import credentials, param
+from samba.tests import TestCase
+from samba.dcerpc import dns, dnsp, dnsserver
+from samba.netcmd.dns import TXTRecord, dns_record_match, data_to_dns_record
+from samba.tests.subunitrun import SubunitOptions, TestProgram
+import samba.getopt as options
+import optparse
+import subprocess
+
+parser = optparse.OptionParser("dns_forwarder.py <server name> <server ip>
(dns forwarder)+ [options]")
+sambaopts = options.SambaOptions(parser)
+parser.add_option_group(sambaopts)
+
+# This timeout only has relevance when testing against Windows
+# Format errors tend to return patchy responses, so a timeout is needed.
+parser.add_option("--timeout", type="int", dest="timeout",
+ help="Specify timeout for DNS requests")
+
+# use command line creds if available
+credopts = options.CredentialsOptions(parser)
+parser.add_option_group(credopts)
+subunitopts = SubunitOptions(parser)
+parser.add_option_group(subunitopts)
+
+opts, args = parser.parse_args()
+
+lp = sambaopts.get_loadparm()
+creds = credopts.get_credentials(lp)
+
+timeout = opts.timeout
+
+if len(args) < 3:
+ parser.print_usage()
+ sys.exit(1)
+
+server_name = args[0]
+server_ip = args[1]
+dns_servers = args[2:]
+
+creds.set_krb_forwardable(credentials.NO_KRB_FORWARDABLE)
+
+def make_txt_record(records):
+ rdata_txt = dns.txt_record()
+ s_list = dnsp.string_list()
+ s_list.count = len(records)
+ s_list.str = records
+ rdata_txt.txt = s_list
--
Samba Shared Repository