The branch, master has been updated
       via  4809f4a6ee9 registry: check for running as root in clustering mode
       via  fd19cae8d2f s3/lib/dbwrap: check if global_messaging_context() 
succeeded
      from  1ce08f72a9e testsuite: Fix build with gcc >= 11.1.1

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


- Log -----------------------------------------------------------------
commit 4809f4a6ee971bcd9767839c729b636b7582fc02
Author: Ralph Boehme <s...@samba.org>
Date:   Sat Aug 7 10:52:28 2021 +0000

    registry: check for running as root in clustering mode
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14787
    RN:  net conf list crashes when run as normal user
    
    Signed-off-by: Ralph Boehme <s...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>
    
    Autobuild-User(master): Ralph Böhme <s...@samba.org>
    Autobuild-Date(master): Tue Aug 17 11:23:15 UTC 2021 on sn-devel-184

commit fd19cae8d2f21977d8285efd3f29e2b480d241e9
Author: Ralph Boehme <s...@samba.org>
Date:   Sat Aug 7 10:51:38 2021 +0000

    s3/lib/dbwrap: check if global_messaging_context() succeeded
    
    The subsequent messaging_ctdb_connection() will fail an assert if messaging 
is
    not up and running, maybe it's a bit better to add a check if
    global_messaging_context() actually succeeded.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14787
    
    Signed-off-by: Ralph Boehme <s...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

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

Summary of changes:
 source3/lib/dbwrap/dbwrap_open.c  | 4 ++++
 source3/registry/reg_backend_db.c | 9 +++++++++
 2 files changed, 13 insertions(+)


Changeset truncated at 500 lines:

diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c
index 1d8c40af75e..52c8a94aeff 100644
--- a/source3/lib/dbwrap/dbwrap_open.c
+++ b/source3/lib/dbwrap/dbwrap_open.c
@@ -149,6 +149,10 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
                         * to be initialized.
                         */
                        msg_ctx = global_messaging_context();
+                       if (msg_ctx == NULL) {
+                               DBG_ERR("Failed to initialize messaging\n");
+                               return NULL;
+                       }
 
                        conn = messaging_ctdb_connection();
                        if (conn == NULL) {
diff --git a/source3/registry/reg_backend_db.c 
b/source3/registry/reg_backend_db.c
index c870dc57ed6..423b310fe8a 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -733,6 +733,15 @@ WERROR regdb_init(void)
                return WERR_OK;
        }
 
+        /*
+         * Clustered Samba can only work as root because we need messaging to
+         * talk to ctdb which only works as root.
+         */
+        if (lp_clustering() && geteuid() != 0) {
+                DBG_ERR("Cluster mode requires running as root.\n");
+               return WERR_ACCESS_DENIED;
+        }
+
        db_path = state_path(talloc_tos(), "registry.tdb");
        if (db_path == NULL) {
                return WERR_NOT_ENOUGH_MEMORY;


-- 
Samba Shared Repository

Reply via email to