1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

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
This commit is contained in:
Volker Lendecke 2021-11-17 12:27:27 +01:00 committed by Ralph Boehme
parent 63c80f25da
commit cdc0268c19
3 changed files with 29 additions and 2 deletions

View 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;
}

View 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',

View File

@ -1 +0,0 @@
^samba3.net_machine_account.net_ads_user\(clusteredmember\)