1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s4:rpc_server/backupkey: make use dcesrv_call_session_info()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Stefan Metzmacher 2018-11-03 01:19:51 +01:00 committed by Jeremy Allison
parent 961ebf229a
commit 707105d0de
2 changed files with 20 additions and 8 deletions

View File

@ -524,6 +524,8 @@ static WERROR bkrp_client_wrap_decrypt_data(struct dcesrv_call_state *dce_call,
struct bkrp_BackupKey *r,
struct ldb_context *ldb_ctx)
{
struct auth_session_info *session_info =
dcesrv_call_session_info(dce_call);
struct bkrp_client_side_wrapped uncrypt_request;
DATA_BLOB blob;
enum ndr_err_code ndr_err;
@ -659,7 +661,7 @@ static WERROR bkrp_client_wrap_decrypt_data(struct dcesrv_call_state *dce_call,
uncrypted_secretv2.payload_key,
uncrypt_request.access_check,
uncrypt_request.access_check_len,
dce_call->conn->auth_state.session_info);
session_info);
if (!W_ERROR_IS_OK(werr)) {
return werr;
}
@ -702,7 +704,7 @@ static WERROR bkrp_client_wrap_decrypt_data(struct dcesrv_call_state *dce_call,
uncrypted_secretv3.payload_key,
uncrypt_request.access_check,
uncrypt_request.access_check_len,
dce_call->conn->auth_state.session_info);
session_info);
if (!W_ERROR_IS_OK(werr)) {
return werr;
}
@ -1387,6 +1389,8 @@ static WERROR bkrp_do_retrieve_default_server_wrap_key(TALLOC_CTX *mem_ctx,
static WERROR bkrp_server_wrap_decrypt_data(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct bkrp_BackupKey *r ,struct ldb_context *ldb_ctx)
{
struct auth_session_info *session_info =
dcesrv_call_session_info(dce_call);
WERROR werr;
struct bkrp_server_side_wrapped decrypt_request;
DATA_BLOB sid_blob, encrypted_blob;
@ -1524,7 +1528,7 @@ static WERROR bkrp_server_wrap_decrypt_data(struct dcesrv_call_state *dce_call,
return WERR_INVALID_ACCESS;
}
caller_sid = &dce_call->conn->auth_state.session_info->security_token->sids[PRIMARY_USER_SID_INDEX];
caller_sid = &session_info->security_token->sids[PRIMARY_USER_SID_INDEX];
if (!dom_sid_equal(&rc4payload.sid, caller_sid)) {
return WERR_INVALID_ACCESS;
@ -1577,6 +1581,8 @@ static WERROR bkrp_generic_decrypt_data(struct dcesrv_call_state *dce_call, TALL
static WERROR bkrp_server_wrap_encrypt_data(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct bkrp_BackupKey *r ,struct ldb_context *ldb_ctx)
{
struct auth_session_info *session_info =
dcesrv_call_session_info(dce_call);
DATA_BLOB sid_blob, encrypted_blob, server_wrapped_blob;
WERROR werr;
struct dom_sid *caller_sid;
@ -1625,7 +1631,7 @@ static WERROR bkrp_server_wrap_encrypt_data(struct dcesrv_call_state *dce_call,
}
}
caller_sid = &dce_call->conn->auth_state.session_info->security_token->sids[PRIMARY_USER_SID_INDEX];
caller_sid = &session_info->security_token->sids[PRIMARY_USER_SID_INDEX];
dump_data_pw("server_key: \n", server_key.key, sizeof(server_key.key));

View File

@ -588,6 +588,8 @@ static WERROR bkrp_client_wrap_decrypt_data(struct dcesrv_call_state *dce_call,
struct bkrp_BackupKey *r,
struct ldb_context *ldb_ctx)
{
struct auth_session_info *session_info =
dcesrv_call_session_info(dce_call);
struct bkrp_client_side_wrapped uncrypt_request;
DATA_BLOB blob;
enum ndr_err_code ndr_err;
@ -723,7 +725,7 @@ static WERROR bkrp_client_wrap_decrypt_data(struct dcesrv_call_state *dce_call,
uncrypted_secretv2.payload_key,
uncrypt_request.access_check,
uncrypt_request.access_check_len,
dce_call->conn->auth_state.session_info);
session_info);
if (!W_ERROR_IS_OK(werr)) {
return werr;
}
@ -767,7 +769,7 @@ static WERROR bkrp_client_wrap_decrypt_data(struct dcesrv_call_state *dce_call,
uncrypted_secretv3.payload_key,
uncrypt_request.access_check,
uncrypt_request.access_check_len,
dce_call->conn->auth_state.session_info);
session_info);
if (!W_ERROR_IS_OK(werr)) {
return werr;
}
@ -1497,6 +1499,8 @@ static WERROR bkrp_do_retrieve_default_server_wrap_key(TALLOC_CTX *mem_ctx,
static WERROR bkrp_server_wrap_decrypt_data(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct bkrp_BackupKey *r ,struct ldb_context *ldb_ctx)
{
struct auth_session_info *session_info =
dcesrv_call_session_info(dce_call);
WERROR werr;
struct bkrp_server_side_wrapped decrypt_request;
DATA_BLOB sid_blob, encrypted_blob, symkey_blob;
@ -1600,7 +1604,7 @@ static WERROR bkrp_server_wrap_decrypt_data(struct dcesrv_call_state *dce_call,
return WERR_INVALID_ACCESS;
}
caller_sid = &dce_call->conn->auth_state.session_info->security_token->sids[PRIMARY_USER_SID_INDEX];
caller_sid = &session_info->security_token->sids[PRIMARY_USER_SID_INDEX];
if (!dom_sid_equal(&rc4payload.sid, caller_sid)) {
return WERR_INVALID_ACCESS;
@ -1653,6 +1657,8 @@ static WERROR bkrp_generic_decrypt_data(struct dcesrv_call_state *dce_call, TALL
static WERROR bkrp_server_wrap_encrypt_data(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct bkrp_BackupKey *r ,struct ldb_context *ldb_ctx)
{
struct auth_session_info *session_info =
dcesrv_call_session_info(dce_call);
DATA_BLOB sid_blob, encrypted_blob, symkey_blob, server_wrapped_blob;
WERROR werr;
struct dom_sid *caller_sid;
@ -1699,7 +1705,7 @@ static WERROR bkrp_server_wrap_encrypt_data(struct dcesrv_call_state *dce_call,
}
}
caller_sid = &dce_call->conn->auth_state.session_info->security_token->sids[PRIMARY_USER_SID_INDEX];
caller_sid = &session_info->security_token->sids[PRIMARY_USER_SID_INDEX];
dump_data_pw("server_key: \n", server_key.key, sizeof(server_key.key));