[SCM] Samba Shared Repository - branch v4-8-test updated

Karolin Seeger kseeger at samba.org
Wed Jun 20 11:54:02 UTC 2018


The branch, v4-8-test has been updated
       via  7f32430 python: Fix talloc frame use in make_simple_acl().
       via  6121a6f s3: smbd: printing: Re-implement delete-on-close semantics for print files missing since 3.5.x.
       via  e5ffffd s3: torture: Add DELETE-PRINT test.
       via  0e3d52f lib: Fix array size in audit_logging
       via  fd83672 s4:ntvfs: Fix string copy of share_name
       via  15c13f7 lib:util: Fix size types in debug.c
       via  05dab79 lib:util: Fix parameter aliasing in tfork test
       via  ca1aced s3:winbind: Fix uninitialzed variable warning
       via  aa833e8 s3:passdb: Fix size of ascii_p16
       via  aff1261 s3:lib: Use memcpy() in escape_ldap_string()
       via  3ef6d6a s4:torture: Use strlcpy() in gen_name()
       via  c16e479 lib:util: Fix string check in mkdir_p()
       via  3e42a24 s3-utils: fix format-truncation in smbpasswd
       via  23f19c8 s4-torture: fix format-truncation warning in smb2 session tests.
       via  1b420a2 s3-printing: fix format-truncation in print_queue_update()
       via  35de20b s3-winbindd: remove unused fill_domain_username()
       via  c70a0d5 s3-winbindd: use fill_domain_username_talloc() in winbind.
       via  c5f3606 s4-heimdal: Fix the format-truncation errors.
       via  2839bf2 s3: smbtorture: Add new SMB2-DIR-FSYNC test to show behavior of FSYNC on directories.
       via  ce89931 s3: smbd: Fix SMB2-FLUSH against directories.
      from  a7a51bd smbd: Flush dfree memcache on service reload

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


- Log -----------------------------------------------------------------
commit 7f32430cb99fdae882889b8dc460883dc1511906
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Jun 14 14:08:36 2018 -0700

    python: Fix talloc frame use in make_simple_acl().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13474
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    This was fixed differently by commit
    539f51f0dfbe4ce317a2978982fd0fc9a7fd6922 in master.
    
    Autobuild-User(v4-8-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-8-test): Wed Jun 20 13:53:29 CEST 2018 on sn-devel-144

commit 6121a6fec193b28e04329a4fde4ea058b9b7cfec
Author: Jeremy Allison <jra at samba.org>
Date:   Thu May 31 10:35:48 2018 -0700

    s3: smbd: printing: Re-implement delete-on-close semantics for print files missing since 3.5.x.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13457
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Fri Jun  1 20:32:03 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 364175b359f018c8641359440fa07b0ea567b045)

commit e5ffffddfe580698624c832ad9b2e32c93fd5974
Author: Jeremy Allison <jra at samba.org>
Date:   Thu May 31 10:18:21 2018 -0700

    s3: torture: Add DELETE-PRINT test.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13457
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit 42f049858f2037aab5b2097036db3e0375fdbf30)

commit 0e3d52f547805a2ee0ea5389ced05b5237fb0eac
Author: Andreas Schneider <asn at samba.org>
Date:   Wed May 16 13:59:55 2018 +0200

    lib: Fix array size in audit_logging
    
    ../lib/audit_logging/audit_logging.c: In function ‘json_add_timestamp’:
    ../lib/audit_logging/audit_logging.c:603:12: error: ‘%s’ directive
           output may be truncated writing up to 9 bytes into a region of size
           between 0 and 43 [-Werror=format-truncation=]
       "%s.%06ld%s",
                ^~
    ../lib/audit_logging/audit_logging.c:606:3:
       tz);
       ~~
    ../lib/audit_logging/audit_logging.c:600:2: note: ‘snprintf’ output
           between 8 and 70 bytes into a destination of size 50
      snprintf(
      ^~~~~~~~~
       timestamp,
       ~~~~~~~~~~
       sizeof(timestamp),
       ~~~~~~~~~~~~~~~~~~
       "%s.%06ld%s",
       ~~~~~~~~~~~~~
       buffer,
       ~~~~~~~
       tv.tv_usec,
       ~~~~~~~~~~~
       tz);
       ~~~
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    
    (cherry picked from commit 8b7c8eb3907e2123acee67949e88c26072afc81a)

commit fd836721cf2a3d4e08f7fa6486aa98c306a6f8cb
Author: Andreas Schneider <asn at samba.org>
Date:   Tue May 15 17:55:22 2018 +0200

    s4:ntvfs: Fix string copy of share_name
    
    ../source4/ntvfs/ipc/rap_server.c:70:3: error: ‘strncpy’ specified bound 13 equals destination size [-Werror=stringop-truncation]
       strncpy((char *)r->out.info[j].info1.share_name,
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        snames[i],
        ~~~~~~~~~~
        sizeof(r->out.info[0].info1.share_name));
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    (cherry picked from commit 609ef35c12900bbd5ecaa557f7b5d71b5784a103)

