The branch, master has been updated
       via  93c576dae4a auth:creds: Add cli_credentials_dump()
       via  3e61d1ff31b autobuild.py: use --enable-clangdb for the "samba-ctdb" 
task
       via  df73a766ab6 wafsamba: move clang_compilation_database usage behind 
an --enable-clangdb option
      from  874c5fcf6da smbd: Remove the smb_fname parameter from set_ea().

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


- Log -----------------------------------------------------------------
commit 93c576dae4a2179a253dea4e8969ac435718bda5
Author: Andreas Schneider <a...@samba.org>
Date:   Thu Dec 10 16:48:16 2020 +0100

    auth:creds: Add cli_credentials_dump()
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Noel Power <noel.po...@suse.com>
    
    Autobuild-User(master): Andreas Schneider <a...@cryptomilk.org>
    Autobuild-Date(master): Wed Dec 16 13:56:49 UTC 2020 on sn-devel-184

commit 3e61d1ff31b77a2fc3c2733c90d535a071aab8b5
Author: Stefan Metzmacher <me...@samba.org>
Date:   Tue Dec 15 13:43:22 2020 +0100

    autobuild.py: use --enable-clangdb for the "samba-ctdb" task
    
    The key is that we only enable it for just one task.
    
    I plan to restructure the autobuild tasks, but 'samba-ctdb'
    will stay the way it works currently.
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit df73a766ab6841e9e21b84fed230c8063bb43019
Author: Stefan Metzmacher <me...@samba.org>
Date:   Tue Dec 15 13:39:40 2020 +0100

    wafsamba: move clang_compilation_database usage behind an --enable-clangdb 
option
    
    Writing bin/default/compile_commands.json doubles the total time used
    for a noop build. That price should only be paid if someone wants to
    use it actually.
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

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

Summary of changes:
 auth/credentials/credentials.c      | 161 ++++++++++++++++++++++++++++++++++++
 auth/credentials/credentials.h      |   2 +
 auth/credentials/tests/test_creds.c |   3 +
 buildtools/wafsamba/samba_utils.py  |   9 +-
 buildtools/wafsamba/samba_waf18.py  |  10 +--
 buildtools/wafsamba/wscript         |  16 ++--
 script/autobuild.py                 |   1 +
 7 files changed, 190 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/auth/credentials/credentials.c b/auth/credentials/credentials.c
index 1bdd6f15a09..6596a227bee 100644
--- a/auth/credentials/credentials.c
+++ b/auth/credentials/credentials.c
@@ -1459,6 +1459,167 @@ _PUBLIC_ bool cli_credentials_set_smb_encryption(struct 
cli_credentials *creds,
        return false;
 }
 
