/* Check for widelinks allowed. */
if (!lp_widelinks(SNUM(conn))) {
const char *conn_rootdir;
+ size_t rootdirlen;
conn_rootdir = SMB_VFS_CONNECTPATH(conn, fname);
if (conn_rootdir == NULL) {
return NT_STATUS_ACCESS_DENIED;
}
+ DEBUG(10, ("resolved_name=%s\n", resolved_name));
+ DEBUGADD(10, ("conn_rootdir =%s\n", conn_rootdir));
+
+ rootdirlen = strlen(conn_rootdir);
+
+ /*
+ * We have to take care of an access to the
+ * rootdir itself.
+ */
+ if ((strlen(resolved_name) == (rootdirlen-1))
+ && (conn_rootdir[rootdirlen-1] == '/')) {
+ rootdirlen -= 1;
+ }
+
if (strncmp(conn_rootdir, resolved_name,
- strlen(conn_rootdir)) != 0) {
+ rootdirlen) != 0) {
DEBUG(2, ("check_reduced_name: Bad access "
"attempt: %s is a symlink outside the "
"share path\n", fname));