[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Fri Jun 17 02:19:01 UTC 2022


The branch, master has been updated
       via  eaf829ad0bf s4/torture/unix_info2: return NULL on failure
       via  8261545a0f6 bind_dlz: some commentary for b9_format
       via  f1017c6f2dd dns/dlz: remember old timestamp for dynamic records
       via  590d2e169c4 dlz_bind9: call dns_name_is_static before adding space for record
       via  aae68994536 tortures/dlz: more DNS update tests
       via  d0d18934fa0 torture: add torture_assertf()
       via  937c2cd38a6 torture/bind_dlz: return the right kind of failure
       via  5d89c90ab45 torture/dlz: minor reformatting for README.Coding
       via  9b47d818d04 torture/dlz: reserve test_ prefix for actual tests
       via  247a39bba04 torture/dlz: putrr callback recognises more than A records
       via  c7254de6fda util/debug: share classname table with tests
       via  1a6890a94d2 debug: add DBG_DEV()
       via  b94c805783e debug: drop an '#if _SAMBA_BUILD_ == 3'
       via  dfc9cf384de tests: rename logging test source
       via  ab949131b5f tests: adapt logging test for s3.
       via  c668b5caa92 tests: test source4 cmdline/smb.conf log level
       via  66cabb8fd1c s3/smbd: stdin fstat failure is a failure
       via  25ad724c014 s3:tests: Reformat test_symlink_traversal_smb2.sh
       via  fcedbfbbc61 s3:tests: Reformat test_symlink_traversal_smb1_posix.sh
       via  0714a6b435b s3:tests: Reformat test_symlink_traversal_smb1.sh
       via  8722450d09c s3:tests: Reformat test_symlink_rename_smb1_posix.sh
       via  b86936063ca s3:tests: Reformat test_success.sh
       via  1f94e871985 s3:tests: Reformat test_substitutions.sh
       via  ce6a31d2188 s3:tests: Reformat test_smbtorture_s3.sh
       via  7731fd6e3fa s3:tests: Reformat test_smbstatus.sh
       via  2eea4409b5c s3:tests: Reformat test_smbspool.sh
       via  627934bc2f0 s3:tests: Reformat test_smbpasswd.sh
       via  8b039153846 s3:tests: Reformat test_smbget.sh
       via  a1520e4e581 s3:tests: Reformat test_smbd_no_krb5.sh
       via  0754d46cd1a s3:tests: Reformat test_smbd_error.sh
       via  42e96b64b33 s3:tests: Reformat test_smbcquota.sh
       via  6368b82f976 s3:tests: Reformat test_smbclient_tarmode.sh
       via  69bb8853f61 s3: VFS: full_audit. Ensure the module doesn't load if an operation name is miss-spelled or otherwise unknown.
       via  ec91a583708 s3: VFS: full_audit: Use correct DBG_ print messages in init_bitmap().
       via  fe78d3c014d s3: test: Add tests to show we still connect to a full_audit share with a bad success or fail VFS names.
      from  e752f841e68 ctdb-daemon: Use DEBUG() macro for child logging

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


- Log -----------------------------------------------------------------
commit eaf829ad0bf4bddf84da2dee0e375e36b13ad76d
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Apr 14 11:47:57 2022 +1200

    s4/torture/unix_info2: return NULL on failure
    
    false is also NULL, but NULL is NULLer.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Fri Jun 17 02:18:32 UTC 2022 on sn-devel-184

commit 8261545a0f68bb24911d3f734b803a13d90f0acf
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Wed Apr 13 12:09:08 2022 +1200

    bind_dlz: some commentary for b9_format
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit f1017c6f2dd136d1654a8ed3734721fc8f3c5b82
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Wed Apr 13 15:20:50 2022 +1200

    dns/dlz: remember old timestamp for dynamic records
    
    If we don't tell dns_common_replace() the old timestamp, it will
    think the node is static because the timestamp is 0.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15040
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 590d2e169c4538a41ed1cd99f5cf72f4b6e6e424
Author: Michael Saxl <mike at mwsys.mine.bz>
Date:   Mon Apr 4 15:33:45 2022 +0200

    dlz_bind9: call dns_name_is_static before adding space for record
    
    dns_name_is_static is called after adding a uninitialized element to
    recs. There is a chance that the uninizialized memory reads a element
    with dwTimeStamp=0 and wType!=0. In that case dns_name_is_static will
    return true
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15040
    
    Signed-off-by: Michael Saxl <mike at mwsys.mine.bz>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit aae689945369cc47574a7cf90faa0e2f20b5b504
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Fri Apr 16 16:45:01 2021 +1200

    tortures/dlz: more DNS update tests
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15040
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d0d18934fa0660f85225f6a9387a4583f77bb780
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Apr 14 11:25:26 2022 +1200

    torture: add torture_assertf()
    
    Often we go 'torture_assert(tctx, expr, talloc_asprintf(tctx, "foo
    %s", foo));' which is just a pain.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15040
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 937c2cd38a6365924e0eaaa34b60815eced6126c
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Apr 14 11:40:43 2022 +1200

    torture/bind_dlz: return the right kind of failure
    
    torture_fail() is a macro that returns false, which evaluates to ISC_R_SUCCESS
    in int context.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15040
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 5d89c90ab45bdf0cc2236f71c02b05208fd715f3
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Sat Apr 24 16:17:46 2021 +1200

    torture/dlz: minor reformatting for README.Coding
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15040
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 9b47d818d04811afac9e4d34b0050c427112fb70
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Wed Apr 21 04:34:50 2021 +0000

    torture/dlz: reserve test_ prefix for actual tests
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15040
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 247a39bba046da0a507303a3b58db71ddd10fe0e
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Fri Apr 16 18:49:36 2021 +1200

    torture/dlz: putrr callback recognises more than A records
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15040
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c7254de6fdacbc9579bf727ac2686c7879d4ac92
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Jun 16 17:26:08 2022 +1200

    util/debug: share classname table with tests
    
    The executables generated from lib/util/tests/test_logging.c are used
    by the samba.tests.logfiles tests to test logging with various
    smb.confs that assign classes to various files at different levels
    etc.
    
    Previously test_logging.c had its own version of the table; now it
    shares one with debug.c
    
    We put the table in a sub-directory (lib/util/debug-classes/), because
    adding local_include=True to the wscript_build stanza causes the
    compiler confusion between <time.h> and lib/util/time.h.
    
    Note: there are still two other lists of the class names, in
    python/samba/tests/logfiles.py and
    docs-xml/smbdotconf/logging/loglevel.xml.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 1a6890a94d23ad15bddd07f2ed1dc5fa68d4cef1
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu May 26 15:55:12 2022 +1200

    debug: add DBG_DEV()
    
    This can be a useful macro when you are trying to track the behaviour
    of one process out of the dozens that samba starts up, and when your
    interest is in following it over time, not necessarily in a single
    stack.
    
    In DEVELOPER mode, if you call 'debug_developer_enable()' in the
    process you're following, then any instances of DBG_DEV() will work
    like DBG_ERR(), also adding ":DEV:12345:" where "12345" is the pid of
    th current process.
    
    Within debug.c itself, the macro always writes to stderr, because the
    debug.c functions are not all reentrant.
    
    When not in DEVELOPER MODE, the macro evaluates to nothing.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b94c805783ecb2ed5dccdeb3747575aec579883b
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu May 26 15:51:25 2022 +1200

    debug: drop an '#if _SAMBA_BUILD_ == 3'
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit dfc9cf384de3c658c05e229b53a76dbde86e780b
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Wed Jun 8 14:48:42 2022 +1200

    tests: rename logging test source
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ab949131b5f7ad8c272a95a023dd79ad1404133a
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Wed Jun 8 14:40:36 2022 +1200

    tests: adapt logging test for s3.
    
    There is one knownfail, where it seems an smb.conf like
    
       log file = foo
       log level = 2 tdb:2 at baa ldb:3
    
    will send the ldb logs to 'baa' instead of 'foo' (i.e., the last
    opened log file, rather than the default log file).
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c668b5caa92642fcb8feff423cee4ca67672dac6
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu May 26 17:19:51 2022 +1200

    tests: test source4 cmdline/smb.conf log level
    
    The 'log level' line in smb.conf allows messages from different log
    classes to be sent to different places, but we have not tested that
    this works. Now we do, somewhat.
    
    The test involves running a special binary based on a stripped down
    source4/samba/server.c that just starts up, parses the command line
    and a given smb.conf, then logs messages from multiple classes and
    exits.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 66cabb8fd1c756794f99f3cb33a7015d36b5ff03
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Fri Jun 3 14:56:10 2022 +1200

    s3/smbd: stdin fstat failure is a failure
    
    It seems we forgot we were in main.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 25ad724c0141c2fc3dc93fe5218f59fa5a4ad958
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Apr 22 15:34:11 2022 +0200

    s3:tests: Reformat test_symlink_traversal_smb2.sh
    
    shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit fcedbfbbc611fe6b7a967bc2e2320ecfb489f5e8
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Apr 22 15:34:11 2022 +0200

    s3:tests: Reformat test_symlink_traversal_smb1_posix.sh
    
    shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 0714a6b435b9939e1a05c78353b1e3a8a0fd3caf
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Apr 22 15:34:11 2022 +0200

    s3:tests: Reformat test_symlink_traversal_smb1.sh
    
    shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 8722450d09c7511433aab93d2025e1c68330ce0e
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Apr 22 15:34:11 2022 +0200

    s3:tests: Reformat test_symlink_rename_smb1_posix.sh
    
    shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b86936063caa91048932bd19d593b14c5a4f4a12
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Apr 22 15:34:11 2022 +0200

    s3:tests: Reformat test_success.sh
    
    shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 1f94e8719854db287a338d86564e64605ffa1e6d
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Apr 22 15:34:11 2022 +0200

    s3:tests: Reformat test_substitutions.sh
    
    shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ce6a31d218886679a82153b3f8d5fd42d266896d
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Apr 22 15:34:11 2022 +0200

    s3:tests: Reformat test_smbtorture_s3.sh
    
    shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 7731fd6e3fab54302d8fd3134c02ac7f9adea56d
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Apr 22 15:34:11 2022 +0200

    s3:tests: Reformat test_smbstatus.sh
    
    shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 2eea4409b5c31cc5a8a8223a371f1fe6c30e11ad
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Apr 22 15:34:11 2022 +0200

    s3:tests: Reformat test_smbspool.sh
    
    shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 627934bc2f01ea04f46d19f025f6c3b16110f553
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Apr 22 15:34:11 2022 +0200

    s3:tests: Reformat test_smbpasswd.sh
    
    shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 8b0391538460ab205456fa11d50ce94ddc766a11
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Apr 22 15:34:11 2022 +0200

    s3:tests: Reformat test_smbget.sh
    
    shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit a1520e4e5816c40c5e4ea090b61e53fd53b51cb3
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Apr 22 15:34:11 2022 +0200

    s3:tests: Reformat test_smbd_no_krb5.sh
    
    shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 0754d46cd1a9fa9250dc0a2db42477060002a33a
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Apr 22 15:34:11 2022 +0200

    s3:tests: Reformat test_smbd_error.sh
    
    shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 42e96b64b332fdfcaa7ca607c9403c4903827667
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Apr 22 15:34:11 2022 +0200

    s3:tests: Reformat test_smbcquota.sh
    
    shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 6368b82f976707c2a53421953833a54b81a5979c
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Apr 22 15:34:11 2022 +0200

    s3:tests: Reformat test_smbclient_tarmode.sh
    
    shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 69bb8853f61212074a7095055fb3570660a1cc27
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Jun 16 12:05:19 2022 -0700

    s3: VFS: full_audit. Ensure the module doesn't load if an operation name is miss-spelled or otherwise unknown.
    
    Document this new behavior. Remove knownfail.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15098
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ec91a583708c57d0da28da7b70e6366153129c64
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Jun 16 12:00:26 2022 -0700

    s3: VFS: full_audit: Use correct DBG_ print messages in init_bitmap().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15098
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit fe78d3c014d1756fe628175baeaa08c58e3e2f02
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Jun 16 11:57:58 2022 -0700

    s3: test: Add tests to show we still connect to a full_audit share with a bad success or fail VFS names.
    
    Add knownfail.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15098
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 docs-xml/manpages/vfs_full_audit.8.xml             |    5 +
 lib/torture/torture.h                              |   14 +
 lib/util/debug-classes/debug-classname-table.c     |   62 +
 lib/util/debug.c                                   |  133 ++-
 lib/util/debug.h                                   |   13 +
 lib/util/tests/test_logging.c                      |  146 +++
 lib/util/wscript_build                             |   19 +-
 python/samba/tests/logfiles.py                     |  381 ++++++
 selftest/knownfail.d/s3-logging                    |    1 +
 selftest/target/Samba3.pm                          |    8 +
 selftest/tests.py                                  |    1 +
 source3/modules/vfs_full_audit.c                   |   17 +-
 source3/script/tests/test_bad_auditnames.sh        |   29 +
 source3/script/tests/test_smbclient_tarmode.sh     |   61 +-
 source3/script/tests/test_smbcquota.sh             |   13 +-
 source3/script/tests/test_smbd_error.sh            |   16 +-
 source3/script/tests/test_smbd_no_krb5.sh          |   16 +-
 source3/script/tests/test_smbget.sh                |   77 +-
 source3/script/tests/test_smbpasswd.sh             |   20 +-
 source3/script/tests/test_smbspool.sh              |   74 +-
 source3/script/tests/test_smbstatus.sh             |  339 +++---
 source3/script/tests/test_smbtorture_s3.sh         |   10 +-
 source3/script/tests/test_substitutions.sh         |    4 +-
 source3/script/tests/test_success.sh               |    7 +-
 .../script/tests/test_symlink_rename_smb1_posix.sh |  181 ++-
 .../script/tests/test_symlink_traversal_smb1.sh    |  277 +++--
 .../tests/test_symlink_traversal_smb1_posix.sh     |  295 +++--
 .../script/tests/test_symlink_traversal_smb2.sh    |  277 +++--
 source3/selftest/tests.py                          |    6 +
 source3/smbd/server.c                              |    2 +-
 source4/dns_server/dlz_bind9.c                     |   28 +-
 source4/torture/dns/dlz_bind9.c                    | 1236 +++++++++++++++++++-
 source4/torture/unix/unix_info2.c                  |    2 +-
 33 files changed, 2848 insertions(+), 922 deletions(-)
 create mode 100644 lib/util/debug-classes/debug-classname-table.c
 create mode 100644 lib/util/tests/test_logging.c
 create mode 100644 python/samba/tests/logfiles.py
 create mode 100644 selftest/knownfail.d/s3-logging
 create mode 100755 source3/script/tests/test_bad_auditnames.sh


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages/vfs_full_audit.8.xml b/docs-xml/manpages/vfs_full_audit.8.xml
index fc08845ac3c..dcd71fa9b64 100644
--- a/docs-xml/manpages/vfs_full_audit.8.xml
+++ b/docs-xml/manpages/vfs_full_audit.8.xml
@@ -156,6 +156,11 @@
 	the VFS operations and none of the VFS operations respectively.
 	</para>
 
+	<para>If an unknown operation name is used (for example an operation name
+	is miss-spelled), the module will fail to load and clients will
+	be refused connections to a share using this module.
+	</para>
+
 	<para><command>vfs_full_audit</command> records operations in fixed
 	format consisting of fields separated by '|' characters. The
 	format is: </para>
diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index c95103072d2..ea34c15e0e9 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -273,6 +273,20 @@ void torture_result(struct torture_context *test,
 	} \
 } while(0)
 
