]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
cmdline: Make -P work in clustered mode
authorVolker Lendecke <vl@samba.org>
Wed, 17 Nov 2021 11:27:27 +0000 (12:27 +0100)
committerRalph Boehme <slow@samba.org>
Wed, 17 Nov 2021 18:29:09 +0000 (18:29 +0000)
Bug: https://bugzilla.samba.org/show_bug.cgi?id=14908
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Nov 17 18:29:09 UTC 2021 on sn-devel-184

lib/cmdline/cmdline_s3.c
lib/cmdline/wscript
selftest/knownfail.d/clustered_machine_account [deleted file]

index 639d403aed3a97648e8505bbda36621e024b2f0d..6e2c154c756baa961db6d68ea7c97bf18a223298 100644 (file)
@@ -26,6 +26,7 @@
 #include "auth/credentials/credentials.h"
 #include "dynconfig/dynconfig.h"
 #include "cmdline_private.h"
+#include "source3/include/secrets.h"
 
 static bool _require_smbconf;
 static enum samba_cmdline_config_type _config_type;
@@ -84,6 +85,31 @@ static bool _samba_cmdline_load_config_s3(void)
        return true;
 }
 
+static NTSTATUS _samba_cmd_set_machine_account_s3(
+       struct cli_credentials *cred,
+       struct loadparm_context *lp_ctx)
+{
+       struct db_context *db_ctx = secrets_db_ctx();
+       NTSTATUS status;
+
+       if (db_ctx == NULL) {
+               DBG_WARNING("failed to open secrets.tdb to obtain our "
+                           "trust credentials for %s\n",
+                           lpcfg_workgroup(lp_ctx));;
+               return NT_STATUS_INTERNAL_ERROR;
+       }
+
+       status = cli_credentials_set_machine_account_db_ctx(
+               cred, lp_ctx, db_ctx);
+       if (!NT_STATUS_IS_OK(status)) {
+               DBG_WARNING("cli_credentials_set_machine_account_db_ctx "
+                           "failed: %s\n",
+                           nt_errstr(status));
+       }
+
+       return status;
+}
+
 bool samba_cmdline_init(TALLOC_CTX *mem_ctx,
                        enum samba_cmdline_config_type config_type,
                        bool require_smbconf)
@@ -119,6 +145,8 @@ bool samba_cmdline_init(TALLOC_CTX *mem_ctx,
        }
 
        samba_cmdline_set_load_config_fn(_samba_cmdline_load_config_s3);
+       samba_cmdline_set_machine_account_fn(
+               _samba_cmd_set_machine_account_s3);
 
        return true;
 }
index 1e13561ddf64cf57b43c850c581a4fda64304f89..01ead85e2c48c2f51c169e6bf98fea446a370bf1 100644 (file)
@@ -22,7 +22,7 @@ def build(bld):
 
     bld.SAMBA_SUBSYSTEM('CMDLINE_S3',
                         source='cmdline_s3.c',
-                        deps='cmdline')
+                        deps='cmdline secrets3')
 
     bld.SAMBA_SUBSYSTEM('CMDLINE_S4',
                         source='cmdline_s4.c',
diff --git a/selftest/knownfail.d/clustered_machine_account b/selftest/knownfail.d/clustered_machine_account
deleted file mode 100644 (file)
index 16abc62..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^samba3.net_machine_account.net_ads_user\(clusteredmember\)
\ No newline at end of file