summaryrefslogtreecommitdiff
path: root/source3/smbd/dir.c
AgeCommit message (Collapse)AuthorFilesLines
2009-07-08s3: Plumb smb_filename through dos_mode() and related funtionsTim Prouty1-25/+23
2009-06-25s3 file_access: Convert some more functions over to use smb_filneameTim Prouty1-17/+22
2009-06-24s3: Plumb smb_filename through SMB_VFS_STAT and SMB_VFS_LSTATTim Prouty1-27/+79
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-06-24s3: Convert is_visible_file to use talloc_asprintf instead of mallocTim Prouty1-14/+15
2009-05-26Introduce "struct stat_ex" as a replacement for SMB_STRUCT_STATVolker Lendecke1-6/+6
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-18s3: Always allocate memory in dptr_ReadDirNameAravind Srinivasan1-13/+26
This is a follow up to 69d61453df6019caef4e7960fa78c6a3c51f3d2a to adjust the API to allow the lower layers allocate memory. Now the memory can explicitly be freed rather than relying on talloc_tos(). Signed-off-by: Tim Prouty <tprouty@samba.org>
2009-05-05s3: Fix trans2 path to use case-insensitive stat optimizationtprouty1-0/+17
Often times before creating a file, a client will first query to see if it already exists. Since some systems have a case-insensitive stat that is called from unix_convert, we can definitively return STATUS_NO_SUCH_FILE to the client without scanning the whole directory. This code path is taken from trans2querypathinfo, but trans2findfirst still does a full directory scan even though the get_real_filename (the case-insensitive stat vfs call) can prevent this. This patch adds the get_real_filename call to the trans2find* path, and also changes the vfs_default behavior for SMB_VFS_GET_REAL_FILENAME. Previously, in the absence of a get_real_filename implementation, we would fallback to the full directory scan. The default behavior now returns -1 and sets errno to EOPNOTSUPP. This allows SMB_VFS_GET_REALFILENAME to be called from trans2* and unix_convert.
2009-02-14Attempt to fix the build on Solaris 8Volker Lendecke1-1/+1
2009-02-09s3: Added SMB_VFS_INIT_SEARCH_OP to initialize data at the beginning of SMB ↵Steven Danneman1-0/+8
search requests. By default this VFS call is a NOOP, but the onefs vfs module takes advantage of it to initialize direntry search caches at the beginning of each TRANS2_FIND_FIRST, TRANS2_FIND_NEXT, SMBffirst, SMBsearch, and SMBunique
2009-02-09Pass stat buffer down through all levels of VFS_READDIR wrappersSteven Danneman1-83/+89
* 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-8/+2
The goal is to move all this variables into a big context structure. metze
2008-08-12Make sure to always set errno on error path in OpenDir (and hence ↵Michael Adam1-0/+1
scan_directory). Michael (This used to be commit 15fc2427f91da697e0e91f7f34b0f0c6e230a9a5)
2008-06-18smbd/dir.c: remove unneeded stat buf parameter from user_can_read_file()Michael Adam1-4/+2
This is not needed anymore since user_can_access_file_acl() ist used. Michael (This used to be commit 3c349f773a52e3de693d3bb79f5060c9f1e01e41)
2008-06-17file_access: remove unneeded stat buf parameter from can_access_file_acl().Michael Adam1-1/+1
This is a security descriptor level function only. Michael (This used to be commit 5931540fa1681f026fed42df387d17e43c493c47)
2008-06-15Remove unused "extern struct current_user" from dir.cVolker Lendecke1-2/+0
(This used to be commit b92cfd19b459caad34229dfe941cf15fd14a5ce0)
2008-05-02Remove the "stat_open()" function, flag, and all associated code. It was onlyJeremy Allison1-66/+2
being (correctly) used in the can_read/can_write checks for hide unreadable/unwritable and this is more properly done using the functions in smbd/file_access.c. Preparing to do NT access checks on all file access. Jeremy. (This used to be commit 6bfb06ad95963ae2acb67c4694a98282d3b29faa)
2008-04-07smbd: make it possible to disable get_file_infos() on searchesStefan Metzmacher1-7/+11
metze (This used to be commit 404a865a34c3a7c67131b3f99e92c11b2abe3e39)
2008-04-07locking: combine get_delete_on_close_flag() and get_write_time() into ↵Stefan Metzmacher1-1/+1
get_file_infos() This means we need to fetch the record only once. metze (This used to be commit 4130b873291d39e363184fe4e38dc1f24ebe5056)
2008-04-07smbd: implement the strange write time update logicStefan Metzmacher1-0/+8
We now never call file_ntimes() directly, every update is done via smb_set_file_time(). This let samba3 pass the BASE-DELAYWRITE test. The write time is only updated 2 seconds after the first write() on any open handle to the current time (not the time of the first write). Each handle which had write requests updates the write time to the current time on close(). If the write time is set explicit via setfileinfo or setpathinfo the write time is visible directly and a following close on the same handle doesn't update the write time. metze (This used to be commit 2eab212ea2e1bfd8fa716c2c89b2c042f7ba12ea)
2008-01-12Convert OpenDir to talloc, use talloc_tos()Volker Lendecke1-57/+39
This cuts some mallocs on NtCreate&X (This used to be commit 8e64107b7846d8f9cce71aabc95b28b7488d01ce)
2008-01-08Allocate dirp->name_cache on demand onlyVolker Lendecke1-11/+10
(This used to be commit 1a15778331393f9ece9aac9450828e799b20a058)
2008-01-06Remove superfluous fd parameter from SMB_VFS_FGET_NT_ACL().Michael Adam1-2/+2
Michael (This used to be commit c0c7c1223da29c68359dac64a340c1c710d5f3d2)
2007-12-22Use filesystem capabilities to support case-insensitive filesystems.James Peach1-17/+21
If we know the underlying filesystem is case-insensitive, then we know that it won't help to search for case variations of the requested name. Jeremy, please review (and revert if you disagree). (This used to be commit 9e8b8f8c16612d8a08b55802f4fd9afca5498a7c)
2007-11-13Make [f]get_nt_acl return NTSTATUSVolker Lendecke1-6/+5
(This used to be commit dcbe1bf942d017a3cd5084c6ef605a13912f795b)
2007-10-18RIP BOOL. Convert BOOL -> bool. I found a few interestingJeremy Allison1-27/+27
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-10r25117: The mega-patch Jerry was waiting for. Remove all pstrings fromJeremy Allison1-41/+94
the main server code paths. We should now be able to cope with paths up to PATH_MAX length now. Final job will be to add the TALLOC_CTX * parameter to unix_convert to make it explicit (for Volker). Jeremy. (This used to be commit 7f0db75fb0f24873577dcb758a2ecee74fdc4297)
2007-10-10r25111: Move to talloced pathnames on most code paths.Jeremy Allison1-6/+7
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-2/+1
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-16/+20
interface. More development will come on top of this. Remove the "mangled map" parameter. Jeremy. (This used to be commit dee8beba7a92b8a3f68bbcc59fd0a827f68c7736)
2007-10-10r24639: Add parameter "directory name cache size" - parameterizeJeremy Allison1-20/+33
use of directory name cache, 100 by default. Will be needed to turn this off for *BSD systems. Jeremy. (This used to be commit bea8e9840fd65268e649f813eba10502b0c4d721)
2007-10-10r23784: use the GPLv3 boilerplate as recommended by the FSF and the license textAndrew Tridgell1-2/+1
(This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07)
2007-10-10r23779: Change from v2 or later to v3 or later.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3)
2007-10-10r23724: Reduce access to the global inbuf a tiny bit. Add a struct smb_requestVolker Lendecke1-3/+3
that contains some of the fields from the SMB header, removing the need to access inbuf directly. This right now is used only in the open file code & friends, and creating that header is only done when needed. This needs more work, but it is a start. Jeremy, I'm only checking this into 3_0, please review before I merge it to _26. Volker (This used to be commit ca988f4e79e977160d82e86486972afd15d4acf5)
2007-10-10r21800: Check-in the DFS rewrite. I am still testing this but itJeremy Allison1-4/+2
works from smbclient and Windows, and I am promising to support and fix both client and server code moving forward. Still need to test the RPC admin support but I haven't changed that code. Jeremy. (This used to be commit 7a7862c01d07796ef206b255c676ad7dc2cc42fc)
2007-10-10r21257: Better fix for bug #4188 :Jeremy Allison1-0/+39
Windows Vista RC1 and RC2 can't delete directory on Samba share based on work by Joe Meadows <jmeadows@webopolis.com>. Jeremy. (This used to be commit 2dab8928769938ab79da7b7ce2d165fc388f9b00)
2007-10-10r21191: Add in the POSIX open/mkdir/unlink calls.Jeremy Allison1-0/+1
Move more error code returns to NTSTATUS. Client test code to follow... See if this passes the build-farm before I add it into 3.0.25. Jeremy. (This used to be commit 83dbbdff345fa9e427c9579183f4380004bf3dd7)
2007-10-10r20873: Some correctness fixes w.r.t. Samba4 torture BASE-DELETE.Jeremy Allison1-5/+8
Allow us to correctly refuse to set delete on close on a non-empty directory. There are still some delete-on-close wrinkles to be fixed, but I understand how to do that better now. I'll fix this tomorrow. Jeremy. (This used to be commit 029635885825a5562e7974a6f5675cce3bf1b5dc)
2007-10-10r20844: Somewhat radical change - this may break the build (I willJeremy Allison1-12/+19
watch carefully - so I'm doing it in one transaction so I can roll back). Change check_name(), reduce_name() and dptr_create() to return NTSTATUS. This helps a lot in error path processing and especially in reduce_name() allows us to ditch the flaky and error-prone saving of errno and return errors directly. Jeremy. (This used to be commit 6133a694aa429d638320e39ffe1c49d172583ccf)
2007-10-10r20411: Fix originally from SATOH Fumiyasu (slightlyJeremy Allison1-0/+12
modified). Ensure "hide unXXX" parameters don't hide MSDFS links. Bug #3319. Jeremy. (This used to be commit e5466fffc286a99fafe0fcfbf70e903e33baa7f9)
2007-10-10r18547: Add in fixes to mangling dir code - ensure don'tJeremy Allison1-40/+51
look in the paths for wcard - always read directly from incoming packet. Jeremy. (This used to be commit 3745a1af4ea9262fcda28931539fa6ab4c9060d1)
2007-10-10r16945: Sync trunk -> 3.0 for 3.0.24 code. Still needJeremy Allison1-10/+11
to do the upper layer directories but this is what everyone is waiting for.... Jeremy. (This used to be commit 9dafb7f48ca3e7af956b0a7d1720c2546fc4cfb8)
2007-10-10r16537: Fix for bug #3858, all files in a directory notJeremy Allison1-6/+7
being deleted when hide unreadable set to true. Here's the scoop. This one is really interesting. The pattern of deleting a directory is to do a findfirst to get the first part of the list, then for each name returned it does a open/set delete on close/close -> thus deleting the file. Then it does a findnext with the last file name THAT IT JUST DELETED ! Now we can handle this in the findnext in the case where hide unreadable is set to false as we look back in our cache of names and just seek to the right point. The bug is actually fixed in the first hunk of this patch - the one that removes the is_visible_file() check after SearchDir returns false. We don't actually need it and in this case it's causing the delete to be aborted because it can't find the name (doh ! it was just deleted). We don't need it as SearchDir is only ever called from findnext, and findnext should only ever be returning names we gave it. The rest of the patch are the debugs I used to find the problem but they're generically useful. Phew - that one took a while to track down..... Jerry, please merge for 3.0.23 final. Jeremy. (This used to be commit cd048cb775f0a8525fc19aa463db07c477521f5b)
2007-10-10r15196: Update a comment that I found confusing (I confuse easily).Paul Green1-1/+1
(This used to be commit eb53f01863f8f9d2980d9c2c8d27899dd39e5fa2)
2007-10-10r14986: Fix OS/2 directory delete bug found by kukks.Jeremy Allison1-8/+28
(Thanks a lot for all your hard work on this). We were caching the results of *all* directory scans, not just the results that match the client wildcard. This actually made no sense, as only matches on the client wildcard can be returned to the client and so might need to be searched for in the cache. This fixes the directory cache to only cache entries that we return to the client. Jeremy. (This used to be commit c88af597d042390ff11b26fe802b0b10d0faa6ce)
2007-10-10r13293: Rather a big patch I'm afraid, but this should fix bug #3347Jeremy Allison1-2/+2
by saving the UNIX token used to set a delete on close flag, and using it when doing the delete. libsmbsharemodes.so still needs updating to cope with this change. Samba4 torture tests to follow. Jeremy. (This used to be commit 23f16cbc2e8cde97c486831e26bcafd4ab4a9654)
2007-10-10r11657: Tiny improvement to debug error message in dir_check_ftype.Paul Green1-1/+1
(This used to be commit 46674ca21d9c257bc48af97e313b49118c7b478d)
2007-10-10r11511: A classic "friday night check-in" :-). This moves muchJeremy Allison1-1/+1
of the Samba4 timezone handling code back into Samba3. Gets rid of "kludge-gmt" and removes the effectiveness of the parameter "time offset" (I can add this back in very easily if needed) - it's no longer being looked at. I'm hoping this will fix the problems people have been having with DST transitions. I'll start comprehensive testing tomorrow, but for now all modifications are done. Splits time get/set functions into srv_XXX and cli_XXX as they need to look at different timezone offsets. Get rid of much of the "efficiency" cruft that was added to Samba back in the day when the C library timezone handling functions were slow. Jeremy. (This used to be commit 414303bc0272f207046b471a0364fa296b67c1f8)
2007-10-10r11420: Fix issue pointed out by Dina Fine <dina@exanet.com>. We canJeremy Allison1-2/+2
only tell at parse time from the wire if an incoming name has wildcards or not. If it's a mangled name and we demangle the demangled name may contain wildcard characters. Ensure these are ignored. Jeremy. (This used to be commit 4cd8e2a96b98ff711905e8c6f416b22440c16062)
2007-10-10r10558: Fix bug #3010 yet again. Die monster, die !Jeremy Allison1-1/+16
Jeremy. (This used to be commit dba56e8d23dc10a31f0f700b02c8776bdc8f57c1)
2007-10-10r9483: Changed DIR to SMB_STRUCT_DIR because of the amazing stupidity of a ↵Jeremy Allison1-1/+1
UNIX vendor not understanding abstract data types :-(. Jeremy. (This used to be commit be5b4e2fa3ed30b0ff01b47d2354e5f782a12e25)