+static const char *obtained_to_str(enum credentials_obtained obtained)
+{
+       switch (obtained) {
+       case CRED_UNINITIALISED:
+               return "CRED_UNINITIALISED";
+       case CRED_SMB_CONF:
+               return "CRED_SMB_CONF";
+       case CRED_CALLBACK:
+               return "CRED_CALLBACK";
+       case CRED_GUESS_ENV:
+               return "CRED_GUESS_ENV";
+       case CRED_GUESS_FILE:
+               return "CRED_GUESS_FILE";
+       case CRED_CALLBACK_RESULT:
+               return "CRED_CALLBACK_RESULT";
+       case CRED_SPECIFIED:
+               return "CRED_SPECIFIED";
+       }
+
+       /* Never reached */
+       return "";
+}
+
+static const char *krb5_state_to_str(enum credentials_use_kerberos krb5_state)
+{
+       switch (krb5_state) {
+       case CRED_USE_KERBEROS_DISABLED:
+               return "CRED_USE_KERBEROS_DISABLED";
+       case CRED_USE_KERBEROS_DESIRED:
+               return "CRED_USE_KERBEROS_DESIRED";
+       case CRED_USE_KERBEROS_REQUIRED:
+               return "CRED_USE_KERBEROS_REQUIRED";
+       }
+
+       /* Never reached */
+       return "";
+}
+
+static const char *krb5_fwd_to_str(enum credentials_krb_forwardable krb5_fwd)
+{
+       switch (krb5_fwd) {
+       case CRED_AUTO_KRB_FORWARDABLE:
+               return "CRED_AUTO_KRB_FORWARDABLE";
+       case CRED_NO_KRB_FORWARDABLE:
+               return "CRED_NO_KRB_FORWARDABLE";
+       case CRED_FORCE_KRB_FORWARDABLE:
+               return "CRED_FORCE_KRB_FORWARDABLE";
+       }
+
+       /* Never reached */
+       return "";
+}
+
+static const char *signing_state_to_str(enum smb_signing_setting signing_state)
+{
+       switch(signing_state) {
+       case SMB_SIGNING_IPC_DEFAULT:
+               return "SMB_SIGNING_IPC_DEFAULT";
+       case SMB_SIGNING_DEFAULT:
+               return "SMB_SIGNING_DEFAULT";
+       case SMB_SIGNING_OFF:
+               return "SMB_SIGNING_OFF";
+       case SMB_SIGNING_IF_REQUIRED:
+               return "SMB_SIGNING_IF_REQUIRED";
+       case SMB_SIGNING_DESIRED:
+               return "SMB_SIGNING_DESIRED";
+       case SMB_SIGNING_REQUIRED:
+               return "SMB_SIGNING_REQUIRED";
+       }
+
+       /* Never reached */
+       return "";
+}
+
+static const char *encryption_state_to_str(enum smb_encryption_setting 
encryption_state)
+{
+       switch(encryption_state) {
+       case SMB_ENCRYPTION_DEFAULT:
+               return "SMB_ENCRYPTION_DEFAULT";
+       case SMB_ENCRYPTION_OFF:
+               return "SMB_ENCRYPTION_OFF";
+       case SMB_ENCRYPTION_IF_REQUIRED:
+               return "SMB_ENCRYPTION_IF_REQUIRED";
+       case SMB_ENCRYPTION_DESIRED:
+               return "SMB_ENCRYPTION_DESIRED";
+       case SMB_ENCRYPTION_REQUIRED:
+               return "SMB_ENCRYPTION_REQUIRED";
+       }
+
+       /* Never reached */
+       return "";
+}
+
+_PUBLIC_ void cli_credentials_dump(struct cli_credentials *creds)
+{
+       DBG_ERR("CLI_CREDENTIALS:\n");
+       DBG_ERR("\n");
+       DBG_ERR("  Username: %s - %s\n",
+               creds->username,
+               obtained_to_str(creds->username_obtained));
+       DBG_ERR("  Workstation: %s - %s\n",
+               creds->workstation,
+               obtained_to_str(creds->workstation_obtained));
+       DBG_ERR("  Domain: %s - %s\n",
+               creds->domain,
+               obtained_to_str(creds->domain_obtained));
+       DBG_ERR("  Password: %s - %s\n",
+               creds->password != NULL ? "*SECRET*" : "NULL",
+               obtained_to_str(creds->password_obtained));
+       DBG_ERR("  Old password: %s\n",
+               creds->old_password != NULL ? "*SECRET*" : "NULL");
+       DBG_ERR("  Password tries: %u\n",
+               creds->password_tries);
+       DBG_ERR("  Realm: %s - %s\n",
+               creds->realm,
+               obtained_to_str(creds->realm_obtained));
+       DBG_ERR("  Principal: %s - %s\n",
+               creds->principal,
+               obtained_to_str(creds->principal_obtained));
+       DBG_ERR("  Salt principal: %s\n",
+               creds->salt_principal);
+       DBG_ERR("  Impersonate principal: %s\n",
+               creds->impersonate_principal);
+       DBG_ERR("  Self service: %s\n",
+               creds->self_service);
+       DBG_ERR("  Target service: %s\n",
+               creds->target_service);
+       DBG_ERR("  Kerberos state: %s\n",
+               krb5_state_to_str(creds->use_kerberos));
+       DBG_ERR("  Kerberos forwardable ticket: %s\n",
+               krb5_fwd_to_str(creds->krb_forwardable));
+       DBG_ERR("  Signing state: %s - %s\n",
+               signing_state_to_str(creds->signing_state),
+               obtained_to_str(creds->signing_state_obtained));
+       DBG_ERR("  IPC signing state: %s - %s\n",
+               signing_state_to_str(creds->ipc_signing_state),
+               obtained_to_str(creds->ipc_signing_state_obtained));
+       DBG_ERR("  Encryption state: %s - %s\n",
+               encryption_state_to_str(creds->encryption_state),
+               obtained_to_str(creds->encryption_state_obtained));
+       DBG_ERR("  Gensec features: %#X\n",
+               creds->gensec_features);
+       DBG_ERR("  Forced sasl mech: %s\n",
+               creds->forced_sasl_mech);
+       DBG_ERR("  CCACHE: %p - %s\n",
+               creds->ccache,
+               obtained_to_str(creds->ccache_obtained));
+       DBG_ERR("  CLIENT_GSS_CREDS: %p - %s\n",
+               creds->client_gss_creds,
+               obtained_to_str(creds->client_gss_creds_obtained));
+       DBG_ERR("  SERVER_GSS_CREDS: %p - %s\n",
+               creds->server_gss_creds,
+               obtained_to_str(creds->server_gss_creds_obtained));
+       DBG_ERR("  KEYTAB: %p - %s\n",
+               creds->keytab,
+               obtained_to_str(creds->keytab_obtained));
+       DBG_ERR("  KVNO: %u\n",
+               creds->kvno);
+       DBG_ERR("\n");
+}
+
 /**
  * @brief Obtain the SMB encryption state from a credentials structure.
  *
diff --git a/auth/credentials/credentials.h b/auth/credentials/credentials.h
index f468b8558dd..1fff37e8154 100644
--- a/auth/credentials/credentials.h
+++ b/auth/credentials/credentials.h
@@ -315,6 +315,8 @@ bool cli_credentials_set_smb_encryption(struct 
cli_credentials *cred,
 enum smb_encryption_setting
 cli_credentials_get_smb_encryption(struct cli_credentials *cred);
 
+void cli_credentials_dump(struct cli_credentials *creds);
+
 /**
  * Return attached NETLOGON credentials 
  */
