The branch, master has been updated
       via  9471508391f s3: remove now unneeded call to 
cmdline_messaging_context()
       via  ca95d7f41b6 s3:dbwrap: initialize messaging before getting the ctdb 
connection
      from  ab71d72138f waf: Symlink the compile database to the source dir for 
clangd

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


- Log -----------------------------------------------------------------
commit 9471508391fd3bcf199b1e94f8d9ee2b956e8f8e
Author: Ralph Boehme <[email protected]>
Date:   Sat May 4 12:12:48 2019 +0200

    s3: remove now unneeded call to cmdline_messaging_context()
    
    This was only needed as dbwrap_open() had a bug where it asked for the ctdb
    connection before initializing messaging. The previous commit fixed that so 
we
    can now safely remove the calls to cmdline_messaging_context() from all 
tools
    that don't use messaging.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13925
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    
    Autobuild-User(master): Jeremy Allison <[email protected]>
    Autobuild-Date(master): Thu Oct 24 09:33:47 UTC 2019 on sn-devel-184

commit ca95d7f41b683b4d7ac59ed6ee709d44abfe2019
Author: Ralph Boehme <[email protected]>
Date:   Sat May 4 12:12:04 2019 +0200

    s3:dbwrap: initialize messaging before getting the ctdb connection
    
    This is a better fix for bug #13465.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13925
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

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

Summary of changes:
 source3/lib/dbwrap/dbwrap_open.c  | 8 +++++++-
 source3/lib/popt_common_cmdline.c | 7 -------
 source3/utils/dbwrap_tool.c       | 2 --
 source3/utils/eventlogadm.c       | 3 ---
 source3/utils/ntlm_auth.c         | 2 --
 source3/utils/pdbedit.c           | 2 --
 source3/utils/sharesec.c          | 1 -
 source3/utils/smbget.c            | 2 --
 source3/utils/smbpasswd.c         | 2 --
 source3/utils/testparm.c          | 2 --
 10 files changed, 7 insertions(+), 24 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c
index c8dfd9103a8..20084bca471 100644
--- a/source3/lib/dbwrap/dbwrap_open.c
+++ b/source3/lib/dbwrap/dbwrap_open.c
@@ -141,13 +141,19 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
                        struct messaging_context *msg_ctx;
                        struct ctdbd_connection *conn;
 
+                       /*
+                        * Initialize messaging before getting the ctdb
+                        * connection, as the ctdb connection requires messaging
+                        * to be initialized.
+                        */
+                       msg_ctx = global_messaging_context();
+
                        conn = messaging_ctdb_connection();
                        if (conn == NULL) {
                                DBG_WARNING("No ctdb connection\n");
                                errno = EIO;
                                return NULL;
                        }
