The branch, v4-8-stable has been updated
       via  42a6fee788d VERSION: Disable GIT_SNAPSHOT for the 4.8.9 release.
       via  be692dd1918 WHATSNEW: Add release notes for Samba 4.8.9.
       via  1be33edc670 s3-vfs: Use ENOATTR in errno comparison for getxattr
       via  3db3eff3120 s3-vfs: add glusterfs_fuse vfs module.
       via  10360077122 selftest:Samba4: use 'smbcontrol samba shutdown'
       via  37b9360c714 s4:server: add support for 'smbcontrol samba shutdown'
       via  676a2fcfdf0 s4:server: avoid using pid=0 for the parent 'samba' 
process
       via  121348d4a56 s4:messaging: add support 'smbcontrol <pid> 
debug/debuglevel'
       via  39abec8db34 manpages/samba.7.xml: smbcontrol can also work with 
'samba'
       via  72e45c8841d join: Throw CommandError instead of Exception for 
simple errors
       via  7acef6b7f43 join: Fix TypeError when handling exception
       via  244bd50e364 vfs_glusterfs: Adapt to changes in libgfapi signatures
       via  b5bc51a7511 vfs_fileid: fix fsname_norootdir algorithm
       via  c56beb9a1fd vfs_fileid: fix get_connectpath_ino
       via  df175f06f9f s3:libsmb: cli_smb2_list() can sometimes fail initially 
on a connection
       via  bb76511f413 libcli: Add error log if insufficient SMB2 credits
       via  b7134e36f8d s3: libsmb: use smb2cli_conn_max_trans_size() in 
cli_smb2_list()
       via  8932a4a161f s3: lib: nmbname: Ensure we limit the NetBIOS name 
correctly. CID: 1433607
       via  129423d3657 s3-vfs-fruit: add close call
       via  c5e171f72e5 s3-vfs-streams_xattr: add close call
       via  8dc1d8c431a dns: changing onelevel search for wildcard to subtree
       via  cfad63624ce s3:auth_winbind: ignore a missing winbindd as NT4 
PDC/BDC without trusts
       via  2181925b13c s3:auth_winbind: return NT_STATUS_NO_LOGON_SERVERS if 
winbindd is not available
       via  ab1bcc4e56f s3:auth_winbind: remove fallback to optional backend
       via  5b0d2f79534 s3-smbd: avoid assuming fsp is always intact after 
close_file call.
       via  daac3542983 lib/util: Count a trailing line that doesn't end in a 
newline
       via  5067926e4fe s3:utils/smbget fix recursive download with empty 
source directories
       via  7aba48de14f s3:utils/smbget add error handling for mkdir() calls
       via  6058729541a s3:script/tests reduce code duplication
       via  74507e182c7 vfs_shadow_copy2: in fstat also convert fsp->fsp_name 
and fsp->base_fsp->fsp_name
       via  0d353c2ab06 s3:smbd: pass down twrp from SMB2_CREATE to 
filename_convert()
       via  299eef1e7e1 s3:smbd: add twrp args to filename_convert()
       via  b2dcbafef73 s3:smbd: add twrp processing to 
filename_convert_internal()
       via  b12bceb8b7e s3:smbd: prepare filename_convert_internal() for twrp
       via  450ac189c88 s3:selftest: add a VSS test reading a stream
       via  6f55dc0ccdf s3-vfs: Prevent NULL pointer dereference in 
vfs_glusterfs.
       via  06336d8a59e vfs_shadow_copy2: nicely deal with attempts to open 
previous version for writing
       via  eae534f01ca vfs_shadow_copy2: add 
shadow_copy2_strip_snapshot_converted
       via  5a0d7463c60 vfs_shadow_copy2: add _already_converted arg to 
shadow_copy2_strip_snapshot_internal()
       via  de114204480 s3:script/tests: add a test for VSS write behaviour
       via  8c031cf05e5 s4:torture: add a test-suite for VSS
       via  b22e8f355bd vfs_error_inject: add EBADF error
       via  688f91e366a vfs_error_inject: add pwrite
       via  a988dcb90c4 VERSION: Bump version up to 4.8.9...
      from  91c4bf85967 VERSION: Disable GIT_SNAPSHOT for the 4.8.8 release.

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


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

