From: Volker Lendecke Date: Fri, 14 Oct 2022 15:12:26 +0000 (+0200) Subject: smbd: Pass unparsed_path_length to symlink_reparse_buffer_marshall() X-Git-Tag: talloc-2.4.0~511 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2c0f118fcccc19072639a7bccad673cc86dc5a6;p=thirdparty%2Fsamba.git smbd: Pass unparsed_path_length to symlink_reparse_buffer_marshall() [MS-FSCC] 2.1.2.4 Symbolic Link Reparse Data Buffer lists this field as reserved, but [MS-SMB2] 2.2.2.2.1 Symbolic Link Error Response is the exact same format with the reserved field as UnparsedPathLength. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/libcli/smb/reparse_symlink.c b/libcli/smb/reparse_symlink.c index 04f26dc1162..31a438013fc 100644 --- a/libcli/smb/reparse_symlink.c +++ b/libcli/smb/reparse_symlink.c @@ -29,8 +29,13 @@ #include "lib/util/debug.h" bool symlink_reparse_buffer_marshall( - const char *substitute, const char *printname, uint32_t flags, - TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen) + const char *substitute, + const char *printname, + uint16_t unparsed_path_length, + uint32_t flags, + TALLOC_CTX *mem_ctx, + uint8_t **pdst, + size_t *pdstlen) { uint8_t *dst = NULL; size_t dst_len; @@ -87,7 +92,7 @@ bool symlink_reparse_buffer_marshall( SIVAL(dst, 0, IO_REPARSE_TAG_SYMLINK); /* ReparseTag */ SSVAL(dst, 4, 12 + subst_len + print_len); /* ReparseDataLength */ - SSVAL(dst, 6, 0); /* Reserved */ + SSVAL(dst, 6, unparsed_path_length); /* Reserved */ SSVAL(dst, 8, 0); /* SubstituteNameOffset */ SSVAL(dst, 10, subst_len); /* SubstituteNameLength */ SSVAL(dst, 12, subst_len); /* PrintNameOffset */ diff --git a/libcli/smb/reparse_symlink.h b/libcli/smb/reparse_symlink.h index b561fa9fc98..7791d71663e 100644 --- a/libcli/smb/reparse_symlink.h +++ b/libcli/smb/reparse_symlink.h @@ -34,8 +34,13 @@ struct symlink_reparse_struct { }; bool symlink_reparse_buffer_marshall( - const char *substitute, const char *printname, uint32_t flags, - TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen); + const char *substitute, + const char *printname, + uint16_t unparsed_path_length, + uint32_t flags, + TALLOC_CTX *mem_ctx, + uint8_t **pdst, + size_t *pdstlen); struct symlink_reparse_struct *symlink_reparse_buffer_parse( TALLOC_CTX *mem_ctx, const uint8_t *src, size_t srclen); diff --git a/source3/libsmb/clisymlink.c b/source3/libsmb/clisymlink.c index 35a9c406968..f77f2c050ab 100644 --- a/source3/libsmb/clisymlink.c +++ b/source3/libsmb/clisymlink.c @@ -97,7 +97,7 @@ static void cli_symlink_create_done(struct tevent_req *subreq) } if (!symlink_reparse_buffer_marshall( - state->link_target, NULL, state->flags, state, + state->link_target, NULL, 0, state->flags, state, &state->in.data, &state->in.length)) { tevent_req_oom(req); return;