+#define torture_assertf(torture_ctx, expr, format, ...) do {		\
+	if (!(expr)) {							\
+		char *_msg = talloc_asprintf(torture_ctx,		\
+					     format,			\
+					     __VA_ARGS__);		\
+		torture_result(torture_ctx,				\
+			       TORTURE_FAIL,				\
+			       __location__": Expression `%s' failed: %s", \
+			       __STRING(expr), _msg);			\
+		talloc_free(_msg);					\
+		return false;						\
+	}								\
+} while(0)
+
 #define torture_assert_goto(torture_ctx,expr,ret,label,cmt) do { \
 	if (!(expr)) { \
 		torture_result(torture_ctx, TORTURE_FAIL, __location__": Expression `%s' failed: %s", __STRING(expr), cmt); \
diff --git a/lib/util/debug-classes/debug-classname-table.c b/lib/util/debug-classes/debug-classname-table.c
new file mode 100644
index 00000000000..9062078165a
--- /dev/null
+++ b/lib/util/debug-classes/debug-classname-table.c
@@ -0,0 +1,62 @@
+/*
+   Unix SMB/CIFS implementation.
+   Samba utility functions
+   Copyright (C) Andrew Tridgell 1992-1998
+   Copyright (C) Elrond               2002
+   Copyright (C) Simo Sorce           2002
+
+   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/>.
+*/
+
+
+static const char *default_classname_table[] = {	
+	[DBGC_ALL] =			"all",
+	[DBGC_TDB] =			"tdb",
+	[DBGC_PRINTDRIVERS] =		"printdrivers",
+	[DBGC_LANMAN] =			"lanman",
+	[DBGC_SMB] =			"smb",
+	[DBGC_RPC_PARSE] =		"rpc_parse",
+	[DBGC_RPC_SRV] =		"rpc_srv",
+	[DBGC_RPC_CLI] =		"rpc_cli",
+	[DBGC_PASSDB] =			"passdb",
+	[DBGC_SAM] =			"sam",
+	[DBGC_AUTH] =			"auth",
+	[DBGC_WINBIND] =		"winbind",
+	[DBGC_VFS] =			"vfs",
+	[DBGC_IDMAP] =			"idmap",
+	[DBGC_QUOTA] =			"quota",
+	[DBGC_ACLS] =			"acls",
+	[DBGC_LOCKING] =		"locking",
+	[DBGC_MSDFS] =			"msdfs",
+	[DBGC_DMAPI] =			"dmapi",
+	[DBGC_REGISTRY] =		"registry",
+	[DBGC_SCAVENGER] =		"scavenger",
+	[DBGC_DNS] =			"dns",
+	[DBGC_LDB] =			"ldb",
+	[DBGC_TEVENT] =			"tevent",
+	[DBGC_AUTH_AUDIT] =		"auth_audit",
+	[DBGC_AUTH_AUDIT_JSON] =	"auth_json_audit",
+	[DBGC_KERBEROS] =       	"kerberos",
+	[DBGC_DRS_REPL] =       	"drs_repl",
+	[DBGC_SMB2] =           	"smb2",
+	[DBGC_SMB2_CREDITS] =   	"smb2_credits",
+	[DBGC_DSDB_AUDIT] =		"dsdb_audit",
+	[DBGC_DSDB_AUDIT_JSON] =	"dsdb_json_audit",
+	[DBGC_DSDB_PWD_AUDIT]  =	"dsdb_password_audit",
+	[DBGC_DSDB_PWD_AUDIT_JSON] =	"dsdb_password_json_audit",
+	[DBGC_DSDB_TXN_AUDIT]  =	"dsdb_transaction_audit",
+	[DBGC_DSDB_TXN_AUDIT_JSON] =	"dsdb_transaction_json_audit",
+	[DBGC_DSDB_GROUP_AUDIT] =	"dsdb_group_audit",
+	[DBGC_DSDB_GROUP_AUDIT_JSON] =	"dsdb_group_json_audit",
+};
diff --git a/lib/util/debug.c b/lib/util/debug.c
index 7f9231eac2e..24d8281d27f 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -124,46 +124,11 @@ struct debug_class {
 	ino_t ino;
 };
 
-static const char *default_classname_table[] = {
-	[DBGC_ALL] =			"all",
-	[DBGC_TDB] =			"tdb",
-	[DBGC_PRINTDRIVERS] =		"printdrivers",
-	[DBGC_LANMAN] =			"lanman",
-	[DBGC_SMB] =			"smb",
-	[DBGC_RPC_PARSE] =		"rpc_parse",
-	[DBGC_RPC_SRV] =		"rpc_srv",
-	[DBGC_RPC_CLI] =		"rpc_cli",
-	[DBGC_PASSDB] =			"passdb",
-	[DBGC_SAM] =			"sam",
-	[DBGC_AUTH] =			"auth",
-	[DBGC_WINBIND] =		"winbind",
-	[DBGC_VFS] =			"vfs",
-	[DBGC_IDMAP] =			"idmap",
-	[DBGC_QUOTA] =			"quota",
-	[DBGC_ACLS] =			"acls",
-	[DBGC_LOCKING] =		"locking",
-	[DBGC_MSDFS] =			"msdfs",
-	[DBGC_DMAPI] =			"dmapi",
-	[DBGC_REGISTRY] =		"registry",
-	[DBGC_SCAVENGER] =		"scavenger",
-	[DBGC_DNS] =			"dns",
-	[DBGC_LDB] =			"ldb",
-	[DBGC_TEVENT] =			"tevent",
-	[DBGC_AUTH_AUDIT] =		"auth_audit",
-	[DBGC_AUTH_AUDIT_JSON] =	"auth_json_audit",
-	[DBGC_KERBEROS] =       	"kerberos",
-	[DBGC_DRS_REPL] =       	"drs_repl",
-	[DBGC_SMB2] =           	"smb2",
-	[DBGC_SMB2_CREDITS] =   	"smb2_credits",
-	[DBGC_DSDB_AUDIT] =		"dsdb_audit",
-	[DBGC_DSDB_AUDIT_JSON] =	"dsdb_json_audit",
-	[DBGC_DSDB_PWD_AUDIT]  =	"dsdb_password_audit",
-	[DBGC_DSDB_PWD_AUDIT_JSON] =	"dsdb_password_json_audit",
-	[DBGC_DSDB_TXN_AUDIT]  =	"dsdb_transaction_audit",
-	[DBGC_DSDB_TXN_AUDIT_JSON] =	"dsdb_transaction_json_audit",
-	[DBGC_DSDB_GROUP_AUDIT] =	"dsdb_group_audit",
-	[DBGC_DSDB_GROUP_AUDIT_JSON] =	"dsdb_group_json_audit",
-};
+/*
+ * default_classname_table[] is read in from debug-classname-table.c
+ * so that test_logging.c can use it too.
+ */
+#include "lib/util/debug-classes/debug-classname-table.c"
 
 /*
  * This is to allow reading of dbgc_config before the debug
@@ -179,6 +144,72 @@ static struct debug_class *dbgc_config = debug_class_list_initial;
 static int current_msg_level = 0;
 static int current_msg_class = 0;
 
+/*
+ * DBG_DEV(): when and how to user it.
+ *
+ * As a developer, you sometimes want verbose logging between point A and
+ * point B, where the relationship between these points is not easily defined
+ * in terms of the call stack.
+ *
+ * For example, you might be interested in what is going on in functions in
+ * lib/util/util_str.c in an ldap worker process after a particular query. If
+ * you use gdb, something will time out and you won't get the full
+ * conversation. If you add fprintf() or DBG_ERR()s to util_str.c, you'll get
+ * a massive flood, and there's a chance one will accidentally slip into a
+ * release and the whole world will flood. DBG_DEV is a solution.
+ *
+ * On start-up, DBG_DEV() is switched OFF. Nothing is printed.
+ *
+ * 1. Add `DBG_DEV("formatted msg %d, etc\n", i);` where needed.
+ *
+ * 2. At each point you want to start debugging, add `debug_developer_enable()`.
+ *
+ * 3. At each point you want debugging to stop, add `debug_developer_disable()`.
+ *
+ * In DEVELOPER builds, the message will be printed at level 0, as with
+ * DBG_ERR(). In production builds, the macro resolves to nothing.
+ *
+ * The messages are printed with a "<function_name>:DEV:<pid>:" prefix.
+ */
+
+static bool debug_developer_is_enabled = false;
+
+bool debug_developer_enabled(void)
+{
+	return debug_developer_is_enabled;
+}
+
+/*
+ * debug_developer_disable() will turn DBG_DEV() on in the current
+ * process and children.
+ */
+void debug_developer_enable(void)
+{
+	debug_developer_is_enabled = true;
+}
+
+/*
+ * debug_developer_disable() will make DBG_DEV() do nothing in the current
+ * process (and children).
+ */
+void debug_developer_disable(void)
+{
+	debug_developer_is_enabled = false;
+}
+
+/*
+ * Within debug.c, DBG_DEV() always writes to stderr, because some functions
+ * here will attempt infinite recursion with normal DEBUG macros.
+ */
+#ifdef DEVELOPER
+#undef DBG_DEV
+#define DBG_DEV(fmt, ...)						\
+	(void)((debug_developer_enabled())				\
+	       && (fprintf(stderr, "%s:DEV:%d: " fmt "%s",		\
+			   __func__, getpid(), ##__VA_ARGS__, "")) )
+#endif
+
+
 #if defined(WITH_SYSLOG) || defined(HAVE_LIBSYSTEMD_JOURNAL) || defined(HAVE_LIBSYSTEMD)
 static int debug_level_to_priority(int level)
 {
@@ -1469,21 +1500,13 @@ void check_log_size( void )
 {
 	off_t maxlog;
 
-	/*
-	 *  We need to be root to check/change log-file, skip this and let the main
-	 *  loop check do a new check as root.
-	 */
-
-#if _SAMBA_BUILD_ == 3
-	if (geteuid() != sec_initial_uid())
-#else
-	if( geteuid() != 0)
-#endif
-	{
-		/* We don't check sec_initial_uid() here as it isn't
-		 * available in common code and we don't generally
-		 * want to rotate and the possibly lose logs in
-		 * make test or the build farm */
+	if (geteuid() != 0) {
+		/*
+		 * We need to be root to change the log file (tests use a fake
+		 * geteuid() from third_party/uid_wrapper). Otherwise we skip
+		 * this and let the main smbd loop or some other process do
+		 * the work.
+		 */
 		return;
 	}
 
diff --git a/lib/util/debug.h b/lib/util/debug.h
index 9aeec853e64..9f902863527 100644
--- a/lib/util/debug.h
+++ b/lib/util/debug.h
@@ -237,6 +237,16 @@ void debuglevel_set_class(size_t idx, int level);
 		&& (dbgtext("%s: ", __func__))				\
 		&& (dbgtext body) )
 
+
+#ifdef DEVELOPER
+#define DBG_DEV(...) \
+  (void)( (debug_developer_enabled())				\
+	  && (dbgtext("%s:DEV:%d: ", __func__, getpid()))	\
+	  && (dbgtext(__VA_ARGS__)) )
+#else
+#define DBG_DEV(...) /* DBG_DEV was here */
+#endif
+
 /*
  * Debug levels matching RFC 3164
  */
@@ -329,6 +339,9 @@ bool debug_get_output_is_stderr(void);
 bool debug_get_output_is_stdout(void);
 void debug_schedule_reopen_logs(void);
 char *debug_list_class_names_and_levels(void);
+bool debug_developer_enabled(void);
+void debug_developer_enable(void);
+void debug_developer_disable(void);
 
 typedef void (*debug_callback_fn)(void *private_ptr, int level, const char *msg);
 
diff --git a/lib/util/tests/test_logging.c b/lib/util/tests/test_logging.c
new file mode 100644
index 00000000000..9b13b052f25
--- /dev/null
+++ b/lib/util/tests/test_logging.c
@@ -0,0 +1,146 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   A test server that only does logging.
+
+   Copyright (C) Andrew Tridgell		1992-2005
+   Copyright (C) Martin Pool			2002
+   Copyright (C) Jelmer Vernooij		2002
+   Copyright (C) James J Myers 			2003 <myersjj at samba.org>
+   Copyright (C) Douglas Bagnall		2022
+
+   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/>.
+*/
+
+#include "includes.h"
+#include "lib/cmdline/cmdline.h"
+
+#ifdef USING_CMDLINE_S3
+#include "lib/util/debug_s3.h"
+#endif
+
+#define BINARY_NAME "test_s4_logging"
+
+static int log_level = 1;
+
+
+#include "lib/util/debug-classes/debug-classname-table.c"
+
+static int log_all_classes(int level)
+{
+	size_t i;
+	const char *name = NULL;
+	for (i = 0; i < ARRAY_SIZE(default_classname_table); i++) {
+		name = default_classname_table[i];
+		DEBUGC(i, level,
+		       ("logging for '%s' [%zu], at level %d\n",
+			name, i, level));
+
+		/*
+		 * That's it for the tests *here*. The invoker of this
+		 * process will have set up an smb.conf that directs the
+		 * output in particular ways, and will be looking to see that
+		 * happens correctly.
+		 */
+	}
+	return 0;
+}
+
+
+static int init_daemon(TALLOC_CTX *mem_ctx,
+		       int argc,
+		       const char *argv[],
+		       const char **error)
+{
+	poptContext pc;
+	int opt;
+	bool ok;
+	struct poptOption long_options[] = {
+		POPT_AUTOHELP
+		{
+			.longName   = "level",
+			.shortName  = 'L',
+			.argInfo    = POPT_ARG_INT,
+			.arg        = &log_level,
+			.descrip    = "log at this level",
+			.argDescrip = "LEVEL",
+		},
+		POPT_COMMON_SAMBA
+		POPT_COMMON_DAEMON
+		POPT_COMMON_VERSION
+		POPT_TABLEEND
+	};
+
+	setproctitle(BINARY_NAME);
+
+	ok = samba_cmdline_init(mem_ctx,
+				SAMBA_CMDLINE_CONFIG_SERVER,
+				true /* require_smbconf */);
+	if (!ok) {
+		*error = "Failed to init cmdline parser!\n";
+		return EINVAL;
+	}
+
+	pc = samba_popt_get_context(BINARY_NAME,
+				    argc,
+				    argv,
+				    long_options,
+				    0);
+	if (pc == NULL) {
+		*error = "Failed to setup popt context!\n";
+		return ENOTRECOVERABLE;
+	}
+
+	while((opt = poptGetNextOpt(pc)) != -1) {
+		fprintf(stderr, "\nInvalid option %s: %s\n\n",
+			poptBadOption(pc, 0), poptStrerror(opt));
+		poptPrintUsage(pc, stderr, 0);
+		return 1;
+	}
+
+	poptFreeContext(pc);
+
+#ifdef USING_CMDLINE_S3
+	reopen_logs();
+#endif
+	return 0;
+}
+
+
+int main(int argc, const char *argv[])
+{
+	int rc;
+	const char *error = NULL;
+	TALLOC_CTX *mem_ctx = talloc_stackframe();
+	if (mem_ctx == NULL) {
+		exit(ENOMEM);
+	}
+
+	setproctitle_init(argc, discard_const(argv), environ);
+
+	rc = init_daemon(mem_ctx, argc, argv, &error);
+	if (rc != 0) {
+		fprintf(stderr, "error [%d]: %s\n", rc, error);
+		exit_daemon(error, rc);
+	}
+
+	rc = log_all_classes(log_level);
+	if (rc != 0) {
+		fprintf(stderr, "error in log_all_classes [%d]\n", rc);
+		exit_daemon("logging error", rc);
+	}
+
+	TALLOC_FREE(mem_ctx);
+	return rc;
+}
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index e3fa3295b46..e2194e68e3e 100644
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -53,7 +53,7 @@ bld.SAMBA_LIBRARY('samba-debug',
                   deps='replace time-basic close-low-fd talloc socket-blocking' + samba_debug_add_deps,
                   public_deps='systemd systemd-journal lttng-ust',
                   local_include=False,
-                  includes=samba_debug_add_inc,
+                  includes='lib/util/debug-classes ' + samba_debug_add_inc,
                   private_library=True)
 
 bld.SAMBA_LIBRARY('socket-blocking',
@@ -367,3 +367,20 @@ else:
                      deps='cmocka replace samba-util',
                      local_include=False,
                      for_selftest=True)
+
+    bld.SAMBA_BINARY('test_s4_logging',
+                     source='tests/test_logging.c',
+                     deps=' '.join(['CMDLINE_S4',
+                                    'samba-util',
+                                    'popt']),
+                     local_include=False,
+                     for_selftest=True)
+
+    bld.SAMBA_BINARY('test_s3_logging',
+                     source='tests/test_logging.c',
+                     deps=' '.join(['CMDLINE_S3',
+                                    'samba-util',
+                                    'popt']),
+                     cflags="-D USING_CMDLINE_S3",
+                     local_include=False,
+                     for_selftest=True)
diff --git a/python/samba/tests/logfiles.py b/python/samba/tests/logfiles.py
new file mode 100644
index 00000000000..38c38045b8d
--- /dev/null
+++ b/python/samba/tests/logfiles.py
@@ -0,0 +1,381 @@
+# Unix SMB/CIFS implementation.
+#
+# Copyright (C) Catalyst.Net Ltd. 2022
+#
+# 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,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list