]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:rpc_server/netlogon: add client_sid helper variables
authorStefan Metzmacher <metze@samba.org>
Wed, 2 Oct 2024 16:06:44 +0000 (18:06 +0200)
committerJule Anger <janger@samba.org>
Wed, 13 Nov 2024 10:39:11 +0000 (10:39 +0000)
This will make the following changes simpler...

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15425

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit eda3728a4079c5399f693b1d68e64e5660647c72)

source3/rpc_server/netlogon/srv_netlog_nt.c

index 47c08bcd516e77f1720df346faefe80e2c569f94..53c100c7a6c55385e9bf4bfc3ec4ab999ae5db9a 100644 (file)
@@ -1311,6 +1311,7 @@ NTSTATUS _netr_ServerPasswordSet(struct pipes_struct *p,
        size_t i;
        struct netlogon_creds_CredentialState *creds = NULL;
        struct _samr_Credentials_t cr = { CRED_TYPE_NT_HASH, {0}};
+       const struct dom_sid *client_sid = NULL;
 
        DEBUG(5,("_netr_ServerPasswordSet: %d\n", __LINE__));
 
@@ -1335,6 +1336,7 @@ NTSTATUS _netr_ServerPasswordSet(struct pipes_struct *p,
                TALLOC_FREE(creds);
                return status;
        }
+       client_sid = creds->sid;
 
        DEBUG(3,("_netr_ServerPasswordSet: Server Password Set by remote machine:[%s] on account [%s]\n",
                        r->in.computer_name, creds->computer_name));
@@ -1353,7 +1355,7 @@ NTSTATUS _netr_ServerPasswordSet(struct pipes_struct *p,
        status = netr_set_machine_account_password(p->mem_ctx,
                                                   session_info,
                                                   p->msg_ctx,
-                                                  creds->sid,
+                                                  client_sid,
                                                   &cr);
        return status;
 }
@@ -1370,6 +1372,7 @@ NTSTATUS _netr_ServerPasswordSet2(struct pipes_struct *p,
                dcesrv_call_session_info(dce_call);
        NTSTATUS status;
        struct netlogon_creds_CredentialState *creds = NULL;
+       const struct dom_sid *client_sid = NULL;
        DATA_BLOB plaintext = data_blob_null;
        DATA_BLOB new_password = data_blob_null;
        size_t confounder_len;
@@ -1395,6 +1398,7 @@ NTSTATUS _netr_ServerPasswordSet2(struct pipes_struct *p,
                TALLOC_FREE(creds);
                return status;
        }
+       client_sid = creds->sid;
 
        DBG_NOTICE("Server Password Set2 by remote "
                   "machine:[%s] on account [%s]\n",
@@ -1515,7 +1519,7 @@ NTSTATUS _netr_ServerPasswordSet2(struct pipes_struct *p,
        status = netr_set_machine_account_password(p->mem_ctx,
                                                   session_info,
                                                   p->msg_ctx,
-                                                  creds->sid,
+                                                  client_sid,
                                                   &cr);
        TALLOC_FREE(creds);
        return status;