The branch, master has been updated
       via  eb35afa winbind: Fix a typo
       via  b26ea7e winbind: Avoid a few explicit ZERO_STRUCT calls
       via  319d602 winbind: remove nss_get_info backend functions
       via  3081efb winbind: Remove nss_get_info()
       via  2b722af winbind: Remove unused nss_get_info_cached
       via  480c958 winbind: Simplify query_user_list to only return rids
       via  67c0696 winbind: Remove wbint_QueryUserList
       via  479ce28 winbind: Make list_users use wb_query_user_list
       via  81e5770 winbind: Make wb_query_user_list just return names
       via  91b73b1 winbind: Remove rpc_lookup_usergroups
       via  b231814 winbind: Remove "lookup_usergroups" winbind method
       via  3f58a8c winbind: Remove validate_ug
       via  876dc28 winbind: Remove wcache_lookup_usergroups
       via  f83863b winbind: Remove wb_cache_lookup_usergroups
       via  256632e winbind: Remove wbint_LookupUserGroups
       via  c0570e6 winbind: Remove wb_lookupusergroups
       via  13d7d46 winbind: Use wb_gettoken in getuserdomgroups
       via  bb050bf winbind: Add "expand_local_aliases" to wb_gettoken
       via  a8ab48e winbind: Remove rpc_query_user
       via  241c81b winbind: Remove "query_user" backend function
       via  81f3400 winbind: Remove unused wb_cache_query_user
       via  5b2d74b winbind: Remove wbint_QueryUser
       via  b92cac8 s3: torture: Add test for cli_ftruncate calling 
cli_smb2_ftruncate.
       via  e0f1ed9 s3: libsmb: Add cli_smb2_ftruncate(), plumb into 
cli_ftruncate().
      from  98bcdca torture-netlogon: Use "all_zero" where appropriate

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


- Log -----------------------------------------------------------------
commit eb35afacc145914478bc94bba9cbab6220b4f7ff
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Jan 3 12:18:25 2017 +0000

    winbind: Fix a typo
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>
    
    Autobuild-User(master): Volker Lendecke <v...@samba.org>
    Autobuild-Date(master): Wed Jan  4 16:10:32 CET 2017 on sn-devel-144

