The branch, master has been updated
       via  f6f6263 torture/ioctl: test compression responses when unsupported
       via  7a10002 smbd/ioctl: match WS2016 ReFS get compression behaviour
       via  fb155a9 s3-rpcclient: Fix initializing rpcclient
       via  5148d3f s3-param: Add comment to call lp_load_global() after popt 
processing
       via  c7bcbd1 s3-utils: Fix loading smb.conf in smbcquotas
       via  fdf8471 s3-libnet: Pass enum value names to 
dcerpc_samr_SetUserInfo2()
       via  0e173d8 s4-libnet: Use SetUserInfo2 to set the account flags
      from  d02909f s3: lib: messaging. Add function comments I needed to 
understand this code.

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


- Log -----------------------------------------------------------------
commit f6f6263f1f03db965b64b5d7858e44ab5ffb0aeb
Author: David Disseldorp <[email protected]>
Date:   Tue Oct 4 01:15:20 2016 +0200

    torture/ioctl: test compression responses when unsupported
    
    Confirm that Samba matches Windows Server 2016 ReFS behaviour here.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=12144
    
    Reported-by: Nick Barrett
    Signed-off-by: David Disseldorp <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    
    Autobuild-User(master): Jeremy Allison <[email protected]>
    Autobuild-Date(master): Thu Oct  6 06:14:34 CEST 2016 on sn-devel-144

commit 7a1000222877cdbc8967122b9de29021a42f4c8a
Author: David Disseldorp <[email protected]>
Date:   Tue Oct 4 01:09:37 2016 +0200

    smbd/ioctl: match WS2016 ReFS get compression behaviour
    
    ReFS doesn't support compression, but responds to get-compression FSCTLs
    with a successful COMPRESSION_FORMAT_NONE response. set-compression
    results in NT_STATUS_NOT_SUPPORTED.
    
    This commit modifies Samba to match the ReFS behaviour, when run atop
    a VFS that doesn't expose compression support.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=12144
    
    Reported-by: Nick Barrett
    Signed-off-by: David Disseldorp <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit fb155a946d995de2c518d22bdb44f3d7f0b8dca3
Author: Andreas Schneider <[email protected]>
Date:   Wed Oct 5 08:39:20 2016 +0200

    s3-rpcclient: Fix initializing rpcclient
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 5148d3f4fa57ed040285ba38523e5fda7d6e3520
Author: Andreas Schneider <[email protected]>
Date:   Wed Oct 5 08:33:03 2016 +0200

    s3-param: Add comment to call lp_load_global() after popt processing
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit c7bcbd166d23b6ebcc2d968b76b0640b9a9beebb
Author: Andreas Schneider <[email protected]>
Date:   Wed Oct 5 08:22:54 2016 +0200

    s3-utils: Fix loading smb.conf in smbcquotas
    
    Pair-Programmed-With: Uri Simchoni <[email protected]>
    Signed-off-by: Andreas Schneider <[email protected]>
    Signed-off-by: Uri Simchoni <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit fdf84713781b8ca9ec8fcbd7ca82f49713908f57
Author: Andreas Schneider <[email protected]>
Date:   Tue Oct 4 18:14:50 2016 +0200

    s3-libnet: Pass enum value names to dcerpc_samr_SetUserInfo2()
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 0e173d8327890b93f44b358d8387b973174efe97
Author: Andreas Schneider <[email protected]>
Date:   Tue Oct 4 18:09:54 2016 +0200

    s4-libnet: Use SetUserInfo2 to set the account flags
    
    [MS-WKST] states that SetUserInfo2 should be used to set the account
    flags. We already call this a few lines down to set the password.
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

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

Summary of changes:
 selftest/knownfail                |  1 +
 source3/libnet/libnet_join.c      | 14 ++++----
 source3/param/loadparm.c          |  3 ++
 source3/rpcclient/rpcclient.c     | 26 ++++++++++----
 source3/smbd/smb2_ioctl_filesys.c | 29 ++++++++-------
 source3/utils/smbcquotas.c        | 15 ++++++--
 source4/torture/smb2/ioctl.c      | 76 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 135 insertions(+), 29 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/knownfail b/selftest/knownfail
