1
0
mirror of https://github.com/samba-team/samba.git synced 2025-11-08 16:23:49 +03:00

libsmb: Make map_fnum_to_smb2_handle type-safe

"struct smb2_hnd" is talloced here, use talloc_get_type_abort()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
This commit is contained in:
Volker Lendecke
2025-05-13 11:12:25 +02:00
parent db715cd272
commit 911b683819

View File

@@ -111,14 +111,16 @@ static NTSTATUS map_fnum_to_smb2_handle(struct cli_state *cli,
struct smb2_hnd **pph) /* Out */
{
struct idr_context *idp = cli->smb2.open_handles;
void *ph = NULL;
if (idp == NULL) {
return NT_STATUS_INVALID_PARAMETER;
}
*pph = (struct smb2_hnd *)idr_find(idp, fnum);
if (*pph == NULL) {
ph = idr_find(idp, fnum);
if (ph == NULL) {
return NT_STATUS_INVALID_HANDLE;
}
*pph = talloc_get_type_abort(ph, struct smb2_hnd);
return NT_STATUS_OK;
}