commit b26ea7ef5e34d8f838d41131002ff5d10dc07ac5
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Jan 3 09:54:33 2017 +0000

    winbind: Avoid a few explicit ZERO_STRUCT calls
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 319d60285c92bbf86bc0a3f872f9c9f9d0530129
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Jan 3 12:35:15 2017 +0000

    winbind: remove nss_get_info backend functions
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 3081efb74f4082a4a4b25d2ddb6a0e339183184f
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Jan 3 12:32:07 2017 +0000

    winbind: Remove nss_get_info()
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 2b722af4235e6cd01e53272bfe0747642bae624b
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Jan 3 12:17:27 2017 +0000

    winbind: Remove unused nss_get_info_cached
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 480c9581a13afc08b20e80d2ff8a45ac8d7f18d3
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Jan 3 12:11:30 2017 +0000

    winbind: Simplify query_user_list to only return rids
    
    Unfortunately this is a pretty large patch, because many functions
    implement this API. The alternative would have been to create a new
    backend function, add the new one piece by piece and then remove the
    original function.
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 67c0696761dedb748b1e4dc02531acbbf5ff95ca
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Jan 2 15:45:50 2017 +0000

    winbind: Remove wbint_QueryUserList
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 479ce28fd7dd54a6ae76fbbe3cd0a870738d87c0
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Jan 2 15:44:04 2017 +0000

    winbind: Make list_users use wb_query_user_list
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 81e5770aeebccfe6c65a40a5ac0e9e3a7b4c5d60
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Jan 2 15:19:14 2017 +0000

    winbind: Make wb_query_user_list just return names
    
    Yes, this compiles. Nobody call this right now. Hold on :-)
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 91b73b1e93bb8fb38e2f1cea6c1cbd012c952542
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Jan 3 15:23:21 2017 +0000

    winbind: Remove rpc_lookup_usergroups
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit b231814c6b0ad17255139bc8934f269610348b2b
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Jan 3 15:21:37 2017 +0000

    winbind: Remove "lookup_usergroups" winbind method
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 3f58a8cabab75a594cff9088d5dd8ea439b36178
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Jan 3 15:13:50 2017 +0000

    winbind: Remove validate_ug
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 876dc28b9cf13343a2962b1a1b035fe78c1858a6
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Jan 3 15:12:35 2017 +0000

    winbind: Remove wcache_lookup_usergroups
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit f83863b4d1510a9519d15934c960fd1675235812
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Jan 3 15:07:03 2017 +0000

    winbind: Remove wb_cache_lookup_usergroups
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 256632ed3cc724bab0fc22132ca6b52faf680ab2
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Jan 3 15:04:29 2017 +0000

    winbind: Remove wbint_LookupUserGroups
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit c0570e6ae8f8f0057ece48d764580897ff2b6f62
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Jan 3 15:02:48 2017 +0000

    winbind: Remove wb_lookupusergroups
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 13d7d46a80949e2f8abd77c7dfc9dc9dcc03ae97
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Jan 3 15:00:46 2017 +0000

    winbind: Use wb_gettoken in getuserdomgroups
    
    This makes sure we return the same information regardless of which call into
    winbind is used
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit bb050bfd88e34c9d922ac2c26ab4cefc1bd07543
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Jan 3 14:54:46 2017 +0000

    winbind: Add "expand_local_aliases" to wb_gettoken
    
    I hate passing down booleans, but we have the "domain_groups_only"
    parameter in wbcLookupUserSids which we need to keep for API
    compatibility. To make sure we use as few code paths as possible, this
    basically passes down this flag.
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit a8ab48ee193f68217e7c53b71bf6c57d2d15f8d7
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Jan 2 15:58:39 2017 +0000

    winbind: Remove rpc_query_user
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 241c81b2763392439043261cf179cd2c8793faed
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Jan 2 15:56:48 2017 +0000

    winbind: Remove "query_user" backend function
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 81f340097436280a90ba252d00f37c644a6be084
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Jan 2 10:35:02 2017 +0000

    winbind: Remove unused wb_cache_query_user
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 5b2d74bd1116ef182b4a2a58cb8949ae8f10638f
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Jan 2 10:32:19 2017 +0000

    winbind: Remove wbint_QueryUser
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit b92cac857823ac2d29133fba2fde57cf58805b45
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Jan 3 15:37:03 2017 -0800

    s3: torture: Add test for cli_ftruncate calling cli_smb2_ftruncate.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12479
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>

commit e0f1ed9f450851bf5b7fec84577b50047309db3f
Author: Jeremy Allison <j...@samba.org>
Date:   Wed Dec 21 13:55:50 2016 -0800

    s3: libsmb: Add cli_smb2_ftruncate(), plumb into cli_ftruncate().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12479
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>

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