commit 15c13f7372ca6c980d38a3be83225eb3cfd18f21
Author: Andreas Schneider <asn at samba.org>
Date:   Tue May 8 09:31:51 2018 +0200

    lib:util: Fix size types in debug.c
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    (cherry picked from commit fb6cd9c44ac6fcc9f6abe3b63fc742aeac42969a)

commit 05dab794c2f15701f5ecb3909e4fa714b74c16c8
Author: Andreas Schneider <asn at samba.org>
Date:   Wed May 9 17:52:19 2018 +0200

    lib:util: Fix parameter aliasing in tfork test
    
    ../lib/util/tests/tfork.c:483:24: error: passing argument 1 to
        restrict-qualified parameter aliases with argument 4 [-Werror=restrict]
       ret = pthread_create(&threads[i],
                            ^~~~~~~~~~~
    ../lib/util/tests/tfork.c:486:10:
              (void *)&threads[i]);
              ~~~~~~~~~~~~~~~~~~~
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    (cherry picked from commit 6f06a0154f5769cb85f6e189eecd78cd7805090a)

commit ca1acededa6905927c7768e1a33bee5358013ebe
Author: Andreas Schneider <asn at samba.org>
Date:   Wed May 9 18:07:47 2018 +0200

    s3:winbind: Fix uninitialzed variable warning
    
    Raised by GCC8.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    (cherry picked from commit 6b728b87bf5726f14100d76956c3df3fd9bb1058)

commit aa833e8b00cf5ce0b363328a20f42390e0ea63d1
Author: Andreas Schneider <asn at samba.org>
Date:   Wed May 9 18:05:01 2018 +0200

    s3:passdb: Fix size of ascii_p16
    
    ../source3/passdb/pdb_smbpasswd.c: In function ‘mod_smbfilepwd_entry’:
    ../source3/passdb/pdb_smbpasswd.c:1015:7: error: ‘:LCT-’ directive
        output may be truncated writing 5 bytes into a region of size between 0
        and 255 [-Werror=format-truncat ion=]
        "%s:LCT-%08X:",
           ^~~~~
    ../source3/passdb/pdb_smbpasswd.c:1015:4: note: using the range [0,
        4294967295] for directive argument
        "%s:LCT-%08X:",
        ^~~~~~~~~~~~~~
    In file included from ../source3/include/includes.h:23,
                     from ../source3/passdb/pdb_smbpasswd.c:23:
    ../lib/replace/../replace/replace.h:514:18: note: ‘snprintf’ output
        between 15 and 270 bytes into a destination of size 255
     #define slprintf snprintf
    ../source3/passdb/pdb_smbpasswd.c:1013:3: note: in expansion of macro ‘slprintf’
       slprintf(&ascii_p16[strlen(ascii_p16)],
       ^~~~~~~~
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    (cherry picked from commit 728297ca889b39ce2006778bf6a5bf1c3ce82d6d)

commit aff126166a1539504e0d471b890f28d21f649648
Author: Andreas Schneider <asn at samba.org>
Date:   Wed May 9 17:29:39 2018 +0200

    s3:lib: Use memcpy() in escape_ldap_string()
    
    ../source3/lib/ldap_escape.c: In function ‘escape_ldap_string’:
    ../source3/lib/ldap_escape.c:79:4: error: ‘strncpy’ output truncated
        before terminating nul copying 3 bytes from a string of the same length
    [-Werror=stringop-truncation]
        strncpy (p, sub, 3);
        ^~~~~~~~~~~~~~~~~~~
    
    We concatenat and do not care about NUL-termination till the loop has
    finished.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    (cherry picked from commit ff7568daaeb19ff30f47f7f600ead247eaf4e826)

commit 3ef6d6ab6dc1d8f220d0d9e3c8e47af682f3e115
Author: Andreas Schneider <asn at samba.org>
Date:   Wed May 9 17:35:45 2018 +0200

    s4:torture: Use strlcpy() in gen_name()
    
    ../source4/torture/basic/mangle_test.c: In function ‘gen_name’:
    ../source4/torture/basic/mangle_test.c:148:3: error: ‘strncpy’ output
        truncated before terminating nul copying 5 bytes from a string of the
        same length [-Werror=stringop-truncation]
       strncpy(p, "ABCDE", 5);
       ^~~~~~~~~~~~~~~~~~~~~~
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    (cherry picked from commit 7a00d90d668f53914ffe035c41a5e79e60b51521)

commit c16e479f49f5bf010f61a923435ca16393747340
Author: Andreas Schneider <asn at samba.org>
Date:   Tue May 8 09:22:00 2018 +0200

    lib:util: Fix string check in mkdir_p()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    (cherry picked from commit 7cec343a89a0862c09f5ddd4707eb442157a4af2)

commit 3e42a24ce882a90b3a5d567c47870f53d8e5f265
Author: Günther Deschner <gd at samba.org>
Date:   Tue May 8 14:13:56 2018 +0200

    s3-utils: fix format-truncation in smbpasswd
    
    ../source3/utils/smbpasswd.c: In function ‘process_root’:
    ../source3/utils/smbpasswd.c:414:37: error: ‘$’ directive output may be truncated writing 1 byte into a region of size between 0 and 255 [-Werror=format-truncation=]
       slprintf(buf, sizeof(buf) - 1, "%s$", user_name);
                                         ^
    In file included from ../source3/include/includes.h:23,
                     from ../source3/utils/smbpasswd.c:19:
    ../lib/replace/../replace/replace.h:514:18: note: ‘snprintf’ output between 2 and 257 bytes into a destination of size 255
     #define slprintf snprintf
    ../source3/utils/smbpasswd.c:414:3: note: in expansion of macro ‘slprintf’
       slprintf(buf, sizeof(buf) - 1, "%s$", user_name);
       ^~~~~~~~
    ../source3/utils/smbpasswd.c:397:35: error: ‘$’ directive output may be truncated writing 1 byte into a region of size between 0 and 255 [-Werror=format-truncation=]
       slprintf(buf, sizeof(buf)-1, "%s$", user_name);
                                       ^
    In file included from ../source3/include/includes.h:23,
                     from ../source3/utils/smbpasswd.c:19:
    ../lib/replace/../replace/replace.h:514:18: note: ‘snprintf’ output between 2 and 257 bytes into a destination of size 255
     #define slprintf snprintf
    ../source3/utils/smbpasswd.c:397:3: note: in expansion of macro ‘slprintf’
       slprintf(buf, sizeof(buf)-1, "%s$", user_name);
       ^~~~~~~~
    cc1: some warnings being treated as errors
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437
    
    Pair-Programmed-With: Andreas Schneider <asn at samba.org>
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Signed-off-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit 9b6dc8f504c406ed8a044e5becca7e8f01da6c84)

