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

lib: Make GUID_to_ndr_buf() return void

The whole point of struct GUID_ndr_buf is that this never fails.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Volker Lendecke 2024-02-09 19:09:35 +01:00
parent ea09be7752
commit 7c68d88cef
10 changed files with 293 additions and 56 deletions

View File

@ -65,12 +65,8 @@ char *ldap_encode_ndr_GUID(TALLOC_CTX *mem_ctx, const struct GUID *guid)
{
struct GUID_ndr_buf buf = { .buf = {0}, };
DATA_BLOB blob = { .data = buf.buf, .length = sizeof(buf.buf), };
NTSTATUS status;
char *ret;
status = GUID_to_ndr_buf(guid, &buf);
if (!NT_STATUS_IS_OK(status)) {
return NULL;
}
GUID_to_ndr_buf(guid, &buf);
ret = ldb_binary_encode(mem_ctx, blob);
return ret;
}

View File

@ -4858,14 +4858,9 @@ static struct tevent_req *smbXcli_negprot_smb2_subreq(struct smbXcli_negprot_sta
SIVAL(buf, 8, 0); /* Capabilities */
}
if (state->conn->max_protocol >= PROTOCOL_SMB2_10) {
NTSTATUS status;
struct GUID_ndr_buf guid_buf = { .buf = {0}, };
status = GUID_to_ndr_buf(&state->conn->smb2.client.guid,
&guid_buf);
if (!NT_STATUS_IS_OK(status)) {
return NULL;
}
GUID_to_ndr_buf(&state->conn->smb2.client.guid, &guid_buf);
memcpy(buf+12, guid_buf.buf, 16); /* ClientGuid */
} else {
memset(buf+12, 0, 16); /* ClientGuid */
@ -5678,14 +5673,9 @@ struct tevent_req *smb2cli_validate_negotiate_info_send(TALLOC_CTX *mem_ctx,
SIVAL(buf, 0, 0); /* Capabilities */
}
if (state->conn->max_protocol >= PROTOCOL_SMB2_10) {
NTSTATUS status;
struct GUID_ndr_buf guid_buf = { .buf = {0}, };
status = GUID_to_ndr_buf(&conn->smb2.client.guid,
&guid_buf);
if (!NT_STATUS_IS_OK(status)) {
return NULL;
}
GUID_to_ndr_buf(&conn->smb2.client.guid, &guid_buf);
memcpy(buf+4, guid_buf.buf, 16); /* ClientGuid */
} else {
memset(buf+4, 0, 16); /* ClientGuid */

277
librpc/ABI/ndr-5.0.0.sigs Normal file
View File

@ -0,0 +1,277 @@
GUID_all_zero: bool (const struct GUID *)
GUID_buf_string: char *(const struct GUID *, struct GUID_txt_buf *)
GUID_compare: int (const struct GUID *, const struct GUID *)
GUID_equal: bool (const struct GUID *, const struct GUID *)
GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
GUID_from_string: NTSTATUS (const char *, struct GUID *)
GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
GUID_random: struct GUID (void)
GUID_string: char *(TALLOC_CTX *, const struct GUID *)
GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
GUID_to_ndr_buf: void (const struct GUID *, struct GUID_ndr_buf *)
GUID_zero: struct GUID (void)
_ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, const char *, const char *, ...)
_ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, const char *, const char *, ...)
ndr_align_size: size_t (uint32_t, size_t)
ndr_charset_length: uint32_t (const void *, charset_t)
ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
ndr_check_padding: void (struct ndr_pull *, size_t)
ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, uint32_t)
ndr_check_steal_array_length: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
ndr_check_steal_array_size: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
ndr_get_array_length: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t *)
ndr_get_array_size: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t *)
ndr_map_error2errno: int (enum ndr_err_code)
ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
ndr_map_error2string: const char *(enum ndr_err_code)
ndr_policy_handle_empty: bool (const struct policy_handle *)
ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
ndr_print_HRESULT: void (struct ndr_print *, const char *, HRESULT)
ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
ndr_print_bool: void (struct ndr_print *, const char *, const bool)
ndr_print_debug: bool (int, ndr_print_fn_t, const char *, void *, const char *, const char *)
ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
ndr_print_double: void (struct ndr_print *, const char *, double)
ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
ndr_print_function_debug: void (ndr_print_function_t, const char *, ndr_flags_type, void *)
ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, ndr_flags_type, void *)
ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
ndr_print_int64: void (struct ndr_print *, const char *, int64_t)
ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
ndr_print_libndr_flags: void (struct ndr_print *, const char *, libndr_flags)
ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
ndr_print_null: void (struct ndr_print *)
ndr_print_pointer: void (struct ndr_print *, const char *, void *)
ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
ndr_print_steal_switch_value: uint32_t (struct ndr_print *, const void *)
ndr_print_string: void (struct ndr_print *, const char *, const char *)
ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
ndr_print_struct: void (struct ndr_print *, const char *, const char *)
ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
ndr_print_u16string: void (struct ndr_print *, const char *, const unsigned char *)
ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
ndr_print_winreg_Data_GPO: void (struct ndr_print *, const char *, const union winreg_Data_GPO *)
ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, DATA_BLOB *)
ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, struct GUID *)
ndr_pull_HRESULT: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, HRESULT *)
ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, struct KRB5_EDATA_NTSTATUS *)
ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, NTSTATUS *)
ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, NTTIME *)
ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, NTTIME *)
ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, NTTIME *)
ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, WERROR *)
ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, uint8_t *, uint32_t)
ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, const char **, uint32_t, uint8_t, charset_t)
ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, const char **, uint32_t, uint8_t, charset_t)
ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, int64_t *)
ndr_pull_double: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, double *)
ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, uint16_t *)
ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, uint16_t *)
ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, uint32_t *)
ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, uint8_t *)
ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, gid_t *)
ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, uint64_t *)
ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, int16_t *)
ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, int32_t *)
ndr_pull_int64: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, int64_t *)
ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, int8_t *)
ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, const char **)
ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, const char **)
ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, struct ndr_syntax_id *)
ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, enum netr_SamDatabaseID *)
ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, enum netr_SchannelType *)
ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, void **)
ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, struct policy_handle *)
ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
ndr_pull_steal_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t *)
ndr_pull_string: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, const char **)
ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, const char ***)
ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
ndr_pull_struct_blob_all_noalloc: enum ndr_err_code (const DATA_BLOB *, void *, ndr_pull_flags_fn_t)
ndr_pull_struct_blob_noalloc: enum ndr_err_code (const uint8_t *, size_t, void *, ndr_pull_flags_fn_t, size_t *)
ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, uint32_t *)
ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, time_t *)
ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, struct timespec *)
ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, struct timeval *)
ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
ndr_pull_u16string: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, const unsigned char **)
ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, uint64_t *)
ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, uint64_t *)
ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, uid_t *)
ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, uint16_t *)
ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, uint16_t *)
ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, uint32_t *)
ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, uint32_t *)
ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, uint8_t *)
ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, union winreg_Data *)
ndr_pull_winreg_Data_GPO: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, union winreg_Data_GPO *)
ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, enum winreg_Type *)
ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, ndr_flags_type, DATA_BLOB)
ndr_push_GUID: enum ndr_err_code (struct ndr_push *, ndr_flags_type, const struct GUID *)
ndr_push_HRESULT: enum ndr_err_code (struct ndr_push *, ndr_flags_type, HRESULT)
ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, ndr_flags_type, const struct KRB5_EDATA_NTSTATUS *)
ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, ndr_flags_type, NTSTATUS)
ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, ndr_flags_type, NTTIME)
ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, ndr_flags_type, NTTIME)
ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, ndr_flags_type, NTTIME)
ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, ndr_flags_type, WERROR)
ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, ndr_flags_type, const uint8_t *, uint32_t)
ndr_push_blob: DATA_BLOB (struct ndr_push *)
ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
ndr_push_charset: enum ndr_err_code (struct ndr_push *, ndr_flags_type, const char *, uint32_t, uint8_t, charset_t)
ndr_push_charset_to_null: enum ndr_err_code (struct ndr_push *, ndr_flags_type, const char *, uint32_t, uint8_t, charset_t)
ndr_push_dlong: enum ndr_err_code (struct ndr_push *, ndr_flags_type, int64_t)
ndr_push_double: enum ndr_err_code (struct ndr_push *, ndr_flags_type, double)
ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, ndr_flags_type, uint16_t)
ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, ndr_flags_type, uint16_t)
ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, ndr_flags_type, uint32_t)
ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, ndr_flags_type, uint8_t)
ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, ndr_flags_type, gid_t)
ndr_push_hyper: enum ndr_err_code (struct ndr_push *, ndr_flags_type, uint64_t)
ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
ndr_push_int16: enum ndr_err_code (struct ndr_push *, ndr_flags_type, int16_t)
ndr_push_int32: enum ndr_err_code (struct ndr_push *, ndr_flags_type, int32_t)
ndr_push_int64: enum ndr_err_code (struct ndr_push *, ndr_flags_type, int64_t)
ndr_push_int8: enum ndr_err_code (struct ndr_push *, ndr_flags_type, int8_t)
ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, ndr_flags_type, const char *)
ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, ndr_flags_type, const char *)
ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, ndr_flags_type, const struct ndr_syntax_id *)
ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, ndr_flags_type, enum netr_SamDatabaseID)
ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, ndr_flags_type, enum netr_SchannelType)
ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, ndr_flags_type, uint32_t)
ndr_push_pointer: enum ndr_err_code (struct ndr_push *, ndr_flags_type, void *)
ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, ndr_flags_type, const struct policy_handle *)
ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
ndr_push_steal_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t *)
ndr_push_string: enum ndr_err_code (struct ndr_push *, ndr_flags_type, const char *)
ndr_push_string_array: enum ndr_err_code (struct ndr_push *, ndr_flags_type, const char **)
ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
ndr_push_struct_into_fixed_blob: enum ndr_err_code (DATA_BLOB *, const void *, ndr_push_flags_fn_t)
ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, ndr_flags_type, uint32_t)
ndr_push_time_t: enum ndr_err_code (struct ndr_push *, ndr_flags_type, time_t)
ndr_push_timespec: enum ndr_err_code (struct ndr_push *, ndr_flags_type, const struct timespec *)
ndr_push_timeval: enum ndr_err_code (struct ndr_push *, ndr_flags_type, const struct timeval *)
ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
ndr_push_u16string: enum ndr_err_code (struct ndr_push *, ndr_flags_type, const unsigned char *)
ndr_push_udlong: enum ndr_err_code (struct ndr_push *, ndr_flags_type, uint64_t)
ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, ndr_flags_type, uint64_t)
ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, ndr_flags_type, uid_t)
ndr_push_uint16: enum ndr_err_code (struct ndr_push *, ndr_flags_type, uint16_t)
ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, ndr_flags_type, uint16_t)
ndr_push_uint32: enum ndr_err_code (struct ndr_push *, ndr_flags_type, uint32_t)
ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, ndr_flags_type, uint32_t)
ndr_push_uint8: enum ndr_err_code (struct ndr_push *, ndr_flags_type, uint8_t)
ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, ndr_flags_type, const union winreg_Data *)
ndr_push_winreg_Data_GPO: enum ndr_err_code (struct ndr_push *, ndr_flags_type, const union winreg_Data_GPO *)
ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, ndr_flags_type, enum winreg_Type)
ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
ndr_set_flags: void (libndr_flags *, libndr_flags)
ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, ndr_flags_type)
ndr_size_GUID: size_t (const struct GUID *, libndr_flags)
ndr_size_string: uint32_t (int, const char * const *, ndr_flags_type)
ndr_size_string_array: size_t (const char **, uint32_t, libndr_flags)
ndr_size_struct: size_t (const void *, libndr_flags, ndr_push_flags_fn_t)
ndr_size_union: size_t (const void *, libndr_flags, uint32_t, ndr_push_flags_fn_t)
ndr_size_winreg_Data_GPO: size_t (const union winreg_Data_GPO *, uint32_t, libndr_flags)
ndr_steal_array_length: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t *)
ndr_steal_array_size: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t *)
ndr_string_array_size: size_t (struct ndr_push *, const char *)
ndr_string_length: uint32_t (const void *, uint32_t)
ndr_syntax_id_buf_string: char *(const struct ndr_syntax_id *, struct ndr_syntax_id_buf *)
ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
ndr_token_max_list_size: size_t (void)
ndr_token_peek: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *)
ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *)
ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *, comparison_fn_t, bool)
ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list *, const void *, uint32_t)
ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
ndr_zero_memory: void (void *, size_t)

