]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:libsmb: normalize leading slashes in cli_resolve_path()
authorStefan Metzmacher <metze@samba.org>
Mon, 19 Jun 2017 12:13:37 +0000 (14:13 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 22 Jun 2017 11:07:40 +0000 (13:07 +0200)
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 <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/libsmb/clidfs.c

index 75012b28e875ee30d73bd8f873b69596c3ea808b..060c4e95acf33005eba6fd312ebd920f972bc7ad 100644 (file)
@@ -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);