mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
librpc: Move dcerpc_ncacn_push_auth from s4 librpc to common librpc
Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
parent
b6c8afa98c
commit
ae9956a65e
@ -1350,3 +1350,58 @@ NTSTATUS dcerpc_generic_session_key(DATA_BLOB *session_key)
|
||||
session_key->length = 16;
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
push a ncacn_packet into a blob, potentially with auth info
|
||||
*/
|
||||
NTSTATUS dcerpc_ncacn_push_auth(DATA_BLOB *blob,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct ncacn_packet *pkt,
|
||||
struct dcerpc_auth *auth_info)
|
||||
{
|
||||
struct ndr_push *ndr;
|
||||
enum ndr_err_code ndr_err;
|
||||
|
||||
ndr = ndr_push_init_ctx(mem_ctx);
|
||||
if (!ndr) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
if (auth_info) {
|
||||
pkt->auth_length = auth_info->credentials.length;
|
||||
} else {
|
||||
pkt->auth_length = 0;
|
||||
}
|
||||
|
||||
ndr_err = ndr_push_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt);
|
||||
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||
return ndr_map_error2ntstatus(ndr_err);
|
||||
}
|
||||
|
||||
if (auth_info) {
|
||||
#if 0
|
||||
/* the s3 rpc server doesn't handle auth padding in
|
||||
bind requests. Use zero auth padding to keep us
|
||||
working with old servers */
|
||||
uint32_t offset = ndr->offset;
|
||||
ndr_err = ndr_push_align(ndr, 16);
|
||||
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||
return ndr_map_error2ntstatus(ndr_err);
|
||||
}
|
||||
auth_info->auth_pad_length = ndr->offset - offset;
|
||||
#else
|
||||
auth_info->auth_pad_length = 0;
|
||||
#endif
|
||||
ndr_err = ndr_push_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, auth_info);
|
||||
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||
return ndr_map_error2ntstatus(ndr_err);
|
||||
}
|
||||
}
|
||||
|
||||
*blob = ndr_push_blob(ndr);
|
||||
|
||||
/* fill in the frag length */
|
||||
dcerpc_set_frag_length(blob, blob->length);
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
@ -447,4 +447,9 @@ struct ndr_syntax_id dcerpc_construct_bind_time_features(uint64_t features);
|
||||
|
||||
NTSTATUS dcerpc_generic_session_key(DATA_BLOB *session_key);
|
||||
|
||||
NTSTATUS dcerpc_ncacn_push_auth(DATA_BLOB *blob,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct ncacn_packet *pkt,
|
||||
struct dcerpc_auth *auth_info);
|
||||
|
||||
#endif /* __DEFAULT_LIBRPC_RPCCOMMON_H__ */
|
||||
|
@ -49,62 +49,6 @@ const struct ndr_interface_call *dcerpc_iface_find_call(const struct ndr_interfa
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
push a ncacn_packet into a blob, potentially with auth info
|
||||
*/
|
||||
NTSTATUS dcerpc_ncacn_push_auth(DATA_BLOB *blob,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct ncacn_packet *pkt,
|
||||
struct dcerpc_auth *auth_info)
|
||||
{
|
||||
struct ndr_push *ndr;
|
||||
enum ndr_err_code ndr_err;
|
||||
|
||||
ndr = ndr_push_init_ctx(mem_ctx);
|
||||
if (!ndr) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
if (auth_info) {
|
||||
pkt->auth_length = auth_info->credentials.length;
|
||||
} else {
|
||||
pkt->auth_length = 0;
|
||||
}
|
||||
|
||||
ndr_err = ndr_push_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt);
|
||||
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||
return ndr_map_error2ntstatus(ndr_err);
|
||||
}
|
||||
|
||||
if (auth_info) {
|
||||
#if 0
|
||||
/* the s3 rpc server doesn't handle auth padding in
|
||||
bind requests. Use zero auth padding to keep us
|
||||
working with old servers */
|
||||
uint32_t offset = ndr->offset;
|
||||
ndr_err = ndr_push_align(ndr, 16);
|
||||
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||
return ndr_map_error2ntstatus(ndr_err);
|
||||
}
|
||||
auth_info->auth_pad_length = ndr->offset - offset;
|
||||
#else
|
||||
auth_info->auth_pad_length = 0;
|
||||
#endif
|
||||
ndr_err = ndr_push_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, auth_info);
|
||||
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||
return ndr_map_error2ntstatus(ndr_err);
|
||||
}
|
||||
}
|
||||
|
||||
*blob = ndr_push_blob(ndr);
|
||||
|
||||
/* fill in the frag length */
|
||||
dcerpc_set_frag_length(blob, blob->length);
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
|
||||
struct epm_map_binding_state {
|
||||
struct dcerpc_binding *binding;
|
||||
const struct ndr_interface_table *table;
|
||||
|
Loading…
x
Reference in New Issue
Block a user