diff --git a/auth/credentials/tests/test_creds.c 
b/auth/credentials/tests/test_creds.c
index d2d3d30d73d..f58b11112ea 100644
--- a/auth/credentials/tests/test_creds.c
+++ b/auth/credentials/tests/test_creds.c
@@ -78,6 +78,9 @@ static void torture_creds_init(void **state)
        assert_int_equal(creds->password_obtained, CRED_SPECIFIED);
        password = cli_credentials_get_password(creds);
        assert_string_equal(password, "SECRET");
+
+       /* Run dump to check it works */
+       cli_credentials_dump(creds);
 }
 
 static void torture_creds_init_anonymous(void **state)
diff --git a/buildtools/wafsamba/samba_utils.py 
b/buildtools/wafsamba/samba_utils.py
index 0587f525aff..e08b55cf71d 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -459,7 +459,14 @@ def RECURSE(ctx, directory):
         return
     visited_dirs.add(key)
     relpath = os.path.relpath(abspath, ctx.path.abspath())
-    if ctxclass in ['tmp', 'OptionsContext', 'ConfigurationContext', 
'BuildContext', 'ClangDbContext']:
+    if ctxclass in ['OptionsContext',
+                    'ConfigurationContext',
+                    'BuildContext',
+                    'CleanContext',
+                    'InstallContext',
+                    'UninstallContext',
+                    'ListContext',
+                    'ClangDbContext']:
         return ctx.recurse(relpath)
     if 'waflib.extras.compat15' in sys.modules:
         return ctx.recurse(relpath)