Summary of changes:
 VERSION                                          |   2 +-
 WHATSNEW.txt                                     |  89 ++++++++-
 docs-xml/manpages/samba.7.xml                    |   2 +-
 docs-xml/manpages/vfs_glusterfs_fuse.8.xml       | 103 ++++++++++
 docs-xml/wscript_build                           |   1 +
 lib/util/tests/file.c                            | 152 +++++++++++++++
 lib/util/util_file.c                             |   6 +-
 libcli/smb/smbXcli_base.c                        |   3 +
 python/samba/join.py                             |   9 +-
 python/samba/netcmd/domain.py                    |   2 +-
 selftest/target/Samba3.pm                        |   9 +
 selftest/target/Samba4.pm                        |   9 +
 source3/auth/auth.c                              |   2 +-
 source3/auth/auth_winbind.c                      |  47 +++--
 source3/libsmb/cli_smb2_fnum.c                   |  15 +-
 source3/libsmb/nmblib.c                          |  34 ++--
 source3/modules/posixacl_xattr.c                 |   4 +-
 source3/modules/vfs_error_inject.c               |  19 ++
 source3/modules/vfs_fileid.c                     |   7 +-
 source3/modules/vfs_fruit.c                      |  82 ++++++++
 source3/modules/vfs_glusterfs.c                  | 221 ++++++++++++++++++----
 source3/modules/vfs_glusterfs_fuse.c             |  71 +++++++
 source3/modules/vfs_shadow_copy2.c               | 230 +++++++++++++++++++++--
 source3/modules/vfs_streams_xattr.c              |  26 +++
 source3/modules/wscript_build                    |   8 +
 source3/rpc_server/srvsvc/srv_srvsvc_nt.c        |   2 +
 source3/script/tests/test_shadow_copy_torture.sh | 114 +++++++++++
 source3/script/tests/test_smbget.sh              |  86 +++++++--
 source3/selftest/tests.py                        |   1 +
 source3/smbd/filename.c                          |  32 +++-
 source3/smbd/nttrans.c                           |   4 +
 source3/smbd/open.c                              |   1 +
 source3/smbd/proto.h                             |   1 +
 source3/smbd/reply.c                             |  15 ++
 source3/smbd/smb2_close.c                        |   2 +-
 source3/smbd/smb2_create.c                       |  30 +--
 source3/smbd/smb2_query_directory.c              |   1 +
 source3/smbd/trans2.c                            |   8 +
 source3/utils/smbget.c                           |  11 +-
 source3/wscript                                  |   4 +
 source4/dns_server/dnsserver_common.c            |   2 +-
 source4/lib/messaging/messaging.c                |  72 +++++++
 source4/smbd/server.c                            |  40 +++-
 source4/torture/smb2/create.c                    | 174 +++++++++++++++++
 source4/torture/smb2/smb2.c                      |   1 +
 45 files changed, 1615 insertions(+), 139 deletions(-)
 create mode 100644 docs-xml/manpages/vfs_glusterfs_fuse.8.xml
 create mode 100644 source3/modules/vfs_glusterfs_fuse.c
 create mode 100755 source3/script/tests/test_shadow_copy_torture.sh


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index c5594450fa9..0c99c4084cb 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
 ########################################################
 SAMBA_VERSION_MAJOR=4
 SAMBA_VERSION_MINOR=8
-SAMBA_VERSION_RELEASE=8
+SAMBA_VERSION_RELEASE=9
 
 ########################################################
 # If a official release has a serious bug              #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index d48d1897469..ecb3db1c713 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,3 +1,88 @@
