summaryrefslogtreecommitdiff
path: root/source3/smbd/dir.c
AgeCommit message (Collapse)AuthorFilesLines
2011-06-21s3-build: Provide a run-time shim to work around duplicate symbolsAndrew Bartlett1-2/+2
The become_root() and similar 'smbd' functions that are used widely in Samba libraries had 'dummy' copies in dummysmbd.c and dummyroot.c. These have been replaced by a runtime plugin mechanim, which ensures that standlone binaries still do nothing, while in smbd the correct function is used. This avoids having these as duplicate symbols in the smbd binary, which can cause unpredictable behaviour. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-06-09s3-talloc Change TALLOC_ZERO_ARRAY() to talloc_zero_array()Andrew Bartlett1-1/+1
Using the standard macro makes it easier to move code into common, as TALLOC_ZERO_ARRAY isn't standard talloc.
2011-06-09s3-talloc Change TALLOC_ZERO_P() to talloc_zero()Andrew Bartlett1-2/+2
Using the standard macro makes it easier to move code into common, as TALLOC_ZERO_P isn't standard talloc.
2011-04-29s3-smb Use FILE_ATTRIBUTE_ARCHIVE intead of aARCHAndrew Bartlett1-2/+2
This means we use just one constant for this file attribute. Andrew Bartlett
2011-04-29s3-smb Use FILE_ATTRIBUTE_DIRECTORY intead of aDIRAndrew Bartlett1-4/+4
This means we use just one constant for this file attribute. Andrew Bartlett
2011-04-29s3-smb Use FILE_ATTRIBUTE_SYSTEM intead of aSYSTEMAndrew Bartlett1-3/+3
This means we use just one constant for this file attribute. Andrew Bartlett
2011-04-29s3-smb Use FILE_ATTRIBUTE_HIDDEN intead of aHIDDENAndrew Bartlett1-3/+3
This means we use just one constant for this file attribute. Andrew Bartlett
2011-04-29s3-smb Use FILE_ATTRIBUTE_READONLY intead of aRONLYAndrew Bartlett1-2/+2
This means we use just one constant for this file attribute. Andrew Bartlett
2011-03-30s3: include smbd/smbd.h where needed.Günther Deschner1-0/+1
Guenther
2011-03-30s3-includes: only include system/filesys.h when needed.Günther Deschner1-0/+1
Guenther
2011-03-18The searches struct is still being used and idled in SMB2 - move it to the ↵Jeremy Allison1-26/+26
global section until we decide if we want to idle SMB2 directory handles. Jeremy. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Fri Mar 18 01:13:53 CET 2011 on sn-devel-104
2011-03-17Fix crash bug on smbd shutdown when using FOPENDIR() found by Volker.Jeremy Allison1-1/+13
The key was allowing the dptr_idle code to be triggered. We were closing the dirp->dir handle without updating the underlying fd in the open fsp. Jeremy.
2011-02-26dirfd doesn't exist in some platforms.Jeremy Allison1-0/+6
Hack that should get the buildfarm back to green. Ensure dirfd() needs to be defined before we properly return fdopendir. This will do until we get a proper dirfd() defined in libreplace. From http://www.gnu.org/software/hello/manual/gnulib/dirfd.html This function is missing on some platforms: AIX 7.1, HP-UX 11, OSF/1 5.1, Solaris 10, mingw. Jeremy. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Sat Feb 26 04:19:55 CET 2011 on sn-devel-104
2011-02-10Put OpenDir() back the way it was - don't overload with an fsp arg. Create ↵Jeremy Allison1-14/+59
OpenDir_fsp for new usage. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu Feb 10 02:43:31 CET 2011 on sn-devel-104
2011-02-09Allow SMB2_FIND to actually use the open fd handle if we support fdopendir. ↵Jeremy Allison1-11/+43
Fallback to pathname opendir if not.
2011-02-08Pass fsp to dptr_CloseDir(). Cope with setting the fd if we're closing an fd ↵Jeremy Allison1-3/+9
that opendir knows about.
2011-01-25Add uint32_t name_hash argument (currently unused) to get_file_infos().Jeremy Allison1-1/+1
Will be used when we store more than one delete on close token.
2010-10-12libcli/security Provide a common, top level libcli/security/security.hAndrew Bartlett1-0/+1
This will reduce the noise from merges of the rest of the libcli/security code, without this commit changing what code is actually used. This includes (along with other security headers) dom_sid.h and security_token.h Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Tue Oct 12 05:54:10 UTC 2010 on sn-devel-104
2010-04-24s3: Simplify (bool != True) to !boolVolker Lendecke1-1/+1
2010-04-23Fix bug #7384 - dptr_Close has a bitmap leak.Ira Cooper1-3/+1
s3: Fix to dptr_Close This fixes a bitmap "leak" in dptr_Close by making it use the same internal routines the rest of the code does.
2010-03-28s3: Use bitmap_talloc in init_dptrsVolker Lendecke1-1/+2
2010-03-15Remove reference to conn->admin_user in preparation for removal.Jeremy Allison1-9/+13
We use (uid_t)0 here not sec_initial_uid() as make test uses a single user context. I will revisit this when all the uid check changes are complete. Jeremy.
2010-03-15Rever e80ceb1d7355c8c46a2ed90d5721cf367640f4e8 "Remove more uses of "extern ↵Jeremy Allison1-10/+3
struct current_user current_user;"." As requested by Volker, split this into smaller commits. Jeremy.
2010-03-12Remove more uses of "extern struct current_user current_user;".Jeremy Allison1-3/+10
Use accessor functions to get to this value. Tidies up much of the user context code. Volker, please look at the changes in smbd/uid.c to familiarize yourself with these changes as I think they make the logic in there cleaner. Cause smbd/posix_acls.c code to look at current user context, not stored context on the conn struct - allows correct use of these function calls under a become_root()/unbecome_root() pair. Jeremy.
2010-02-10s3-smbd: update to use new DLIST macrosAndrew Tridgell1-4/+3
(cherry picked from commit 365b408c458c848a818637d9b36a0423aeb1ba54)
2010-01-07s3: Remove some code that has become unnecessaryVolker Lendecke1-8/+0
The code I just removed was checked in with e5466fffc286a99f as a bug fix for https://bugzilla.samba.org/show_bug.cgi?id=3319. With the changes to is_visible_file made with 9e8b8f8c16612 these lines have become unnecessary, even with "hide unreadable = yes" dead msdfs symlinks show. This is because we can not stat(2) them and default to showing them. Why this change? I have a user who wants to use "hide unreadable" on msdfs links. Because you can't edit acls on symlinks themselves, the user created the targets as bogus, empty files that just exist as acl placeholders. With the code in place that this patch removes, we never allow this to work. Jeremy, please check! :-) Thanks, Volker
2009-11-23Revert "s3: Make the implicit reference to Protocol in is_in_path() explicit"Volker Lendecke1-2/+1
This reverts commit f7b4151a64d8c6851e62255a7139fd00a5fc63a3.
2009-11-23Revert "s3: Move the global variable Protocol to struct smbd_server_connection"Volker Lendecke1-2/+1
This reverts commit c85a4c9ba4a7de65a7850f6f9708df66bd24deea.
2009-11-21s3: Move the global variable Protocol to struct smbd_server_connectionVolker Lendecke1-1/+2
2009-11-21s3: Make the implicit reference to Protocol in is_in_path() explicitVolker Lendecke1-1/+2
2009-11-18s3: Replace some create_synthetic_smb_fname() callsVolker Lendecke1-28/+20
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-30/+51
This is a hot codepath (called from the stat cache)
2009-08-28s3: Add a new VFS op called SMB_VFS_TRANSLATE_NAMEAravind Srinivasan1-13/+22
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-07s3:smbd: move dptr globals into struct smbd_server_connectionStefan Metzmacher1-55/+98
metze
2009-08-07s3:smbd: remove dirptr and dirpath from connection_structStefan Metzmacher1-8/+3
They're both only used in the context of a function, so we can make them stack variables. metze
2009-08-07s3:smbd: let get_dir_entry() use smbd_dirptr_get_entry()Stefan Metzmacher1-139/+89
metze
2009-08-07s3:smbd: add generic smbd_dirptr_get_entry()Stefan Metzmacher1-0/+142
metze
2009-08-07s3:smbd: don't ignore check_descend in get_dir_entry()Stefan Metzmacher1-0/+6
metze
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)