summaryrefslogtreecommitdiff
path: root/lib/cmdline
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2021-11-17 12:27:27 +0100
committerRalph Boehme <slow@samba.org>2021-11-17 18:29:09 +0000
commitcdc0268c1987f36ab400ea01df88d55c02dccfdb (patch)
tree4e0328b2b27113d2630218e9ade10ce5967b6f30 /lib/cmdline
parent63c80f25da8829a7bd3244afea29c13f699efac1 (diff)
downloadsamba-cdc0268c1987f36ab400ea01df88d55c02dccfdb.tar.gz
cmdline: Make -P work in clustered mode
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
Diffstat (limited to 'lib/cmdline')
-rw-r--r--lib/cmdline/cmdline_s3.c28
-rw-r--r--lib/cmdline/wscript2
2 files changed, 29 insertions, 1 deletions
diff --git a/lib/cmdline/cmdline_s3.c b/lib/cmdline/cmdline_s3.c
index 639d403aed3..6e2c154c756 100644
--- a/lib/cmdline/cmdline_s3.c
+++ b/lib/cmdline/cmdline_s3.c
@@ -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;
}
diff --git a/lib/cmdline/wscript b/lib/cmdline/wscript
index 1e13561ddf6..01ead85e2c4 100644
--- a/lib/cmdline/wscript
+++ b/lib/cmdline/wscript
@@ -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',