[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Wed Aug 30 03:16:02 UTC 2023


The branch, master has been updated
       via  70dea37d063 wscript: Refer to correct ConfigSet variable
       via  54ebd103c85 wscript: Remove semicolons
       via  8f430492c8e wscript: Remove unused imports
       via  c6d0323bf15 wscript: Use ‘is’ to compare with singletons
       via  b5cc15fdf16 wscript: Remove unused variable
       via  752a1c409e0 third_party/heimdal_build: Use ‘is’ to compare with singletons
       via  a6c442acea1 third_party/heimdal_build: Remove semicolons
       via  dfe25969f31 third_party/heimdal_build: Remove unused imports
       via  0898329b8d7 selftest: Don’t use invalid escape sequences
       via  0fe4a12b3f3 selftest: Remove star imports
       via  6db02afab81 selftest: Remove unused imports
       via  3c7ef6d0415 s4:dsdb:tests: Fix usage lines
       via  fec8d228ad1 s4:dsdb:tests: Remove unused imports
       via  6e20afeb42a s4:dsdb:tests: Fix spelling
       via  357b520b37f tests/krb5: Have modified_ticket() not modify its arguments
       via  b4a2e64110f tests/krb5: Add KerberosCredentials.get_rid()
       via  7b4b03e5e79 tests/krb5: Re-raise any LdbError other than ERR_ENTRY_ALREADY_EXISTS
       via  3f01cf91699 tests/krb5: Correctly assert that we found a LOGON_INFO PAC buffer
       via  04cdb13c080 tests/krb5: Remove local variable
       via  1def8f04f34 tests/krb5: Move KDC TGT tests to new file
       via  e390e674ecb tests/krb5: Remove test of pre-1.20 MIT Kerberos behaviour
       via  2b566979acf gp: Use read_file() instead of readfp()
       via  34042677b7d gp: Fix resource leaks
       via  928f2bbc6b5 gp: Use assertEqual() instead of assertEquals()
       via  953bc91851c gp: Check correct variables
       via  036a523e516 gp: Prefer ‘x not in y’ to ‘not x in y’
       via  94afa3b1946 gp: Don’t shadow imports
       via  5755b4a4905 gp: Add missing import
       via  de04333b4d5 pytest/dns_aging: Assert that the name of the node to search for is a string
       via  472d80c1c9f pytest/dns_aging: Correctly check that record is tombstoned
       via  8e5c998b1d3 pytest/dns_aging: Check value of ‘dtime’
       via  d3bc6faa7a5 python:tests: Rename test method so as not to mask previously-defined method
       via  bbd0e35f11f python:tests: Complete assertion messages
       via  c4e0d4fbd17 python:tests: Fix usage line
       via  83230577ece python: Fix reference to undefined name ‘samba’
       via  5c5045eeb44 samba-tool: Remove useless return
       via  b076cad4b26 python:join: Fix references to undefined variables
       via  b068592dd0d python: Fix invalid escape sequences
       via  12f1c7825db python: Remove redundant backslashes
       via  fce882ab671 python: Remove unused imports
       via  6c6db88ddac python: Fix spelling
       via  5de640fc581 ldb: Heed return code from Python testsuite
       via  b440732e7fc ldb: Remove unused import
       via  e4ab1de4e41 lib:ldb:tests: Remove explicit comparison with False
       via  84dc7129ead buildtools: Properly set global variable
       via  8d61d3f8e02 buildtools: Prefer ‘x not in y’ to ‘not x in y’
       via  6df81630af8 buildtools: Use ‘is’ to compare with singletons
       via  94f46f0cbbc buildtools: Fix comments and documentation
       via  6668d213e77 pyldb: Fix leaks
       via  5e9187baf92 pyldb: Check return values of Python functions
       via  e5794b8c8a6 pyldb: Check return values of talloc functions
       via  93d37f8bfca pyldb: Check whether Python object is a list
      from  7dc181757c7 gp: Send list of keys instead of dict to remove

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


- Log -----------------------------------------------------------------
commit 70dea37d063fea3e72f5a04c29e6bbd5e11d20b0
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 12:18:27 2023 +1200

    wscript: Refer to correct ConfigSet variable
    
    LIB_GSSAPI appears to be an error of copy-and-pasting.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Wed Aug 30 03:15:05 UTC 2023 on atb-devel-224

commit 54ebd103c859333e96c1b609ada42de52029b18a
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 12:15:19 2023 +1200

    wscript: Remove semicolons
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 8f430492c8e92a542d0d3a92bb82d1f7e1bb105c
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 12:14:45 2023 +1200

    wscript: Remove unused imports
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c6d0323bf1535f41d11a1df3561128cdd84e6848
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 12:11:39 2023 +1200

    wscript: Use ‘is’ to compare with singletons
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b5cc15fdf16dbfa64b6808dca5c0ac6701f1a553
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 12:11:08 2023 +1200

    wscript: Remove unused variable
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 752a1c409e035a57b13bda1ffee3849f81743069
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 12:07:33 2023 +1200

    third_party/heimdal_build: Use ‘is’ to compare with singletons
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit a6c442acea1de3dfcfaf8d897bf87d4e9d042912
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 12:06:13 2023 +1200

    third_party/heimdal_build: Remove semicolons
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit dfe25969f319e9e494e6621db9b9768bef532086
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 14:58:53 2023 +1200

    third_party/heimdal_build: Remove unused imports
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 0898329b8d7c49eb56515bdae5a01ba703549b37
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Aug 23 11:00:42 2023 +1200

    selftest: Don’t use invalid escape sequences
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 0fe4a12b3f30f44558962b1f3d997db4cd358e66
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 15:14:51 2023 +1200

    selftest: Remove star imports
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 6db02afab8115643dea587dd8c90a6e481b261db
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 15:14:23 2023 +1200

    selftest: Remove unused imports
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3c7ef6d04157ce38931a2eb04103a0ee4d6006de
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Aug 25 11:13:56 2023 +1200

    s4:dsdb:tests: Fix usage lines
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit fec8d228ad1ad3215a125ba0719d503f89a9f35f
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Aug 25 11:12:34 2023 +1200

    s4:dsdb:tests: Remove unused imports
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 6e20afeb42a646fb0d3f1f9c20bdbf3bfb07460d
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 14:24:00 2023 +1200

    s4:dsdb:tests: Fix spelling
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 357b520b37f5fd832118f58c1f034c1d64fb7a43
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Mon Aug 28 13:52:47 2023 +1200

    tests/krb5: Have modified_ticket() not modify its arguments
    
    Inexplicable behaviour could result when the same arguments were passed
    in across multiple calls.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b4a2e64110f9c1fb159bc6c8cc94cd90ba14323e
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Aug 25 15:12:39 2023 +1200

    tests/krb5: Add KerberosCredentials.get_rid()
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 7b4b03e5e79d02385dc5508bc115ac8f21f31769
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Aug 25 10:58:05 2023 +1200

    tests/krb5: Re-raise any LdbError other than ERR_ENTRY_ALREADY_EXISTS
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3f01cf9169947d52138a16c53d5bedb28f8c78cc
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Aug 25 10:53:00 2023 +1200

    tests/krb5: Correctly assert that we found a LOGON_INFO PAC buffer
    
    Because ‘found_logon_info’ was invariably true, we would miss the case
    in which set_pac_sids() failed to accomplish anything, having been
    unable to find the LOGON_INFO PAC buffer.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 04cdb13c0809194092ec418313ec8c3eede8b18a
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Aug 25 10:52:31 2023 +1200

    tests/krb5: Remove local variable
    
    This seems a bit clearer to me.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 1def8f04f34f26529f73f4bbf8b0d077ed0e233a
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Aug 24 14:11:45 2023 +1200

    tests/krb5: Move KDC TGT tests to new file
    
    We can now rely on having MIT Kerberos 1.20 available.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit e390e674ecb93d7c64456825697cc7de4cbf181d
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 14:48:24 2023 +1200

    tests/krb5: Remove test of pre-1.20 MIT Kerberos behaviour
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 2b566979acfc89ad609eb7c0c87d720f1a35f30a
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 16:30:08 2023 +1200

    gp: Use read_file() instead of readfp()
    
    readfp() is deprecated and could be removed in a future version of
    Python.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 34042677b7da79936ed0278a80ec34ee9b93de3e
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 16:29:55 2023 +1200

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

commit 928f2bbc6b56294207bbcbcfb6b2dc8678c4cc5e
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 16:27:04 2023 +1200

    gp: Use assertEqual() instead of assertEquals()
    
    assertEquals() is deprecated and could be removed in a future version of
    Python.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 953bc91851cdae05b0876b44792b97bca7ad061a
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Aug 25 13:59:06 2023 +1200

    gp: Check correct variables
    
    We were intending to check the keys, not the certificates.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 036a523e5169a77d062607d0369eba0a02c230db
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Aug 25 13:58:17 2023 +1200

    gp: Prefer ‘x not in y’ to ‘not x in y’
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 94afa3b194607d389986f2504c15c02578aa8ada
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Aug 25 13:57:09 2023 +1200

    gp: Don’t shadow imports
    
    Rename a variable that shadows an import of ‘gp_ext’.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 5755b4a4905e945b3afb07aaa3434c19e5beeecd
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 14:57:20 2023 +1200

    gp: Add missing import
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit de04333b4d5da7a4b22778c83428e80c1a6ca97d
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 17:37:31 2023 +1200

    pytest/dns_aging: Assert that the name of the node to search for is a string
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 472d80c1c9f24bd352cd1cb41b0d66dde418ce91
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 17:31:14 2023 +1200

    pytest/dns_aging: Correctly check that record is tombstoned
    
    We were passing in as the name parameter to assert_tombstoned() an NDR
    Python object, rather than a string. This meant that the LDAP search
    filter would look something like this:
    
    (&(objectClass=dnsNode)(name=<dnsp.DnssrvRpcRecord talloc based object at 0x29abee0>))
    
    and we would fail to find any records.
    
    These searches should have a better chance of working if we pass in the
    name of the record instead.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 8e5c998b1d327dd6f3e4a8c433bf456cf496ac75
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Mon Aug 28 13:39:03 2023 +1200

    pytest/dns_aging: Check value of ‘dtime’
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d3bc6faa7a5d9d937045de975c9917a5e4646983
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Mon Aug 28 13:40:03 2023 +1200

    python:tests: Rename test method so as not to mask previously-defined method
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit bbd0e35f11f71e57b14e954c591eb2aac9f0c916
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Aug 25 13:58:39 2023 +1200

    python:tests: Complete assertion messages
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c4e0d4fbd17741e7feff5aec71ee6fbbc83df4c2
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Aug 25 11:57:09 2023 +1200

    python:tests: Fix usage line
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 83230577ece3568e7365f3e449a62ff3d826e963
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Mon Aug 28 13:15:10 2023 +1200

    python: Fix reference to undefined name ‘samba’
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 5c5045eeb449230c8a59748e40aa9a9d2475de2b
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Aug 25 12:51:43 2023 +1200

    samba-tool: Remove useless return
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b076cad4b2679369652f864fcb3a77b22d28fd2a
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Mon Aug 28 13:11:21 2023 +1200

    python:join: Fix references to undefined variables
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b068592dd0dccce634cb17b66f0659ba60523908
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Aug 25 13:56:21 2023 +1200

    python: Fix invalid escape sequences
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 12f1c7825db44d83e94ba37335c1582363281f75
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Aug 25 13:55:23 2023 +1200

    python: Remove redundant backslashes
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit fce882ab67186fddd957404fe62f84d41380895c
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Aug 25 11:09:52 2023 +1200

    python: Remove unused imports
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 6c6db88ddacdc962c146ef348a62605405a5c109
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 14:23:51 2023 +1200

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

commit 5de640fc58113014fef7c6b27b63810fa503984b
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 20:50:32 2023 +1200

    ldb: Heed return code from Python testsuite
    
    When we added a second run of the Python testsuite, the return code from
    the first run began to go ignored.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b440732e7fcd817d7c2012ea2f843899eaa45a9a
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 20:50:13 2023 +1200

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

commit e4ab1de4e411b057f34dcc98544501057bed74ca
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 20:48:58 2023 +1200

    lib:ldb:tests: Remove explicit comparison with False
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 84dc7129ead1c80b89f89f7d5b426ea3592fca58
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 20:48:14 2023 +1200

    buildtools: Properly set global variable
    
    Since we didn’t declare ‘old_refill_task_list’ as global, we were just
    assigning a value to a local variable that was destroyed after we
    returned from this function. We clearly intended instead to assign to a
    global variable of the same name.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 8d61d3f8e021284bc879f65c55958f5b1d946035
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 15:10:53 2023 +1200

    buildtools: Prefer ‘x not in y’ to ‘not x in y’
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 6df81630af8e8d11711b0387baec8b84e0e529fc
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 15:12:27 2023 +1200

    buildtools: Use ‘is’ to compare with singletons
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 94f46f0cbbc5097111c58b3310c925b2cf446a51
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 29 14:22:58 2023 +1200

    buildtools: Fix comments and documentation
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 6668d213e77590305e4598c27b22155fd07fccc8
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Aug 30 09:47:28 2023 +1200

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

commit 5e9187baf926b513032cc781a7b9519d5fa91636
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Aug 25 14:20:50 2023 +1200

    pyldb: Check return values of Python functions
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit e5794b8c8a6561c82cc2d45b39589715b9460689
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Aug 25 14:22:15 2023 +1200

    pyldb: Check return values of talloc functions
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 93d37f8bfcac58893a514349ed47c12d27149146
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Aug 25 14:21:24 2023 +1200

    pyldb: Check whether Python object is a list
    
    If we’re going to call PyList_Size() on an object, we should be sure
    that it is a list first.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 buildtools/wafsamba/pkgconfig.py                   |   2 +-
 buildtools/wafsamba/samba_deps.py                  |   2 +-
 buildtools/wafsamba/samba_install.py               |   2 +-
 buildtools/wafsamba/stale_files.py                 |   1 +
 buildtools/wafsamba/wafsamba.py                    |   6 +-
 buildtools/wafsamba/wscript                        |  12 +-
 lib/ldb/pyldb.c                                    | 336 +++++++++++++++++---
 lib/ldb/pyldb_util.c                               |  53 +++-
 lib/ldb/tests/python/api.py                        |   2 +-
 lib/ldb/wscript                                    |   3 +-
 python/samba/__init__.py                           |   1 -
 python/samba/domain_update.py                      |   3 -
 python/samba/forest_update.py                      |   2 -
 python/samba/gp/gp_centrify_crontab_ext.py         |   6 +-
 python/samba/gp/gp_centrify_sudoers_ext.py         |   1 -
 python/samba/gp/gp_cert_auto_enroll_ext.py         |  10 +-
 python/samba/gp/gp_ext_loader.py                   |  14 +-
 python/samba/gp/gp_gnome_settings_ext.py           |   5 +-
 python/samba/gp/gp_msgs_ext.py                     |  11 +-
 python/samba/gp/gp_sec_ext.py                      |   6 +-
 python/samba/gp/gp_smb_conf_ext.py                 |   2 +-
 python/samba/gp/gp_sudoers_ext.py                  |   6 +-
 python/samba/gp/gpclass.py                         |  25 +-
 python/samba/gp/util/logging.py                    |   1 -
 python/samba/gp/vgp_access_ext.py                  |   1 -
 python/samba/gp/vgp_issue_ext.py                   |  12 +-
 python/samba/gp/vgp_motd_ext.py                    |  12 +-
 python/samba/gp/vgp_openssh_ext.py                 |   6 +-
 python/samba/gp/vgp_startup_scripts_ext.py         |   2 +-
 python/samba/gp/vgp_sudoers_ext.py                 |   5 +-
 python/samba/gp/vgp_symlink_ext.py                 |   2 -
 python/samba/gp_parse/gp_ini.py                    |   4 +-
 python/samba/graph.py                              |   2 +-
 python/samba/join.py                               |  14 +-
 python/samba/kcc/kcc_utils.py                      |   4 +-
 python/samba/mdb_util.py                           |   1 -
 python/samba/netcmd/domain/level.py                |   1 -
 python/samba/netcmd/gpo.py                         |   8 +-
 python/samba/ntacls.py                             |   2 +-
 python/samba/policies.py                           |   5 +-
 python/samba/provision/__init__.py                 |   6 -
 python/samba/provision/sambadns.py                 |   4 -
 python/samba/remove_dc.py                          |   6 +-
 python/samba/safe_tarfile.py                       |   2 +-
 python/samba/samdb.py                              |   2 +-
 python/samba/subunit/__init__.py                   |   1 -
 python/samba/tests/__init__.py                     |   6 +-
 python/samba/tests/common.py                       |   2 +-
 python/samba/tests/complex_expressions.py          |   2 +-
 python/samba/tests/compression.py                  |   2 -
 python/samba/tests/dcerpc/samr_change_password.py  |   1 -
 python/samba/tests/dns_aging.py                    |  19 +-
 python/samba/tests/dns_forwarder.py                |   2 +-
 python/samba/tests/domain_backup_offline.py        |   3 -
 python/samba/tests/dsdb_dns.py                     |   1 -
 python/samba/tests/dsdb_lock.py                    |   1 -
 python/samba/tests/getdcname.py                    |   5 +-
 python/samba/tests/gpo.py                          | 346 ++++++++++-----------
 python/samba/tests/gpo_member.py                   |   2 -
 python/samba/tests/krb5/compatability_tests.py     |  69 ----
 python/samba/tests/krb5/kdc_base_test.py           |  10 +-
 .../tests/krb5/{rodc_tests.py => kdc_tgt_tests.py} |  65 ++--
 python/samba/tests/krb5/raw_testcase.py            |  12 +
 python/samba/tests/krb5_credentials.py             |   2 +-
 python/samba/tests/ldap_upn_sam_account.py         |   4 +-
 python/samba/tests/ldap_whoami.py                  |   2 +-
 python/samba/tests/netlogonsvc.py                  |   1 -
 python/samba/tests/password_hash_ldap.py           |   1 -
 python/samba/tests/safe_tarfile.py                 |   1 -
 python/samba/tests/samba_startup_fl_change.py      |   3 +-
 python/samba/tests/samba_tool/gpo.py               |   8 +-
 python/samba/tests/samdb_api.py                    |   1 -
 python/samba/tests/security_descriptors.py         |   1 -
 python/samba/tests/smb-notify.py                   |   1 -
 python/samba/tests/smb1posix.py                    |   1 -
 python/samba/tests/smbconf.py                      |   2 +-
 python/samba/upgrade.py                            |   1 -
 python/samba/upgradehelpers.py                     |   2 +-
 selftest/knownfail_mit_kdc_1_20                    |   1 -
 selftest/tap2subunit                               |  12 +-
 selftest/wscript                                   |  16 +-
 source4/dsdb/tests/python/acl_modify.py            |   2 +-
 source4/dsdb/tests/python/ad_dc_multi_bind.py      |  10 +-
 source4/dsdb/tests/python/deletetest.py            |   6 +-
 source4/dsdb/tests/python/ldap.py                  |   8 +-
 source4/dsdb/tests/python/ndr_pack_performance.py  |   8 -
 source4/dsdb/tests/python/notification.py          |   7 +-
 source4/dsdb/tests/python/priv_attrs.py            |  34 +-
 source4/dsdb/tests/python/rodc.py                  |   4 -
 source4/dsdb/tests/python/rodc_rwdc.py             |   3 +-
 source4/dsdb/tests/python/sort.py                  |   2 +-
 source4/dsdb/tests/python/subtree_rename.py        |   1 -
 source4/dsdb/tests/python/tombstone_reanimation.py |   1 -
 source4/dsdb/tests/python/user_account_control.py  |   6 +-
 third_party/heimdal_build/wscript_build            |   5 +-
 third_party/heimdal_build/wscript_configure        |   5 +-
 wscript                                            |  27 +-
 wscript_build                                      |   2 -
 wscript_configure_system_gnutls                    |   1 -
 wscript_configure_system_heimdal                   |   3 -
 wscript_configure_system_mitkrb5                   |  16 +-
 101 files changed, 784 insertions(+), 589 deletions(-)
 copy python/samba/tests/krb5/{rodc_tests.py => kdc_tgt_tests.py} (50%)


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/pkgconfig.py b/buildtools/wafsamba/pkgconfig.py
index b77bd618c89..417bf030fe4 100644
--- a/buildtools/wafsamba/pkgconfig.py
+++ b/buildtools/wafsamba/pkgconfig.py
@@ -5,7 +5,7 @@ from waflib import Build, Logs
 from samba_utils import SUBST_VARS_RECURSIVE, TO_LIST
 
 def subst_at_vars(task):
-    '''substiture @VAR@ style variables in a file'''
+    '''substitute @VAR@ style variables in a file'''
 
     s = task.inputs[0].read()
     # split on the vars
diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py
index 66adf40307e..80379d37a9c 100644
--- a/buildtools/wafsamba/samba_deps.py
+++ b/buildtools/wafsamba/samba_deps.py
@@ -360,7 +360,7 @@ def show_final_deps(bld, tgt_list):
 
 
 def add_samba_attributes(bld, tgt_list):
-    '''ensure a target has a the required samba attributes'''
+    '''ensure a target has the required samba attributes'''
 
     targets = LOCAL_CACHE(bld, 'TARGET_TYPE')
 
diff --git a/buildtools/wafsamba/samba_install.py b/buildtools/wafsamba/samba_install.py
index 2957e16c3da..a43d10398d3 100644
--- a/buildtools/wafsamba/samba_install.py
+++ b/buildtools/wafsamba/samba_install.py
@@ -188,7 +188,7 @@ def symlink_lib(self):
     blddir = os.path.dirname(self.bld.srcnode.abspath(self.bld.env))
     libpath = self.link_task.outputs[0].abspath(self.env)
 
-    # calculat the link target and put it in the environment
+    # calculate the link target and put it in the environment
     soext=""
     vnum = getattr(self, 'vnum', None)
     if vnum is not None:
diff --git a/buildtools/wafsamba/stale_files.py b/buildtools/wafsamba/stale_files.py
index 78efea424fd..ac2c2a74194 100644
--- a/buildtools/wafsamba/stale_files.py
+++ b/buildtools/wafsamba/stale_files.py
@@ -107,6 +107,7 @@ def replace_refill_task_list(self):
 
 def AUTOCLEANUP_STALE_FILES(bld):
     """automatically clean up any files in bin that shouldn't be there"""
+    global old_refill_task_list
     old_refill_task_list = Parallel.refill_task_list
     Parallel.refill_task_list = replace_refill_task_list
     Parallel.bld = bld
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 40c7b866fba..c14eb58c879 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -82,7 +82,7 @@ def ADD_INIT_FUNCTION(bld, subsystem, target, init_function):
         return
     bld.ASSERT(subsystem is not None, "You must specify a subsystem for init_function '%s'" % init_function)
     cache = LOCAL_CACHE(bld, 'INIT_FUNCTIONS')
-    if not subsystem in cache:
+    if subsystem not in cache:
         cache[subsystem] = []
     cache[subsystem].append( { 'TARGET':target, 'INIT_FUNCTION':init_function } )
 Build.BuildContext.ADD_INIT_FUNCTION = ADD_INIT_FUNCTION
@@ -303,7 +303,7 @@ def SAMBA_LIBRARY(bld, libname, source,
         else:
             bundled_name = libname.replace('_', '-')
     else:
-        assert (private_library == True and realname is None)
+        assert (private_library is True and realname is None)
         bundled_name = PRIVATE_NAME(bld, libname.replace('_', '-'))
         vnum = None
 
@@ -1058,7 +1058,7 @@ def copy_and_fix_perl_path(task):
     lineno = 0
     for line in source_file:
         newline = line
-        if lineno == 0 and task.env["PERL_SPECIFIED"] == True and line[:2] == "#!":
+        if lineno == 0 and task.env["PERL_SPECIFIED"] is True and line[:2] == "#!":
             newline = replacement_shebang
         elif pattern in line:
             newline = line.replace(pattern, replacement)
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 30cb366331a..99a623737f1 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -37,7 +37,7 @@ def options(opt):
                    help=(f'''comma separated list of bundled libraries.
 
 {Context.g_module.APPNAME} includes copies of externally maintained
-system libraries (such as popt, cmokca) as well as Samba-maintained
+system libraries (such as popt, cmocka) as well as Samba-maintained
 libraries that can be found on the system already (such as talloc,
 tdb).
 
@@ -99,7 +99,7 @@ versions of libraries that we include match that found on the system,
 before we will select not to 'bundle'.
 
 This option, possibly useful for packagers, allows that specified
-version to be overridden (say, if it is absolutely known that a the
+version to be overridden (say, if it is absolutely known that the
 newer version included in this tarball has no relevant changes).
 
 Use this with extreme care
@@ -539,7 +539,7 @@ def configure(conf):
         # conf.DEFINE('_XOPEN_SOURCE', 600, add_to_cflags=True)
 
     # we should use the PIC options in waf instead
-    # Some compilo didn't support -fPIC but just print a warning
+    # Some compiler didn't support -fPIC but just print a warning
     if conf.env['COMPILER_CC'] == "suncc":
         conf.ADD_CFLAGS('-KPIC', testflags=True)
         # we really want define here as we need to have this
@@ -552,7 +552,7 @@ def configure(conf):
 
     # On Solaris 8 with suncc (at least) the flags for the linker to define the name of the
     # library are not always working (if the command line is very very long and with a lot
-    # files)
+    # of files)
 
     if conf.env['COMPILER_CC'] == "suncc":
         save = conf.env['SONAME_ST']
@@ -615,7 +615,7 @@ struct foo bar = { .y = 'X', .x = 1 };
 
     # see if we need special largefile flags
     if not conf.CHECK_LARGEFILE():
-        raise Errors.WafError('Samba requires large file support support, but not available on this platform: sizeof(off_t) < 8')
+        raise Errors.WafError('Samba requires large file support, but not available on this platform: sizeof(off_t) < 8')
 
     if conf.env.HAVE_STDDEF_H and conf.env.HAVE_STDLIB_H:
         conf.DEFINE('STDC_HEADERS', 1)
@@ -632,7 +632,7 @@ struct foo bar = { .y = 'X', .x = 1 };
     else:
         conf.define('SHLIBEXT', "so", quote=True)
 
-    # First try a header check for cross-compile friendlyness
+    # First try a header check for cross-compile friendliness
     conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER
                         #define B __BYTE_ORDER
                         #elif defined(BYTE_ORDER)
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c
index bb491af5ada..49641957223 100644
--- a/lib/ldb/pyldb.c
+++ b/lib/ldb/pyldb.c
@@ -91,6 +91,9 @@ static PyObject *PyLdbBytes_FromStringAndSize(const char *msg, int size)
 	PyObject* result = NULL;
 	PyObject* args = NULL;
 	args = Py_BuildValue("(y#)", msg, size);
+	if (args == NULL) {
+		return NULL;
+	}
 	result = PyLdbBytesType.tp_new(&PyLdbBytesType, args, NULL);
 	Py_DECREF(args);
 	return result;
@@ -454,11 +457,29 @@ static struct ldb_result *PyLdbResult_AsResult(TALLOC_CTX *mem_ctx,
 	if (obj == Py_None)
 		return NULL;
 
+	if (!PyList_Check(obj)) {
+		PyErr_SetString(PyExc_ValueError, "Expected list of LDB results");
+		return NULL;
+	}
+
 	res = talloc_zero(mem_ctx, struct ldb_result);
+	if (res == NULL) {
+		PyErr_NoMemory();
+		return NULL;
+	}
 	res->count = PyList_Size(obj);
 	res->msgs = talloc_array(res, struct ldb_message *, res->count);
+	if (res->msgs == NULL) {
+		talloc_free(res);
+		PyErr_NoMemory();
+		return NULL;
+	}
 	for (i = 0; i < res->count; i++) {
 		PyObject *item = PyList_GetItem(obj, i);
+		if (item == NULL) {
+			talloc_free(res);
+			return NULL;
+		}
 		res->msgs[i] = pyldb_Message_AsMessage(item);
 	}
 	return res;
@@ -889,35 +910,69 @@ static Py_ssize_t py_ldb_dn_len(PyLdbDnObject *self)
  */
 static PyObject *py_ldb_dn_copy(struct ldb_dn *dn)
 {
+	TALLOC_CTX *mem_ctx = NULL;
+	struct ldb_dn *new_dn = NULL;
 	PyLdbDnObject *py_ret;
 
+	mem_ctx = talloc_new(NULL);
+	if (mem_ctx == NULL) {
+		return PyErr_NoMemory();
+	}
+
+	new_dn = ldb_dn_copy(mem_ctx, dn);
+	if (new_dn == NULL) {
+		talloc_free(mem_ctx);
+		return PyErr_NoMemory();
+	}
+
 	py_ret = (PyLdbDnObject *)PyLdbDn.tp_alloc(&PyLdbDn, 0);
 	if (py_ret == NULL) {
+		talloc_free(mem_ctx);
 		PyErr_NoMemory();
 		return NULL;
 	}
-	py_ret->mem_ctx = talloc_new(NULL);
-	py_ret->dn = ldb_dn_copy(py_ret->mem_ctx, dn);
+	py_ret->mem_ctx = mem_ctx;
+	py_ret->dn = new_dn;
 	return (PyObject *)py_ret;
 }
 
 static PyObject *py_ldb_dn_concat(PyLdbDnObject *self, PyObject *py_other)
 {
+	TALLOC_CTX *mem_ctx = NULL;
 	struct ldb_dn *dn = pyldb_Dn_AS_DN((PyObject *)self),
 				  *other;
+	struct ldb_dn *new_dn = NULL;
 	PyLdbDnObject *py_ret;
 
 	if (!pyldb_Object_AsDn(NULL, py_other, NULL, &other))
 		return NULL;
 
+	mem_ctx = talloc_new(NULL);
+	if (mem_ctx == NULL) {
+		return PyErr_NoMemory();
+	}
+
+	new_dn = ldb_dn_copy(mem_ctx, dn);
+	if (new_dn == NULL) {
+		talloc_free(mem_ctx);
+		return PyErr_NoMemory();
+	}
+
+	if (!ldb_dn_add_base(new_dn, other)) {
+		PyErr_SetString(PyExc_RuntimeError, "unable to concatenate DNs");
+		talloc_free(mem_ctx);
+		return NULL;
+	}
+
 	py_ret = (PyLdbDnObject *)PyLdbDn.tp_alloc(&PyLdbDn, 0);
 	if (py_ret == NULL) {
+		talloc_free(mem_ctx);
 		PyErr_NoMemory();
 		return NULL;
 	}
-	py_ret->mem_ctx = talloc_new(NULL);
-	py_ret->dn = ldb_dn_copy(py_ret->mem_ctx, dn);
-	ldb_dn_add_base(py_ret->dn, other);
+	py_ret->mem_ctx = mem_ctx;
+	py_ret->dn = new_dn;
+
 	return (PyObject *)py_ret;
 }
 
@@ -1208,6 +1263,7 @@ static int py_ldb_init(PyLdbObject *self, PyObject *args, PyObject *kwargs)
 		ret = ldb_connect(ldb, url, flags, options);
 		if (ret != LDB_SUCCESS) {
 			PyErr_SetLdbError(PyExc_LdbError, ret, ldb);
+			talloc_free(options);
 			return -1;
 		}
 	} else {
@@ -1220,20 +1276,29 @@ static int py_ldb_init(PyLdbObject *self, PyObject *args, PyObject *kwargs)
 
 static PyObject *py_ldb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
 {
+	TALLOC_CTX *mem_ctx = NULL;
 	PyLdbObject *ret;
 	struct ldb_context *ldb;
-	ret = (PyLdbObject *)type->tp_alloc(type, 0);
-	if (ret == NULL) {
+
+	mem_ctx = talloc_new(NULL);
+	if (mem_ctx == NULL) {
+		return PyErr_NoMemory();
+	}
+
+	ldb = ldb_init(mem_ctx, NULL);
+	if (ldb == NULL) {
+		talloc_free(mem_ctx);
 		PyErr_NoMemory();
 		return NULL;
 	}
-	ret->mem_ctx = talloc_new(NULL);
-	ldb = ldb_init(ret->mem_ctx, NULL);
 
-	if (ldb == NULL) {
+	ret = (PyLdbObject *)type->tp_alloc(type, 0);
+	if (ret == NULL) {
+		talloc_free(mem_ctx);
 		PyErr_NoMemory();
 		return NULL;
 	}
+	ret->mem_ctx = mem_ctx;
 
 	ret->ldb_ctx = ldb;
 	return (PyObject *)ret;
@@ -1869,10 +1934,14 @@ static PyObject *py_ldb_write_ldif(PyLdbObject *self, PyObject *args)
 	ldif.changetype = changetype;
 
 	mem_ctx = talloc_new(NULL);
+	if (mem_ctx == NULL) {
+		return PyErr_NoMemory();
+	}
 
 	string = ldb_ldif_write_string(pyldb_Ldb_AS_LDBCONTEXT(self), mem_ctx, &ldif);
 	if (!string) {
 		PyErr_SetString(PyExc_KeyError, "Failed to generate LDIF");
+		talloc_free(mem_ctx);
 		return NULL;
 	}
 
@@ -1901,6 +1970,11 @@ static PyObject *py_ldb_parse_ldif(PyLdbObject *self, PyObject *args)
 	}
 
 	list = PyList_New(0);
+	if (list == NULL) {
+		talloc_free(mem_ctx);
+		return NULL;
+	}
+
 	while (s && *s != '\0') {
 		ldif = ldb_ldif_read_string(self->ldb_ctx, &s);
 		talloc_steal(mem_ctx, ldif);
@@ -1999,6 +2073,7 @@ static PyObject *py_ldb_msg_diff(PyLdbObject *self, PyObject *args)
 
 	diff = ldb_msg_copy(mem_ctx, diff);
 	if (diff == NULL) {
+		talloc_free(mem_ctx);
 		PyErr_NoMemory();
 		return NULL;
 	}
@@ -2616,15 +2691,29 @@ static PyMethodDef py_ldb_methods[] = {
 
 static PyObject *PyLdbModule_FromModule(struct ldb_module *mod)
 {
+	TALLOC_CTX *mem_ctx = NULL;
+	struct ldb_module *mod_ref = NULL;
 	PyLdbModuleObject *ret;
 
+	mem_ctx = talloc_new(NULL);
+	if (mem_ctx == NULL) {
+		return PyErr_NoMemory();
+	}
+
+	mod_ref = talloc_reference(mem_ctx, mod);
+	if (mod_ref == NULL) {
+		talloc_free(mem_ctx);
+		return PyErr_NoMemory();
+	}
+
 	ret = (PyLdbModuleObject *)PyLdbModule.tp_alloc(&PyLdbModule, 0);
 	if (ret == NULL) {
+		talloc_free(mem_ctx);
 		PyErr_NoMemory();
 		return NULL;
 	}
-	ret->mem_ctx = talloc_new(NULL);
-	ret->mod = talloc_reference(ret->mem_ctx, mod);
+	ret->mem_ctx = mem_ctx;
+	ret->mod = mod_ref;
 	return (PyObject *)ret;
 }
 
@@ -2685,15 +2774,29 @@ static PySequenceMethods py_ldb_seq = {
 
 static PyObject *PyLdb_FromLdbContext(struct ldb_context *ldb_ctx)
 {
+	TALLOC_CTX *mem_ctx = NULL;
+	struct ldb_context *ldb_ctx_ref = NULL;
 	PyLdbObject *ret;
 
+	mem_ctx = talloc_new(NULL);
+	if (mem_ctx == NULL) {
+		return PyErr_NoMemory();
+	}
+
+	ldb_ctx_ref = talloc_reference(mem_ctx, ldb_ctx);
+	if (ldb_ctx_ref == NULL) {
+		talloc_free(mem_ctx);
+		return PyErr_NoMemory();
+	}
+
 	ret = (PyLdbObject *)PyLdb.tp_alloc(&PyLdb, 0);
 	if (ret == NULL) {
+		talloc_free(mem_ctx);
 		PyErr_NoMemory();
 		return NULL;
 	}
-	ret->mem_ctx = talloc_new(NULL);
-	ret->ldb_ctx = talloc_reference(ret->mem_ctx, ldb_ctx);
+	ret->mem_ctx = mem_ctx;
+	ret->ldb_ctx = ldb_ctx_ref;
 	return (PyObject *)ret;
 }
 
@@ -3274,10 +3377,26 @@ static PyObject *ldb_msg_element_to_set(struct ldb_context *ldb_ctx,
 
 	/* Python << 2.5 doesn't have PySet_New and PySet_Add. */
 	result = PyList_New(me->num_values);
+	if (result == NULL) {
+		return NULL;
+	}
 
 	for (i = 0; i < me->num_values; i++) {
-		PyList_SetItem(result, i,
-			PyObject_FromLdbValue(&me->values[i]));
+		PyObject *obj = NULL;
+		int ret;
+
+		obj = PyObject_FromLdbValue(&me->values[i]);
+		if (obj == NULL) {
+			Py_DECREF(result);
+			return NULL;
+		}
+
+		ret = PyList_SetItem(result, i, obj);
+		if (ret) {
+			Py_DECREF(obj);
+			Py_DECREF(result);
+			return NULL;
+		}
 	}
 
 	return result;
@@ -3362,17 +3481,27 @@ static PyObject *py_ldb_msg_element_iter(PyLdbMessageElementObject *self)
 
 static PyObject *PyLdbMessageElement_FromMessageElement(struct ldb_message_element *el, TALLOC_CTX *mem_ctx)
 {
+	TALLOC_CTX *ret_mem_ctx = NULL;
 	PyLdbMessageElementObject *ret;
-	ret = PyObject_New(PyLdbMessageElementObject, &PyLdbMessageElement);
-	if (ret == NULL) {
+
+	ret_mem_ctx = talloc_new(NULL);
+	if (ret_mem_ctx == NULL) {
+		return PyErr_NoMemory();
+	}
+
+	if (talloc_reference(ret_mem_ctx, mem_ctx) == NULL) {
+		talloc_free(ret_mem_ctx);
 		PyErr_NoMemory();
 		return NULL;
 	}
-	ret->mem_ctx = talloc_new(NULL);
-	if (talloc_reference(ret->mem_ctx, mem_ctx) == NULL) {
+
+	ret = PyObject_New(PyLdbMessageElementObject, &PyLdbMessageElement);
+	if (ret == NULL) {
+		talloc_free(ret_mem_ctx);
 		PyErr_NoMemory();
 		return NULL;
 	}
+	ret->mem_ctx = ret_mem_ctx;
 	ret->el = el;
 	return (PyObject *)ret;
 }
@@ -3632,12 +3761,46 @@ static PyObject *py_ldb_msg_keys(PyLdbMessageObject *self,
 	struct ldb_message *msg = pyldb_Message_AsMessage(self);
 	Py_ssize_t i, j = 0;
 	PyObject *obj = PyList_New(msg->num_elements+(msg->dn != NULL?1:0));
+	if (obj == NULL) {
+		return NULL;
+	}
+
 	if (msg->dn != NULL) {
-		PyList_SetItem(obj, j, PyUnicode_FromString("dn"));
+		PyObject *py_dn = NULL;
+		int ret;
+
+		py_dn = PyUnicode_FromString("dn");
+		if (py_dn == NULL) {
+			Py_DECREF(obj);
+			return NULL;
+		}
+
+		ret = PyList_SetItem(obj, j, py_dn);
+		if (ret) {
+			Py_DECREF(py_dn);
+			Py_DECREF(obj);
+			return NULL;
+		}
+
 		j++;
 	}
 	for (i = 0; i < msg->num_elements; i++) {
-		PyList_SetItem(obj, j, PyUnicode_FromString(msg->elements[i].name));
+		PyObject *py_name = NULL;
+		int ret;
+
+		py_name = PyUnicode_FromString(msg->elements[i].name);
+		if (py_name == NULL) {
+			Py_DECREF(obj);
+			return NULL;
+		}


-- 
Samba Shared Repository



More information about the samba-cvs mailing list