The branch, v4-2-stable has been updated
       via  851ea18 VERSION: Disable git snapshots for the 4.2.5 release.
       via  0c46d4a WHATSNEW: Add release notes for Samba 4.2.5.
       via  bf344f7 dcerpc.idl: accept invalid dcerpc_bind_nak pdus
       via  4cb9657 s3:smbstatus: add stream name to share_entry_forall()
       via  2b1a40d s3: lsa: lookup_name() logic for unqualified (no DOMAIN\ 
component) names is incorrect.
       via  8bd6345 s3:lib: validate domain name in lookup_wellknown_name()
       via  8c5990a s3:locking: initialize lease pointer in 
share_mode_traverse_fn()
       via  f1ea5fd s4: torture: Add SMB2 access-based enumeration test. Passes 
against Win2k12R2.
       via  b13c829 lib: cli: Add accessor function smb2cli_tcon_flags() to get 
tcon flags.
       via  3695d46 s3: smbd: Fix our access-based enumeration on "hide 
unreadable" to match Windows.
       via  deaa748 smbd: Fix file name buflen and padding in notify repsonse
       via  dd39bd2 vfs_fruit: return value of ad_pack in vfs_fruit.c
       via  95b17d5 tdb: Fix bug 11381, deadlock
       via  0349f95 vfs_commit: set the fd on open before calling SMB_VFS_FSTAT
       via  ba280e6 s3:ctdbd_conn: make sure we destroy tevent_fd before 
closing the socket
       via  5bc3a2f kerberos: make sure we only use prompter type when 
available.
       via  b6f1310 winbind: Fix 100% loop
       via  f9a820a s3: smbd: Fix NULL pointer bug introduced by previous 'raw' 
