mirror of
https://github.com/samba-team/samba.git
synced 2025-01-03 01:18:10 +03:00
s4:pyrpc: make use of dcerpc_binding_handle_auth_session_key()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
5d3faa86fd
commit
38874d2840
@ -161,30 +161,18 @@ static PyObject *py_iface_user_session_key(PyObject *obj, void *closure)
|
|||||||
dcerpc_InterfaceObject *iface = (dcerpc_InterfaceObject *)obj;
|
dcerpc_InterfaceObject *iface = (dcerpc_InterfaceObject *)obj;
|
||||||
TALLOC_CTX *mem_ctx;
|
TALLOC_CTX *mem_ctx;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
struct gensec_security *security = NULL;
|
|
||||||
DATA_BLOB session_key = data_blob_null;
|
DATA_BLOB session_key = data_blob_null;
|
||||||
static PyObject *session_key_obj = NULL;
|
static PyObject *session_key_obj = NULL;
|
||||||
|
|
||||||
if (iface->pipe == NULL) {
|
if (iface->binding_handle == NULL) {
|
||||||
PyErr_SetNTSTATUS(NT_STATUS_NO_USER_SESSION_KEY);
|
PyErr_SetNTSTATUS(NT_STATUS_NO_USER_SESSION_KEY);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iface->pipe->conn == NULL) {
|
|
||||||
PyErr_SetNTSTATUS(NT_STATUS_NO_USER_SESSION_KEY);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iface->pipe->conn->security_state.generic_state == NULL) {
|
|
||||||
PyErr_SetNTSTATUS(NT_STATUS_NO_USER_SESSION_KEY);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
security = iface->pipe->conn->security_state.generic_state;
|
|
||||||
|
|
||||||
mem_ctx = talloc_new(NULL);
|
mem_ctx = talloc_new(NULL);
|
||||||
|
|
||||||
status = gensec_session_key(security, mem_ctx, &session_key);
|
status = dcerpc_binding_handle_auth_session_key(iface->binding_handle,
|
||||||
|
mem_ctx,
|
||||||
|
&session_key);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
talloc_free(mem_ctx);
|
talloc_free(mem_ctx);
|
||||||
PyErr_SetNTSTATUS(status);
|
PyErr_SetNTSTATUS(status);
|
||||||
|
Loading…
Reference in New Issue
Block a user