The branch, v4-12-stable has been updated
       via  21679048604 VERSION: Disable GIT_SNAPSHOT for the 4.12.0 release...
       via  a1b4c4a0d9d WHATSNEW: Add release notes for Samba 4.12.0.
       via  a99445e298c selftest: Test behaviour of DNS scavenge with an 
existing dNSTombstoned value
       via  c6b90fbcee0 dsdb: Correctly handle memory in objectclass_attrs
       via  201489edf9d VERSION: Bump version up to 4.12.0rc5...
      from  e629b9230ea VERSION: Disable GIT_SNAPSHOT for th Samba 4.12.0rc4 
release.

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-12-stable


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 VERSION                                            |  2 +-
 WHATSNEW.txt                                       | 24 +++++++------
 python/samba/tests/dns.py                          | 39 ++++++++++++++++++++++
 source4/dsdb/samdb/ldb_modules/objectclass_attrs.c | 17 +++++++++-
 4 files changed, 69 insertions(+), 13 deletions(-)


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index 42b5b48af5e..5fcdb65ffb9 100644
--- a/VERSION
+++ b/VERSION
@@ -87,7 +87,7 @@ SAMBA_VERSION_PRE_RELEASE=
 # e.g. SAMBA_VERSION_RC_RELEASE=1                      #
 #  ->  "3.0.0rc1"                                      #
 ########################################################
-SAMBA_VERSION_RC_RELEASE=4
+SAMBA_VERSION_RC_RELEASE=
 
 ########################################################
 # To mark SVN snapshots this should be set to 'yes'    #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index b58cba6aebf..82525ebff0a 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,16 +1,11 @@
-Release Announcements
-=====================
+                   ==============================
+                   Release Notes for Samba 4.12.0
+                           March 03, 2019
+                  ==============================
 
-This is the fourth release candidate of Samba 4.12.  This is *not*
-intended for production environments and is designed for testing
-purposes only.  Please report any defects via the Samba bug reporting
-system at https://bugzilla.samba.org/.
 
-Samba 4.12 will be the next version of the Samba suite.
-
-
-UPGRADING
-=========
+This is the first stable release of the Samba 4.12 release series.
+Please read the release notes carefully before upgrading.
 
 
 NEW FEATURES/CHANGES
@@ -270,6 +265,13 @@ smb.conf changes
   spotlight backend                 New                        noindex
 
 
+CHANGES SINCE 4.12.0rc4
+=======================
+
+o  Andrew Bartlett <[email protected]>
+   * BUG 14258: dsdb: Correctly handle memory in objectclass_attrs.
+
+
 CHANGES SINCE 4.12.0rc3
 =======================
 
diff --git a/python/samba/tests/dns.py b/python/samba/tests/dns.py
index 1dd1f549a33..bc05076c615 100644
--- a/python/samba/tests/dns.py
+++ b/python/samba/tests/dns.py
@@ -1523,26 +1523,51 @@ class TestZones(DNSTest):
         name, txt = 'agingtest', ['test txt']
         name2, txt2 = 'agingtest2', ['test txt2']
         name3, txt3 = 'agingtest3', ['test txt3']
+        name4, txt4 = 'agingtest4', ['test txt4']
+        name5, txt5 = 'agingtest5', ['test txt5']
         self.dns_update_record(name, txt)
         self.dns_update_record(name2, txt)
         self.dns_update_record(name2, txt2)
         self.dns_update_record(name3, txt)
         self.dns_update_record(name3, txt2)
+
+        # Create a tomb stoned record.
+        self.dns_update_record(name4, txt4)
+        self.dns_tombstone(name4, txt4, self.zone)
+        records = self.ldap_get_records(name4)
+        self.assertTrue("dNSTombstoned" in records[0])
+        self.assertEqual(records[0]["dNSTombstoned"][0], b"TRUE")
+
+        # Create an un-tombstoned record, with dnsTombstoned: FALSE
+        self.dns_update_record(name5, txt5)
+        self.dns_tombstone(name5, txt5, self.zone)
+        self.dns_update_record(name5, txt5)
+        records = self.ldap_get_records(name5)
+        self.assertTrue("dNSTombstoned" in records[0])
+        self.assertEqual(records[0]["dNSTombstoned"][0], b"FALSE")
+
         last_add = self.dns_update_record(name3, txt3)
 
         def mod_ts(rec):
             self.assertTrue(rec.dwTimeStamp > 0)
             if rec.data.str == txt:
                 rec.dwTimeStamp -= interval * 5