index 076880f..976761b 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -173,6 +173,7 @@
 ^samba3.smb2.replay.replay3
 ^samba3.smb2.replay.replay4
 ^samba3.smb2.lock.*replay
+^samba4.smb2.ioctl.compress_notsup.*\(ad_dc_ntvfs\)
 ^samba3.raw.session.*reauth2 # maybe fix this?
 ^samba3.rpc.lsa.secrets.seal # This gives NT_STATUS_LOCAL_USER_SESSION_KEY
 ^samba3.rpc.samr.passwords.badpwdcount.samr.badPwdCount\(nt4_dc\) # We fail 
this test currently
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 86130ca..3ac7f39 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -1413,11 +1413,11 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX 
*mem_ctx,
        ZERO_STRUCT(user_info.info16);
        user_info.info16.acct_flags = acct_flags;
 
-       status = dcerpc_samr_SetUserInfo(b, mem_ctx,
-                                        &user_pol,
-                                        16,
-                                        &user_info,
-                                        &result);
+       status = dcerpc_samr_SetUserInfo2(b, mem_ctx,
+                                         &user_pol,
+                                         UserControlInformation,
+                                         &user_info,
+                                         &result);
        if (!NT_STATUS_IS_OK(status)) {
                dcerpc_samr_DeleteUser(b, mem_ctx,
                                       &user_pol,
@@ -1459,7 +1459,7 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX 
*mem_ctx,
 
        status = dcerpc_samr_SetUserInfo2(b, mem_ctx,
                                          &user_pol,
-                                         26,
+                                         UserInternal5InformationNew,
                                          &user_info,
                                          &result);
 
@@ -1476,7 +1476,7 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX 
*mem_ctx,
 
                status = dcerpc_samr_SetUserInfo2(b, mem_ctx,
                                                  &user_pol,
-                                                 24,
+                                                 UserInternal5Information,
                                                  &user_info,
                                                  &result);
        }
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index f282651..9306444 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -3903,6 +3903,9 @@ bool lp_load_initial_only(const char *pszFname)
 
 /**
  * most common lp_load wrapper, loading only the globals
+ *
+ * If this is used in a daemon or client utility it should be called
+ * after processing popt.
  */
 bool lp_load_global(const char *file_name)
 {
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 74ae708..3f7a8b7 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -905,6 +905,7 @@ out_free:
        char *user, *domain, *q;
        const char *host;
        int signing_state = SMB_SIGNING_IPC_DEFAULT;
+       bool ok;
 
        /* make sure the vars that get altered (4th field) are in
           a fixed location or certain compilers complain */
@@ -976,21 +977,32 @@ out_free:
        poptFreeContext(pc);
        popt_burn_cmdline_password(argc, argv);
 
-       if (!init_names()) {
+       /* Load smb.conf file */
+
+       ok = lp_load_global(get_dyn_CONFIGFILE());
+       if (!ok) {
+               fprintf(stderr,
+                       "Can't load %s - run testparm to debug it\n",
+                       get_dyn_CONFIGFILE());
                result = 1;
                goto done;
        }
 
-       /* Load smb.conf file */
-
-       if (!lp_load_global(get_dyn_CONFIGFILE()))
-               fprintf(stderr, "Can't load %s\n", get_dyn_CONFIGFILE());
+       rpcclient_msg_ctx = messaging_init(talloc_autofree_context(),
+                       samba_tevent_context_init(talloc_autofree_context()));
+       if (rpcclient_msg_ctx == NULL) {
+               fprintf(stderr, "Could not init messaging context\n");
+               result = 1;
+               goto done;
+       }
 
        /* We must load interfaces after we load the smb.conf */
        load_interfaces();
 
-       rpcclient_msg_ctx = messaging_init(talloc_autofree_context(),
-                       samba_tevent_context_init(talloc_autofree_context()));
+       if (!init_names()) {
+               result = 1;
+               goto done;
+       }
 
        /*
         * Get password
diff --git a/source3/smbd/smb2_ioctl_filesys.c 
b/source3/smbd/smb2_ioctl_filesys.c
index 6e4a785..55ce3f2 100644
--- a/source3/smbd/smb2_ioctl_filesys.c
+++ b/source3/smbd/smb2_ioctl_filesys.c
@@ -48,19 +48,24 @@ static NTSTATUS fsctl_get_cmprn(TALLOC_CTX *mem_ctx,
 
        /* Windows doesn't check for SEC_FILE_READ_ATTRIBUTE permission here */
 
-       if ((fsp->conn->fs_capabilities & FILE_FILE_COMPRESSION) == 0) {
-               DEBUG(4, ("FS does not advertise compression support\n"));
-               return NT_STATUS_NOT_SUPPORTED;
-       }
-
        ZERO_STRUCT(cmpr_state);
-       status = SMB_VFS_GET_COMPRESSION(fsp->conn,
-                                        mem_ctx,
-                                        fsp,
-                                        NULL,
-                                        &cmpr_state.format);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
+       if (fsp->conn->fs_capabilities & FILE_FILE_COMPRESSION) {
+               status = SMB_VFS_GET_COMPRESSION(fsp->conn,
+                                                mem_ctx,
+                                                fsp,
+                                                NULL,
+                                                &cmpr_state.format);
+               if (!NT_STATUS_IS_OK(status)) {
+                       return status;
+               }
+       } else {
+               /*
+                * bso#12144: The underlying filesystem doesn't support
+                * compression, so we should respond with "not-compressed"
+                * (like WS2016 ReFS) instead of STATUS_NOT_SUPPORTED or
+                * NT_STATUS_INVALID_DEVICE_REQUEST.
+                */
+               cmpr_state.format = COMPRESSION_FORMAT_NONE;
        }
 
        ndr_ret = ndr_push_struct_blob(&output, mem_ctx,
diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c
index 06ecea1..8ba3cc5 100644
--- a/source3/utils/smbcquotas.c
+++ b/source3/utils/smbcquotas.c
@@ -582,6 +582,7 @@ int main(int argc, char *argv[])
        static bool test_args = False;
        struct cli_state *cli;
        bool fix_user = False;
+       bool ok;
        SMB_NTQUOTA_STRUCT qt;
        TALLOC_CTX *frame = talloc_stackframe();
        poptContext pc;
@@ -617,9 +618,6 @@ 
FSQFLAGS:QUOTA_ENABLED/DENY_DISK/LOG_SOFTLIMIT/LOG_HARD_LIMIT", "SETSTRING" },
 
        fault_setup();
 
-       lp_load_global(get_dyn_CONFIGFILE());
-       load_interfaces();
-
        smbcquotas_auth_info = user_auth_info_init(frame);
        if (smbcquotas_auth_info == NULL) {
                exit(1);
@@ -714,6 +712,17 @@ 
FSQFLAGS:QUOTA_ENABLED/DENY_DISK/LOG_SOFTLIMIT/LOG_HARD_LIMIT", "SETSTRING" },
        poptFreeContext(pc);
        popt_burn_cmdline_password(argc, argv);
 
+       ok = lp_load_global(get_dyn_CONFIGFILE());
+       if (!ok) {
+               DBG_ERR("ERROR: Loading config file %s - "
+                       "run testparm to debug it\n",
+                       get_dyn_CONFIGFILE());
+               exit(EXIT_PARSE_ERROR);
+       }
+
+       /* We must load interfaces after we load the smb.conf */
+       load_interfaces();
+
        string_replace(path, '/', '\\');
 
        server = SMB_STRDUP(path+2);
diff --git a/source4/torture/smb2/ioctl.c b/source4/torture/smb2/ioctl.c
index 2baf7b6..01cc150 100644
--- a/source4/torture/smb2/ioctl.c
+++ b/source4/torture/smb2/ioctl.c
@@ -2543,6 +2543,78 @@ static bool test_ioctl_compress_perms(struct 
torture_context *torture,
        return true;
 }
 
+static bool test_ioctl_compress_notsup_get(struct torture_context *torture,
+                                          struct smb2_tree *tree)
+{
+       struct smb2_handle fh;
+       NTSTATUS status;
+       TALLOC_CTX *tmp_ctx = talloc_new(tree);
+       bool ok;
+       uint16_t compression_fmt;
+
+       ok = test_setup_create_fill(torture, tree, tmp_ctx,
+                                   FNAME, &fh, 0, SEC_RIGHTS_FILE_ALL,
+                                   FILE_ATTRIBUTE_NORMAL);
+       torture_assert(torture, ok, "setup compression file");
+
+       /* skip if the server DOES support compression */
+       status = test_ioctl_compress_fs_supported(torture, tree, tmp_ctx, &fh,
+                                                 &ok);
+       torture_assert_ntstatus_ok(torture, status, "SMB2_GETINFO_FS");
+       if (ok) {
+               smb2_util_close(tree, fh);
+               torture_skip(torture, "FS compression supported\n");
+       }
+
+       /*
+        * Despite not supporting compression, we should get a successful
+        * response indicating that the file is uncompressed - like WS2016.
+        */
+       status = test_ioctl_compress_get(torture, tmp_ctx, tree, fh,
+                                        &compression_fmt);
+       torture_assert_ntstatus_ok(torture, status, "FSCTL_GET_COMPRESSION");
+
+       torture_assert(torture, (compression_fmt == COMPRESSION_FORMAT_NONE),
+                      "initial compression state not NONE");
+
+       smb2_util_close(tree, fh);
+       talloc_free(tmp_ctx);
+       return true;
+}
+
+static bool test_ioctl_compress_notsup_set(struct torture_context *torture,
+                                          struct smb2_tree *tree)
+{
+       struct smb2_handle fh;
+       NTSTATUS status;
+       TALLOC_CTX *tmp_ctx = talloc_new(tree);
+       bool ok;
+
+       ok = test_setup_create_fill(torture, tree, tmp_ctx,
+                                   FNAME, &fh, 0, SEC_RIGHTS_FILE_ALL,
+                                   FILE_ATTRIBUTE_NORMAL);
+       torture_assert(torture, ok, "setup compression file");
+
+       /* skip if the server DOES support compression */
+       status = test_ioctl_compress_fs_supported(torture, tree, tmp_ctx, &fh,
+                                                 &ok);
+       torture_assert_ntstatus_ok(torture, status, "SMB2_GETINFO_FS");
+       if (ok) {
+               smb2_util_close(tree, fh);
+               torture_skip(torture, "FS compression supported\n");
+       }
+
+       status = test_ioctl_compress_set(torture, tmp_ctx, tree, fh,
+                                        COMPRESSION_FORMAT_DEFAULT);
+       torture_assert_ntstatus_equal(torture, status,
+                                     NT_STATUS_NOT_SUPPORTED,
+                                     "FSCTL_GET_COMPRESSION");
+
+       smb2_util_close(tree, fh);
+       talloc_free(tmp_ctx);
+       return true;
+}
+
 /*
    basic testing of the SMB2 FSCTL_QUERY_NETWORK_INTERFACE_INFO ioctl
 */
@@ -6169,6 +6241,10 @@ struct torture_suite *torture_smb2_ioctl_init(void)
                                     test_ioctl_compress_set_file_attr);
        torture_suite_add_1smb2_test(suite, "compress_perms",
                                     test_ioctl_compress_perms);
+       torture_suite_add_1smb2_test(suite, "compress_notsup_get",
+                                    test_ioctl_compress_notsup_get);
+       torture_suite_add_1smb2_test(suite, "compress_notsup_set",
+                                    test_ioctl_compress_notsup_set);
        torture_suite_add_1smb2_test(suite, "network_interface_info",
                                     test_ioctl_network_interface_info);
        torture_suite_add_1smb2_test(suite, "sparse_file_flag",


-- 
Samba Shared Repository

Reply via email to