diff options
author | Andreas Schneider <asn@samba.org> | 2021-07-12 13:05:59 +0200 |
---|---|---|
committer | Jule Anger <janger@samba.org> | 2021-09-08 12:32:11 +0000 |
commit | 13dff7227f41922bbcf66f035ced9f0b371072e6 (patch) | |
tree | 231256f45136ab4138d3967a1615fe03293c61cd | |
parent | 9698e453ae952af5ce1af09c1cd8e12cc2c3eb94 (diff) | |
download | samba-13dff7227f41922bbcf66f035ced9f0b371072e6.tar.gz |
mit-samba: Use talloc_get_type_abort() instead of casting
This is safer to use and fixes compiler warnings.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14817
(cherry picked from commit 60159e03850f88cdee332ba65939cfe4582cb5e1)
-rw-r--r-- | source4/kdc/mit_samba.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/source4/kdc/mit_samba.c b/source4/kdc/mit_samba.c index 0a142513608..0a0d3a98315 100644 --- a/source4/kdc/mit_samba.c +++ b/source4/kdc/mit_samba.c @@ -1076,7 +1076,8 @@ int mit_samba_kpasswd_change_password(struct mit_samba_context *ctx, struct samr_DomInfo1 *dominfo; const char *error_string = NULL; struct auth_user_info_dc *user_info_dc; - struct samba_kdc_entry *p; + struct samba_kdc_entry *p = + talloc_get_type_abort(db_entry->e_data, struct samba_kdc_entry); krb5_error_code code = 0; #ifdef DEBUG_PASSWORD @@ -1088,8 +1089,6 @@ int mit_samba_kpasswd_change_password(struct mit_samba_context *ctx, return ENOMEM; } - p = (struct samba_kdc_entry *)db_entry->e_data; - status = authsam_make_user_info_dc(tmp_ctx, ctx->db_ctx->samdb, lpcfg_netbios_name(ctx->db_ctx->lp_ctx), @@ -1165,11 +1164,10 @@ out: void mit_samba_zero_bad_password_count(krb5_db_entry *db_entry) { struct netr_SendToSamBase *send_to_sam = NULL; - struct samba_kdc_entry *p; + struct samba_kdc_entry *p = + talloc_get_type_abort(db_entry->e_data, struct samba_kdc_entry); struct ldb_dn *domain_dn; - p = (struct samba_kdc_entry *)db_entry->e_data; - domain_dn = ldb_get_default_basedn(p->kdc_db_ctx->samdb); authsam_logon_success_accounting(p->kdc_db_ctx->samdb, @@ -1183,9 +1181,8 @@ void mit_samba_zero_bad_password_count(krb5_db_entry *db_entry) void mit_samba_update_bad_password_count(krb5_db_entry *db_entry) { - struct samba_kdc_entry *p; - - p = (struct samba_kdc_entry *)db_entry->e_data; + struct samba_kdc_entry *p = + talloc_get_type_abort(db_entry->e_data, struct samba_kdc_entry); authsam_update_bad_pwd_count(p->kdc_db_ctx->samdb, p->msg, |