+
+        def mod_ts_all(rec):
+            rec.dwTimeStamp -= interval * 5
         self.ldap_modify_dnsrecs(name, mod_ts)
         self.ldap_modify_dnsrecs(name2, mod_ts)
         self.ldap_modify_dnsrecs(name3, mod_ts)
+        self.ldap_modify_dnsrecs(name5, mod_ts_all)
         self.assertTrue(callable(getattr(dsdb, '_scavenge_dns_records', None)))
         dsdb._scavenge_dns_records(self.samdb)
 
         recs = self.ldap_get_dns_records(name)
         self.assertEqual(len(recs), 1)
         self.assertEqual(recs[0].wType, dnsp.DNS_TYPE_TOMBSTONE)
+        records = self.ldap_get_records(name)
+        self.assertTrue("dNSTombstoned" in records[0])
+        self.assertEqual(records[0]["dNSTombstoned"][0], b"TRUE")
 
         recs = self.ldap_get_dns_records(name2)
         self.assertEqual(len(recs), 1)
@@ -1556,6 +1581,20 @@ class TestZones(DNSTest):
         self.assertEqual(recs[0].wType, dnsp.DNS_TYPE_TXT)
         self.assertEqual(recs[1].wType, dnsp.DNS_TYPE_TXT)
 
+        recs = self.ldap_get_dns_records(name4)
+        self.assertEqual(len(recs), 1)
+        self.assertEqual(recs[0].wType, dnsp.DNS_TYPE_TOMBSTONE)
+        records = self.ldap_get_records(name4)
+        self.assertTrue("dNSTombstoned" in records[0])
+        self.assertEqual(records[0]["dNSTombstoned"][0], b"TRUE")
+
+        recs = self.ldap_get_dns_records(name5)
+        self.assertEqual(len(recs), 1)
+        self.assertEqual(recs[0].wType, dnsp.DNS_TYPE_TOMBSTONE)
+        records = self.ldap_get_records(name5)
+        self.assertTrue("dNSTombstoned" in records[0])
+        self.assertEqual(records[0]["dNSTombstoned"][0], b"TRUE")
+
         for make_it_work in [False, True]:
             inc = -1 if make_it_work else 1
 
diff --git a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c 
b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
index e5f86d260f4..0b9725e2767 100644
--- a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
+++ b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
@@ -133,7 +133,16 @@ static int oc_auto_normalise(struct ldb_context *ldb, 
const struct dsdb_attribut
        for (i=0; i<el->num_values; i++) {
                struct ldb_val v;
                int ret;
-               ret = attr->ldb_schema_attribute->syntax->canonicalise_fn(ldb, 
el->values, &el->values[i], &v);
+               /*
+                * We use msg->elements (owned by this module due to
+                * ldb_msg_copy_shallow()) as a memory context and
+                * then steal from there to the right spot if we don't
+                * free it.
+                */
+               ret = attr->ldb_schema_attribute->syntax->canonicalise_fn(ldb,
+                                                                         
msg->elements,
+                                                                         
&el->values[i],
+                                                                         &v);
                if (ret != LDB_SUCCESS) {
                        return ret;
                }
@@ -156,6 +165,12 @@ static int oc_auto_normalise(struct ldb_context *ldb, 
const struct dsdb_attribut
                }
 
                el->values[i] = v;
+
+               /*
+                * By now el->values is a talloc pointer under
+                * msg->elements and may now be used
+                */
+               talloc_steal(el->values, v.data);
        }
        return LDB_SUCCESS;
 }


-- 
Samba Shared Repository

Reply via email to