smbd: Fix snapshot query on shares with DFS enabled master
authorChristof Schmitt <cs@samba.org>
Fri, 12 Aug 2016 21:59:07 +0000 (14:59 -0700)
committerJeremy Allison <jra@samba.org>
Sat, 13 Aug 2016 03:44:38 +0000 (05:44 +0200)
When DFS is enabled (host msdfs = yes and msdfs root = yes), then SMB
clients send create requests in the format \hostname\service\path.
Putting the GMT tag as first element breaks the DFS parsing and results
in OBJECT_NOT_FOUND for snapshotted files.  Fix this by appending the
GMT tag to the end of the path.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12150

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Aug 13 05:44:39 CEST 2016 on sn-devel-144

source3/smbd/smb2_create.c

index 4c1b81d96731caa98710f1513aa28aaaae9fbcc1..75da8a1e34ba942183903ed3a4f9fa89cfe3e2c7 100644 (file)
@@ -913,14 +913,14 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
 
                        TALLOC_FREE(fname);
                        fname = talloc_asprintf(state,
-                                       "@GMT-%04u.%02u.%02u-%02u.%02u.%02u\\%s",
+                                       "%s\\@GMT-%04u.%02u.%02u-%02u.%02u.%02u",
+                                       in_name,
                                        tm->tm_year + 1900,
                                        tm->tm_mon + 1,
                                        tm->tm_mday,
                                        tm->tm_hour,
                                        tm->tm_min,
-                                       tm->tm_sec,
-                                       in_name);
+                                       tm->tm_sec);
                        if (tevent_req_nomem(fname, req)) {
                                return tevent_req_post(req, ev);
                        }