1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

pysmbd: get_nt_acl() raises FileNotFoundError if appropriate

rather than an NTStatusError, which is harder to decipher, and which
carries less information (namely, not the name of the problematic
file).

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall 2022-09-01 11:25:26 +12:00 committed by Douglas Bagnall
parent a5eeed52ef
commit 1b4938c3b1

View File

@ -879,7 +879,16 @@ static PyObject *py_smbd_get_nt_acl(PyObject *self, PyObject *args, PyObject *kw
status = get_nt_acl_conn(frame, fname, conn, security_info_wanted, &sd);
if (NT_STATUS_IS_ERR(status)) {
PyErr_SetNTSTATUS(status);
if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
/*
* This will show up as a FileNotFoundError in python,
* from which samba-tool can at least produce a short
* message containing the problematic filename.
*/
PyErr_SetFromErrnoWithFilename(PyExc_OSError, fname);
} else {
PyErr_SetNTSTATUS(status);
}
TALLOC_FREE(frame);
return NULL;
}