mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
libcli/util: let nt_errstr() fallback to hresult_errstr()
Sometimes NTSTATUS fields return things like HRES_SEC_E_WRONG_PRINCIPAL. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Wed Dec 18 18:30:08 UTC 2024 on atb-devel-224
This commit is contained in:
parent
6e0e9c4efc
commit
4fcdb01808
@ -346,6 +346,21 @@ const char *nt_errstr(NTSTATUS nt_code)
|
||||
idx++;
|
||||
}
|
||||
|
||||
/*
|
||||
* NTSTATUS codes have 0xC000 in the upper 16-bit, if the
|
||||
* upper 16-bit are not 0 and not 0xC000, it's likely
|
||||
* an HRESULT.
|
||||
*
|
||||
* E.g. we should display HRES_SEC_E_WRONG_PRINCIPAL instead of
|
||||
* 'NT code 0x80090322'
|
||||
*/
|
||||
if ((NT_STATUS_V(nt_code) & 0xFFFF0000) != 0 &&
|
||||
(NT_STATUS_V(nt_code) & 0xFFFF0000) != 0xC0000000)
|
||||
{
|
||||
HRESULT hres = HRES_ERROR(NT_STATUS_V(nt_code));
|
||||
return hresult_errstr(hres);
|
||||
}
|
||||
|
||||
/*
|
||||
* This should not really happen, we should have all error codes
|
||||
* available. We have a problem that this might get wrongly
|
||||
|
Loading…
Reference in New Issue
Block a user