1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +03:00

xss4:pyrpc: make use of dcerpc_binding_handle_transport_session_key()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Stefan Metzmacher 2024-09-14 14:20:46 +02:00 committed by Ralph Boehme
parent 93e8d58736
commit 57905603e0

View File

@ -130,12 +130,30 @@ static PyObject *py_iface_transfer_syntax(PyObject *obj, void *closure)
static PyObject *py_iface_session_key(PyObject *obj, void *closure) static PyObject *py_iface_session_key(PyObject *obj, void *closure)
{ {
dcerpc_InterfaceObject *iface = (dcerpc_InterfaceObject *)obj; dcerpc_InterfaceObject *iface = (dcerpc_InterfaceObject *)obj;
DATA_BLOB session_key; TALLOC_CTX *frame = talloc_stackframe();
DATA_BLOB session_key = { .length = 0, };
static PyObject *session_key_obj = NULL;
NTSTATUS status;
NTSTATUS status = dcerpc_fetch_session_key(iface->pipe, &session_key); if (iface->binding_handle == NULL) {
PyErr_NTSTATUS_IS_ERR_RAISE(status); PyErr_SetNTSTATUS(NT_STATUS_NO_USER_SESSION_KEY);
TALLOC_FREE(frame);
return NULL;
}
return PyBytes_FromStringAndSize((const char *)session_key.data, session_key.length); status = dcerpc_binding_handle_transport_session_key(iface->binding_handle,
frame,
&session_key);
if (!NT_STATUS_IS_OK(status)) {
PyErr_SetNTSTATUS(status);
TALLOC_FREE(frame);
return NULL;
}
session_key_obj = PyBytes_FromStringAndSize((const char *)session_key.data,
session_key.length);
TALLOC_FREE(frame);
return session_key_obj;
} }
static PyObject *py_iface_user_session_key(PyObject *obj, void *closure) static PyObject *py_iface_user_session_key(PyObject *obj, void *closure)