stream fix (bug #11522).
       via  d69db57 s3: smbd: fix a crash in unix_convert()
       via  2df7b85 net: fix a crash with net ads keytab create
       via  2e516a7 s3: tests: smbclient test to ensure we can create and see a 
:foobar stream on the top level directory in a share.
       via  22d55ca s3: smbd: Fix opening/creating :stream files on the root 
share directory.
       via  29f057c s3: smbd: Remove unused parameter from build_stream_path().
       via  eb1aa45 s3: smbclient: Move cmd_setmode out of clitar.c and back 
into client.c
       via  6c6b62f pam_winbind: Fix a segfault if initialization fails
       via  d2105b7 s4: torture: Test mkdir race condition.
       via  d194836 s3: smbd: Fix mkdir race condition.
       via  105f949 s3: dfs: Fix a crash when the dfs targets are disabled.
       via  68801fb nss_winbind: fix hang on Solaris on big groups
       via  f4bc73f build: use as-needed linker flag also on OpenBSD
       via  7cabb4c VERSION: Bump version up to 4.2.5...
      from  413fb83 VERSION: Disable git snapshots for the 4.2.4 release.

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


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 VERSION                                   |   2 +-
 WHATSNEW.txt                              |  95 +++++++++++-
 lib/tdb/common/traverse.c                 |  14 +-
 libcli/smb/smbXcli_base.c                 |   5 +
 libcli/smb/smbXcli_base.h                 |   1 +
 librpc/idl/dcerpc.idl                     |   6 +-
 librpc/idl/notify.idl                     |   4 +-
 librpc/ndr/ndr_dcerpc.c                   |  49 +++++++
 nsswitch/pam_winbind.c                    |  19 ++-
 nsswitch/winbind_nss_solaris.c            |   6 +
 selftest/knownfail                        |   2 +
 source3/client/client.c                   | 118 +++++++++++++++
 source3/client/client_proto.h             |   6 +
 source3/client/clitar.c                   | 130 -----------------
 source3/lib/ctdbd_conn.c                  |   6 +-
 source3/lib/util_wellknown.c              |  13 +-
 source3/libads/kerberos.c                 |  26 ++++
 source3/libads/ldap.c                     |   7 +
 source3/libsmb/clidfs.c                   |   4 +-
 source3/locking/proto.h                   |   3 +-
 source3/locking/share_mode_lock.c         |  21 ++-
 source3/modules/vfs_commit.c              |  11 +-
 source3/modules/vfs_fruit.c               |  14 +-
 source3/passdb/lookup_sid.c               |  31 +++-
 source3/rpc_server/srvsvc/srv_srvsvc_nt.c |  21 ++-
 source3/script/tests/test_smbclient_s3.sh |  36 +++++
 source3/smbd/dir.c                        |  64 ++++++++-
 source3/smbd/filename.c                   |  35 ++++-
 source3/smbd/notify.c                     |  14 +-
 source3/smbd/open.c                       |  19 +++
 source3/utils/status.c                    |   6 +-
 source4/heimdal_build/wscript_configure   |   1 +
 source4/torture/smb2/acls.c               | 230 ++++++++++++++++++++++++++++++
 source4/torture/smb2/create.c             | 151 ++++++++++++++++++++
 wscript                                   |   3 +-
 wscript_configure_system_mitkrb5          |   2 +
 36 files changed, 987 insertions(+), 188 deletions(-)


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index 381f62e..967a8fa 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
 ########################################################
 SAMBA_VERSION_MAJOR=4
 SAMBA_VERSION_MINOR=2
-SAMBA_VERSION_RELEASE=4
+SAMBA_VERSION_RELEASE=5
 
 ########################################################
 # If a official release has a serious bug              #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 4d01c77..8e65255 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,4 +1,95 @@
                    =============================
+                   Release Notes for Samba 4.2.5
+                         October 27, 2015
+                   =============================
+
+
+This is the latest stable release of Samba 4.2.
+
+
+Changes since 4.2.4:
+--------------------
+
+o   Jeremy Allison <[email protected]>
+    * BUG 10252: s3: smbd: Fix our access-based enumeration on "hide 
unreadable"
+      to match Windows.
+    * BUG 10634: smbd: Fix file name buflen and padding in notify repsonse.
+    * BUG 11486: s3: smbd: Fix mkdir race condition.
+    * BUG 11522: s3: smbd: Fix opening/creating :stream files on the root share
+      directory.
+    * BUG 11535: s3: smbd: Fix NULL pointer bug introduced by previous 'raw'
+      stream fix (bug #11522).
+    * BUG 11555: s3: lsa: lookup_name() logic for unqualified (no DOMAIN\
+      component) names is incorrect.
+
+
+o   Ralph Boehme <[email protected]>
+    * BUG 11535: s3: smbd: Fix a crash in unix_convert().
+    * BUG 11543: vfs_fruit: Return value of ad_pack in vfs_fruit.c.
+    * BUG 11549: Fix bug in smbstatus where the lease info is not printed.
+    * BUG 11550: s3:smbstatus: Add stream name to share_entry_forall().
+    * BUG 11555: s3:lib: validate domain name in lookup_wellknown_name().
+
+
+o   Günther Deschner <[email protected]>
+    * BUG 11038: kerberos: Make sure we only use prompter type when available.
+
+
+o   Björn Jacke <[email protected]>
+    * BUG 10365: nss_winbind: Fix hang on Solaris on big groups.
+    * BUG 11355: build: Use as-needed linker flag also on OpenBSD.
+
+
+o   Volker Lendecke <[email protected]>
+    * BUG 11038: winbind: Fix 100% loop.
+    * BUG 11381: Fix a deadlock in tdb.
+
+
+o   Stefan Metzmacher <[email protected]>
+    * BUG 11316: s3:ctdbd_conn: Make sure we destroy tevent_fd before closing
+      the socket.
+    * BUG 11327: dcerpc.idl: accept invalid dcerpc_bind_nak pdus.
+
+
+o   Har Gagan Sahai <[email protected]>
+    * BUG 11509: s3: dfs: Fix a crash when the dfs targets are disabled.
+
+
+o   Andreas Schneider <[email protected]>
+    * BUG 11502: pam_winbind: Fix a segfault if initialization fails.
+
+
+o   Uri Simchoni <[email protected]>
+    * BUG 11528: net: Fix a crash with 'net ads keytab create'.
+    * BUG 11547: vfs_commit: Set the fd on open before calling SMB_VFS_FSTAT.
+
+
+#######################################
+Reporting bugs & Development Discussion
+#######################################
+
+Please discuss this release on the samba-technical mailing list or by
+joining the #samba-technical IRC channel on irc.freenode.net.
+
+If you do report problems then please try to send high quality
+feedback. If you don't provide vital information to help us track down
+the problem then you will probably be ignored.  All bug reports should
+be filed under the Samba 4.2 product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+
+Release notes for older releases follow:
+----------------------------------------
+
+======================================================================
+
+                   =============================
                    Release Notes for Samba 4.2.4
                          September 8, 2015
                    =============================
@@ -105,10 +196,8 @@ database (https://bugzilla.samba.org/).
 ======================================================================
 
 
-Release notes for older releases follow:
-----------------------------------------
+----------------------------------------------------------------------
 
-======================================================================
 
                    =============================
                    Release Notes for Samba 4.2.3
diff --git a/lib/tdb/common/traverse.c b/lib/tdb/common/traverse.c
index 618670f..e18e3c3 100644
--- a/lib/tdb/common/traverse.c
+++ b/lib/tdb/common/traverse.c
@@ -245,13 +245,25 @@ _PUBLIC_ int tdb_traverse(struct tdb_context *tdb,
                 tdb_traverse_func fn, void *private_data)
 {
        struct tdb_traverse_lock tl = { NULL, 0, 0, F_WRLCK };
+       enum tdb_lock_flags lock_flags;
        int ret;
 
        if (tdb->read_only || tdb->traverse_read) {
                return tdb_traverse_read(tdb, fn, private_data);
        }
 
-       if (tdb_transaction_lock(tdb, F_WRLCK, TDB_LOCK_WAIT)) {
+       lock_flags = TDB_LOCK_WAIT;
+
+       if (tdb->allrecord_lock.count != 0) {
+               /*
+                * This avoids a deadlock between tdb_lockall() and
+                * tdb_traverse(). See
+                * https://bugzilla.samba.org/show_bug.cgi?id=11381
+                */
+               lock_flags = TDB_LOCK_NOWAIT;
+       }
+
+       if (tdb_transaction_lock(tdb, F_WRLCK, lock_flags)) {
                return -1;
        }
 
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index 803b6ee..69599bd 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -5497,6 +5497,11 @@ uint32_t smb2cli_tcon_capabilities(struct smbXcli_tcon 
*tcon)
        return tcon->smb2.capabilities;
 }
 
+uint32_t smb2cli_tcon_flags(struct smbXcli_tcon *tcon)
+{
+       return tcon->smb2.flags;
+}
+
 void smb2cli_tcon_set_values(struct smbXcli_tcon *tcon,
                             struct smbXcli_session *session,
                             uint32_t tcon_id,
diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h
index 9a970d4..9a957e2 100644
--- a/libcli/smb/smbXcli_base.h
+++ b/libcli/smb/smbXcli_base.h
@@ -421,6 +421,7 @@ bool smb1cli_tcon_set_values(struct smbXcli_tcon *tcon,
                             const char *fs_type);
 uint32_t smb2cli_tcon_current_id(struct smbXcli_tcon *tcon);
 uint32_t smb2cli_tcon_capabilities(struct smbXcli_tcon *tcon);
+uint32_t smb2cli_tcon_flags(struct smbXcli_tcon *tcon);
 void smb2cli_tcon_set_values(struct smbXcli_tcon *tcon,
                             struct smbXcli_session *session,
                             uint32_t tcon_id,
diff --git a/librpc/idl/dcerpc.idl b/librpc/idl/dcerpc.idl
index 67f4b9d..cb7f5b8 100644
--- a/librpc/idl/dcerpc.idl
+++ b/librpc/idl/dcerpc.idl
@@ -114,7 +114,7 @@ interface dcerpc
                [flag(NDR_REMAINING)] DATA_BLOB auth_info;
        } dcerpc_bind_ack;
 
-       typedef [enum16bit] enum {
+       typedef [public,enum16bit] enum {
                DCERPC_BIND_NAK_REASON_NOT_SPECIFIED                  = 0,
                DCERPC_BIND_NAK_REASON_TEMPORARY_CONGESTION           = 1,
                DCERPC_BIND_NAK_REASON_LOCAL_LIMIT_EXCEEDED           = 2,
@@ -128,12 +128,12 @@ interface dcerpc
        const int DCERPC_BIND_REASON_INVALID_AUTH_TYPE =
                DCERPC_BIND_NAK_REASON_INVALID_AUTH_TYPE;
 
-       typedef struct {
+       typedef [public] struct {
                uint8 rpc_vers;         /* RPC version */
                uint8 rpc_vers_minor;   /* Minor version */
        } dcerpc_bind_nak_version;
 
-       typedef struct {
+       typedef [public,nopull] struct {
                dcerpc_bind_nak_reason reject_reason;
                uint8 num_versions;
                dcerpc_bind_nak_version versions[num_versions];
diff --git a/librpc/idl/notify.idl b/librpc/idl/notify.idl
index ec81e8c..6da00dc 100644
--- a/librpc/idl/notify.idl
+++ b/librpc/idl/notify.idl
@@ -92,6 +92,8 @@ interface notify
                uint32 NextEntryOffset;
                FILE_NOTIFY_ACTION Action;
                [value(strlen_m(FileName1)*2)] uint32 FileNameLength;
-               [charset(UTF16),flag(STR_NOTERM)] uint16 
FileName1[FileNameLength];
+               [charset(UTF16),flag(STR_NOTERM)]
+                       uint16 FileName1[strlen_m(FileName1)];
+               DATA_BLOB _pad;
        } FILE_NOTIFY_INFORMATION;
 }
diff --git a/librpc/ndr/ndr_dcerpc.c b/librpc/ndr/ndr_dcerpc.c
index ca09fb6..0224b2c 100644
--- a/librpc/ndr/ndr_dcerpc.c
+++ b/librpc/ndr/ndr_dcerpc.c
@@ -24,6 +24,55 @@
 #include "librpc/gen_ndr/ndr_dcerpc.h"
 #include "librpc/gen_ndr/ndr_misc.h"
 
+/*
+ * This function was generated by pidl and
+ * has been extended by the (_available == 0) check.
+ *
+ * That's why we ignore the 80 char per line limit.
+ */
+enum ndr_err_code ndr_pull_dcerpc_bind_nak(struct ndr_pull *ndr, int 
ndr_flags, struct dcerpc_bind_nak *r)
+{
+       uint32_t size_versions_0 = 0;
+       uint32_t cntr_versions_0;
+       TALLOC_CTX *_mem_save_versions_0 = NULL;
+       NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+       if (ndr_flags & NDR_SCALARS) {
+               uint32_t _available;
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_dcerpc_bind_nak_reason(ndr, NDR_SCALARS, 
&r->reject_reason));
+               _available = ndr->data_size - ndr->offset;
+               if (_available == 0) {
+                       /*
+                        * This works around a bug in older
+                        * Samba (<= 4.1) releases.
+                        *
+                        * See bug #11327.
+                        */
+                       r->num_versions = 0;
+               } else {
+                       NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, 
&r->num_versions));
+               }
+               size_versions_0 = r->num_versions;
+               NDR_PULL_ALLOC_N(ndr, r->versions, size_versions_0);
+               _mem_save_versions_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->versions, 0);
+               for (cntr_versions_0 = 0; cntr_versions_0 < (size_versions_0); 
cntr_versions_0++) {
+                       NDR_CHECK(ndr_pull_dcerpc_bind_nak_version(ndr, 
NDR_SCALARS, &r->versions[cntr_versions_0]));
+               }
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_versions_0, 0);
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, 
&r->_pad));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+               NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
 const uint8_t DCERPC_SEC_VT_MAGIC[] = 
{0x8a,0xe3,0x13,0x71,0x02,0xf4,0x36,0x71};
 
 _PUBLIC_ enum ndr_err_code ndr_push_dcerpc_sec_vt_count(struct ndr_push *ndr, 
int ndr_flags, const struct dcerpc_sec_vt_count *r)
diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
index 1a21a83..7b84a39 100644
--- a/nsswitch/pam_winbind.c
+++ b/nsswitch/pam_winbind.c
@@ -2485,7 +2485,7 @@ static int _pam_delete_cred(pam_handle_t *pamh, int flags,
 
        retval = _pam_winbind_init_context(pamh, flags, argc, argv, type, &ctx);
        if (retval) {
-               goto out;
+               return retval;
        }
 
        _PAM_LOG_FUNCTION_ENTER("_pam_delete_cred", ctx);
@@ -2621,7 +2621,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
        retval = _pam_winbind_init_context(pamh, flags, argc, argv,
                                           PAM_WINBIND_AUTHENTICATE, &ctx);
        if (retval) {
-               goto out;
+               return retval;
        }
 
        _PAM_LOG_FUNCTION_ENTER("pam_sm_authenticate", ctx);
@@ -2773,7 +2773,7 @@ int pam_sm_setcred(pam_handle_t *pamh, int flags,
        ret = _pam_winbind_init_context(pamh, flags, argc, argv,
                                        PAM_WINBIND_SETCRED, &ctx);
        if (ret) {
-               goto out;
+               return ret;
        }
 
        _PAM_LOG_FUNCTION_ENTER("pam_sm_setcred", ctx);
@@ -2804,8 +2804,6 @@ int pam_sm_setcred(pam_handle_t *pamh, int flags,
                        break;
        }
 
- out:
-
        _PAM_LOG_FUNCTION_LEAVE("pam_sm_setcred", ctx, ret);
 
        TALLOC_FREE(ctx);
@@ -2829,7 +2827,7 @@ int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags,
        ret = _pam_winbind_init_context(pamh, flags, argc, argv,
                                        PAM_WINBIND_ACCT_MGMT, &ctx);
        if (ret) {
-               goto out;
+               return ret;
        }
 
        _PAM_LOG_FUNCTION_ENTER("pam_sm_acct_mgmt", ctx);
@@ -2925,7 +2923,7 @@ int pam_sm_open_session(pam_handle_t *pamh, int flags,
        ret = _pam_winbind_init_context(pamh, flags, argc, argv,
                                        PAM_WINBIND_OPEN_SESSION, &ctx);
        if (ret) {
-               goto out;
+               return ret;
        }
 
        _PAM_LOG_FUNCTION_ENTER("pam_sm_open_session", ctx);
@@ -2934,7 +2932,7 @@ int pam_sm_open_session(pam_handle_t *pamh, int flags,
                /* check and create homedir */
                ret = _pam_mkhomedir(ctx);
        }
- out:
+
        _PAM_LOG_FUNCTION_LEAVE("pam_sm_open_session", ctx, ret);
 
        TALLOC_FREE(ctx);
@@ -2952,12 +2950,11 @@ int pam_sm_close_session(pam_handle_t *pamh, int flags,
        ret = _pam_winbind_init_context(pamh, flags, argc, argv,
                                        PAM_WINBIND_CLOSE_SESSION, &ctx);
        if (ret) {
-               goto out;
+               return ret;
        }
 
        _PAM_LOG_FUNCTION_ENTER("pam_sm_close_session", ctx);
 
-out:
        _PAM_LOG_FUNCTION_LEAVE("pam_sm_close_session", ctx, ret);
 
        TALLOC_FREE(ctx);
@@ -3039,7 +3036,7 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
        ret = _pam_winbind_init_context(pamh, flags, argc, argv,
                                        PAM_WINBIND_CHAUTHTOK, &ctx);
        if (ret) {
-               goto out;
+               return ret;
        }
 
        _PAM_LOG_FUNCTION_ENTER("pam_sm_chauthtok", ctx);
diff --git a/nsswitch/winbind_nss_solaris.c b/nsswitch/winbind_nss_solaris.c
index 1d0ac90..dfb87e3 100644
--- a/nsswitch/winbind_nss_solaris.c
+++ b/nsswitch/winbind_nss_solaris.c
@@ -259,6 +259,9 @@ _nss_winbind_getgrnam_solwrap(nss_backend_t* be, void* args)
        if(ret == NSS_STATUS_SUCCESS)
                NSS_ARGS(args)->returnval = (void*) result;
 
+       if (NSS_ARGS(args)->erange == ERANGE && ret == NSS_STATUS_TRYAGAIN)
+               return NSS_STATUS_UNAVAIL;
+
        return ret;
 }
 
@@ -278,6 +281,9 @@ _nss_winbind_getgrgid_solwrap(nss_backend_t* be, void* args)
        if(ret == NSS_STATUS_SUCCESS)
                NSS_ARGS(args)->returnval = (void*) result;
 
+       if (NSS_ARGS(args)->erange == ERANGE && ret == NSS_STATUS_TRYAGAIN)
+               return NSS_STATUS_UNAVAIL;
+
        return ret;
 }
 
diff --git a/selftest/knownfail b/selftest/knownfail
index 7a89fde..fd41263 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -147,9 +147,11 @@
 ^samba4.raw.acls.*.create_file
 ^samba4.smb2.create.*.acldir
 ^samba4.smb2.create.*.impersonation
+^samba4.smb2.create.*.mkdir-dup # bug 11486
 ^samba4.smb2.acls.*.generic
 ^samba4.smb2.acls.*.inheritflags
 ^samba4.smb2.acls.*.owner
+^samba4.smb2.acls.*.ACCESSBASED
 
^samba4.ldap.dirsync.python.dc..__main__.ExtendedDirsyncTests.test_dirsync_deleted_items
 #^samba4.ldap.dirsync.python.dc..__main__.ExtendedDirsyncTests.*
 ^samba4.libsmbclient.opendir.opendir # This requires netbios browsing
diff --git a/source3/client/client.c b/source3/client/client.c
index 1458cf2..67cc359 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -4523,6 +4523,124 @@ static int cmd_show_connect( void )
        return 0;
 }
 
+/**
+ * set_remote_attr - set DOS attributes of a remote file
+ * @filename: path to the file name
+ * @new_attr: attribute bit mask to use
+ * @mode: one of ATTR_SET or ATTR_UNSET
+ *
+ * Update the file attributes with the one provided.
+ */
+int set_remote_attr(const char *filename, uint16 new_attr, int mode)
+{
+       extern struct cli_state *cli;
+       uint16 old_attr;
+       NTSTATUS status;
+
+       status = cli_getatr(cli, filename, &old_attr, NULL, NULL);
+       if (!NT_STATUS_IS_OK(status)) {
+               d_printf("cli_getatr failed: %s\n", nt_errstr(status));
+               return 1;
+       }
+
+       if (mode == ATTR_SET) {
+               new_attr |= old_attr;
+       } else {
+               new_attr = old_attr & ~new_attr;
+       }
+
+       status = cli_setatr(cli, filename, new_attr, 0);
+       if (!NT_STATUS_IS_OK(status)) {
+               d_printf("cli_setatr failed: %s\n", nt_errstr(status));
+               return 1;
+       }
+
+       return 0;
+}
+
+/**
+ * cmd_setmode - interactive command to set DOS attributes
+ *
+ * Read a filename and mode from the client command line and update
+ * the file DOS attributes.
+ */
+int cmd_setmode(void)
+{
+       const extern char *cmd_ptr;
+       char *buf;
+       char *fname = NULL;
+       uint16 attr[2] = {0};
+       int mode = ATTR_SET;
+       int err = 0;
+       bool ok;
+       TALLOC_CTX *ctx = talloc_new(NULL);
+       if (ctx == NULL) {
+               return 1;
+       }
+
+       ok = next_token_talloc(ctx, &cmd_ptr, &buf, NULL);
+       if (!ok) {
+               d_printf("setmode <filename> <[+|-]rsha>\n");
+               err = 1;
+               goto out;
+       }
+
+       fname = talloc_asprintf(ctx,
+                               "%s%s",
+                               client_get_cur_dir(),
+                               buf);
+       if (fname == NULL) {
+               err = 1;
+               goto out;
+       }
+
+       while (next_token_talloc(ctx, &cmd_ptr, &buf, NULL)) {
+               const char *s = buf;
+
+               while (*s) {
+                       switch (*s++) {


-- 
Samba Shared Repository

Reply via email to