diff --git a/buildtools/wafsamba/samba_waf18.py 
b/buildtools/wafsamba/samba_waf18.py
index ecf3891f175..e2a078bd3a0 100644
--- a/buildtools/wafsamba/samba_waf18.py
+++ b/buildtools/wafsamba/samba_waf18.py
@@ -5,7 +5,6 @@ from waflib import Build, Configure, Node, Utils, Options, 
Logs, TaskGen
 from waflib import ConfigSet
 from waflib.TaskGen import feature, after
 from waflib.Configure import conf, ConfigurationContext
-from waflib.extras import clang_compilation_database
 
 from waflib.Tools.flex import decide_ext
 
@@ -37,10 +36,11 @@ TaskGen.declare_chain(
     decider = decide_ext,
 )
 
-
-for y in (Build.BuildContext, Build.CleanContext, Build.InstallContext, 
Build.UninstallContext, Build.ListContext, 
clang_compilation_database.ClangDbContext):
-    class tmp(y):
-        variant = 'default'
+Build.BuildContext.variant = 'default'
+Build.CleanContext.variant = 'default'
+Build.InstallContext.variant = 'default'
+Build.UninstallContext.variant = 'default'
+Build.ListContext.variant = 'default'
 
 def abspath(self, env=None):
     if env and hasattr(self, 'children'):
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 65cc8d3cd5e..1aadb9570e1 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -132,6 +132,9 @@ def options(opt):
         action="store_true",
         dest='undefined_sanitizer',
         default=False)
+    gr.add_option('--enable-clangdb',
+                   help=("Enable use of clang_compilation_database"),
+                   action="store_true", dest='enable_clangdb', default=False)
     gr.add_option('--enable-libfuzzer',
                   help=("Build fuzzing binaries (use ADDITIONAL_CFLAGS to 
specify compiler options for libFuzzer or use CC=honggfuzz/hfuzz-cc)"),
                   action="store_true", dest='enable_libfuzzer', default=False)
@@ -657,12 +660,13 @@ struct foo bar = { .y = 'X', .x = 1 };
         conf.DEFINE('FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION', 1)
         conf.env.FUZZ_TARGET_LDFLAGS = Options.options.FUZZ_TARGET_LDFLAGS
 
-    conf.load('clang_compilation_database')
-
-    # Create a symlink of the compile db for clangd
-    symlink(os.path.join(conf.bldnode.abspath(), 
'default/compile_commands.json'),
-            os.path.join(conf.srcnode.abspath(), 'compile_commands.json'),
-            force=True)
+    conf.env.enable_clangdb = Options.options.enable_clangdb
+    if conf.env.enable_clangdb:
+        conf.load('clang_compilation_database')
+        # Create a symlink of the compile db for clangd
+        symlink(os.path.join(conf.bldnode.abspath(), 
'default/compile_commands.json'),
+                os.path.join(conf.srcnode.abspath(), 'compile_commands.json'),
+                force=True)
 
     conf.SAMBA_BUILD_ENV()
 
diff --git a/script/autobuild.py b/script/autobuild.py
index 00ba8d727b0..444bc156f48 100755
--- a/script/autobuild.py
+++ b/script/autobuild.py
@@ -620,6 +620,7 @@ tasks = {
          "PKG_CONFIG_PATH=${PREFIX_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH} "
          "./configure.developer ${PREFIX} "
          "--with-selftest-prefix=./bin/ab "
+         "--enable-clangdb "
          "--with-cluster-support "
          "--without-ad-dc "
          "--bundled-libraries=!tdb"),


-- 
Samba Shared Repository

Reply via email to