Summary of changes:
 librpc/idl/winbind.idl                       |  14 -
 source3/include/nss_info.h                   |  10 -
 source3/libsmb/cli_smb2_fnum.c               |  65 +++
 source3/libsmb/cli_smb2_fnum.h               |   3 +
 source3/libsmb/clifile.c                     |   8 +-
 source3/selftest/tests.py                    |   2 +-
 source3/torture/proto.h                      |   1 +
 source3/torture/test_smb2.c                  | 157 +++++++
 source3/torture/torture.c                    |   1 +
 source3/winbindd/idmap_ad_nss.c              | 106 -----
 source3/winbindd/idmap_hash/idmap_hash.c     |  41 --
 source3/winbindd/nss_info.c                  |  26 --
 source3/winbindd/nss_info_template.c         |  27 --
 source3/winbindd/wb_gettoken.c               |  10 +-
 source3/winbindd/wb_lookupusergroups.c       |  97 -----
 source3/winbindd/wb_query_user_list.c        |  70 ++-
 source3/winbindd/winbindd.h                  |  17 +-
 source3/winbindd/winbindd_ads.c              | 613 +--------------------------
 source3/winbindd/winbindd_cache.c            | 443 ++-----------------
 source3/winbindd/winbindd_dual_srv.c         |  74 +---
 source3/winbindd/winbindd_getgroups.c        |   2 +-
 source3/winbindd/winbindd_getuserdomgroups.c |  15 +-
 source3/winbindd/winbindd_getusersids.c      |   2 +-
 source3/winbindd/winbindd_list_users.c       | 106 ++---
 source3/winbindd/winbindd_msrpc.c            | 172 +-------
 source3/winbindd/winbindd_proto.h            |  37 +-
 source3/winbindd/winbindd_reconnect.c        |  50 +--
 source3/winbindd/winbindd_reconnect_ads.c    |  50 +--
 source3/winbindd/winbindd_rpc.c              | 212 +--------
 source3/winbindd/winbindd_rpc.h              |  20 +-
 source3/winbindd/winbindd_samr.c             | 204 +--------
 source3/winbindd/wscript_build               |   1 -
 32 files changed, 453 insertions(+), 2203 deletions(-)
 delete mode 100644 source3/winbindd/wb_lookupusergroups.c


Changeset truncated at 500 lines:

diff --git a/librpc/idl/winbind.idl b/librpc/idl/winbind.idl
index d38b17a..6245e13 100644
--- a/librpc/idl/winbind.idl
+++ b/librpc/idl/winbind.idl
@@ -84,11 +84,6 @@ interface winbind
        dom_sid group_sid;
     } wbint_userinfo;
 
-    NTSTATUS wbint_QueryUser(
-       [in] dom_sid *sid,
-       [out] wbint_userinfo *info
-       );
-
     NTSTATUS wbint_GetNssInfo(
        [in,out] wbint_userinfo *info
        );
@@ -108,11 +103,6 @@ interface winbind
        [out] wbint_RidArray *rids
        );
 
-    NTSTATUS wbint_LookupUserGroups(
-       [in] dom_sid *sid,
-       [out] wbint_SidArray *sids
-       );
-
     NTSTATUS wbint_QuerySequenceNumber(
        [out] uint32 *sequence
        );
@@ -139,10 +129,6 @@ interface winbind
        [size_is(num_userinfos)] wbint_userinfo userinfos[];
     } wbint_userinfos;
 
-    NTSTATUS wbint_QueryUserList(
-       [out] wbint_userinfos *users
-       );
-
     NTSTATUS wbint_QueryGroupList(
        [out] wbint_Principals *groups
        );
