From: Volker Lendecke Date: Thu, 29 Sep 2022 13:41:30 +0000 (+0200) Subject: libsmb: Fix the smbclient readlink command X-Git-Tag: talloc-2.4.0~780 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3804161dca1d23ab44b2c22bdf199bf640fd6cb5;p=thirdparty%2Fsamba.git libsmb: Fix the smbclient readlink command We use cli_smb2_qpathinfo_basic() for cli_resolve_path() before calling cli_readlink(). This fails as it never tries with FILE_OPEN_REPARSE_POINT, so we never get to the point where we actually can issue the FSCTL_GET_REPARSE_POINT. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c index f64bbef961d..c7d5ac70dcd 100644 --- a/source3/libsmb/cli_smb2_fnum.c +++ b/source3/libsmb/cli_smb2_fnum.c @@ -1614,6 +1614,24 @@ NTSTATUS cli_smb2_qpathinfo_basic(struct cli_state *cli, NULL); } + if (NT_STATUS_EQUAL(status, NT_STATUS_STOPPED_ON_SYMLINK)) { + /* Maybe a reparse point ? */ + status = cli_smb2_create_fnum(cli, + name, + 0, /* create_flags */ + SMB2_IMPERSONATION_IMPERSONATION, + FILE_READ_ATTRIBUTES, /* desired_access */ + 0, /* file attributes */ + FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, /* share_access */ + FILE_OPEN, /* create_disposition */ + FILE_OPEN_REPARSE_POINT, /* create_options */ + NULL, + &fnum, + &cr, + NULL, + NULL); + } + if (!NT_STATUS_IS_OK(status)) { return status; }