mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
libcli: Use GUID_to_ndr_buf() in ldap_encode_ndr_GUID()
Avoid a talloc/free Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
29e3c0cdb7
commit
77877cfed1
@ -63,15 +63,15 @@ char *ldap_encode_ndr_dom_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid)
|
|||||||
*/
|
*/
|
||||||
char *ldap_encode_ndr_GUID(TALLOC_CTX *mem_ctx, const struct GUID *guid)
|
char *ldap_encode_ndr_GUID(TALLOC_CTX *mem_ctx, const struct GUID *guid)
|
||||||
{
|
{
|
||||||
DATA_BLOB blob;
|
struct GUID_ndr_buf buf = { .buf = {0}, };
|
||||||
|
DATA_BLOB blob = { .data = buf.buf, .length = sizeof(buf.buf), };
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
char *ret;
|
char *ret;
|
||||||
status = GUID_to_ndr_blob(guid, mem_ctx, &blob);
|
status = GUID_to_ndr_buf(guid, &buf);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ret = ldb_binary_encode(mem_ctx, blob);
|
ret = ldb_binary_encode(mem_ctx, blob);
|
||||||
data_blob_free(&blob);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user