diff --git a/source3/include/nss_info.h b/source3/include/nss_info.h
index f92937e..54b4399 100644
--- a/source3/include/nss_info.h
+++ b/source3/include/nss_info.h
@@ -61,11 +61,6 @@ struct nss_domain_entry {
 
 struct nss_info_methods {
        NTSTATUS (*init)( struct nss_domain_entry *e );
-       NTSTATUS (*get_nss_info)( struct nss_domain_entry *e, 
-                                 const struct dom_sid *sid,
-                                 TALLOC_CTX *ctx, 
-                                 const char **homedir, const char **shell,
-                                 const char **gecos, gid_t *p_gid);
        NTSTATUS (*map_to_alias)(TALLOC_CTX *mem_ctx,
                                 struct nss_domain_entry *e,
                                 const char *name, char **alias);
@@ -82,11 +77,6 @@ NTSTATUS smb_register_idmap_nss(int version,
                                const char *name, 
                                struct nss_info_methods *methods);
 
-NTSTATUS nss_get_info( const char *domain, const struct dom_sid *user_sid,
-                      TALLOC_CTX *ctx,
-                      const char **homedir, const char **shell,
-                      const char **gecos, gid_t *p_gid);
-
 NTSTATUS nss_map_to_alias( TALLOC_CTX *mem_ctx, const char *domain,
                           const char *name, char **alias );
 
diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c
index 266f2d3..848e077 100644
--- a/source3/libsmb/cli_smb2_fnum.c
+++ b/source3/libsmb/cli_smb2_fnum.c
@@ -3574,3 +3574,68 @@ NTSTATUS cli_smb2_shadow_copy_data(TALLOC_CTX *mem_ctx,
        TALLOC_FREE(frame);
        return status;
 }
+
+/***************************************************************
+ Wrapper that allows SMB2 to truncate a file.
+ Synchronous only.
+***************************************************************/
+
+NTSTATUS cli_smb2_ftruncate(struct cli_state *cli,
+                       uint16_t fnum,
+                       uint64_t newsize)
+{
+       NTSTATUS status;
+       DATA_BLOB inbuf = data_blob_null;
+       struct smb2_hnd *ph = NULL;
+       TALLOC_CTX *frame = talloc_stackframe();
+
+       if (smbXcli_conn_has_async_calls(cli->conn)) {
+               /*
+                * Can't use sync call while an async call is in flight
+                */
+               status = NT_STATUS_INVALID_PARAMETER;
+               goto fail;
+       }
+
+       if (smbXcli_conn_protocol(cli->conn) < PROTOCOL_SMB2_02) {
+               status = NT_STATUS_INVALID_PARAMETER;
+               goto fail;
+       }
+
+       status = map_fnum_to_smb2_handle(cli,
+                                       fnum,
+                                       &ph);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto fail;
+       }
+
+       inbuf = data_blob_talloc_zero(frame, 8);
+       if (inbuf.data == NULL) {
+               status = NT_STATUS_NO_MEMORY;
+               goto fail;
+       }
+
+       SBVAL(inbuf.data, 0, newsize);
+
+       /* setinfo on the handle with info_type SMB2_SETINFO_FILE (1),
+          level 20 (SMB_FILE_END_OF_FILE_INFORMATION - 1000). */
+
+       status = smb2cli_set_info(cli->conn,
+                               cli->timeout,
+                               cli->smb2.session,
+                               cli->smb2.tcon,
+                               1, /* in_info_type */
+                                       /* in_file_info_class */
+                               SMB_FILE_END_OF_FILE_INFORMATION - 1000,
+                               &inbuf, /* in_input_buffer */
+                               0, /* in_additional_info */
+                               ph->fid_persistent,
+                               ph->fid_volatile);
+
+  fail:
+
+       cli->raw_status = status;
+
+       TALLOC_FREE(frame);
+       return status;
+}
diff --git a/source3/libsmb/cli_smb2_fnum.h b/source3/libsmb/cli_smb2_fnum.h
index 3289f7e..12c42a2 100644
--- a/source3/libsmb/cli_smb2_fnum.h
+++ b/source3/libsmb/cli_smb2_fnum.h
@@ -208,4 +208,7 @@ NTSTATUS cli_smb2_shadow_copy_data(TALLOC_CTX *mem_ctx,
                        bool get_names,
                        char ***pnames,
                        int *pnum_names);
+NTSTATUS cli_smb2_ftruncate(struct cli_state *cli,
+                       uint16_t fnum,
+                       uint64_t newsize);
 #endif /* __SMB2CLI_FNUM_H__ */
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 5e667bd..03dd640 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -2819,11 +2819,17 @@ NTSTATUS cli_ftruncate_recv(struct tevent_req *req)
 
 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size)
 {
-       TALLOC_CTX *frame = talloc_stackframe();
+       TALLOC_CTX *frame = NULL;
        struct tevent_context *ev = NULL;
        struct tevent_req *req = NULL;
        NTSTATUS status = NT_STATUS_OK;
 
+       if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
+               return cli_smb2_ftruncate(cli, fnum, size);
+       }
+
+       frame = talloc_stackframe();
+
        if (smbXcli_conn_has_async_calls(cli->conn)) {
                /*
                 * Can't use sync call while an async call is in flight
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index d9d32cc..3aecc9c 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -53,7 +53,7 @@ tests = ["FDPASS", "LOCK1", "LOCK2", "LOCK3", "LOCK4", 
"LOCK5", "LOCK6", "LOCK7"
         "CHAIN3", "PIDHIGH",
         "GETADDRINFO", "UID-REGRESSION-TEST", "SHORTNAME-TEST",
         "CASE-INSENSITIVE-CREATE", "SMB2-BASIC", "NTTRANS-FSCTL", 
"SMB2-NEGPROT",
-        "SMB2-SESSION-REAUTH", "SMB2-SESSION-RECONNECT",
+        "SMB2-SESSION-REAUTH", "SMB2-SESSION-RECONNECT", "SMB2-FTRUNCATE",
         "CLEANUP1",
         "CLEANUP2",
         "CLEANUP4",
diff --git a/source3/torture/proto.h b/source3/torture/proto.h
index 7d2dedd..da0c69f 100644
--- a/source3/torture/proto.h
+++ b/source3/torture/proto.h
@@ -98,6 +98,7 @@ bool run_smb2_session_reconnect(int dummy);
 bool run_smb2_tcon_dependence(int dummy);
 bool run_smb2_multi_channel(int dummy);
 bool run_smb2_session_reauth(int dummy);
+bool run_smb2_ftruncate(int dummy);
 bool run_chain3(int dummy);
 bool run_local_conv_auth_info(int dummy);
 bool run_local_sprintf_append(int dummy);
diff --git a/source3/torture/test_smb2.c b/source3/torture/test_smb2.c
index 7819bc2..c0d11e6 100644
--- a/source3/torture/test_smb2.c
+++ b/source3/torture/test_smb2.c
@@ -27,6 +27,7 @@
 #include "auth/gensec/gensec.h"
 #include "auth_generic.h"
 #include "../librpc/ndr/libndr.h"
+#include "libsmb/clirap.h"
 
 extern fstring host, workgroup, share, password, username, myname;
 extern struct cli_credentials *torture_creds;
@@ -1892,3 +1893,159 @@ bool run_smb2_session_reauth(int dummy)
 
        return true;
 }
+
+static NTSTATUS check_size(struct cli_state *cli,
+                               uint16_t fnum,
+                               const char *fname,
+                               size_t size)
+{
+       off_t size_read = 0;
+
+       NTSTATUS status = cli_qfileinfo_basic(cli,
+                               fnum,
+                               NULL,
+                               &size_read,
+                               NULL,
+                               NULL,
+                               NULL,
+                               NULL,
+                               NULL);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("cli_smb2_qfileinfo_basic of %s failed (%s)\n",
+                       fname,
+                       nt_errstr(status));
+               return status;
+       }
+
+       if (size != size_read) {
+               printf("size (%u) != size_read(%u) for %s\n",
+                       (unsigned int)size,
+                       (unsigned int)size_read,
+                       fname);
+               /* Use EOF to mean bad size. */
+               return NT_STATUS_END_OF_FILE;
+       }
+       return NT_STATUS_OK;
+}
+
+/* Ensure cli_ftruncate() works for SMB2. */
+
+bool run_smb2_ftruncate(int dummy)
+{
+       struct cli_state *cli = NULL;
+       const char *fname = "smb2_ftruncate.txt";
+       uint16_t fnum = (uint16_t)-1;
+       bool correct = false;
+       size_t buflen = 1024*1024;
+       uint8_t *buf = NULL;
+       unsigned int i;
+       NTSTATUS status;
+
+       printf("Starting SMB2-FTRUNCATE\n");
+
+       if (!torture_init_connection(&cli)) {
+               goto fail;
+       }
+
+       status = smbXcli_negprot(cli->conn, cli->timeout,
+                                PROTOCOL_SMB2_02, PROTOCOL_SMB2_02);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("smbXcli_negprot returned %s\n", nt_errstr(status));
+               goto fail;
+       }
+
+       status = cli_session_setup_creds(cli, torture_creds);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("cli_session_setup returned %s\n", nt_errstr(status));
+               goto fail;
+       }
+
+       status = cli_tree_connect(cli, share, "?????", NULL);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("cli_tree_connect returned %s\n", nt_errstr(status));
+               goto fail;
+       }
+
+       cli_setatr(cli, fname, 0, 0);
+       cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+
+       status = cli_ntcreate(cli,
+                               fname,
+                               0,
+                               GENERIC_ALL_ACCESS,
+                               FILE_ATTRIBUTE_NORMAL,
+                               FILE_SHARE_NONE,
+                               FILE_CREATE,
+                               0,
+                               0,
+                               &fnum,
+                               NULL);
+
+        if (!NT_STATUS_IS_OK(status)) {
+                printf("open of %s failed (%s)\n", fname, nt_errstr(status));
+                goto fail;
+        }
+
+       buf = talloc_zero_array(cli, uint8_t, buflen);
+       if (buf == NULL) {
+               goto fail;
+       }
+
+       /* Write 1MB. */
+       status = cli_writeall(cli,
+                               fnum,
+                               0,
+                               buf,
+                               0,
+                               buflen,
+                               NULL);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("write of %u to %s failed (%s)\n",
+                       (unsigned int)buflen,
+                       fname,
+                       nt_errstr(status));
+               goto fail;
+       }
+
+       status = check_size(cli, fnum, fname, buflen);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto fail;
+       }
+
+       /* Now ftruncate. */
+       for ( i = 0; i < 10; i++) {
+               status = cli_ftruncate(cli, fnum, i*1024);
+               if (!NT_STATUS_IS_OK(status)) {
+                       printf("cli_ftruncate %u of %s failed (%s)\n",
+                               (unsigned int)i*1024,
+                               fname,
+                               nt_errstr(status));
+                       goto fail;
+               }
+               status = check_size(cli, fnum, fname, i*1024);
+               if (!NT_STATUS_IS_OK(status)) {
+                       goto fail;
+               }
+       }
+
+       correct = true;
+
+  fail:
+
+       if (cli == NULL) {
+               return false;
+       }
+
+       if (fnum != (uint16_t)-1) {
+               cli_close(cli, fnum);
+       }
+       cli_setatr(cli, fname, 0, 0);
+       cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+
+       if (!torture_close_connection(cli)) {
+               correct = false;
+       }
+       return correct;
+}
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 1a57f41..ff3d68e 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -11070,6 +11070,7 @@ static struct {
        { "SMB2-TCON-DEPENDENCE", run_smb2_tcon_dependence },
        { "SMB2-MULTI-CHANNEL", run_smb2_multi_channel },
        { "SMB2-SESSION-REAUTH", run_smb2_session_reauth },
+       { "SMB2-FTRUNCATE", run_smb2_ftruncate },
        { "CLEANUP1", run_cleanup1 },
        { "CLEANUP2", run_cleanup2 },
        { "CLEANUP3", run_cleanup3 },
diff --git a/source3/winbindd/idmap_ad_nss.c b/source3/winbindd/idmap_ad_nss.c
index d979231..8b27b36 100644
--- a/source3/winbindd/idmap_ad_nss.c
+++ b/source3/winbindd/idmap_ad_nss.c
@@ -197,109 +197,6 @@ static NTSTATUS nss_rfc2307_init( struct nss_domain_entry 
*e )
        return nss_ad_generic_init(e, WB_POSIX_MAP_RFC2307);
 }
 
