[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Wed May 24 01:53:01 UTC 2023


The branch, master has been updated
       via  a5235a9d05b librpc/idl: Alias the DS_ constants in netlogon.idl to the NBT_SERVER equivilants
       via  4caab32f08f librpc/idl: Use nbt_server_type instead of netr_DsR_DcFlags netlogon.idl
       via  089f555eb73 librpc/idl: Merge missing bits into nbt_server_type in nbt.idl
       via  22d0aa53bfb s4-dsdb:large_ldap: Call setUpClass() method of base class
       via  e77c249dd54 pytest: dcerpc/dnsserver: Call setUpClass() method of base class
       via  d2892010e6c pytest: dcerpc/dnsserver: Remove unused import
       via  c9e12a8d982 pyldb: Fix leak
       via  715c45da6ec tests/auth_log: Simplify isRemote()
       via  59378dddbfa tests/auth_log: Rename ‘self’ parameter to ‘cls’
       via  ea7b82ad93d tests/auth_log: Call setUpClass() method of base class
       via  781990577a5 tests/auth_log: Don’t silently override remoteAddress
       via  b421d2d5cf6 tests/auth_log_winbind: Expect an empty remote address
       via  f89b0cdbbc4 tests/audit_log: Pre-compile GUID regex
       via  8dea2a43456 s4:kdc: Move parameter comments adjacent to parameters
       via  200117f5edf audit_tests: Check return value of json_new_array()
       via  80b3752052a s3:utils: Check return value of json_new_object()
       via  3ce2803f6dd lib:audit_logging:tests: Check return value of json_new_{object,array}()
       via  281b616ac74 lib:audit_logging: Check return value of json_new_object()
       via  65923be91e4 s4:kdc: Use talloc_steal() rather than talloc_reference()
       via  e843e590760 s4:kdc: Make parameters const
       via  fc212116dcb s4:kdc: Make functions static
       via  46677077203 s4:auth: Allocate user_info_dc->sids on correct talloc context
       via  f0ec5763e6d s4:kdc: Allocate user_info_dc->sids on correct talloc context
       via  480060ecd34 selftest: Report better error message if environment is unknown
       via  a1a1adb7b72 s4/messaging/py: Fix typo
       via  ca987dcb417 s4/messaging/py: Fix leaks
       via  3ce96c9ebd0 s4/messaging/py: Fix leak of p_server_id
       via  4c67cac68b7 s4/messaging/py: Check py_return_ndr_struct() return value
       via  28536f32daf s4/messaging/py: Fix callback return value leak
       via  cfd80303f19 s4/messaging/py: Fix leak
       via  b22c2179952 s4/messaging/py: Fix leaks
       via  77d8b6762f9 s4/messaging: Return the number of previously-registered functions that are removed
       via  e29c3374bcf s4/messaging/py: Fix typo
       via  48602b0e298 s4/messaging/py: Add more helpful error message for a wrongly-sized tuple
       via  f6b1307a852 s4/messaging/py: Document lp_ctx parameter of messaging.Messaging()
       via  f320b73ba6a s4/messaging/py: Remove incorrect function names in messaging.Messaging()
       via  a57b1cc05dd pyglue: Raise an exception on error
       via  d5df0b463ee pyglue: Check generate_random_str() return value
       via  98fcd47451b pyglue: Fix typo
       via  7e32c7655df s4:kdc: Note correct constant
      from  f1a204d3154 gp: sshd policy correctly sort policy

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit a5235a9d05be3e2247534beb3cd8e49a64394bf5
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue May 23 15:22:49 2023 +1200

    librpc/idl: Alias the DS_ constants in netlogon.idl to the NBT_SERVER equivilants
    
    Both the NBT_SERVER versions (in python scripts) and DS_ constants are
    in use in freeIPA so we can not just drop one for the other without
    discussion.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Wed May 24 01:52:28 UTC 2023 on atb-devel-224

commit 4caab32f08fba897c01ae35855d5d5380d02b0e5
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue May 23 14:57:07 2023 +1200

    librpc/idl: Use nbt_server_type instead of netr_DsR_DcFlags netlogon.idl
    
    We should not keep two idential bitfield tables in two nearby IDL files.
    
    However a number of python files in Samba and in freeIPA use the nbt.NBT_SERVER_*
    constants, so these are the better names to keep.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Joseph Sutton <josephsutton at catalyst.net.nz>

commit 089f555eb735522e30207398837d657b8aa1988b
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue May 23 14:45:39 2023 +1200

    librpc/idl: Merge missing bits into nbt_server_type in nbt.idl
    
    These bits are defined in netr_DsR_DcFlags in netlogon.idl already.
    
    We need these new bits to announce FL 2012R2 and 2016 support.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Joseph Sutton <josephsutton at catalyst.net.nz>

commit 22d0aa53bfba3e0e95a0ec7ff53d28d91dec98f9
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 14:59:24 2023 +1200

    s4-dsdb:large_ldap: Call setUpClass() method of base class
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit e77c249dd54088607d54a65b583f4585755712db
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 14:58:44 2023 +1200

    pytest: dcerpc/dnsserver: Call setUpClass() method of base class
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d2892010e6c782343ab9863a42790ebc1e5a887f
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 14:58:35 2023 +1200

    pytest: dcerpc/dnsserver: Remove unused import
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c9e12a8d982ff9cb8e1df9943cf21672c9581bd2
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 14:07:08 2023 +1200

    pyldb: Fix leak
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 715c45da6ecb7d770f9b29d1cd9dc47ef876cb06
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 14:20:30 2023 +1200

    tests/auth_log: Simplify isRemote()
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 59378dddbfa6bbe29f2d1cbff08ddbeb8ce58138
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 14:57:47 2023 +1200

    tests/auth_log: Rename ‘self’ parameter to ‘cls’
    
    This method operates on the class, not on an instance of the class.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ea7b82ad93d370d043af6af337e3c3988eb12cdf
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 14:57:03 2023 +1200

    tests/auth_log: Call setUpClass() method of base class
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 781990577a5c936ddd9db1f40b9423042f331b71
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 13:07:07 2023 +1200

    tests/auth_log: Don’t silently override remoteAddress
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b421d2d5cf6be41cd901cf837de41d2c8f348afe
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 14:04:19 2023 +1200

    tests/auth_log_winbind: Expect an empty remote address
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit f89b0cdbbc4c6f0cf8c04b81880853b52ce4b002
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri May 19 14:54:00 2023 +1200

    tests/audit_log: Pre-compile GUID regex
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 8dea2a434560806eeb62fa8401770af5c4a223f4
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri May 19 13:15:45 2023 +1200

    s4:kdc: Move parameter comments adjacent to parameters
    
    This is more consistent with the non-NULL parameters, and makes it
    easier to swap in the real values when we get them.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 200117f5edfd5690a89e4e9f08674a5c322db4f8
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 11:17:22 2023 +1200

    audit_tests: Check return value of json_new_array()
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 80b3752052aa9234d8317ee6c671dcda64dcdf3f
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 11:16:56 2023 +1200

    s3:utils: Check return value of json_new_object()
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3ce2803f6dd34c33af4787f7f9ed364ad18a0cff
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 11:15:50 2023 +1200

    lib:audit_logging:tests: Check return value of json_new_{object,array}()
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 281b616ac74c8a0e26d1636b948179dfd40e47c4
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 11:15:17 2023 +1200

    lib:audit_logging: Check return value of json_new_object()
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 65923be91e41c35550c521975f2ae4bc835983fc
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 10:05:10 2023 +1200

    s4:kdc: Use talloc_steal() rather than talloc_reference()
    
    This is consistent with the other uses in this file (in
    authn_policy_ntlm_client() and authn_policy_server()).
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit e843e5907608c2851d82988d24ba2f294da35e8e
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 10:01:27 2023 +1200

    s4:kdc: Make parameters const
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit fc212116dcb5d4e8c8d5f60fc3389c89fe8ef80a
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 09:59:33 2023 +1200

    s4:kdc: Make functions static
    
    These functions are used only internally.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 46677077203673e90989db2b33ed0a1f4259d67b
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 09:42:46 2023 +1200

    s4:auth: Allocate user_info_dc->sids on correct talloc context
    
    ‘user_info_dc->sids’ must live for at least as long as ‘user_info_dc’,
    or a use-after-free may result.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit f0ec5763e6d4841070758cdcb8fbbc19b37006dc
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 09:21:17 2023 +1200

    s4:kdc: Allocate user_info_dc->sids on correct talloc context
    
    ‘user_info_dc->sids’ must live for at least as long as ‘user_info_dc’,
    or a use-after-free may result.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 480060ecd34472cce41b1322a2ac35c32889ca74
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 16 12:04:49 2023 +1200

    selftest: Report better error message if environment is unknown
    
    Now we get the error “environment [...] is unknown” rather than “samba
    can't start up known environment”.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit a1a1adb7b725f76d8d75a418255b65305c67c232
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 14:30:22 2023 +1200

    s4/messaging/py: Fix typo
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ca987dcb4178a9535a6bea64d3387af0186063c5
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 12:52:17 2023 +1200

    s4/messaging/py: Fix leaks
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3ce96c9ebd0b415949a7ffac9ae06125e78bc2a7
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 12:49:28 2023 +1200

    s4/messaging/py: Fix leak of p_server_id
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 4c67cac68b7129c6109c6bb415ae0ff2b0ea679c
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 12:48:56 2023 +1200

    s4/messaging/py: Check py_return_ndr_struct() return value
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 28536f32dafadcff3c4677358900e33b00684636
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 12:47:54 2023 +1200

    s4/messaging/py: Fix callback return value leak
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit cfd80303f191b93b6b41f12ba67f1a358b5a2e7e
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 12:46:56 2023 +1200

    s4/messaging/py: Fix leak
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b22c21799527323877b330c16c23057582721abb
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 12:32:02 2023 +1200

    s4/messaging/py: Fix leaks
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 77d8b6762f9fcd6c94e615b4ad3977d8d836ade4
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 12:30:12 2023 +1200

    s4/messaging: Return the number of previously-registered functions that are removed
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit e29c3374bcf85a72ab91a85684b7bdf8cd955053
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 23 12:00:07 2023 +1200

    s4/messaging/py: Fix typo
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 48602b0e298009ec80d2f791cdf15694a542c2ff
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri May 19 12:54:11 2023 +1200

    s4/messaging/py: Add more helpful error message for a wrongly-sized tuple
    
    >>> m = Messaging((1,2,3,4,5))
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: function takes exactly 1 argument (5 given)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit f6b1307a8525b6be888504947502440c3438e427
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri May 19 12:41:21 2023 +1200

    s4/messaging/py: Document lp_ctx parameter of messaging.Messaging()
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit f320b73ba6a6ed96dae1f69f5daf8405e84c82ff
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri May 19 12:39:52 2023 +1200

    s4/messaging/py: Remove incorrect function names in messaging.Messaging()
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit a57b1cc05dd366fec2df7bf8e47090b5767d33d8
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 9 15:31:43 2023 +1200

    pyglue: Raise an exception on error
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d5df0b463ee7f93cb72c75659e3d6630d04d0efd
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue May 9 15:30:58 2023 +1200

    pyglue: Check generate_random_str() return value
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 98fcd47451be0386f56e774e0878aae12df942e4
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed May 17 13:52:05 2023 +1200

    pyglue: Fix typo
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 7e32c7655dffad8cf1d3a700f25b6c8526d26a38
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Sep 23 16:27:46 2022 +1200

    s4:kdc: Note correct constant
    
    KRB5_PADATA_PW_SALT is wrong. It’s an unrelated constant that just
    happens to share the same value.
    
    Heimdal uses the correct constant, kERB_ERR_TYPE_EXTENDED.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/audit_logging/audit_logging.c                  |  6 ++
 lib/audit_logging/tests/audit_logging_error_test.c | 17 ++++++
 lib/audit_logging/tests/audit_logging_test.c       | 25 +++++++++
 lib/ldb/pyldb.c                                    |  4 +-
 librpc/idl/nbt.idl                                 |  8 ++-
 librpc/idl/netlogon.idl                            | 46 ++++++++-------
 python/pyglue.c                                    | 23 ++++----
 python/samba/tests/audit_log_base.py               |  5 +-
 python/samba/tests/auth_log_base.py                | 35 ++++++------
 python/samba/tests/auth_log_winbind.py             |  2 +
 python/samba/tests/dcerpc/dnsserver.py             |  4 +-
 selftest/target/Samba.pm                           |  2 +-
 source3/utils/status.c                             |  4 +-
 source4/auth/sam.c                                 |  2 +-
 .../dsdb/samdb/ldb_modules/tests/test_audit_util.c |  1 +
 source4/dsdb/tests/python/large_ldap.py            |  1 +
 source4/kdc/authn_policy_util.c                    |  8 +--
 source4/kdc/mit_samba.c                            | 26 ++++-----
 source4/kdc/pac-glue.c                             | 65 ++++++++++------------
 source4/kdc/pac-glue.h                             | 16 ------
 source4/lib/messaging/messaging.c                  | 13 +++--
 source4/lib/messaging/messaging.h                  |  2 +-
 source4/lib/messaging/pymessaging.c                | 65 +++++++++++++++-------
 23 files changed, 222 insertions(+), 158 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/audit_logging/audit_logging.c b/lib/audit_logging/audit_logging.c
index 038012f4668..ff4cabaf129 100644
--- a/lib/audit_logging/audit_logging.c
+++ b/lib/audit_logging/audit_logging.c
@@ -1185,6 +1185,12 @@ struct json_object json_get_object(struct json_object *object, const char *name)
 	json_t *v = NULL;
 	int ret = 0;
 
+	if (json_is_invalid(&o)) {
+		DBG_ERR("Unable to get object [%s]\n", name);
+		json_free(&o);
+		return o;
+	}
+
 	if (json_is_invalid(object)) {
 		DBG_ERR("Invalid JSON object, unable to get object [%s]\n",
 			name);
diff --git a/lib/audit_logging/tests/audit_logging_error_test.c b/lib/audit_logging/tests/audit_logging_error_test.c
index bbcc074232b..a7bea9d0532 100644
--- a/lib/audit_logging/tests/audit_logging_error_test.c
+++ b/lib/audit_logging/tests/audit_logging_error_test.c
@@ -286,6 +286,7 @@ static void test_json_add_int(_UNUSED_ void **state)
 
 	will_return(__wrap_json_object, false);
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 
 	/*
 	 * Test json integer failure
@@ -315,6 +316,7 @@ static void test_json_add_bool(_UNUSED_ void **state)
 
 	will_return(__wrap_json_object, false);
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 
 	/*
 	 * json_boolean does not return an error code.
@@ -379,7 +381,10 @@ static void test_json_add_object(_UNUSED_ void **state)
 	will_return(__wrap_json_object, false);
 
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
+
 	value = json_new_object();
+	assert_false(json_is_invalid(&value));
 
 	/*
 	 * Test json object set new failure
@@ -414,7 +419,10 @@ static void test_json_add_to_array(_UNUSED_ void **state)
 	will_return(__wrap_json_object, false);
 
 	array = json_new_array();
+	assert_false(json_is_invalid(&array));
+
 	value = json_new_object();
+	assert_false(json_is_invalid(&value));
 
 	/*
 	 * Test json array append new failure
@@ -446,6 +454,7 @@ static void test_json_add_timestamp(_UNUSED_ void **state)
 
 	will_return(__wrap_json_object, false);
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 
 	/*
 	 * Test json string failure
@@ -547,6 +556,7 @@ static void test_json_add_version(_UNUSED_ void **state)
 	 */
 	will_return(__wrap_json_object, false);
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 
 	will_return(__wrap_json_object, true);
 	rc = json_add_version(&object, 1, 11);
@@ -564,6 +574,7 @@ static void test_json_add_version(_UNUSED_ void **state)
 	 */
 	will_return(__wrap_json_object, false);
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 
 	will_return(__wrap_json_object, false);
 	will_return(__wrap_json_integer, false);
@@ -583,6 +594,7 @@ static void test_json_add_version(_UNUSED_ void **state)
 	 */
 	will_return(__wrap_json_object, false);
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 
 	will_return(__wrap_json_object, false);
 	will_return(__wrap_json_integer, false);
@@ -604,6 +616,7 @@ static void test_json_add_version(_UNUSED_ void **state)
 	 */
 	will_return(__wrap_json_object, false);
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 
 	will_return(__wrap_json_object, false);
 	will_return(__wrap_json_integer, false);
@@ -634,6 +647,7 @@ static void test_json_add_address(_UNUSED_ void **state)
 	 */
 	will_return(__wrap_json_object, false);
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 
 	will_return(__wrap_json_object_set_new, JANSSON_FAILURE);
 	rc = json_add_address(&object, "name", NULL);
@@ -697,6 +711,7 @@ static void test_json_add_sid(void **state)
 	 */
 	will_return(__wrap_json_object, false);
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 
 	will_return(__wrap_json_object_set_new, JANSSON_FAILURE);
 	rc = json_add_sid(&object, "null", NULL);
@@ -727,6 +742,7 @@ static void test_json_add_guid(void **state)
 	 */
 	will_return(__wrap_json_object, false);
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 
 	will_return(__wrap_json_object_set_new, JANSSON_FAILURE);
 	rc = json_add_guid(&object, "null", NULL);
@@ -756,6 +772,7 @@ static void test_json_to_string(_UNUSED_ void **state)
 
 	will_return(__wrap_json_object, false);
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 
 	/*
 	 * json_dumps failure
diff --git a/lib/audit_logging/tests/audit_logging_test.c b/lib/audit_logging/tests/audit_logging_test.c
index d393b986cf0..d41f9517c47 100644
--- a/lib/audit_logging/tests/audit_logging_test.c
+++ b/lib/audit_logging/tests/audit_logging_test.c
@@ -69,6 +69,7 @@ static void test_json_add_int(_UNUSED_ void **state)
 	intmax_t big_int = ((intmax_t)1)<<33;
 
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 	rc = json_add_int(&object, "positive_one", 1);
 	assert_int_equal(0, rc);
 	rc = json_add_int(&object, "zero", 0);
@@ -117,6 +118,7 @@ static void test_json_add_bool(_UNUSED_ void **state)
 	int rc = 0;
 
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 	rc = json_add_bool(&object, "true", true);
 	assert_int_equal(0, rc);
 	rc = json_add_bool(&object, "false", false);
@@ -150,6 +152,7 @@ static void test_json_add_string(_UNUSED_ void **state)
 	int rc = 0;
 
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 	rc = json_add_string(&object, "null", NULL);
 	assert_int_equal(0, rc);
 	rc = json_add_string(&object, "empty", "");
@@ -192,7 +195,9 @@ static void test_json_add_object(_UNUSED_ void **state)
 	int rc = 0;
 
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 	other  = json_new_object();
+	assert_false(json_is_invalid(&other));
 	rc = json_add_object(&object, "null", NULL);
 	assert_int_equal(0, rc);
 	rc = json_add_object(&object, "other", &other);
@@ -212,6 +217,7 @@ static void test_json_add_object(_UNUSED_ void **state)
 
 	object.valid = false;
 	after = json_new_object();
+	assert_false(json_is_invalid(&after));
 	rc = json_add_object(&object, "after", &after);
 	assert_int_equal(JSON_ERROR, rc);
 
@@ -235,11 +241,15 @@ static void test_json_add_to_array(_UNUSED_ void **state)
 	int rc = 0;
 
 	array = json_new_array();
+	assert_false(json_is_invalid(&array));
 	assert_true(json_is_array(array.root));
 
 	o1 = json_new_object();
+	assert_false(json_is_invalid(&o1));
 	o2 = json_new_object();
+	assert_false(json_is_invalid(&o2));
 	o3 = json_new_object();
+	assert_false(json_is_invalid(&o3));
 
 	rc = json_add_object(&array, NULL, &o3);
 	assert_int_equal(0, rc);
@@ -269,6 +279,7 @@ static void test_json_add_to_array(_UNUSED_ void **state)
 
 	array.valid = false;
 	after = json_new_object();
+	assert_false(json_is_invalid(&after));
 	rc = json_add_object(&array, "after", &after);
 	assert_int_equal(JSON_ERROR, rc);
 
@@ -296,6 +307,7 @@ static void test_json_add_timestamp(_UNUSED_ void **state)
 	int ret;
 
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 
 	ret = gettimeofday(&tv, NULL);
 	assert_int_equal(0, ret);
@@ -359,6 +371,7 @@ static void test_json_add_stringn(_UNUSED_ void **state)
 	int rc = 0;
 
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 	rc = json_add_stringn(&object, "null", NULL, 10);
 	assert_int_equal(0, rc);
 	rc = json_add_stringn(&object, "null-zero-len", NULL, 0);
@@ -427,6 +440,7 @@ static void test_json_add_version(_UNUSED_ void **state)
 	int rc;
 
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 	rc = json_add_version(&object, 3, 1);
 	assert_int_equal(0, rc);
 
@@ -471,6 +485,7 @@ static void test_json_add_address(_UNUSED_ void **state)
 	TALLOC_CTX *ctx = talloc_new(NULL);
 
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 
 	rc = json_add_address(&object, "null", NULL);
 	assert_int_equal(0, rc);
@@ -545,6 +560,7 @@ static void test_json_add_sid(_UNUSED_ void **state)
 	int rc;
 
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 
 	rc = json_add_sid(&object, "null", NULL);
 	assert_int_equal(0, rc);
@@ -584,6 +600,7 @@ static void test_json_add_guid(_UNUSED_ void **state)
 	int rc;
 
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 
 	rc = json_add_guid(&object, "null", NULL);
 	assert_int_equal(0, rc);
@@ -622,6 +639,7 @@ static void test_json_to_string(_UNUSED_ void **state)
 	TALLOC_CTX *ctx = talloc_new(NULL);
 
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 
 	s = json_to_string(ctx, &object);
 	assert_string_equal("{}", s);
@@ -658,7 +676,10 @@ static void test_json_get_array(_UNUSED_ void **state)
 	struct json_object o2;
 	int rc;
 
+	assert_false(json_is_invalid(&stored_array));
+
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 
 	array = json_get_array(&object, "not-there");
 	assert_true(array.valid);
@@ -667,6 +688,7 @@ static void test_json_get_array(_UNUSED_ void **state)
 	json_free(&array);
 
 	o1 = json_new_object();
+	assert_false(json_is_invalid(&o1));
 	rc = json_add_string(&o1, "value", "value-one");
 	assert_int_equal(0, rc);
 	rc = json_add_object(&stored_array, NULL, &o1);
@@ -698,6 +720,7 @@ static void test_json_get_array(_UNUSED_ void **state)
 	array = json_get_array(&object, "stored_array");
 	assert_true(json_is_array(array.root));
 	o2 = json_new_object();
+	assert_false(json_is_invalid(&o2));
 	rc = json_add_string(&o2, "value", "value-two");
 	assert_int_equal(0, rc);
 	assert_true(o2.valid);
@@ -753,6 +776,7 @@ static void test_json_get_object(_UNUSED_ void **state)
 	int rc;
 
 	object = json_new_object();
+	assert_false(json_is_invalid(&object));
 
 	o1 = json_get_object(&object, "not-there");
 	assert_true(o1.valid);
@@ -761,6 +785,7 @@ static void test_json_get_object(_UNUSED_ void **state)
 	json_free(&o1);
 
 	o1 = json_new_object();
+	assert_false(json_is_invalid(&o1));
 	rc = json_add_string(&o1, "value", "value-one");
 	assert_int_equal(0, rc);
 	rc = json_add_object(&object, "stored_object", &o1);
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c
index 11d093c0429..544d5672983 100644
--- a/lib/ldb/pyldb.c
+++ b/lib/ldb/pyldb.c
@@ -988,7 +988,9 @@ static void py_ldb_debug(void *context, enum ldb_debug_level level, const char *
 static void py_ldb_debug(void *context, enum ldb_debug_level level, const char *fmt, va_list ap)
 {
 	PyObject *fn = (PyObject *)context;
-	PyObject_CallFunction(fn, discard_const_p(char, "(i,O)"), level, PyUnicode_FromFormatV(fmt, ap));
+	PyObject *result = NULL;
+	result = PyObject_CallFunction(fn, discard_const_p(char, "(i,O)"), level, PyUnicode_FromFormatV(fmt, ap));
+	Py_XDECREF(result);
 }
 
 static PyObject *py_ldb_debug_func;
diff --git a/librpc/idl/nbt.idl b/librpc/idl/nbt.idl
index 50b52a55dc4..021e9538bd7 100644
--- a/librpc/idl/nbt.idl
+++ b/librpc/idl/nbt.idl
@@ -357,10 +357,12 @@ interface nbt
 		NBT_SERVER_WRITABLE			= 0x00000100,
 		NBT_SERVER_GOOD_TIMESERV		= 0x00000200,
 		NBT_SERVER_NDNC				= 0x00000400,
-		NBT_SERVER_SELECT_SECRET_DOMAIN_6	= 0x00000800,
-		NBT_SERVER_FULL_SECRET_DOMAIN_6		= 0x00001000,
+		NBT_SERVER_SELECT_SECRET_DOMAIN_6	= 0x00000800, /* 2008 / RODC */
+		NBT_SERVER_FULL_SECRET_DOMAIN_6		= 0x00001000, /* 2008 */
 		NBT_SERVER_ADS_WEB_SERVICE		= 0x00002000,
-		NBT_SERVER_DS_8				= 0x00004000,
+		NBT_SERVER_DS_8			= 0x00004000, /* 2012 */
+		NBT_SERVER_DS_9			= 0x00008000, /* 2012R2 */
+		NBT_SERVER_DS_10			= 0x00010000, /* 2016 */
 		NBT_SERVER_HAS_DNS_NAME			= 0x20000000,
 		NBT_SERVER_IS_DEFAULT_NC		= 0x40000000,
 		NBT_SERVER_FOREST_ROOT			= 0x80000000
diff --git a/librpc/idl/netlogon.idl b/librpc/idl/netlogon.idl
index c6231c41aee..3a821c0a905 100644
--- a/librpc/idl/netlogon.idl
+++ b/librpc/idl/netlogon.idl
@@ -4,7 +4,7 @@
   who contributed!
 */
 
-import "misc.idl", "lsa.idl", "samr.idl", "security.idl";
+import "misc.idl", "lsa.idl", "samr.idl", "security.idl", "nbt.idl";
 
 #include "idl_types.h"
 
@@ -23,6 +23,26 @@ cpp_quote("#define ENC_CLAIMS_SUPPORTED KERB_ENCTYPE_CLAIMS_SUPPORTED")
 cpp_quote("#define ENC_RESOURCE_SID_COMPRESSION_DISABLED KERB_ENCTYPE_RESOURCE_SID_COMPRESSION_DISABLED")
 cpp_quote("#define NETLOGON_SERVER_PIPE_STATE_MAGIC 0x4f555358")
 
+cpp_quote("#define DS_SERVER_PDC NBT_SERVER_PDC")
+cpp_quote("#define DS_SERVER_GC NBT_SERVER_GC")
+cpp_quote("#define DS_SERVER_LDAP NBT_SERVER_LDAP")
+cpp_quote("#define DS_SERVER_DS NBT_SERVER_DS")
+cpp_quote("#define DS_SERVER_KDC NBT_SERVER_KDC")
+cpp_quote("#define DS_SERVER_TIMESERV NBT_SERVER_TIMESERV")
+cpp_quote("#define DS_SERVER_CLOSEST NBT_SERVER_CLOSEST")
+cpp_quote("#define DS_SERVER_WRITABLE NBT_SERVER_WRITABLE")
+cpp_quote("#define DS_SERVER_GOOD_TIMESERV NBT_SERVER_GOOD_TIMESERV")
+cpp_quote("#define DS_SERVER_NDNC NBT_SERVER_NDNC")
+cpp_quote("#define DS_SERVER_SELECT_SECRET_DOMAIN_6 NBT_SERVER_SELECT_SECRET_DOMAIN_6 /* 2008 / RODC */")
+cpp_quote("#define DS_SERVER_FULL_SECRET_DOMAIN_6 NBT_SERVER_FULL_SECRET_DOMAIN_6 /* 2008 */")
+cpp_quote("#define DS_SERVER_WEBSERV NBT_SERVER_ADS_WEB_SERVICE")
+cpp_quote("#define DS_SERVER_DS_8 NBT_SERVER_DS_8 /* 2012 */")
+cpp_quote("#define DS_SERVER_DS_9 NBT_SERVER_DS_9 /* 2012R2 */")
+cpp_quote("#define DS_SERVER_DS_10 NBT_SERVER_DS_10 /* 2016 */")
+cpp_quote("#define DS_DNS_CONTROLLER NBT_SERVER_HAS_DNS_NAME")
+cpp_quote("#define DS_DNS_DOMAIN NBT_SERVER_IS_DEFAULT_NC")
+cpp_quote("#define DS_DNS_FOREST_ROOT NBT_SERVER_FOREST_ROOT")
+
 [
   uuid("12345678-1234-abcd-ef00-01234567cffb"),
   version(1.0),
@@ -1195,28 +1215,6 @@ interface netlogon
 		DS_ADDRESS_TYPE_NETBIOS		= 2
 	} netr_DsRGetDCNameInfo_AddressType;
 
-	typedef [bitmap32bit] bitmap {
-		DS_SERVER_PDC			 = 0x00000001,
-		DS_SERVER_GC			 = 0x00000004,
-		DS_SERVER_LDAP			 = 0x00000008,
-		DS_SERVER_DS			 = 0x00000010,
-		DS_SERVER_KDC			 = 0x00000020,
-		DS_SERVER_TIMESERV		 = 0x00000040,
-		DS_SERVER_CLOSEST		 = 0x00000080,
-		DS_SERVER_WRITABLE		 = 0x00000100,
-		DS_SERVER_GOOD_TIMESERV		 = 0x00000200,
-		DS_SERVER_NDNC			 = 0x00000400,
-		DS_SERVER_SELECT_SECRET_DOMAIN_6 = 0x00000800, /* 2008 / RODC */
-		DS_SERVER_FULL_SECRET_DOMAIN_6	 = 0x00001000, /* 2008 / RWDC */
-		DS_SERVER_WEBSERV		 = 0x00002000,
-		DS_SERVER_DS_8			 = 0x00004000, /* 2012 */
-		DS_SERVER_DS_9			 = 0x00008000, /* 2012R2 */
-		DS_SERVER_DS_10			 = 0x00010000, /* 2016 */
-		DS_DNS_CONTROLLER		 = 0x20000000,
-		DS_DNS_DOMAIN			 = 0x40000000,
-		DS_DNS_FOREST_ROOT		 = 0x80000000
-	} netr_DsR_DcFlags;
-
 	typedef [public] struct {
 		[string,charset(UTF16)] uint16 *dc_unc;
 		[string,charset(UTF16)] uint16 *dc_address;
@@ -1224,7 +1222,7 @@ interface netlogon
 		GUID domain_guid;
 		[string,charset(UTF16)] uint16 *domain_name;
 		[string,charset(UTF16)] uint16 *forest_name;
-		netr_DsR_DcFlags dc_flags;
+		nbt_server_type dc_flags;
 		[string,charset(UTF16)] uint16 *dc_site_name;
 		[string,charset(UTF16)] uint16 *client_site_name;
 	} netr_DsRGetDCNameInfo;
diff --git a/python/pyglue.c b/python/pyglue.c
index 808a86b444f..90c3d6e2895 100644
--- a/python/pyglue.c
+++ b/python/pyglue.c
@@ -48,6 +48,9 @@ static PyObject *py_generate_random_str(PyObject *self, PyObject *args)
 		return NULL;
 	}
 	retstr = generate_random_str(NULL, len);
+	if (retstr == NULL) {
+		return PyErr_NoMemory();
+	}
 	ret = PyUnicode_FromStringAndSize(retstr, len);
 	talloc_free(retstr);
 	return ret;
@@ -76,11 +79,11 @@ static PyObject *py_generate_random_password(PyObject *self, PyObject *args)
 	retstr = generate_random_password(NULL, min, max);
 	if (retstr == NULL) {
 		if (errno == EINVAL) {
-			PyErr_Format(PyExc_ValueError,
-				     "invalid range: %zd - %zd",
-				     min, max);
+			return PyErr_Format(PyExc_ValueError,
+					    "invalid range: %zd - %zd",
+					    min, max);
 		}
-		return NULL;
+		return PyErr_NoMemory();
 	}
 	ret = PyUnicode_FromString(retstr);
 	talloc_free(retstr);
@@ -100,7 +103,7 @@ static PyObject *py_generate_random_machine_password(PyObject *self, PyObject *a
 		/*
 		 * The real range checks happens in
 		 * generate_random_machine_password().
-		 * Here we are just filter out any negative numbers.
+		 * Here we just filter out any negative numbers.
 		 */
 		PyErr_Format(PyExc_ValueError,
 			     "invalid range: %zd - %zd",
@@ -111,11 +114,11 @@ static PyObject *py_generate_random_machine_password(PyObject *self, PyObject *a
 	retstr = generate_random_machine_password(NULL, min, max);
 	if (retstr == NULL) {
 		if (errno == EINVAL) {
-			PyErr_Format(PyExc_ValueError,
-				     "invalid range: %zd - %zd",
-				     min, max);
+			return PyErr_Format(PyExc_ValueError,
+					    "invalid range: %zd - %zd",
+					    min, max);
 		}
-		return NULL;
+		return PyErr_NoMemory();
 	}
 	ret = PyUnicode_FromString(retstr);
 	talloc_free(retstr);
@@ -354,7 +357,7 @@ static PyObject *py_interface_ips(PyObject *self, PyObject *args)
 	lp_ctx = lpcfg_from_py_object(tmp_ctx, py_lp_ctx);
 	if (lp_ctx == NULL) {
 		talloc_free(tmp_ctx);
-		return NULL;
+		return PyErr_NoMemory();
 	}
 
 	load_interface_list(tmp_ctx, lp_ctx, &ifaces);
diff --git a/python/samba/tests/audit_log_base.py b/python/samba/tests/audit_log_base.py
index c791a1a8ca8..18f86a9d310 100644
--- a/python/samba/tests/audit_log_base.py
+++ b/python/samba/tests/audit_log_base.py
@@ -183,13 +183,14 @@ class AuditLogTestBase(samba.tests.TestCase):
             self.context["txnMessage"] = None
             self.msg_ctx.loop_once(0.001)
 
-    GUID_RE = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
+    GUID_RE = re.compile(
+        "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")
 
     #
     # Is the supplied GUID string correctly formatted
     #
     def is_guid(self, guid):
-        return re.match(self.GUID_RE, guid)
+        return self.GUID_RE.match(guid)
 
     def get_session(self):
         return self.auth_context["sessionId"]
diff --git a/python/samba/tests/auth_log_base.py b/python/samba/tests/auth_log_base.py
index 2026bc97a83..ebe9c3a124a 100644


-- 
Samba Shared Repository



More information about the samba-cvs mailing list