-                       msg_ctx = global_messaging_context();
 
                        result = db_open_ctdb(mem_ctx, msg_ctx, base,
                                              hash_size,
diff --git a/source3/lib/popt_common_cmdline.c 
b/source3/lib/popt_common_cmdline.c
index 79e34847f48..39a787510a3 100644
--- a/source3/lib/popt_common_cmdline.c
+++ b/source3/lib/popt_common_cmdline.c
@@ -102,15 +102,8 @@ static void popt_common_credentials_callback(poptContext 
con,
        }
 
        if (reason == POPT_CALLBACK_REASON_POST) {
-               struct messaging_context *msg_ctx = NULL;
                bool ok;
 
-               msg_ctx = cmdline_messaging_context(get_dyn_CONFIGFILE());
-               if (msg_ctx == NULL) {
-                       fprintf(stderr, "Unable to initialize "
-                               "messaging context\n");
-               }
-
                ok = lp_load_client(get_dyn_CONFIGFILE());
                if (!ok) {
                        const char *pname = poptGetInvocationName(con);
diff --git a/source3/utils/dbwrap_tool.c b/source3/utils/dbwrap_tool.c
index 84ff6f9d3c4..5d4791473a0 100644
--- a/source3/utils/dbwrap_tool.c
+++ b/source3/utils/dbwrap_tool.c
@@ -422,8 +422,6 @@ int main(int argc, const char **argv)
                while (extra_argv[extra_argc]) extra_argc++;
        }
 
-       cmdline_messaging_context(get_dyn_CONFIGFILE());
-
        lp_load_global(get_dyn_CONFIGFILE());
 
        if ((extra_argc < 2) || (extra_argc > 5)) {
diff --git a/source3/utils/eventlogadm.c b/source3/utils/eventlogadm.c
index db874dfae8a..2770fffa48c 100644
--- a/source3/utils/eventlogadm.c
+++ b/source3/utils/eventlogadm.c
@@ -473,9 +473,6 @@ int main( int argc, char *argv[] )
                exit( 1 );
        }
 
-       cmdline_messaging_context(configfile == NULL ?
-                                 get_dyn_CONFIGFILE() : configfile);
-
        if ( configfile == NULL ) {
                lp_load_global(get_dyn_CONFIGFILE());
        } else if (!lp_load_global(configfile)) {
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index a10b3ef27f1..85862e389e8 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -2544,8 +2544,6 @@ enum {
 
        poptFreeContext(pc);
 
-       cmdline_messaging_context(get_dyn_CONFIGFILE());
-
        if (!lp_load_global(get_dyn_CONFIGFILE())) {
                d_fprintf(stderr, "ntlm_auth: error opening config file %s. 
Error was %s\n",
                        get_dyn_CONFIGFILE(), strerror(errno));
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index 64ae08d4f0d..b6ee806e190 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -1128,8 +1128,6 @@ int main(int argc, const char **argv)
        if (user_name == NULL)
                user_name = poptGetArg(pc);
 
-       cmdline_messaging_context(get_dyn_CONFIGFILE());
-
        if (!lp_load_global(get_dyn_CONFIGFILE())) {
                fprintf(stderr, "Can't load %s - run testparm to debug it\n", 
get_dyn_CONFIGFILE());
                exit(1);
diff --git a/source3/utils/sharesec.c b/source3/utils/sharesec.c
index a73af180445..510505f0032 100644
--- a/source3/utils/sharesec.c
+++ b/source3/utils/sharesec.c
@@ -501,7 +501,6 @@ int main(int argc, const char *argv[])
 
        setlinebuf(stdout);
 
-       cmdline_messaging_context(get_dyn_CONFIGFILE());
        lp_load_with_registry_shares(get_dyn_CONFIGFILE());
 
        /* check for initializing secrets.tdb first */
diff --git a/source3/utils/smbget.c b/source3/utils/smbget.c
index 0b1de58ffa3..68e2217fb56 100644
--- a/source3/utils/smbget.c
+++ b/source3/utils/smbget.c
@@ -1007,8 +1007,6 @@ int main(int argc, char **argv)
 
        popt_burn_cmdline_password(argc, argv);
 
-       cmdline_messaging_context(get_dyn_CONFIGFILE());
-
        if (smbc_init(get_auth_data, opt.debuglevel) < 0) {
                fprintf(stderr, "Unable to initialize libsmbclient\n");
                ret= 1;
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c
index 8e2b9d7f80f..a6509abe5cb 100644
--- a/source3/utils/smbpasswd.c
+++ b/source3/utils/smbpasswd.c
@@ -197,8 +197,6 @@ static int process_options(int argc, char **argv, int 
local_flags)
                usage();
        }
 
-       cmdline_messaging_context(configfile);
-
        if (!lp_load_global(configfile)) {
                fprintf(stderr, "Can't load %s - run testparm to debug it\n", 
                        configfile);
diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c
index efa58a6a417..9ba625da4bf 100644
--- a/source3/utils/testparm.c
+++ b/source3/utils/testparm.c
@@ -742,8 +742,6 @@ static void do_per_share_checks(int s)
                goto done;
        }
 
-       cmdline_messaging_context(config_file);
-
        fprintf(stderr,"Load smb config files from %s\n",config_file);
 
        if (!lp_load_with_registry_shares(config_file)) {


-- 
Samba Shared Repository

Reply via email to