[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed Jan 16 21:12:04 UTC 2019


The branch, master has been updated
       via  9e4b08f4c38 join: Throw CommandError instead of Exception for simple errors
       via  3bb7808984c join: Fix TypeError when handling exception
       via  e68dd420b45 libcli: remove declaration of nt_errstr_const
      from  c324f84a2fa s3:libsmb: Honor disable_netbios option in smbsock_connect_send

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


- Log -----------------------------------------------------------------
commit 9e4b08f4c384b8cae5ad853a7be7cf03e2749be5
Author: Tim Beale <timbeale at catalyst.net.nz>
Date:   Wed Jan 16 15:37:00 2019 +1300

    join: Throw CommandError instead of Exception for simple errors
    
    Throwing an exception here still dumps out the Python stack trace, which
    can be a little disconcerting for users.
    
    In this case, the stack trace isn't going to really help at all (the
    problem is pretty obvious), and it obscures the useful message
    explaining what went wrong.
    
    Throw a CommandError instead, which samba-tool will catch and display
    more nicely.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13747
    
    Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
    Reviewed-by: Rowland Penny <rpenny at samba.org>
    Reviewed-by: Jeremy Allison <rpenny at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Jan 16 22:11:04 CET 2019 on sn-devel-144

commit 3bb7808984c163a7bba66fb983411d1281589722
Author: Tim Beale <timbeale at catalyst.net.nz>
Date:   Wed Jan 16 15:17:38 2019 +1300

    join: Fix TypeError when handling exception
    
    When we can't resolve a domain name, we were inadvertently throwing a
    TypeError whilst trying to output a helpful message. E.g.
    
    ERROR(<class 'TypeError'>): uncaught exception - 'NTSTATUSError' object
    does not support indexing
    
    Instead of indexing the object, we want to index the Exception.args so
    that we just display the string portion of the exception error.
    
    The same problem is also present for the domain trust commands.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13747
    
    Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
    Reviewed-by: Rowland Penny <rpenny at samba.org>
    Reviewed-by: Jeremy Allison <rpenny at samba.org>

commit e68dd420b45a3f7d9ce3b08e866c5495be18b725
Author: Philipp Gesang <philipp.gesang at intra2net.com>
Date:   Wed Jan 16 10:01:28 2019 +0100

    libcli: remove declaration of nt_errstr_const
    
    nt_errstr_const was renamed nt_errstr in 2011, rendering the
    declaration useless.
    
    Signed-off-by: Philipp Gesang <philipp.gesang at intra2net.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 libcli/util/ntstatus.h        | 9 ---------
 python/samba/join.py          | 7 ++++---
 python/samba/netcmd/domain.py | 2 +-
 3 files changed, 5 insertions(+), 13 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/util/ntstatus.h b/libcli/util/ntstatus.h
index e24d6eb9843..4b5f1ca1802 100644
--- a/libcli/util/ntstatus.h
+++ b/libcli/util/ntstatus.h
@@ -102,15 +102,6 @@ typedef uint32_t NTSTATUS;
  * this means we need a torture test */
 #define NT_STATUS_FOOBAR NT_STATUS_UNSUCCESSFUL
 
-/*****************************************************************************
- Returns an NT error message.  not amazingly helpful, but better than a number.
-
- This version is const, and so neither allocates memory nor uses a
- static variable for unknown errors.
- *****************************************************************************/
-
-const char *nt_errstr_const(NTSTATUS nt_code);
-
 /*****************************************************************************
  returns an NT error message.  not amazingly helpful, but better than a number.
  *****************************************************************************/
diff --git a/python/samba/join.py b/python/samba/join.py
index cf5d1b92b66..da8dcb050d3 100644
--- a/python/samba/join.py
+++ b/python/samba/join.py
@@ -50,6 +50,7 @@ import os
 import tempfile
 from samba.compat import text_type
 from samba.compat import get_string
+from samba.netcmd import CommandError
 
 
 class DCJoinException(Exception):
@@ -345,10 +346,10 @@ class DCJoinContext(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 9c5ae21fdd7..b7aedc16a91 100644
--- a/python/samba/netcmd/domain.py
+++ b/python/samba/netcmd/domain.py
@@ -1802,7 +1802,7 @@ class DomainTrustCommand(Command):
             remote_info = remote_net.finddc(flags=remote_flags, domain=domain, address=remote_server)
         except NTSTATUSError as error:
             raise CommandError("Failed to find a writeable DC for domain '%s': %s" %
-                               (domain, error[1]))
+                               (domain, error.args[1]))
         except Exception:
             raise CommandError("Failed to find a writeable DC for domain '%s'" % domain)
         flag_map = {


-- 
Samba Shared Repository



More information about the samba-cvs mailing list