1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

s4:dsdb: Move the responsibility for determining whether an account is a gMSA out of gmsa_recalculate_managed_pwd()

and into its callers.

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Jo Sutton 2024-04-17 13:27:19 +12:00 committed by Jo Sutton
parent 2f2d3b7cf2
commit 245dc1f0f2
2 changed files with 18 additions and 14 deletions

View File

@ -1108,6 +1108,15 @@ static bool samdb_result_gkdi_rollover_interval(const struct ldb_message *msg,
rollover_interval_out);
}
/*
* Recalculate the managed password of an account. The account referred to by
* msg should be a Group Managed Service Account.
*
* Updated passwords are returned in update_out.
*
* Pass in a nonNULL pointer for return_out if you want the passwords as
* reflected by the msDS-ManagedPassword operational attribute.
*/
int gmsa_recalculate_managed_pwd(TALLOC_CTX *mem_ctx,
struct ldb_context *ldb,
const struct ldb_message *msg,
@ -1143,20 +1152,6 @@ int gmsa_recalculate_managed_pwd(TALLOC_CTX *mem_ctx,
}
*update_out = NULL;
{
/* Is the account a Group Managed Service Account? */
const bool is_gmsa = dsdb_account_is_gmsa(ldb, msg);
if (!is_gmsa) {
/* Its not a GMSA — were done here. */
*update_out = NULL;
if (return_out != NULL) {
*return_out = (struct gmsa_return_pwd){};
}
ret = LDB_SUCCESS;
goto out;
}
}
/* Calculate the rollover interval. */
ok = samdb_result_gkdi_rollover_interval(msg, &rollover_interval);
if (!ok || rollover_interval == 0) {

View File

@ -99,6 +99,15 @@ struct gmsa_return_pwd {
NTTIME unchanged_interval;
};
/*
* Recalculate the managed password of an account. The account referred to by
* msg should be a Group Managed Service Account.
*
* Updated passwords are returned in update_out.
*
* Pass in a nonNULL pointer for return_out if you want the passwords as
* reflected by the msDS-ManagedPassword operational attribute.
*/
int gmsa_recalculate_managed_pwd(TALLOC_CTX *mem_ctx,
struct ldb_context *ldb,
const struct ldb_message *msg,