commit 23f19c835e018b85918c0302407da114e9738e31
Author: Günther Deschner <gd at samba.org>
Date:   Tue May 8 13:54:53 2018 +0200

    s4-torture: fix format-truncation warning in smb2 session tests.
    
    ../source4/torture/smb2/session.c: In function ‘test_session_reauth5’:
    ../source4/torture/smb2/session.c:645:36: error: ‘\file.dat’ directive output may be truncated writing 9 bytes into a region of size between 1 and 256 [-Werror=format-truncation=]
      snprintf(fname, sizeof(fname), "%s\\file.dat", dname);
                                        ^~~~~~~~~~
    ../source4/torture/smb2/session.c:645:2: note: ‘snprintf’ output between 10 and 265 bytes into a destination of size 256
      snprintf(fname, sizeof(fname), "%s\\file.dat", dname);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../source4/torture/smb2/session.c:696:38: error: ‘\file2.dat’ directive output may be truncated writing 10 bytes into a region of size between 1 and 256 [-Werror=format-truncation=]
      snprintf(fname2, sizeof(fname2), "%s\\file2.dat", dname);
                                          ^~~~~~~~~~~
    ../source4/torture/smb2/session.c:696:2: note: ‘snprintf’ output between 11 and 266 bytes into a destination of size 256
      snprintf(fname2, sizeof(fname2), "%s\\file2.dat", dname);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: some warnings being treated as errors
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit 5729898248041794ffdd0b769332e015baf12cce)

commit 1b420a212e38760d801449932d1905cd74f98979
Author: Günther Deschner <gd at samba.org>
Date:   Tue May 8 13:46:11 2018 +0200

    s3-printing: fix format-truncation in print_queue_update()
    
    ../source3/printing/printing.c: In function ‘print_queue_update’:
    ../source3/printing/printing.c:1809:42: error: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 244 [-Werror=format-truncation=]
      snprintf(key, sizeof(key), "MSG_PENDING/%s", sharename);
                                              ^~   ~~~~~~~~~
    ../source3/printing/printing.c:1809:2: note: ‘snprintf’ output between 13 and 268 bytes into a destination of size 256
      snprintf(key, sizeof(key), "MSG_PENDING/%s", sharename);
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit 6326b3415f3e225aafd5912d0965c80abcd7b22c)

commit 35de20bd3c7f5f4e73dda5070da05b0d081c3090
Author: Günther Deschner <gd at samba.org>
Date:   Tue May 8 11:19:42 2018 +0200

    s3-winbindd: remove unused fill_domain_username()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit b24d4eb7afad82afc3a9bab65e1d799edc4b5172)

commit c70a0d52afbfb600ce2c060379c66d3280b7d5fc
Author: Günther Deschner <gd at samba.org>
Date:   Tue May 8 11:18:56 2018 +0200

    s3-winbindd: use fill_domain_username_talloc() in winbind.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit 3c6481d75cea175d0a69988577163efb40e2316b)

