]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
cmdline: Add a callback to set the machine account details
authorVolker Lendecke <vl@samba.org>
Wed, 17 Nov 2021 11:25:58 +0000 (12:25 +0100)
committerRalph Boehme <slow@samba.org>
Wed, 17 Nov 2021 17:41:30 +0000 (17:41 +0000)
source3 clients need to work in clustered mode, the default
cli_credentials_set_machine_account() only looks at the local
secrets.tdb file

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>
lib/cmdline/cmdline.c
lib/cmdline/cmdline.h

index 753cec27c3ffe2b2815b2a6f760519938abeadd1..33d0c94e3b1694c9e80db90d06addd6686a26346 100644 (file)
@@ -30,6 +30,11 @@ static struct cli_credentials *cmdline_creds;
 static samba_cmdline_load_config cmdline_load_config_fn;
 static struct samba_cmdline_daemon_cfg cmdline_daemon_cfg;
 
+static NTSTATUS (*cli_credentials_set_machine_account_fn)(
+       struct cli_credentials *cred,
+       struct loadparm_context *lp_ctx) =
+       cli_credentials_set_machine_account;
+
 /* PRIVATE */
 bool samba_cmdline_set_talloc_ctx(TALLOC_CTX *mem_ctx)
 {
@@ -122,6 +127,13 @@ struct samba_cmdline_daemon_cfg *samba_cmdline_get_daemon_cfg(void)
        return &cmdline_daemon_cfg;
 }
 
+void samba_cmdline_set_machine_account_fn(
+       NTSTATUS (*fn) (struct cli_credentials *cred,
+                       struct loadparm_context *lp_ctx))
+{
+       cli_credentials_set_machine_account_fn = fn;
+}
+
 void samba_cmdline_burn(int argc, char *argv[])
 {
        bool found = false;
@@ -792,8 +804,8 @@ static void popt_common_credentials_callback(poptContext popt_ctx,
                if (machine_account_pending) {
                        NTSTATUS status;
 
-                       status = cli_credentials_set_machine_account(creds,
-                                                                    lp_ctx);
+                       status = cli_credentials_set_machine_account_fn(
+                               creds, lp_ctx);
                        if (!NT_STATUS_IS_OK(status)) {
                                fprintf(stderr,
                                        "Failed to set machine account: %s\n",
index 1f85da0099e76cd9ccf8a1484557bc9394d216c6..5cd58c3ddbb3c334489be327d2079ec854637f89 100644 (file)
@@ -131,6 +131,10 @@ struct poptOption *samba_cmdline_get_popt(enum smb_cmdline_popt_options opt);
  */
 struct samba_cmdline_daemon_cfg *samba_cmdline_get_daemon_cfg(void);
 
+void samba_cmdline_set_machine_account_fn(
+       NTSTATUS (*fn) (struct cli_credentials *cred,
+                       struct loadparm_context *lp_ctx));
+
 /**
  * @brief Burn secrets on the command line.
  *