summaryrefslogtreecommitdiff
path: root/source3/smbd/msdfs.c
AgeCommit message (Collapse)AuthorFilesLines
2010-05-21Make DFS work over SMB2.Jeremy Allison1-1/+2
Jeremy.
2010-04-08Fix bug #7339 - MSDFS is non-functional in 3.5.xJeremy Allison1-1/+2
In the refactoring around filename_convert, the split between the functions resolve_dfspath() and resolve_dfspath_wcard() was lost, leaving us only with resolve_dfspath_wcard(). Internally resolve_dfspath_wcard() calls dfs_redirect() only with a "allow_wcards" flag of true, wheras the old resolve_dfspath() would call with a value of false. The loss of this case causes dfs_redirect to always masquerade DFS links as directories, even when they are being queried directly by a trans2 QPATHINFO call. We should only masquerade DFS links as directories when called from a SMBsearch or trans2 findfirst/findnext - which was the intent of the "allow_wcards" flag. This patch adds back an allow_wcards bool parameter to resolve_dfspath_wcard(). This bool is set from the state of the ucf_flags when filename_convert() is called. I will follow this up with a new smbclient-based torture test that will prevent us from ever regressing our DFS support again. Jeremy.
2009-11-18s3: Replace some create_synthetic_smb_fname() callsVolker Lendecke1-13/+6
In very hot codepaths like the statcache copy_smb_filename and the subsequent recursive talloc_free is noticable in the CPU load.
2009-11-18s3: Do not talloc in readdirVolker Lendecke1-8/+12
This is a hot codepath (called from the stat cache)
2009-08-28s3: Add a new VFS op called SMB_VFS_TRANSLATE_NAMEAravind Srinivasan1-0/+4
This vop is designed to work in tandem with SMB_VFS_READDIR to allow vfs modules to make modifications to arbitrary filenames before they're consumed by callers. Subsequently the core directory enumeration code in smbd is now changed to free the memory that may be allocated in a module. This vop enables the new version of catia in the following patch. Signed-off-by: Tim Prouty <tprouty@samba.org>
2009-08-24Second attempt at fix for bug 6529 - Offline files conflict with Vista and ↵Jeremy Allison1-1/+1
Office 2003. Confirmation from reporter that this fixes the issue in master on ext3/ext4. Back-ports to follow. Jeremy.
2009-08-07s3:smbd: conn_free_internal() can be static nowStefan Metzmacher1-11/+11
metze
2009-07-24s3: Convert a few callers of unix_convert() over to filename_convert()Tim Prouty1-1/+1
This patch also changes the unix convert flags to make sure the correct semantics are preservered for allowing/disallowing wildcards in the last component of the path.
2009-07-24s3: Remove a few callers of get_full_smb_filename()Tim Prouty1-21/+31
2009-07-24s3: Allow filename_convert() to pass through unix_convert_flags and let the ↵Tim Prouty1-35/+10
caller know if the path has a wildcard This also eliminates the need for resolve_dfspath().
2009-07-22s3: Convert some callers of vfs_lstat_smb_fname to SMB_VFS_LSTAT()Tim Prouty1-6/+14
2009-07-06s3: Plumb smb_filename through SMB_VFS_UNLINKTim Prouty1-2/+26
2009-06-24s3: Plumb smb_filename through SMB_VFS_STAT and SMB_VFS_LSTATTim Prouty1-1/+1
This patch introduces two new temporary helper functions vfs_stat_smb_fname and vfs_lstat_smb_fname. They basically allowed me to call the new smb_filename version of stat, while avoiding plumbing it through callers that are still too inconvenient. As the conversion moves along, I will be able to remove callers of this, with the goal being to remove all callers. There was also a bug in create_synthetic_smb_fname_split (also a temporary utility function) that caused it to incorrectly handle filenames with ':'s in them when in posix mode. This is now fixed.
2009-05-26Introduce "struct stat_ex" as a replacement for SMB_STRUCT_STATVolker Lendecke1-1/+1
This patch introduces struct stat_ex { dev_t st_ex_dev; ino_t st_ex_ino; mode_t st_ex_mode; nlink_t st_ex_nlink; uid_t st_ex_uid; gid_t st_ex_gid; dev_t st_ex_rdev; off_t st_ex_size; struct timespec st_ex_atime; struct timespec st_ex_mtime; struct timespec st_ex_ctime; struct timespec st_ex_btime; /* birthtime */ blksize_t st_ex_blksize; blkcnt_t st_ex_blocks; }; typedef struct stat_ex SMB_STRUCT_STAT; It is really large because due to the friendly libc headers playing macro tricks with fields like st_ino, so I renamed them to st_ex_xxx. Why this change? To support birthtime, we already have quite a few #ifdef's at places where it does not really belong. With a stat struct that we control, we can consolidate the nanosecond timestamps and the birthtime deep in the VFS stat calls. At this moment it is triggered by a request to support the birthtime field for GPFS. GPFS does not extend the system level struct stat, but instead has a separate call that gets us the additional information beyond posix. Without being able to do that within the VFS stat calls, that support would have to be scattered around the main smbd code. It will very likely break all the onefs modules, but I think the changes will be reasonably easy to do.
2009-05-20s3: Change unix_convert (and its callers) to use struct smb_filenameTim Prouty1-3/+12
This is the first of a series of patches that change path based operations to operate on a struct smb_filename instead of a char *. This same concept already exists in source4. My goals for this series of patches are to eventually: 1) Solve the stream vs. posix filename that contains a colon ambiguity that currently exists. 2) Make unix_convert the only function that parses the stream name. 3) Clean up the unix_convert API. 4) Change all path based vfs operation to take a struct smb_filename. 5) Make is_ntfs_stream_name() a constant operation that can simply check the state of struct smb_filename rather than re-parse the filename. 6) Eliminate the need for split_ntfs_stream_name() to exist. My strategy is to start from the inside at unix_convert() and work my way out through the vfs layer, call by call. This first patch does just that, by changing unix_convert and all of its callers to operate on struct smb_filename. Since this is such a large change, I plan on pushing the patches in phases, where each phase keeps full compatibility and passes make test. The API of unix_convert has been simplified from: NTSTATUS unix_convert(TALLOC_CTX *ctx, connection_struct *conn, const char *orig_path, bool allow_wcard_last_component, char **pp_conv_path, char **pp_saved_last_component, SMB_STRUCT_STAT *pst) to: NTSTATUS unix_convert(TALLOC_CTX *ctx, connection_struct *conn, const char *orig_path, struct smb_filename *smb_fname, uint32_t ucf_flags) Currently the smb_filename struct looks like: struct smb_filename { char *base_name; char *stream_name; char *original_lcomp; SMB_STRUCT_STAT st; }; One key point here is the decision to break up the base_name and stream_name. I have introduced a helper function called get_full_smb_filename() that takes an smb_filename struct and allocates the full_name. I changed the callers of unix_convert() to subsequently call get_full_smb_filename() for the time being, but I plan to eventually eliminate get_full_smb_filename().
2009-05-08Fix bug #6330 - DFS doesn't work on AIX. Jeremy.Jeremy Allison1-0/+4
2009-05-04s3-printing: Fix driver upload for Xerox 4110 PS printer driver.Günther Deschner1-0/+2
We need to allow to set filesystem capabilities from the default vfs in create_conn_struct() in order to find mixed-case filenames. Thanks Volker! This one was hard to find, so a little longer explanation: When a Windows client tries to upload e.g. the Xerox 4110 PS driver, the client first uploads the driver files to the [print$] share. Some of them (in this case the Windows Postscript drivers) are with uppercase filenames while some of them (like the PPD file) are in lowercase. After the driver upload the client issues the spoolss_AddPrinterDriverEx() call with level 6. There the client tries to add the PPD file with an uppercase filename (while having stored it in lowercase on the server). The internal spoolss add driver functions then could not find the appropriate filename while trying to move them to the version subdirectory (in this case W32X86/3) and fails then entire spoolss_AddPrinterDriverEx() call. With this fix, the convert_unix_name() name finds the correct file and the spoolss_AddPrinterDriverEx() succeeds. Guenther
2009-02-09Pass stat buffer down through all levels of VFS_READDIR wrappersSteven Danneman1-2/+2
* VFS_OP_READDIR can now provide stat information, take advantage of it if it's available * is_visible_file(): optimistically expect the provided stat buffer is already valid * dptr_ReadDirName(): refactor code for easier readability, functionality is the same
2009-01-08s3:smbd: move all globals and static variables in globals.[ch]Stefan Metzmacher1-2/+1
The goal is to move all this variables into a big context structure. metze
2008-11-23Add auth_serversupplied_info to create_conn_structVolker Lendecke1-4/+15
srvsvc needs it, as will printing
2008-11-20Fix bug #5909 - MS-DFS does not work on Vista, if link name includes ↵Yasuma Takeda1-6/+6
multibyte character.
2008-07-27Make create_conn_struct() publicVolker Lendecke1-1/+1
(This used to be commit e115e2582256c34e6905afc8c2929efd6ea61088)
2008-06-24Move the responsibility to keep the cwd from srv_dfs_nt to msdfs.cVolker Lendecke1-17/+53
(This used to be commit 7db382588ac90fe250b72cf4cd07afb39fcae7c0)
2008-06-22Remove the "exists" parameter from create_msdfs_linkVolker Lendecke1-11/+11
Jeremy, setting "exists" to True in _dfs_Add prevented the initial creation of a new symlink for me, because the SMB_VFS_UNLINK failed. This also exists in 3.2. I only check it into 3.3 as I would like you to look at it first. Thanks, Volker (This used to be commit f58b098a4172949018e84c4d0c722d6eb9bba514)
2008-06-22Reduce memory usage in form_junctions() a little bitVolker Lendecke1-0/+1
(This used to be commit d031e6d8cabe2dd0b29e90d173d45843e145176a)
2008-06-22Fix an abort in junction_to_local_pathVolker Lendecke1-1/+1
(This used to be commit 587bd636cb70d09600111ced040adaa55af35d0f)
2008-06-22Fix a crash in _dfs_EnumVolker Lendecke1-0/+2
(cherry picked from commit 4a996476297963d4cb300b4d45c23e83a493c339) (This used to be commit 86cae83a7db87063ecd6e58eaa15f11441c45040)
2008-06-22Fix an uninitialized variable access in callers of parse_msdfs_symlinkVolker Lendecke1-1/+2
At least form_junctions() does not initialize refcount, and I don't see it in get_referred_path(). For the latters, the callers might initialize it. But even if they did, I think parse_msdfs_symlink() should unconditionally return the number of referrals it found. I don't think it makes sense to count them up from somewhere else. (This used to be commit 73172113484a2c6c9af014f59e84707716c61a7d)
2008-06-21Fix a double-closedir() in form_junctions()Volker Lendecke1-1/+0
(This used to be commit 1d7ad0dea7ebf7a46af6e695797e5132264307d6)
2008-05-25Remove some references to get_current_username() and current_user_infoVolker Lendecke1-0/+11
(This used to be commit 344d69f95e217d16213eaa6b53141af6ab459708)
2008-05-19Restructuring of code to fix #5460. Remove searchJeremy Allison1-16/+12
by name code from conn, we were already doing the same check in the dfs_redirect() function, so move it into parse_dfs_path() instead. Jeremy. (This used to be commit 8a7c6df122c5e4a1d0f74ab0f1bc9376a0a8bcb1)
2008-05-13Fix debug message.Jeremy Allison1-2/+2
Jeremy. (This used to be commit 08d168f0e5b8fb07e95a5118a839e0da53e9d363)
2008-05-13Second part of patch for bug #5460. Cope with pathnamesJeremy Allison1-15/+39
that don't look like \xxx\yyy, cope with arbitrary length. Jeremy. (This used to be commit 635035d999fcd8e06b70c8cb1137127c289dc9e6)
2008-05-13Fix bug #5460. The problem is RHEL5.0 shipped a CIFS clientJeremy Allison1-0/+10
that sets the DFS bit on pathnames but doesn't send DFS paths. This causes lookups to fail as the smbd/msdfs.c code now just eats the first two parts of the pathname and uses the rest as the local path. The previous hostname check used to protect us from that as we knew that when the hostname was invalid it was a local path (and a broken client). I didn't want to put that check back in, but came up with another idea - even though the hostname can be a different one, the sharename must be valid on this machine. So we can check for a valid sharename instead. Jeremy. (This used to be commit e1cda82f6f7de3306a653af920756c1640057f2d)
2008-05-05Fix dfs_Enum: In form_junctions, correctly check for malloc failureVolker Lendecke1-1/+1
(This used to be commit 1b1614c3261e1e93a2cad1f1063e28cbbb13f434)
2008-05-05Remove connection_struct->mem_ctx, connection_struct is its own parentVolker Lendecke1-45/+36
(This used to be commit 559180f7d30606d1999399d954ceedc798c669a4)
2008-04-02Fix MSDFS bug noticed by Ofir Azoulay <Ofir.Azoulay@expand.com>.Jeremy Allison1-30/+0
There is no reason to ensure the target host is ourselves, and this breaks MS clients in some cases. Jeremy. (This used to be commit c19fdf43d16ce9fba3e8e12e6192bac31837715e)
2008-01-23strtok -> strtok_rVolker Lendecke1-2/+3
(This used to be commit fd34ce437057bb34cdc37f4b066e424000d36789)
2007-12-07Don't build rpctorture anymore - not maintained. Just remove.Jeremy Allison1-1/+1
Remove all vestiges of pstring (except for smbctool as noted in previous commit). Jeremy (This used to be commit 4c32a22ac50ada3275d2ffba3c1aa08bee7d1549)
2007-11-10Always define PATH_MAX. Makes code simpler (removesJeremy Allison1-21/+41
a bunch of #defines). Remove pstring from msdfs.c. Jeremy. (This used to be commit e203ba22275320808bc11b17361ad1f2d5b0b897)
2007-10-18RIP BOOL. Convert BOOL -> bool. I found a few interestingJeremy Allison1-28/+28
bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f)
2007-10-10r25327: Normalize the path we return for 'msdfs proxy'Volker Lendecke1-1/+11
We now accept both \\server\tmp and \server\tmp. There are other places where this might be necessary, but at least the functionality is a bit easier now. (This used to be commit 25cc27df97e9eecb470f99ea934de12f2a0f4df9)
2007-10-10r25324: Fix "msdfs proxy"Volker Lendecke1-1/+1
Jeremy, please check! (This used to be commit d4eddf88d20b09c450d4358d2ef1bc35736501ff)
2007-10-10r25184: Fix some C++ warnings and an uninitialized variableVolker Lendecke1-1/+1
(This used to be commit b64df8a3c504ab7749c21ffb26e4771a9a0a328f)
2007-10-10r25173: Use the append_buffer version in a loop.Jeremy Allison1-2/+2
Jeremy. (This used to be commit 37cf2c272751065245dd46708af0a78f1f0c47df)
2007-10-10r25138: More pstring elimination. Add a TALLOC_CTX parameterJeremy Allison1-1/+1
to unix_convert(). Jeremy. (This used to be commit 39c211a702e91c34c1a5a689e1b0c4530ea8a1ac)
2007-10-10r25111: Move to talloced pathnames on most code paths.Jeremy Allison1-10/+6
There are now ony 17 pstrings left in reply.c, and these will be easy to remove (and I'll be doing that shortly). Had to fix an interesting bug in pull_ucs2_base_talloc() when a source string is not null terminated :-). Jeremy. (This used to be commit 0c9a8c4dff10974dbffd2a302ae982896122fcc0)
2007-10-10r25102: Rewrite msdfs code to use talloced filenames. Passes make testJeremy Allison1-252/+609
and make valgrindtest. Final step will be to change srvstr_get_path() to return talloced memory in the major codepaths. Jeremy. (This used to be commit cf6b6f9c3a38b68d2671c753f412772344506742)
2007-10-10r25009: Large patch discussed with Volker. Move unix_convert to a talloc-basedJeremy Allison1-3/+4
interface. More development will come on top of this. Remove the "mangled map" parameter. Jeremy. (This used to be commit dee8beba7a92b8a3f68bbcc59fd0a827f68c7736)
2007-10-10r24253: From Jan Martin <Jan.Martin@rwedea.com>.Jeremy Allison1-0/+8
---------------------------------------------------------- In rare cases, Samba 3.0.25b shows directory contents at the wrong position in the file tree when displaying a subdirectory of a DFS link. The problem occurs whenever Windows XP asks for a DFS referral for a subdirectory of a DFS link with a trailing backslash. Windows does not do this very often, but we saw it several times per day on our central DFS server. smbd/msdfs.c, dfs_path_lookup() does the following with the requested path: - in line 390, the local copy 'localpath' is 'unix_convert'ed; the trailing backslash is removed inside unix_convert - in lines 417-20, 'dfspath' (another copy of the requested path) is mangled another way without removing trailing backslashes That's why the following loop (lines 435-461) that is meant to synchronously cut off the last path component from both strings until it comes to a DFS link, does not handle both strings the same. When the original path ended with a backslash, 'canon_dfspath' has always one component more than 'localpath', so that *consumedcntp gets too big in line 446. This value is reported to the client. ---------------------------------------------------------- Bug #4860. Jeremy. (This used to be commit 42d1c6713a56197ca8dfebf74eb0d483102148f7)