commit c5f3606ca2574fc4e16b51eb857aafd8912f12a2
Author: Günther Deschner <gd at samba.org>
Date:   Wed May 30 09:27:49 2018 +0200

    s4-heimdal: Fix the format-truncation errors.
    
    ../source4/heimdal/lib/com_err/compile_et.c: In function ‘generate_h’:
    ../source4/heimdal/lib/com_err/compile_et.c:138:33: error: ‘%s’ directive output may be truncated writing up to 127 bytes into a region of size 126 [-Werror=format-truncation=]
         snprintf(fn, sizeof(fn), "__%s__", hfn);
                                     ^~     ~~~
    ../source4/heimdal/lib/com_err/compile_et.c:138:5: note: ‘snprintf’ output between 5 and 132 bytes into a destination of size 128
         snprintf(fn, sizeof(fn), "__%s__", hfn);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../source4/heimdal/lib/com_err/compile_et.c: In function ‘main’:
    ../source4/heimdal/lib/com_err/compile_et.c:234:35: error: ‘.h’ directive output may be truncated writing 2 bytes into a region of size between 1 and 128 [-Werror=format-truncation=]
         snprintf(hfn, sizeof(hfn), "%s.h", Basename);
                                       ^~
    ../source4/heimdal/lib/com_err/compile_et.c:234:5: note: ‘snprintf’ output between 3 and 130 bytes into a destination of size 128
         snprintf(hfn, sizeof(hfn), "%s.h", Basename);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../source4/heimdal/lib/com_err/compile_et.c:235:35: error: ‘.c’ directive output may be truncated writing 2 bytes into a region of size between 1 and 128 [-Werror=format-truncation=]
         snprintf(cfn, sizeof(cfn), "%s.c", Basename);
                                       ^~
    ../source4/heimdal/lib/com_err/compile_et.c:235:5: note: ‘snprintf’ output between 3 and 130 bytes into a destination of size 128
         snprintf(cfn, sizeof(cfn), "%s.c", Basename);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: some warnings being treated as errors
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Fri Jun  8 13:23:51 CEST 2018 on sn-devel-144

commit 2839bf2ea38a63bebae88611a5766c9d0351d8d3
Author: Jeremy Allison <jra at samba.org>
Date:   Thu May 10 11:30:24 2018 -0700

    s3: smbtorture: Add new SMB2-DIR-FSYNC test to show behavior of FSYNC on directories.
    
    Tests against a directory handle on the root of a share,
    and a directory handle on a sub-directory in a share.
    
    Check SEC_DIR_ADD_FILE and SEC_DIR_ADD_SUBDIR separately,
    either allows flush to succeed.
    
    Passes against Windows.
    
    Regression test for:
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13428
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Fri May 18 02:38:50 CEST 2018 on sn-devel-144
    
    (cherry picked from commit d42f467a25e75e5487a00378609a24809ddc83ee)

commit ce89931796ff0fc52c16b8d9595f83e10e1e80dd
Author: Jeremy Allison <jra at samba.org>
Date:   Thu May 10 10:26:52 2018 -0700

    s3: smbd: Fix SMB2-FLUSH against directories.
    
    Directories opened with either FILE_ADD_FILE or
    FILE_ADD_SUBDIRECTORY can be flushed even if
    they're not writable in the conventional sense.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13428
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 42aadf42f27053e621f2a6b72448afebb3f5082a)

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

Summary of changes:
 auth/auth_log.c                          |   2 +-
 lib/util/debug.c                         |  14 +-
 lib/util/mkdir_p.c                       |   4 +-
 lib/util/tests/tfork.c                   |   7 +-
 selftest/knownfail                       |   1 +
 source3/lib/ldap_escape.c                |   2 +-
 source3/passdb/pdb_smbpasswd.c           |   2 +-
 source3/printing/printing.c              |   2 +-
 source3/printing/printspoolss.c          |  17 ++
 source3/script/tests/test_smbspool.sh    |  63 ++++++++
 source3/selftest/tests.py                |   2 +-
 source3/smbd/pysmbd.c                    |  49 +++---
 source3/smbd/smb2_flush.c                |  26 ++-
 source3/torture/proto.h                  |   1 +
 source3/torture/test_smb2.c              | 270 +++++++++++++++++++++++++++++++
 source3/torture/torture.c                |  74 +++++++++
 source3/utils/smbpasswd.c                |  49 +++---
 source3/winbindd/wb_getpwsid.c           |  15 +-
 source3/winbindd/wb_query_user_list.c    |   9 +-
 source3/winbindd/winbindd_group.c        |  12 +-
 source3/winbindd/winbindd_list_groups.c  |  14 +-
 source3/winbindd/winbindd_pam.c          |  13 +-
 source3/winbindd/winbindd_proto.h        |   1 -
 source3/winbindd/winbindd_util.c         |  20 ---
 source4/heimdal/lib/com_err/compile_et.c |   6 +-
 source4/ntvfs/ipc/rap_server.c           |   9 +-
 source4/torture/basic/mangle_test.c      |   2 +-
 source4/torture/smb2/session.c           |   2 +-
 28 files changed, 576 insertions(+), 112 deletions(-)