View File

@ -863,7 +863,7 @@ enum ndr_err_code ndr_push_charset_to_null(struct ndr_push *ndr, ndr_flags_type
/* GUIDs */
bool GUID_equal(const struct GUID *u1, const struct GUID *u2);
struct GUID_ndr_buf { uint8_t buf[16]; };
NTSTATUS GUID_to_ndr_buf(const struct GUID *guid, struct GUID_ndr_buf *buf);
void GUID_to_ndr_buf(const struct GUID *guid, struct GUID_ndr_buf *buf);
NTSTATUS GUID_to_ndr_blob(const struct GUID *guid, TALLOC_CTX *mem_ctx, DATA_BLOB *b);
NTSTATUS GUID_from_ndr_blob(const DATA_BLOB *b, struct GUID *guid);
NTSTATUS GUID_from_data_blob(const DATA_BLOB *s, struct GUID *guid);

View File

@ -22,21 +22,22 @@
*/
#include "replace.h"
#include "lib/util/debug.h"
#include "lib/util/samba_util.h"
#include "lib/util/genrand.h"
#include "librpc/ndr/libndr.h"
#include "librpc/gen_ndr/ndr_misc.h"
#include "lib/util/util_str_hex.h"
_PUBLIC_ NTSTATUS GUID_to_ndr_buf(
const struct GUID *guid, struct GUID_ndr_buf *buf)
_PUBLIC_ void GUID_to_ndr_buf(const struct GUID *guid,
struct GUID_ndr_buf *buf)
{
DATA_BLOB b = { .data = buf->buf, .length = sizeof(buf->buf), };
enum ndr_err_code ndr_err;
ndr_err = ndr_push_struct_into_fixed_blob(
&b, guid, (ndr_push_flags_fn_t)ndr_push_GUID);
return ndr_map_error2ntstatus(ndr_err);
SMB_ASSERT(NDR_ERR_CODE_IS_SUCCESS(ndr_err));
}
/**
@ -45,12 +46,8 @@ _PUBLIC_ NTSTATUS GUID_to_ndr_buf(
_PUBLIC_ NTSTATUS GUID_to_ndr_blob(const struct GUID *guid, TALLOC_CTX *mem_ctx, DATA_BLOB *b)
{
struct GUID_ndr_buf buf = { .buf = {0}, };
NTSTATUS status;
status = GUID_to_ndr_buf(guid, &buf);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
GUID_to_ndr_buf(guid, &buf);
*b = data_blob_talloc(mem_ctx, buf.buf, sizeof(buf.buf));
if (b->data == NULL) {

View File

@ -674,7 +674,7 @@ bld.SAMBA_LIBRARY('ndr',
public_deps='samba-errors talloc samba-util util_str_hex',
public_headers='gen_ndr/misc.h gen_ndr/ndr_misc.h ndr/libndr.h:ndr.h',
header_path= [('*gen_ndr*', 'gen_ndr')],
vnum='4.0.0',
vnum='5.0.0',
abi_directory='ABI',
abi_match='!ndr_table_* ndr_* GUID_* _ndr_pull_error* _ndr_push_error*',
)

View File

@ -621,10 +621,7 @@ static NTSTATUS fsctl_validate_neg_info(TALLOC_CTX *mem_ctx,
return NT_STATUS_ACCESS_DENIED;
}
status = GUID_to_ndr_buf(&conn->smb2.server.guid, &out_guid_buf);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
GUID_to_ndr_buf(&conn->smb2.server.guid, &out_guid_buf);
*out_output = data_blob_talloc(mem_ctx, NULL, 0x18);
if (out_output->data == NULL) {

View File

@ -113,13 +113,9 @@ static TDB_DATA smbXsrv_client_global_id_to_key(const struct GUID *client_guid,
uint8_t *key_buf)
{
TDB_DATA key = { .dsize = 0, };
NTSTATUS status;
struct GUID_ndr_buf buf = { .buf = {0}, };
status = GUID_to_ndr_buf(client_guid, &buf);
if (!NT_STATUS_IS_OK(status)) {
return key;
}
GUID_to_ndr_buf(client_guid, &buf);
memcpy(key_buf, buf.buf, SMBXSRV_CLIENT_GLOBAL_TDB_KEY_SIZE);
key = make_tdb_data(key_buf, SMBXSRV_CLIENT_GLOBAL_TDB_KEY_SIZE);

View File

@ -1043,13 +1043,9 @@ NTSTATUS smbcli_pull_guid(void *base, uint16_t offset,
*/
NTSTATUS smbcli_push_guid(void *base, uint16_t offset, const struct GUID *guid)
{
NTSTATUS status;
struct GUID_ndr_buf buf = { .buf = {0}, };
status = GUID_to_ndr_buf(guid, &buf);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
GUID_to_ndr_buf(guid, &buf);
memcpy(offset + (uint8_t *)base, buf.buf, sizeof(buf.buf));
return NT_STATUS_OK;
}

View File

@ -117,11 +117,7 @@ struct smb2_request *smb2_create_send(struct smb2_tree *tree, struct smb2_create
}
SIVAL(data, 4, flags);
SBVAL(data, 8, 0x0); /* reserved */
status = GUID_to_ndr_buf(&io->in.create_guid, &guid_buf);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(req);
return NULL;
}
GUID_to_ndr_buf(&io->in.create_guid, &guid_buf);
memcpy(data+16, guid_buf.buf, sizeof(guid_buf.buf));
status = smb2_create_blob_add(req, &blobs,
@ -150,11 +146,7 @@ struct smb2_request *smb2_create_send(struct smb2_tree *tree, struct smb2_create
uint32_t flags = 0;
smb2_push_handle(data, io->in.durable_handle_v2);
status = GUID_to_ndr_buf(&io->in.create_guid, &guid_buf);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(req);
return NULL;
}
GUID_to_ndr_buf(&io->in.create_guid, &guid_buf);
memcpy(data+16, guid_buf.buf, sizeof(guid_buf.buf));
if (io->in.persistent_open) {
flags = SMB2_DHANDLE_FLAG_PERSISTENT;
@ -250,11 +242,7 @@ struct smb2_request *smb2_create_send(struct smb2_tree *tree, struct smb2_create
SSVAL(data, 0, 20); /* structure size */
SSVAL(data, 2, 0); /* reserved */
status = GUID_to_ndr_buf(io->in.app_instance_id, &guid_buf);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(req);
return NULL;
}
GUID_to_ndr_buf(io->in.app_instance_id, &guid_buf);
memcpy(data+4, guid_buf.buf, sizeof(guid_buf.buf));
status = smb2_create_blob_add(req, &blobs,