-
-/************************************************************************
- ***********************************************************************/
-
-static NTSTATUS nss_ad_get_info( struct nss_domain_entry *e,
-                                 const struct dom_sid *sid,
-                                 TALLOC_CTX *mem_ctx,
-                                 const char **homedir,
-                                 const char **shell,
-                                 const char **gecos,
-                                 gid_t *p_gid )
-{
-       const char *attrs[] = {NULL, /* attr_homedir */
-                              NULL, /* attr_shell */
-                              NULL, /* attr_gecos */
-                              NULL, /* attr_gidnumber */
-                              NULL };
-       char *filter = NULL;
-       LDAPMessage *msg_internal = NULL;
-       ADS_STATUS ads_status = ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL);
-       NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
-       char *sidstr = NULL;
-       struct idmap_domain *dom;
-       struct idmap_ad_context *ctx;
-
-       DEBUG(10, ("nss_ad_get_info called for sid [%s] in domain '%s'\n",
-                  sid_string_dbg(sid), e->domain?e->domain:"NULL"));
-
-       /* Only do query if we are online */
-       if (idmap_is_offline()) {
-               return NT_STATUS_FILE_IS_OFFLINE;
-       }
-
-       dom = talloc_get_type(e->state, struct idmap_domain);
-       ctx = talloc_get_type(dom->private_data, struct idmap_ad_context);
-
-       ads_status = ad_idmap_cached_connection(dom);
-       if (!ADS_ERR_OK(ads_status)) {
-               return NT_STATUS_OBJECT_NAME_NOT_FOUND;
-       }
-
-       if (!ctx->ad_schema) {
-               DEBUG(10, ("nss_ad_get_info: no ad_schema configured!\n"));
-               return NT_STATUS_OBJECT_NAME_NOT_FOUND;
-       }
-
-       if (!sid || !homedir || !shell || !gecos) {
-               return NT_STATUS_INVALID_PARAMETER;
-       }
-
-       /* Have to do our own query */
-
-       DEBUG(10, ("nss_ad_get_info: no ads connection given, doing our "
-                  "own query\n"));
-
-       attrs[0] = ctx->ad_schema->posix_homedir_attr;
-       attrs[1] = ctx->ad_schema->posix_shell_attr;
-       attrs[2] = ctx->ad_schema->posix_gecos_attr;
-       attrs[3] = ctx->ad_schema->posix_gidnumber_attr;
-
-       sidstr = ldap_encode_ndr_dom_sid(mem_ctx, sid);
-       filter = talloc_asprintf(mem_ctx, "(objectSid=%s)", sidstr);
-       TALLOC_FREE(sidstr);
-
-       if (!filter) {
-               nt_status = NT_STATUS_NO_MEMORY;
-               goto done;
-       }
-
-       ads_status = ads_search_retry(ctx->ads, &msg_internal, filter, attrs);
-       if (!ADS_ERR_OK(ads_status)) {
-               nt_status = ads_ntstatus(ads_status);
-               goto done;
-       }
-
-       *homedir = ads_pull_string(ctx->ads, mem_ctx, msg_internal, 
ctx->ad_schema->posix_homedir_attr);
-       *shell   = ads_pull_string(ctx->ads, mem_ctx, msg_internal, 
ctx->ad_schema->posix_shell_attr);
-       *gecos   = ads_pull_string(ctx->ads, mem_ctx, msg_internal, 
ctx->ad_schema->posix_gecos_attr);
-
-       if (p_gid != NULL) {
-               uint32_t gid = UINT32_MAX;
-               bool ok;
-
-               ok = ads_pull_uint32(ctx->ads, msg_internal,
-                                    ctx->ad_schema->posix_gidnumber_attr,
-                                    &gid);
-               if (ok) {
-                       *p_gid = gid;
-               } else {
-                       *p_gid = (gid_t)-1;
-               }
-       }
-
-       nt_status = NT_STATUS_OK;
-
-done:
-       if (msg_internal) {
-               ads_msgfree(ctx->ads, msg_internal);
-       }
-
-       return nt_status;
-}
-
 /**********************************************************************
  *********************************************************************/
 
@@ -475,21 +372,18 @@ done:
 


-- 
Samba Shared Repository

Reply via email to