Changeset truncated at 500 lines:

diff --git a/auth/auth_log.c b/auth/auth_log.c
index d4c6c44..72d8f81 100644
--- a/auth/auth_log.c
+++ b/auth/auth_log.c
@@ -350,7 +350,7 @@ static void add_version(struct json_context *context, int major, int minor)
 static void add_timestamp(struct json_context *context)
 {
 	char buffer[40];	/* formatted time less usec and timezone */
-	char timestamp[50];	/* the formatted ISO 8601 time stamp	 */
+	char timestamp[65];	/* the formatted ISO 8601 time stamp	 */
 	char tz[10];		/* formatted time zone			 */
 	struct tm* tm_info;	/* current local time			 */
 	struct timeval tv;	/* current system time			 */
diff --git a/lib/util/debug.c b/lib/util/debug.c
index d010b72..b58303e 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -480,8 +480,8 @@ static void debug_set_backends(const char *param)
 static void debug_backends_log(const char *msg, int msg_level)
 {
 	char msg_no_nl[FORMAT_BUFR_SIZE];
-	unsigned i;
-	int len;
+	size_t i;
+	size_t len;
 
 	/*
 	 * Some backends already add an extra newline, so also provide
@@ -551,7 +551,7 @@ static const char *default_classname_table[] = {
  */
 static const int debug_class_list_initial[ARRAY_SIZE(default_classname_table)];
 
-static int debug_num_classes = 0;
+static size_t debug_num_classes = 0;
 int     *DEBUGLEVEL_CLASS = discard_const_p(int, debug_class_list_initial);
 
 
@@ -630,7 +630,7 @@ utility lists registered debug class names's
 char *debug_list_class_names_and_levels(void)
 {
 	char *buf = NULL;
-	int i;
+	size_t i;
 	/* prepare strings */
 	for (i = 0; i < debug_num_classes; i++) {
 		buf = talloc_asprintf_append(buf,
@@ -651,7 +651,7 @@ char *debug_list_class_names_and_levels(void)
 
 static int debug_lookup_classname_int(const char* classname)
 {
-	int i;
+	size_t i;
 
 	if (!classname) return -1;
 
@@ -741,7 +741,7 @@ static int debug_lookup_classname(const char *classname)
 
 static void debug_dump_status(int level)
 {
-	int q;
+	size_t q;
 
 	DEBUG(level, ("INFO: Current debug levels:\n"));
 	for (q = 0; q < debug_num_classes; q++) {
@@ -790,7 +790,7 @@ bool debug_parse_levels(const char *params_str)
 	size_t str_len = strlen(params_str);
 	char str[str_len+1];
 	char *tok, *saveptr;
-	int i;
+	size_t i;
 
 	/* Just in case */
 	debug_init();
diff --git a/lib/util/mkdir_p.c b/lib/util/mkdir_p.c
index 290a1f3..87a3f79 100644
--- a/lib/util/mkdir_p.c
+++ b/lib/util/mkdir_p.c
@@ -49,11 +49,11 @@ int mkdir_p(const char *dir, int mode)
 
 	/* Create ancestors */
 	len = strlen(dir);
-	if (len >= PATH_MAX) {
+	ret = snprintf(t, sizeof(t), "%s", dir);
+	if (ret != len) {
 		errno = ENAMETOOLONG;
 		return -1;
 	}
-	strncpy(t, dir, len+1);
 
 	ret = mkdir_p(dirname(t), mode);
 	if (ret != 0) {
diff --git a/lib/util/tests/tfork.c b/lib/util/tests/tfork.c
index 9bcdc2f..3c73355 100644
--- a/lib/util/tests/tfork.c
+++ b/lib/util/tests/tfork.c
@@ -417,8 +417,7 @@ static void *tfork_thread(void *p)
 	struct tfork *t = NULL;
 	int status;
 	pid_t child;
-	pthread_t *ptid = (pthread_t *)p;
-	uint64_t tid;
+	uint64_t tid = (uint64_t)pthread_self();
 	uint64_t *result = NULL;
 	int up[2];
 	ssize_t nread;
@@ -429,8 +428,6 @@ static void *tfork_thread(void *p)
 		pthread_exit(NULL);
 	}
 
-	tid = (uint64_t)*ptid;
-
 	t = tfork_create();
 	if (t == NULL) {
 		pthread_exit(NULL);
@@ -480,7 +477,7 @@ static bool test_tfork_threads(struct torture_context *tctx)
 #endif
 
 	for (i = 0; i < num_threads; i++) {
-		ret = pthread_create(&threads[i], NULL, tfork_thread, &threads[i]);
+		ret = pthread_create(&threads[i], NULL, tfork_thread, NULL);
 		torture_assert_goto(tctx, ret == 0, ok, done,
 				    "pthread_create failed\n");
 	}
diff --git a/selftest/knownfail b/selftest/knownfail
index 710fd33..eaddaec 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -8,6 +8,7 @@
 .*driver.add_driver_timestamps # we only can store dates, not timestamps
  ^samba3.smbtorture_s3.crypt_server\(nt4_dc\).SMB2-SESSION-REAUTH # expected to give ACCESS_DENIED SMB2.1 doesn't have encryption
 ^samba3.smbtorture_s3.crypt_server\(nt4_dc\).SMB2-SESSION-RECONNECT # expected to give CONNECTION_DISCONNECTED, we need to fix the test
+^samba3.smbtorture_s3.*ad_dc_ntvfs.*SMB2-DIR-FSYNC.*
 ^samba3.smb2.session enc.reconnect # expected to give CONNECTION_DISCONNECTED, we need to fix the test
 ^samba3.raw.session enc # expected to give ACCESS_DENIED as SMB1 encryption isn't used
 ^samba3.smbtorture_s3.crypt_server # expected to give ACCESS_DENIED as SMB1 encryption isn't used
diff --git a/source3/lib/ldap_escape.c b/source3/lib/ldap_escape.c
index fa75dab..0d2b8f5 100644
--- a/source3/lib/ldap_escape.c
+++ b/source3/lib/ldap_escape.c
@@ -76,7 +76,7 @@ char *escape_ldap_string(TALLOC_CTX *mem_ctx, const char *s)
 			output = tmp;
 
 			p = &output[i];
-			strncpy (p, sub, 3);
+			memcpy(p, sub, 3);
 			p += 3;
 			i += 3;
 
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c
index 9c38147..ec184ca 100644
--- a/source3/passdb/pdb_smbpasswd.c
+++ b/source3/passdb/pdb_smbpasswd.c
@@ -741,7 +741,7 @@ static bool mod_smbfilepwd_entry(struct smbpasswd_privates *smbpasswd_state, con
 	char linebuf[LINEBUF_SIZE + 1];
 	char readbuf[1024];
 	int c;
-	fstring ascii_p16;
+	char ascii_p16[FSTRING_LEN + 20];
 	fstring encode_bits;
 	unsigned char *p = NULL;
 	size_t linebuf_len = 0;
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index e4bb1d8..38d7180 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -1693,7 +1693,7 @@ extern pid_t background_lpq_updater_pid;
 static void print_queue_update(struct messaging_context *msg_ctx,
 			       int snum, bool force)
 {
-	fstring key;
+	char key[268];
 	fstring sharename;
 	char *lpqcommand = NULL;
 	char *lprmcommand = NULL;
diff --git a/source3/printing/printspoolss.c b/source3/printing/printspoolss.c
index 6000202..9d565de 100644
--- a/source3/printing/printspoolss.c
+++ b/source3/printing/printspoolss.c
@@ -309,6 +309,23 @@ void print_spool_end(files_struct *fsp, enum file_close_type close_type)
 	WERROR werr;
 	struct dcerpc_binding_handle *b = NULL;
 
+	if (fsp->fh->private_options &
+	    NTCREATEX_OPTIONS_PRIVATE_DELETE_ON_CLOSE) {
+		int ret;
+
+		/*
+		 * Job was requested to be cancelled by setting
+		 * delete on close so truncate the job file.
+		 * print_job_end() which is called from
+		 * _spoolss_EndDocPrinter() will take
+		 * care of deleting it for us.
+		 */
+		ret = ftruncate(fsp->fh->fd, 0);
+		if (ret == -1) {
+			DBG_ERR("ftruncate failed: %s\n", strerror(errno));
+		}
+	}
+
 	b = fsp->conn->spoolss_pipe->binding_handle;
 
 	switch (close_type) {
diff --git a/source3/script/tests/test_smbspool.sh b/source3/script/tests/test_smbspool.sh
index 899b34d..d95ed06 100755
--- a/source3/script/tests/test_smbspool.sh
+++ b/source3/script/tests/test_smbspool.sh
@@ -22,6 +22,7 @@ incdir=`dirname $0`/../../../testprogs/blackbox
 samba_bindir="$BINDIR"
 samba_vlp="$samba_bindir/vlp"
 samba_smbspool="$samba_bindir/smbspool"
+samba_smbtorture3="$samba_bindir/smbtorture3"
 samba_smbspool_krb5="$samba_bindir/smbspool_krb5_wrapper"
 
 test_smbspool_noargs()
@@ -119,6 +120,64 @@ test_vlp_verify()
 	fi
 }
 
+test_delete_on_close()
+{
+	tdbfile="$PREFIX_ABS/$TARGET_ENV/lockdir/vlp.tdb"
+	if [ ! -w $tdbfile ]; then
+		echo "vlp tdbfile $tdbfile doesn't exist or is not writeable!"
+		return 1
+	fi
+
+	cmd='$samba_vlp tdbfile=$tdbfile lpq print1 2>&1'
+	eval echo "$cmd"
+	out=$(eval $cmd)
+	ret=$?
+	if [ $ret != 0 ]; then
+		echo "failed to lpq jobs on print1 with $samba_vlp"
+		echo "$out"
+		return 1
+	fi
+
+	num_jobs=$(echo "$out" | wc -l)
+	#
+	# Now run the test DELETE-PRINT from smbtorture3
+	#
+	cmd='$samba_smbtorture3 //$SERVER_IP/print1 -U$USERNAME%$PASSWORD DELETE-PRINT 2>&1'
+	eval echo "$cmd"
+	out_t=$(eval $cmd)
+	ret=$?
+	if [ $ret != 0 ]; then
+		echo "failed to run DELETE-PRINT on print1"
+		echo "$out_t"
+		return 1
+	fi
+
+	cmd='$samba_vlp tdbfile=$tdbfile lpq print1 2>&1'
+	eval echo "$cmd"
+	out1=$(eval $cmd)
+	ret=$?
+	if [ $ret != 0 ]; then
+		echo "(2) failed to lpq jobs on print1 with $samba_vlp"
+		echo "$out1"
+		return 1
+	fi
+	num_jobs1=$(echo "$out1" | wc -l)
+
+	#
+	# Number of jobs should not change. Job
+	# should not have made it to backend.
+	#
+	if [ "$num_jobs1" -ne "$num_jobs" ]; then
+		echo "delete-on-close fail $num_jobs1 -ne $num_jobs"
+		echo "$out"
+		echo "$out_t"
+		echo "$out1"
+		return 1
+	fi
+
+	return 0
+}
+
 testit "smbspool no args" \
 	test_smbspool_noargs $samba_smbspool || \
 	failed=$(expr $failed + 1)
@@ -180,4 +239,8 @@ testit "vlp verify example.ps" \
 	failed=$(expr $failed + 1)
 unset AUTH_INFO_REQUIRED
 
+testit "delete on close" \
+	test_delete_on_close \
+	|| failed=$(expr $failed + 1)
+
 exit $failed
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index ac21284..f43d2b1 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -78,7 +78,7 @@ tests = ["FDPASS", "LOCK1", "LOCK2", "LOCK3", "LOCK4", "LOCK5", "LOCK6", "LOCK7"
         "UID-REGRESSION-TEST", "SHORTNAME-TEST",
         "CASE-INSENSITIVE-CREATE", "SMB2-BASIC", "NTTRANS-FSCTL", "SMB2-NEGPROT",
         "SMB2-SESSION-REAUTH", "SMB2-SESSION-RECONNECT", "SMB2-FTRUNCATE",
-        "SMB2-ANONYMOUS",
+        "SMB2-ANONYMOUS", "SMB2-DIR-FSYNC",
         "CLEANUP1",
         "CLEANUP2",
         "CLEANUP4",
diff --git a/source3/smbd/pysmbd.c b/source3/smbd/pysmbd.c
index be30b86..41b44ad 100644
--- a/source3/smbd/pysmbd.c
+++ b/source3/smbd/pysmbd.c
@@ -268,101 +268,101 @@ static int set_acl_entry_perms(SMB_ACL_ENTRY_T entry, mode_t perm_mask)
 	return 0;
 }
 
-static SMB_ACL_T make_simple_acl(gid_t gid, mode_t chmod_mode)
+static SMB_ACL_T make_simple_acl(TALLOC_CTX *mem_ctx,
+			gid_t gid,
+			mode_t chmod_mode)
 {
-	TALLOC_CTX *frame = talloc_stackframe();
-
 	mode_t mode = SMB_ACL_READ|SMB_ACL_WRITE|SMB_ACL_EXECUTE;
 
 	mode_t mode_user = (chmod_mode & 0700) >> 6;
 	mode_t mode_group = (chmod_mode & 070) >> 3;
 	mode_t mode_other = chmod_mode &  07;
 	SMB_ACL_ENTRY_T entry;
-	SMB_ACL_T acl = sys_acl_init(frame);
+	SMB_ACL_T acl = sys_acl_init(mem_ctx);
 
 	if (!acl) {
 		return NULL;
 	}
 
 	if (sys_acl_create_entry(&acl, &entry) != 0) {
-		TALLOC_FREE(frame);
+		TALLOC_FREE(acl);
 		return NULL;
 	}
 
 	if (sys_acl_set_tag_type(entry, SMB_ACL_USER_OBJ) != 0) {
-		TALLOC_FREE(frame);
+		TALLOC_FREE(acl);
 		return NULL;
 	}
 
 	if (set_acl_entry_perms(entry, mode_user) != 0) {
-		TALLOC_FREE(frame);
+		TALLOC_FREE(acl);
 		return NULL;
 	}
 
 	if (sys_acl_create_entry(&acl, &entry) != 0) {
-		TALLOC_FREE(frame);
+		TALLOC_FREE(acl);
 		return NULL;
 	}
 
 	if (sys_acl_set_tag_type(entry, SMB_ACL_GROUP_OBJ) != 0) {
-		TALLOC_FREE(frame);
+		TALLOC_FREE(acl);
 		return NULL;
 	}
 
 	if (set_acl_entry_perms(entry, mode_group) != 0) {
-		TALLOC_FREE(frame);
+		TALLOC_FREE(acl);
 		return NULL;
 	}
 
 	if (sys_acl_create_entry(&acl, &entry) != 0) {
-		TALLOC_FREE(frame);
+		TALLOC_FREE(acl);
 		return NULL;
 	}
 
 	if (sys_acl_set_tag_type(entry, SMB_ACL_OTHER) != 0) {
-		TALLOC_FREE(frame);
+		TALLOC_FREE(acl);
 		return NULL;
 	}
 
 	if (set_acl_entry_perms(entry, mode_other) != 0) {
-		TALLOC_FREE(frame);
+		TALLOC_FREE(acl);
 		return NULL;
 	}
 
 	if (gid != -1) {
 		if (sys_acl_create_entry(&acl, &entry) != 0) {
-			TALLOC_FREE(frame);
+			TALLOC_FREE(acl);
 			return NULL;
 		}
 
 		if (sys_acl_set_tag_type(entry, SMB_ACL_GROUP) != 0) {
-			TALLOC_FREE(frame);
+			TALLOC_FREE(acl);
 			return NULL;
 		}
 
 		if (sys_acl_set_qualifier(entry, &gid) != 0) {
-			TALLOC_FREE(frame);
+			TALLOC_FREE(acl);
 			return NULL;
 		}
 
 		if (set_acl_entry_perms(entry, mode_group) != 0) {
-			TALLOC_FREE(frame);
+			TALLOC_FREE(acl);
 			return NULL;
 		}
 	}
 
 	if (sys_acl_create_entry(&acl, &entry) != 0) {
-		TALLOC_FREE(frame);
+		TALLOC_FREE(acl);
 		return NULL;
 	}
 
 	if (sys_acl_set_tag_type(entry, SMB_ACL_MASK) != 0) {
-		TALLOC_FREE(frame);
+		TALLOC_FREE(acl);
 		return NULL;
 	}
 
 	if (set_acl_entry_perms(entry, mode) != 0) {
-		TALLOC_FREE(frame);
+		TALLOC_FREE(acl);
 		return NULL;
 	}
 	return acl;
@@ -386,17 +386,20 @@ static PyObject *py_smbd_set_simple_acl(PyObject *self, PyObject *args, PyObject
 					 &fname, &mode, &gid, &service))
 		return NULL;
 
-	acl = make_simple_acl(gid, mode);
-
 	frame = talloc_stackframe();
 
+	acl = make_simple_acl(frame, gid, mode);
+	if (acl == NULL) {
+		TALLOC_FREE(frame);
+		return NULL;
+	}
+
 	conn = get_conn(frame, service);
 	if (!conn) {
 		return NULL;
 	}
 
 	ret = set_sys_acl_conn(fname, SMB_ACL_TYPE_ACCESS, acl, conn);
-	TALLOC_FREE(acl);
 
 	if (ret != 0) {
 		TALLOC_FREE(frame);
diff --git a/source3/smbd/smb2_flush.c b/source3/smbd/smb2_flush.c
index d1ab3a0..ef9b7fd 100644
--- a/source3/smbd/smb2_flush.c
+++ b/source3/smbd/smb2_flush.c
@@ -23,6 +23,7 @@
 #include "smbd/globals.h"
 #include "../libcli/smb/smb_common.h"
 #include "../lib/util/tevent_ntstatus.h"
+#include "libcli/security/security.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_SMB2
@@ -147,8 +148,29 @@ static struct tevent_req *smbd_smb2_flush_send(TALLOC_CTX *mem_ctx,
 	}
 
 	if (!CHECK_WRITE(fsp)) {
-		tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
-		return tevent_req_post(req, ev);
+		bool allow_dir_flush = false;
+		uint32_t flush_access = FILE_ADD_FILE | FILE_ADD_SUBDIRECTORY;
+
+		if (!fsp->is_directory) {
+			tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
+			return tevent_req_post(req, ev);
+		}
+
+		/*
+		 * Directories are not writable in the conventional
+		 * sense, but if opened with *either*
+		 * FILE_ADD_FILE or FILE_ADD_SUBDIRECTORY
+		 * they can be flushed.
+		 */
+
+		if ((fsp->access_mask & flush_access) != 0) {
+			allow_dir_flush = true;
+		}
+
+		if (allow_dir_flush == false) {
+			tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
+			return tevent_req_post(req, ev);
+		}
 	}
 
 	if (fsp->fh->fd == -1) {
diff --git a/source3/torture/proto.h b/source3/torture/proto.h
index 45870c9..1634da4 100644
--- a/source3/torture/proto.h
+++ b/source3/torture/proto.h
@@ -101,6 +101,7 @@ bool run_smb2_tcon_dependence(int dummy);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list