summaryrefslogtreecommitdiffstats
path: root/source3/smbd/files.c
Commit message (Collapse)AuthorAgeFilesLines
* s3: smbd : Ensure file_new doesn't call into smbXsrv_open_create() for ↵Jeremy Allison2014-05-021-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | INTERNAL_OPEN_ONLY. This causes deadlocks which cause smbd to crash if the locking database has already been locked for a compound operation we need to be atomic (as in the file rename case). Ensure INTERNAL_OPEN_ONLY opens are synonymous with req==NULL. INTERNAL_OPEN_ONLY opens leave a NO_OPLOCK record in the share mode database, so they can be detected by other processes for share mode violation purposes (because they're doing an operation on the file that may include reads or writes they need to have real state inside the locking database) but have an fnum of FNUM_FIELD_INVALID and a local share_file_id of zero, as they will never be seen on the wire. Ensure validate_my_share_entries() ignores INTERNAL_OPEN_ONLY records (share_file_id == 0). Bug 10564 - Lock order violation and file lost https://bugzilla.samba.org/show_bug.cgi?id=10564 Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org>
* lib: Move full_path_tos to util_str.cVolker Lendecke2014-04-231-39/+0
| | | | | | | This can be useful elsewhere Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:smbd: use PATH_MAX for the buffer passed to full_path_tos()Stefan Metzmacher2013-12-141-1/+1
| | | | | | | We use this in other places too and it's better than a hardcoded value. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* smbd: Implement and use full_path_tosVolker Lendecke2013-12-141-9/+49
| | | | | | | | Yes, this looks like a hack, but talloc_asprintf does show up high in profiles called from these routines Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Remove FAKE_LEVEL_II_OPLOCKVolker Lendecke2013-10-151-2/+1
| | | | | | | | | FAKE_LEVEL_II_OPLOCK was an indicator to break level2 oplock holders on write. This information is now being held in brlock.tdb, which makes the FAKE_LEVEL_II_OPLOCK type unnecessary. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Convert file_new to synthetic_smb_fnameVolker Lendecke2013-04-171-4/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Convert fsp_set_smb_fname to cp_smb_filenameVolker Lendecke2013-04-171-4/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: split out file_fsp_get from file_fsp_smb2David Disseldorp2013-01-161-10/+24
| | | | | | | Obtain the files_struct from smb2req, persistent_id and volatile_id. Reviewed by: Jeremy Allison <jra@samba.org>
* s3:smbd: also close durable file handles in a tdisMichael Adam2012-09-081-2/+9
| | | | Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
* s3:smbd: if a fsp has fsp->deferred_close, clients shouldn't be able to use itStefan Metzmacher2012-07-231-2/+18
| | | | | | | metze Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Mon Jul 23 16:22:03 CEST 2012 on sn-devel-104
* Add uint64_t mid field to the files_struct.Jeremy Allison2012-06-301-0/+1
| | | | Ensure it is initialized so we know what mid created this file.
* s3:smbd: make use of smbXsrv_open for smb1/2/3Stefan Metzmacher2012-06-291-128/+44
| | | | | | | | | | | | This makes sure we generate unique persistent file ids, which are stored in smbXsrv_open_global.tdb. Pair-Programmed-With: Michael Adam <obnox@samba.org> metze Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Fri Jun 29 21:01:11 CEST 2012 on sn-devel-104
* s3:smbd/files: fsp->fnum is uint64_t not int!Stefan Metzmacher2012-06-281-3/+3
| | | | metze
* s3:smbd: make use of smbXsrv_tcon and smbXsrv_session for smb2Stefan Metzmacher2012-06-251-2/+6
| | | | | | | | | The removes the protocol specific smbd_smb2_session and smbd_smb2_tcon. Pair-Programmed-With: Michael Adam <obnox@samba.org> metze
* s3:smbd: change files.c to use fsp_fnum_dbg() for fsp->fnum logging.Michael Adam2012-06-151-2/+2
| | | | Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:smbd: use FNUM_FIELD_INVALID instead of literal -1Michael Adam2012-06-151-2/+2
| | | | | | This is in preparation of changing fnum to uint64_t Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:files: factor fsp_free() out of file_free()Michael Adam2012-06-151-20/+27
| | | | | | To be reused in the durable reconnect code. Pair-Programmed-With: Volker Lendecke <vl@samba.org>
* s3:files: reorder file_free() a bitMichael Adam2012-06-151-16/+18
| | | | | Pair-Programmed-With: Volker Lendecke <vl@samba.org> Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
* s3:smbd: refactor fsp_new() out of file_new()Michael Adam2012-06-151-34/+55
| | | | | Pair-Programmed-With: Volker Lendecke <vl@samba.org> Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
* s3:smbd: use fsp_persistent_id() as persistent_file_id part for SMB2 (bug #8995)Stefan Metzmacher2012-06-141-4/+6
| | | | | | | | | | | | | | | It seems to be important to have unique persistent file ids, because windows clients seem to index files by server_guid + persistent_file_id. Which may break, if we just have a 16-bit range per connection and the client connects multiple times. Based on code from Ira Cooper. Use fsp->fh->gen_id as the persistent fileid in SMB2. metze Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Thu Jun 14 22:04:13 CEST 2012 on sn-devel-104
* s3:smbd: add a fsp_persistent_id() functionStefan Metzmacher2012-06-141-0/+24
| | | | | | | | | | | | | | | | This calculates a 64-bit value that most likely uniquely identifies the files_struct globally to the server. * 32-bit random gen_id * 16-bit truncated open_time * 16-bit fnum (valatile_id) Based on code from Ira Cooper. Use fsp->fh->gen_id as the persistent fileid in SMB2. Pair-Programmed-With: Michael Adam <obnox@samba.org> metze
* s3:smbd: only set fsp->fh->gen_id for a client connectionStefan Metzmacher2012-06-141-1/+2
| | | | | | For faked connections, like dfs and printing, we leave it as 0. metze
* s3:smbd: try to make fsp->fh->gen_id as globally unique as possibleStefan Metzmacher2012-06-141-1/+19
| | | | | | | | | | | | | | | | | This makes sure the value is never 0, it's between 1 and UINT32_MAX. While fsp->fh->gen_id is 'unsigned long' currently (which might by 8 bytes), there's some oplock code which truncates it to uint32_t (using IVAL()). Which means we could reuse fsp->fh->gen_id as persistent file id until we have a final fix, which uses database. See bug #8995 for more details. Based on code from Ira Cooper. Ensure fsp->fh->gen_id starts from a random point. We will use this as the SMB2 persistent_id. metze
* Revert "s3:smbd: set req->smb2req->compat_chain_fsp in file_fsp()"Stefan Metzmacher2012-06-101-3/+0
| | | | | | | | | | | This reverts commit c2716a7d5ccf78f9716b703c22e6cf4d4f179656. This is not needed anymore, as we have file_fsp_smb2() now. metze Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Sun Jun 10 18:04:21 CEST 2012 on sn-devel-104
* s3:smbd: add file_fsp_smb2()Stefan Metzmacher2012-06-091-0/+43
| | | | metze
* s3:smbd: set req->smb2req->compat_chain_fsp in file_fsp()Stefan Metzmacher2012-06-091-0/+3
| | | | metze
* s3: Replace an if with a boolean short circuitVolker Lendecke2012-06-081-5/+3
| | | | Signed-off-by: Michael Adam <obnox@samba.org>
* s3: Assigning ?True:False to a bool is a bit pointlessVolker Lendecke2012-06-081-2/+2
| | | | Signed-off-by: Michael Adam <obnox@samba.org>
* s3: Remove unnecessary ()Volker Lendecke2012-06-081-1/+1
| | | | Signed-off-by: Michael Adam <obnox@samba.org>
* s3:smbd: let file_close_pid/file_close_user take a uint64_t vuidStefan Metzmacher2012-06-061-2/+2
| | | | metze
* s3:smbd: dup_file_fsp() never gets called for print filesStefan Metzmacher2012-06-061-8/+3
| | | | metze
* s3:smbd: make use of vfs_remove_all_fsp_extensions() in file_free()Stefan Metzmacher2012-06-061-3/+1
| | | | metze
* s3:smbd/files: split file_init_global() out of file_init()Stefan Metzmacher2012-05-241-13/+34
| | | | metze
* s3:smbd/files: work without sconn->file_bmap and assign fsp->fnum = -1Stefan Metzmacher2012-05-241-23/+39
| | | | | | | For faked connection_structs we do not need valid fnum values, e.g. in the dfs and printing code. metze
* s3:smbd/files: fix error path and correctly cleanupStefan Metzmacher2012-05-241-7/+7
| | | | metze
* s3:smbd/files: remove unused VALID_FNUM()Stefan Metzmacher2012-05-231-2/+0
| | | | metze
* s3: oplock_timeout is a talloc child of fspVolker Lendecke2012-04-261-3/+0
| | | | | | | | | Jeremy, I know you like it explicit, but I stumbled across this explicit TALLOC_FREE and asked myself about a potentially wrong talloc hierarchy. Autobuild-User: Volker Lendecke <vl@samba.org> Autobuild-Date: Thu Apr 26 23:00:03 CEST 2012 on sn-devel-104
* s3: New notify implementationVolker Lendecke2012-04-171-4/+0
| | | | | | | | | | | | From notify_internal.c: /* * The notify database is split up into two databases: One * relatively static index db and the real notify db with the * volatile entries. */ This change is necessary to make notify scale better in a cluster
* s3: Use talloc_get_size instead of strlenVolker Lendecke2012-04-101-1/+1
| | | | | | | | We've just talloc_asprintf'ed the fullpath, so talloc_get_size knows the strlen. Autobuild-User: Volker Lendecke <vl@samba.org> Autobuild-Date: Tue Apr 10 13:20:22 CEST 2012 on sn-devel-104
* lib/util: Remove obsolete sys_getpid() and sys_fork().Jelmer Vernooij2012-03-241-1/+1
| | | | | | | | | The performance of these is minimal (these days) and they can return invalid results when used as part of applications that do not use sys_fork(). Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Sat Mar 24 21:55:41 CET 2012 on sn-devel-104
* s3: Move the notify_ctx to the smbd_server_connectionVolker Lendecke2012-03-211-2/+4
| | | | | | | | | We only need one notify_ctx per smbd. The notify_array can become quite large. It's based on absolute paths, so there's no point in having a copy of the complete array in memory multiple times. Autobuild-User: Volker Lendecke <vl@samba.org> Autobuild-Date: Wed Mar 21 14:26:07 CET 2012 on sn-devel-104
* s3:smbd: keep 'num_files' and 'files' directly under smbd_server_connectionStefan Metzmacher2012-03-061-7/+7
| | | | | | | | | | The plan is to have files_struct as some kind of low level abstraction for a smb1/smb2 opens, that can be used by SMB_VFS modules. metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Tue Mar 6 23:04:01 CET 2012 on sn-devel-104
* s3: files_struct->mode is only written, remove itVolker Lendecke2012-02-141-1/+0
| | | | | Autobuild-User: Volker Lendecke <vl@samba.org> Autobuild-Date: Tue Feb 14 19:14:29 CET 2012 on sn-devel-104
* lib/util Move bitmap.c to lib/utilAndrew Bartlett2011-07-081-0/+1
|
* source3/smdb/files.c: file_name_hash to use Jenkins hash from CCAN.Rusty Russell2011-06-201-3/+2
| | | | | Rather than tdb's internal one.
* s3: only include tdb headers where needed.Günther Deschner2011-05-061-0/+1
| | | | Guenther
* s3: include smbd/smbd.h where needed.Günther Deschner2011-03-301-0/+1
| | | | Guenther
* Add name_hash to files_struct. Set within fsp_set_smb_fname().Jeremy Allison2011-01-251-1/+32
|
* libcli/security Provide a common, top level libcli/security/security.hAndrew Bartlett2010-10-121-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
* s3: Remove some remaining files.c globals to sconnVolker Lendecke2010-09-281-33/+41
|