+                   =============================
+                   Release Notes for Samba 4.8.9
+                         February 7, 2019
+                   =============================
+
+
+This is the latest stable release of the Samba 4.8 release series.
+
+
+Changes since 4.8.8:
+--------------------
+
+o  Jeremy Allison <j...@samba.org>
+   * BUG 11495: s3: lib: nmbname: Ensure we limit the NetBIOS name correctly.
+     CID: 1433607.
+
+o  Christian Ambach <a...@samba.org>
+   * BUG 13199: s3:utils/smbget: Fix recursive download with empty source
+     directories.
+
+o  Tim Beale <timbe...@catalyst.net.nz>
+   * BUG 13736: s3:libsmb: cli_smb2_list() can sometimes fail initially on a
+     connection.
+   * BUG 13747: join: Throw CommandError instead of Exception for simple 
errors.
+
+o  Ralph Boehme <s...@samba.org>
+   * BUG 13688: Windows 2016 fails to restore previous version of a file from a
+     shadow_copy2 snapshot.
+   * BUG 13455: Restoring previous version of stream with vfs_shadow_copy2 
fails
+     with NT_STATUS_OBJECT_NAME_INVALID.
+   * BUG 13736: s3: libsmb: Use smb2cli_conn_max_trans_size() in
+     cli_smb2_list().
+
+o  Günther Deschner <g...@samba.org>
+   * BUG 13708: s3-vfs: Prevent NULL pointer dereference in vfs_glusterfs.
+   * BUG 13720: s3-smbd: Avoid assuming fsp is always intact after close_file
+     call.
+   * BUG 13725: s3-vfs-fruit,s3-vfs-streams_xattr: Add close call.
+   * BUG 13774: s3-vfs: Add glusterfs_fuse vfs module.
+
+o  Aaron Haslett <aaronhasl...@catalyst.net.nz>
+   * BUG 13738: dns: Changing onelevel search for wildcard to subtree.
+
+o  Stefan Metzmacher <me...@samba.org>
+   * BUG 13722: s3:auth_winbind: Ignore a missing winbindd as NT4 PDC/BDC
+     without trusts.
+   * BUG 13723: s3:auth_winbind: Return NT_STATUS_NO_LOGON_SERVERS if winbindd
+     is not available.
+   * BUG 13752: s4:messaging: Add support 'smbcontrol <pid> debug/debuglevel'.
+
+o  Anoop C S <anoo...@redhat.com>
+   * BUG 13330: vfs_glusterfs: Adapt to changes in libgfapi signatures.
+   * BUG 13774: s3-vfs: Use ENOATTR in errno comparison for getxattr.
+
+o  Martin Schwenke <mar...@meltin.net>
+   * BUG 13717: lib/util: Count a trailing line that doesn't end in a newline.
+
+o  Ralph Wuerthner <ralph.wuerth...@de.ibm.com>
+   * BUG 13741: vfs_fileid: Fix get_connectpath_ino.
+   * BUG 13744: vfs_fileid: Fix fsname_norootdir algorithm.
+
+
+#######################################
+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.1 and newer" 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.8.8
                          December 13, 2018
