[SCM] Samba Shared Repository - branch master updated

David Mulder dmulder at samba.org
Fri Feb 10 20:32:01 UTC 2023


The branch, master has been updated
       via  5b7fc5b696c gp: gp_sudoers_ext warn w/out visudo installed
       via  ff98ddf0f92 gp: Log ext failure with file and line number
      from  075bd6b9f15 s4-auth: Free user_info_dc in KDC caller to authsam_update_user_info_dc()

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


- Log -----------------------------------------------------------------
commit 5b7fc5b696cc64c8a612d1a59eb3baa9d59e63c4
Author: David Mulder <dmulder at samba.org>
Date:   Thu Feb 9 10:43:42 2023 -0700

    gp: gp_sudoers_ext warn w/out visudo installed
    
    Rather than print an ugly error message from
    Popen, display a warning to the user if visudo
    is missing.
    
    Signed-off-by: David Mulder <dmulder at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): David Mulder <dmulder at samba.org>
    Autobuild-Date(master): Fri Feb 10 20:31:37 UTC 2023 on atb-devel-224

commit ff98ddf0f9286db545419bb52947ebf5c021885f
Author: David Mulder <dmulder at samba.org>
Date:   Thu Feb 9 10:34:24 2023 -0700

    gp: Log ext failure with file and line number
    
    Rather than dumping a traceback when there is a
    failure, simply log the file name, line number
    and the error message instead. This is much
    cleaner.
    
    Signed-off-by: David Mulder <dmulder at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

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

Summary of changes:
 python/samba/gp/gp_sudoers_ext.py | 2 ++
 python/samba/gp/gpclass.py        | 6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/python/samba/gp/gp_sudoers_ext.py b/python/samba/gp/gp_sudoers_ext.py
index 5607298eb19..1990962144f 100644
--- a/python/samba/gp/gp_sudoers_ext.py
+++ b/python/samba/gp/gp_sudoers_ext.py
@@ -49,6 +49,8 @@ def sudo_applier_func(sudo_dir, sudo_entries):
         with NamedTemporaryFile() as f:
             with open(f.name, 'w') as w:
                 w.write(contents)
+            if visudo is None:
+                raise FileNotFoundError('visudo not found, please install it')
             sudo_validation = \
                     Popen([visudo, '-c', '-f', f.name],
                         stdout=PIPE, stderr=PIPE).wait()
diff --git a/python/samba/gp/gpclass.py b/python/samba/gp/gpclass.py
index 4737bfe0738..bec1ec5fecf 100644
--- a/python/samba/gp/gpclass.py
+++ b/python/samba/gp/gpclass.py
@@ -677,8 +677,10 @@ def apply_gp(lp, creds, store, gp_extensions, username, target, force=False):
                                 del_gpos, changed_gpos)
         except Exception as e:
             log.error('Failed to apply extension  %s' % str(ext))
-            log.error('Message was: %s: %s' % (type(e).__name__, str(e)))
-            log.debug(traceback.format_exc())
+            _, _, tb = sys.exc_info()
+            filename, line_number, _, _ = traceback.extract_tb(tb)[-1]
+            log.error('%s:%d: %s: %s' % (filename, line_number,
+                                         type(e).__name__, str(e)))
             continue
     for gpo_obj in gpos:
         if not gpo_obj.file_sys_path:


-- 
Samba Shared Repository



More information about the samba-cvs mailing list