From: Stefan Metzmacher Date: Mon, 19 Jun 2017 12:13:37 +0000 (+0200) Subject: s3:libsmb: normalize leading slashes in cli_resolve_path() X-Git-Tag: tevent-0.9.32~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07eb10b7457adc9a994284d7e7ea12bbb3f5d2f5;p=thirdparty%2Fsamba.git s3:libsmb: normalize leading slashes in cli_resolve_path() As we try to pass the path to an SMB2 server, we should have just one leading backslash (which then gets ignored in cli_smb2_create_fnum_send()). Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison --- diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c index 75012b28e87..060c4e95acf 100644 --- a/source3/libsmb/clidfs.c +++ b/source3/libsmb/clidfs.c @@ -919,6 +919,13 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx, root_tcon = rootcli->smb1.tcon; } + /* + * Avoid more than one leading directory separator + */ + while (IS_DIRECTORY_SEP(path[0]) && IS_DIRECTORY_SEP(path[1])) { + path++; + } + if (!smbXcli_tcon_is_dfs_share(root_tcon)) { *targetcli = rootcli; *pp_targetpath = talloc_strdup(ctx, path);