@@ -96,8 +181,8 @@ database (https://bugzilla.samba.org/).
 ======================================================================
 
 
-Release notes for older releases follow:
-----------------------------------------
+----------------------------------------------------------------------
+
 
                    =============================
                    Release Notes for Samba 4.8.7
diff --git a/docs-xml/manpages/samba.7.xml b/docs-xml/manpages/samba.7.xml
index 761c8d3c65a..750a718185b 100644
--- a/docs-xml/manpages/samba.7.xml
+++ b/docs-xml/manpages/samba.7.xml
@@ -166,7 +166,7 @@
                <manvolnum>1</manvolnum></citerefentry></term>
                <listitem><para><command>smbcontrol</command> is a utility
                that can change the behaviour of running
-               <command>smbd</command>, <command>nmbd</command> and
+               <command>samba</command>, <command>smbd</command>, 
<command>nmbd</command> and
                <command>winbindd</command> daemons.
                </para></listitem>
                </varlistentry>
diff --git a/docs-xml/manpages/vfs_glusterfs_fuse.8.xml 
b/docs-xml/manpages/vfs_glusterfs_fuse.8.xml
new file mode 100644
index 00000000000..b9f7f42c6f2
--- /dev/null
+++ b/docs-xml/manpages/vfs_glusterfs_fuse.8.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant 
V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc";>
+<refentry id="vfs_glusterfs_fuse.8">
+
+<refmeta>
+       <refentrytitle>vfs_glusterfs_fuse</refentrytitle>
+       <manvolnum>8</manvolnum>
+       <refmiscinfo class="source">Samba</refmiscinfo>
+       <refmiscinfo class="manual">System Administration tools</refmiscinfo>
+       <refmiscinfo class="version">&doc.version;</refmiscinfo>
+</refmeta>
+
+
+<refnamediv>
+       <refname>vfs_glusterfs_fuse</refname>
+       <refpurpose>
+               Utilize features provided by GlusterFS
+       </refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+       <cmdsynopsis>
+               <command>vfs objects = glusterfs_fuse</command>
+       </cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1>
+       <title>DESCRIPTION</title>
+
+       <para>This VFS module is part of the
+       <citerefentry><refentrytitle>samba</refentrytitle>
+       <manvolnum>8</manvolnum></citerefentry> suite.</para>
+
+       <para>
+               GlusterFS
+               (<ulink 
url="http://www.gluster.org/";>http://www.gluster.org</ulink>)
+               is an Open Source clustered file system capable of scaling to
+               several peta-bytes.  With its FUSE based native client,
+               GlusterFS is available as a POSIX compliant file system and can
+               hence be shared by Samba without additional steps.
+       </para>
+
+       <para>
+               The <command>vfs_glusterfs_fuse</command> VFS module provides 
an enhanced way
+               to access a Gluster filesystem using a Gluster FUSE mount. It 
provides support
+               for the <command>get_real_filename</command> VFS call which 
enhances file access performance
+               by avoiding multiple expensive case folding lookup calls to 
detect the appropriate
+               case of an exisiting filename.
+       </para>
+
+       <para>
+               This module can be combined with other modules, but it
+               should be the last module in the <command>vfs objects</command>
+               list. Modules added to this list to the right of the glusterfs
+               entry may not have any effect at all.
+       </para>
+</refsect1>
+
+<refsect1>
+       <title>CONFIGURATION</title>
+
+       <para>
+               A basic configuration looks like this.
+       </para>
+
+       <programlisting>
+               <smbconfsection name="[share]"/>
+               <smbconfoption name="vfs objects">glusterfs_fuse</smbconfoption>
+               <smbconfoption 
name="path">/absolute/path_of_fusemount</smbconfoption>
+       </programlisting>
+
+       <para>
+               Note that <command>vfs_glusterfs_fuse</command> requires a 
Gluster mount. For accessing glusterfs directly
+               over the GFAPI library please use the 
<command>vfs_glusterfs</command> module.
+       </para>
+</refsect1>
+
+<refsect1>
+       <title>OPTIONS</title>
+       <para>
+               This module does currently have no further options.
+       </para>
+</refsect1>
+
+<refsect1>
+       <title>VERSION</title>
+
+       <para>
+               This man page is part of version &doc.version; of the Samba 
suite.
+       </para>
+</refsect1>
+
+<refsect1>
+       <title>AUTHOR</title>
+
+       <para>The original Samba software and related utilities
+       were created by Andrew Tridgell. Samba is now developed
+       by the Samba Team as an Open Source project similar
+       to the way the Linux kernel is developed.</para>
+
+</refsect1>
+
+</refentry>
diff --git a/docs-xml/wscript_build b/docs-xml/wscript_build
index ec5d28fc62a..d0edfdbed2c 100644
--- a/docs-xml/wscript_build
+++ b/docs-xml/wscript_build
@@ -69,6 +69,7 @@ manpages='''
          manpages/vfs_fruit.8
          manpages/vfs_full_audit.8
          manpages/vfs_glusterfs.8
+         manpages/vfs_glusterfs_fuse.8
          manpages/vfs_gpfs.8
          manpages/vfs_linux_xfs_sgid.8
          manpages/vfs_media_harmony.8
diff --git a/lib/util/tests/file.c b/lib/util/tests/file.c
index f349c214f08..ca0416e20e6 100644
--- a/lib/util/tests/file.c
+++ b/lib/util/tests/file.c
@@ -60,6 +60,154 @@ static bool test_file_load_save(struct torture_context 
*tctx)
        return true;
 }
 
+#define TEST_DATA_WITH_NEWLINE TEST_DATA "\n"
+#define TEST_DATA_NO_NEWLINE TEST_DATA
+#define TEST_DATA_EMPTY ""
+#define TEST_DATA_BLANKS_ONLY "\n\n\n\n\n"
+#define TEST_DATA_WITH_TRAILING_BLANKS TEST_DATA TEST_DATA_BLANKS_ONLY
+
+static bool test_file_lines_load(struct torture_context *tctx)
+{
+       char **lines;
+       int numlines;
+       TALLOC_CTX *mem_ctx = tctx;
+
+       /*
+        * Last line has trailing whitespace
+        */
+
+       torture_assert(tctx,
+                      file_save(TEST_FILENAME,
+                                TEST_DATA_WITH_NEWLINE,
+                                strlen(TEST_DATA_WITH_NEWLINE)),
+                      "saving file");
+
+       lines = file_lines_load(TEST_FILENAME, &numlines, 0, mem_ctx);
+
+       torture_assert_int_equal(tctx, numlines, 3, "Lines");
+
+       torture_assert_mem_equal(tctx,
+                                lines[0],
+                                TEST_LINE1,
+                                strlen(TEST_LINE1),
+                                "Line 1");
+
+       torture_assert_mem_equal(tctx,
+                                lines[1],
+                                TEST_LINE2,
+                                strlen(TEST_LINE2),
+                                "Line 2");
+
+       torture_assert_mem_equal(tctx,
+                                lines[2],
+                                TEST_LINE3,
+                                strlen(TEST_LINE3),
+                                "Line 3");
+
+       unlink(TEST_FILENAME);
+
+       /*
+        * Last line has NO trailing whitespace
+        */
+
+       torture_assert(tctx,
+                      file_save(TEST_FILENAME,
+                                TEST_DATA_NO_NEWLINE,
+                                strlen(TEST_DATA_NO_NEWLINE)),
+                      "saving file");
+
+       lines = file_lines_load(TEST_FILENAME, &numlines, 0, mem_ctx);
+
+       torture_assert_int_equal(tctx, numlines, 3, "Lines");
+
+       torture_assert_mem_equal(tctx,
+                                lines[0],
+                                TEST_LINE1,
+                                strlen(TEST_LINE1),
+                                "Line 1");
+
+       torture_assert_mem_equal(tctx,
+                                lines[1],
+                                TEST_LINE2,
+                                strlen(TEST_LINE2),
+                                "Line 2");
+
+       torture_assert_mem_equal(tctx,
+                                lines[2],
+                                TEST_LINE3,
+                                strlen(TEST_LINE3),
+                                "Line 3");
+
+       unlink(TEST_FILENAME);
+
+       /*
+        * Empty file
+        */
+
+       torture_assert(tctx,
+                      file_save(TEST_FILENAME,
+                                TEST_DATA_EMPTY,
+                                strlen(TEST_DATA_EMPTY)),
+                      "saving file");
+
+       lines = file_lines_load(TEST_FILENAME, &numlines, 0, mem_ctx);
+
+       torture_assert_int_equal(tctx, numlines, 0, "Lines");
+
+       unlink(TEST_FILENAME);
+
+       /*
+        * Just blank lines
+        */
+
+       torture_assert(tctx,
+                      file_save(TEST_FILENAME,
+                                TEST_DATA_BLANKS_ONLY,
+                                strlen(TEST_DATA_BLANKS_ONLY)),
+                      "saving file");
+
+       lines = file_lines_load(TEST_FILENAME, &numlines, 0, mem_ctx);
+
+       torture_assert_int_equal(tctx, numlines, 0, "Lines");
+
+       unlink(TEST_FILENAME);
+
+       /*
+        * Several trailing blank lines
+        */
+
+       torture_assert(tctx,
+                      file_save(TEST_FILENAME,
+                                TEST_DATA_WITH_TRAILING_BLANKS,
+                                strlen(TEST_DATA_WITH_TRAILING_BLANKS)),
+                      "saving file");
+
+       lines = file_lines_load(TEST_FILENAME, &numlines, 0, mem_ctx);
+
+       torture_assert_int_equal(tctx, numlines, 3, "Lines");
+
+       torture_assert_mem_equal(tctx,
+                                lines[0],
+                                TEST_LINE1,
+                                strlen(TEST_LINE1),
+                                "Line 1");
+
+       torture_assert_mem_equal(tctx,
+                                lines[1],
+                                TEST_LINE2,
+                                strlen(TEST_LINE2),
+                                "Line 2");
+
+       torture_assert_mem_equal(tctx,
+                                lines[2],
+                                TEST_LINE3,
+                                strlen(TEST_LINE3),
+                                "Line 3");
+
+       unlink(TEST_FILENAME);
+
+       return true;
+}
 
 static bool test_afdgets(struct torture_context *tctx)
 {
@@ -102,6 +250,10 @@ struct torture_suite *torture_local_util_file(TALLOC_CTX 
*mem_ctx)
        torture_suite_add_simple_test(suite, "file_load_save", 
                                      test_file_load_save);
 
+       torture_suite_add_simple_test(suite,
+                                     "file_lines_load",
+                                     test_file_lines_load);
+
        torture_suite_add_simple_test(suite, "afdgets", test_afdgets);
 
        return suite;
diff --git a/lib/util/util_file.c b/lib/util/util_file.c
index ac8206008a3..b449ce07f62 100644
--- a/lib/util/util_file.c
+++ b/lib/util/util_file.c
@@ -219,7 +219,7 @@ parse a buffer into lines
 **/
 char **file_lines_parse(char *p, size_t size, int *numlines, TALLOC_CTX 
*mem_ctx)
 {
-       int i;
+       unsigned int i;
        char *s, **ret;
 
        if (!p) return NULL;
@@ -237,11 +237,11 @@ char **file_lines_parse(char *p, size_t size, int 
*numlines, TALLOC_CTX *mem_ctx
        talloc_steal(ret, p);
 
        ret[0] = p;
-       for (s = p, i=0; s < p+size; s++) {
+       for (s = p, i=1; s < p+size; s++) {
                if (s[0] == '\n') {
                        s[0] = 0;
-                       i++;
                        ret[i] = s+1;
+                       i++;
                }
                if (s[0] == '\r') s[0] = 0;
        }
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index 3f65216a669..10de278825a 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -3231,6 +3231,9 @@ NTSTATUS smb2cli_req_compound_submit(struct tevent_req 
**reqs,
 
                avail = MIN(avail, state->conn->smb2.cur_credits);
                if (avail < charge) {
+                       DBG_ERR("Insufficient credits. "
+                               "%"PRIu64" available, %"PRIu16" needed\n",
+                               avail, charge);
                        return NT_STATUS_INTERNAL_ERROR;
                }
 
diff --git a/python/samba/join.py b/python/samba/join.py
index 9782f536dce..d577df07069 100644
--- a/python/samba/join.py
+++ b/python/samba/join.py
@@ -35,13 +35,14 @@ from samba.provision.sambadns import setup_bind9_dns
 from samba import read_and_sub_file
 from samba import werror
 from base64 import b64encode
-from samba import WERRORError
+from samba import WERRORError, NTSTATUSError
 from samba.dnsserver import ARecord, AAAARecord, PTRRecord, CNameRecord, 
NSRecord, MXRecord, SOARecord, SRVRecord, TXTRecord
 from samba import sd_utils
 import logging
 import talloc
 import random
 import time
+from samba.netcmd import CommandError
 
 class DCJoinException(Exception):
 
@@ -337,10 +338,10 @@ class dc_join(object):
         try:
             ctx.cldap_ret = ctx.net.finddc(domain=domain, 
flags=nbt.NBT_SERVER_LDAP | nbt.NBT_SERVER_DS | nbt.NBT_SERVER_WRITABLE)
         except NTSTATUSError as error:
-            raise Exception("Failed to find a writeable DC for domain '%s': 
%s" %
-                            (domain, error[1]))
+            raise CommandError("Failed to find a writeable DC for domain '%s': 
%s" %
+                               (domain, error.args[1]))
         except Exception:
-            raise Exception("Failed to find a writeable DC for domain '%s'" % 
domain)
+            raise CommandError("Failed to find a writeable DC for domain '%s'" 
% domain)
         if ctx.cldap_ret.client_site is not None and ctx.cldap_ret.client_site 
!= "":
             ctx.site = ctx.cldap_ret.client_site
         return ctx.cldap_ret.pdc_dns_name
diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py
index 38c800c711b..2901605ce29 100644
--- a/python/samba/netcmd/domain.py
+++ b/python/samba/netcmd/domain.py


-- 
Samba Shared Repository

Reply via email to