1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

350 Commits

Author SHA1 Message Date
Volker Lendecke
c56be509f1 smbd: Remove "share_access" from dup_file_fsp()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-08-06 21:49:29 +00:00
Volker Lendecke
13921645c4 smbd: Remove "share_access" from files_struct
Nobody used this (except vfs_gpfs, which did not need it really). If
you *really* need this, you can always look in locking.tdb, but this
should never happen in any hot code path, as no runtime decisions are
made on the share access after the open is done.

Bump VFS interface number to 42.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-08-06 21:49:29 +00:00
Noel Power
6555fa9d8f s3/smbd: cppcheck: Fix ctunullpointer error
Fixes:

source3/smbd/files.c:783: error: ctunullpointer: Null pointer dereference: buf <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-05-29 10:10:23 +00:00
Andreas Schneider
7ff94b18e2 s3:vfs: Correctly check if OFD locks should be enabled or not
Also the smb.conf options should only be checked once and a reload of
the config should not switch to a different locking mode.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Feb  9 03:43:50 CET 2019 on sn-devel-144
2019-02-09 03:43:50 +01:00
Volker Lendecke
aa30fd54a2 smbd: Remove "file_sync_all" function
Replace with a call to files_forall. Why? I just came across this
function that only has one pretty obscure user. This does not justify
a full library function, IMHO at least.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-09-14 07:49:13 +02:00
Jeremy Allison
232abcc932 s3: smbd: When deleting an fsp pointer ensure we don't keep any references to it around.
Based on a suggestion from <lev@zadarastorage.com>

https://bugzilla.samba.org/show_bug.cgi?id=12818

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jun 22 00:12:49 CEST 2017 on sn-devel-144
2017-06-22 00:12:49 +02:00
Jeremy Allison
125c78ad0b s3: locking: Move two leases functions into a new file.
map_oplock_to_lease_type(), fsp_lease_type().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12628

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2017-03-15 16:14:08 +01:00
Volker Lendecke
229c9108d9 smbd: Add "path" to notify_remove
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-20 05:21:06 +02:00
Volker Lendecke
ea47abcf3c smbd: Add fsp_fullbasepath
Okay, this is similar to full_path_tos, but with variable arrays now and much
simpler :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-20 05:21:06 +02:00
Jeremy Allison
dc5dad4813 s3: Filenames: Add uint32_t flags parameter to synthetic_smb_fname().
Get it from parent/deriving smb_filename if present.
Use 0 (as usually this a Windows-style lookup) if
not.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-03-24 22:57:16 +01:00
Michael Adam
44f3dde857 smbd: fix use after free via conn->fsp_fi_cache
Some instrumentation of the the durable reconnect
code uncovered a problem in the fsp_new, fsp_free pair:

vfs_default_durable_reconnect():
  fsp_new() ==> this does DLIST_ADD(fsp->conn->sconn->files, fsp)
  if (fsp->oplock_type == LEASE_OPLOCK) {
    find_fsp_lease(fsp, &key, l) ==> this fills conn->fsp_fi_cache
    if (client guids not equal) {
      fsp_free(fsp) ==> this does DLIST_REMOVE(fsp->conn->sconn->files, fsp)
  }

so after this code we have the fsp_fi_cache still pointing to the
free'd memory. The next call to find_fsp_lease will use the cache
and hence access the freed memory.

The fix consists in invalidating the cache in fsp_free() instead
of just in its wrapper file_free().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11799

Pair-Programmed-With: Guenther Deschner <gd@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Mar 17 04:31:10 CET 2016 on sn-devel-144
2016-03-17 04:31:10 +01:00
Richard Sharpe
6abd986704 Convert all uses of uint8/16/32 to _t in source3/smbd.
Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-05-06 04:14:14 +02:00
Volker Lendecke
f686db87a4 source3: Replace ccan hash calls with tdb_jenkins_hash
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-03-17 11:30:52 +01:00
Jeremy Allison
cec2a38e97 s3: smbd: leases - losen paranoia check. Stat opens can grant leases.
https://bugzilla.samba.org/show_bug.cgi?id=11102

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
2015-02-19 20:42:07 +01:00
Volker Lendecke
a2d6511f90 Fix signed/unsigned comparisons
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-12-07 00:12:07 +01:00
Volker Lendecke
02f2684dd8 s3:smbd: Implementation of SMB2.1 and SMB3.0 leases.
Pair-Programmed-With: Jeremy Allison <jra@samba.org>
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2014-12-04 05:45:10 +01:00
Volker Lendecke
eb9fc01d20 s3:smbd: add file_find_one_fsp_from_lease_key() helper function
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-12-04 05:45:10 +01:00
Volker Lendecke
b72fca52de s3:smbd: add fsp_lease_type() and get_lease_type() helper functions
These convert the oplock state into SMB2_LEASE_ flags.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-12-04 05:45:10 +01:00
Jeremy Allison
c22d521d26 s3:smbd: Add fsp_client_guid() utility function to return the connected client guid.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-12-04 05:45:09 +01:00
Stefan Metzmacher
d799fb360a s3:smbd: use req->xconn in files.c
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:13 +02:00
Jeremy Allison
580eb9424c s3: smbd : Ensure file_new doesn't call into smbXsrv_open_create() for 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>
2014-05-02 21:27:07 +02:00
Volker Lendecke
3e24e07467 lib: Move full_path_tos to util_str.c
This can be useful elsewhere

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-04-23 22:33:08 +02:00
Stefan Metzmacher
952392af38 s3:smbd: use PATH_MAX for the buffer passed to full_path_tos()
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>
2013-12-14 16:24:34 +01:00
Volker Lendecke
5baa7402ba smbd: Implement and use full_path_tos
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>
2013-12-14 11:21:32 +01:00
Volker Lendecke
fcafaf6022 smbd: Remove FAKE_LEVEL_II_OPLOCK
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>
2013-10-15 01:52:29 +02:00
Volker Lendecke
e3a7f70768 smbd: Convert file_new to synthetic_smb_fname
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-17 14:50:01 -07:00
Volker Lendecke
0831de71e7 smbd: Convert fsp_set_smb_fname to cp_smb_filename
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-17 14:49:57 -07:00
David Disseldorp
7ca8663e31 smbd: split out file_fsp_get from file_fsp_smb2
Obtain the files_struct from smb2req, persistent_id and
volatile_id.

Reviewed by: Jeremy Allison <jra@samba.org>
2013-01-16 23:15:07 +01:00
Michael Adam
42afa596d5 s3:smbd: also close durable file handles in a tdis
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
2012-09-08 03:39:06 +02:00
Stefan Metzmacher
0b903e1cf5 s3:smbd: if a fsp has fsp->deferred_close, clients shouldn't be able to use it
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Jul 23 16:22:03 CEST 2012 on sn-devel-104
2012-07-23 16:22:03 +02:00
Jeremy Allison
34bb743ce3 Add uint64_t mid field to the files_struct.
Ensure it is initialized so we know what mid created this file.
2012-06-30 02:23:39 +02:00
Stefan Metzmacher
7d1395536b s3:smbd: make use of smbXsrv_open for smb1/2/3
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
2012-06-29 21:01:11 +02:00
Stefan Metzmacher
66fa891d2d s3:smbd/files: fsp->fnum is uint64_t not int!
metze
2012-06-28 10:08:03 +02:00
Stefan Metzmacher
463b308f16 s3:smbd: make use of smbXsrv_tcon and smbXsrv_session for smb2
The removes the protocol specific smbd_smb2_session and
smbd_smb2_tcon.

Pair-Programmed-With: Michael Adam <obnox@samba.org>

metze
2012-06-25 20:55:06 +02:00
Michael Adam
93dd5a80cd s3:smbd: change files.c to use fsp_fnum_dbg() for fsp->fnum logging.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:14 +02:00
Michael Adam
5d2af68a25 s3:smbd: use FNUM_FIELD_INVALID instead of literal -1
This is in preparation of changing fnum to uint64_t

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:13 +02:00
Michael Adam
a7dccea0c5 s3:files: factor fsp_free() out of file_free()
To be reused in the durable reconnect code.

Pair-Programmed-With: Volker Lendecke <vl@samba.org>
2012-06-15 03:28:13 +02:00
Michael Adam
7aa9ad5bb9 s3:files: reorder file_free() a bit
Pair-Programmed-With: Volker Lendecke <vl@samba.org>
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:13 +02:00
Michael Adam
82a96d2432 s3:smbd: refactor fsp_new() out of file_new()
Pair-Programmed-With: Volker Lendecke <vl@samba.org>
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:13 +02:00
Stefan Metzmacher
3f110e50bf s3:smbd: use fsp_persistent_id() as persistent_file_id part for SMB2 (bug #8995)
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
2012-06-14 22:04:10 +02:00
Stefan Metzmacher
47f837c105 s3:smbd: add a fsp_persistent_id() function
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
2012-06-14 18:13:31 +02:00
Stefan Metzmacher
5662166b23 s3:smbd: only set fsp->fh->gen_id for a client connection
For faked connections, like dfs and printing, we leave it as 0.

metze
2012-06-14 18:13:31 +02:00
Stefan Metzmacher
c7c351b817 s3:smbd: try to make fsp->fh->gen_id as globally unique as possible
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
2012-06-14 18:13:31 +02:00
Stefan Metzmacher
c48e307de4 Revert "s3:smbd: set req->smb2req->compat_chain_fsp in file_fsp()"
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
2012-06-10 18:04:21 +02:00
Stefan Metzmacher
2a804a359a s3:smbd: add file_fsp_smb2()
metze
2012-06-09 21:23:44 +02:00
Stefan Metzmacher
163207a28e s3:smbd: set req->smb2req->compat_chain_fsp in file_fsp()
metze
2012-06-09 15:02:47 +02:00
Volker Lendecke
a51278067b s3: Replace an if with a boolean short circuit
Signed-off-by: Michael Adam <obnox@samba.org>
2012-06-08 21:29:19 +02:00
Volker Lendecke
91be6b42f1 s3: Assigning ?True:False to a bool is a bit pointless
Signed-off-by: Michael Adam <obnox@samba.org>
2012-06-08 21:29:19 +02:00
Volker Lendecke
e1e1fbcfe6 s3: Remove unnecessary ()
Signed-off-by: Michael Adam <obnox@samba.org>
2012-06-08 21:29:19 +02:00
Stefan Metzmacher
bb27bb081e s3:smbd: let file_close_pid/file_close_user take a uint64_t vuid
metze
2012-06-06 10:18:41 +02:00
Stefan Metzmacher
0907b1e20c s3:smbd: dup_file_fsp() never gets called for print files
metze
2012-06-06 10:18:37 +02:00
Stefan Metzmacher
4321e19657 s3:smbd: make use of vfs_remove_all_fsp_extensions() in file_free()
metze
2012-06-06 10:18:37 +02:00
Stefan Metzmacher
9e45885fcc s3:smbd/files: split file_init_global() out of file_init()
metze
2012-05-24 18:16:37 +02:00
Stefan Metzmacher
0733183594 s3:smbd/files: work without sconn->file_bmap and assign fsp->fnum = -1
For faked connection_structs we do not need valid fnum values,
e.g. in the dfs and printing code.

metze
2012-05-24 14:12:32 +02:00
Stefan Metzmacher
768004b11d s3:smbd/files: fix error path and correctly cleanup
metze
2012-05-24 14:12:32 +02:00
Stefan Metzmacher
97f0a3675f s3:smbd/files: remove unused VALID_FNUM()
metze
2012-05-23 20:03:09 +02:00
Volker Lendecke
54a6d7b3b8 s3: oplock_timeout is a talloc child of fsp
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
2012-04-26 23:00:03 +02:00
Volker Lendecke
843432d56f s3: New notify implementation
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
2012-04-17 10:21:02 +02:00
Volker Lendecke
3cca094514 s3: Use talloc_get_size instead of strlen
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
2012-04-10 13:20:22 +02:00
Jelmer Vernooij
c0288e0612 lib/util: Remove obsolete sys_getpid() and sys_fork().
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
2012-03-24 21:55:40 +01:00
Volker Lendecke
f3fe53668f s3: Move the notify_ctx to the smbd_server_connection
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
2012-03-21 14:26:06 +01:00
Stefan Metzmacher
68b840726b s3:smbd: keep 'num_files' and 'files' directly under smbd_server_connection
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
2012-03-06 23:04:01 +01:00
Volker Lendecke
740d4d7550 s3: files_struct->mode is only written, remove it
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Tue Feb 14 19:14:29 CET 2012 on sn-devel-104
2012-02-14 19:14:29 +01:00
Andrew Bartlett
6e6aaacedb lib/util Move bitmap.c to lib/util 2011-07-08 11:23:23 +02:00
Rusty Russell
eb8cb4f548 source3/smdb/files.c: file_name_hash to use Jenkins hash from CCAN.
Rather than tdb's internal one.
2011-06-20 11:18:34 +02:00
Günther Deschner
d8cfca3a9b s3: only include tdb headers where needed.
Guenther
2011-05-06 10:48:10 +02:00
Günther Deschner
8c24ebf371 s3: include smbd/smbd.h where needed.
Guenther
2011-03-30 01:13:08 +02:00
Jeremy Allison
76418e23bc Add name_hash to files_struct. Set within fsp_set_smb_fname(). 2011-01-25 13:49:01 -08:00
Andrew Bartlett
f768b32e37 libcli/security Provide a common, top level libcli/security/security.h
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-10-12 05:54:10 +00:00
Volker Lendecke
49b4d2e652 s3: Remove some remaining files.c globals to sconn 2010-09-28 07:36:18 +02:00
Volker Lendecke
d26d79b640 s3: Remove talloc_autofree_context() from files.c 2010-09-28 07:36:18 +02:00
Volker Lendecke
eadc4b5b78 s3: Lift smbd_server_conn from file_find_fd 2010-09-28 07:36:18 +02:00
Volker Lendecke
54f7b70212 s3: Remove smbd_server_conn from file_fsp 2010-09-28 07:36:18 +02:00
Volker Lendecke
3009178ee5 s3: Slightly simplify file_fnum
req==NULL should never happen, see the comment
2010-09-28 07:36:18 +02:00
Volker Lendecke
e57811440a s3: Remove smbd_server_conn from file_sync_all 2010-09-28 07:36:17 +02:00
Volker Lendecke
e2222fc19c s3: Remove smbd_server_conn from file_find_subpath 2010-09-28 07:36:17 +02:00
Volker Lendecke
75c6e0e5c7 s3: Lift smbd_server_conn from file_find_di_first 2010-09-28 07:36:17 +02:00
Volker Lendecke
b448e42de4 s3: Lift smbd_server_conn from file_find_dif 2010-09-28 07:36:16 +02:00
Volker Lendecke
fb8686962a s3: Remove smbd_server_conn from files_forall 2010-09-28 07:36:16 +02:00
Volker Lendecke
9fc9ff9bfa s3: Remove smbd_server_conn from file_close_user 2010-09-28 07:36:16 +02:00
Volker Lendecke
25ca1cd1a8 s3: Remove smbd_server_conn from file_close_pid 2010-09-28 07:36:16 +02:00
Volker Lendecke
6a1c4bad13 s3: Remove smbd_server_conn from file_close_conn 2010-09-28 07:36:16 +02:00
Volker Lendecke
c5d2799543 s3: Remove smbd_server_conn from file_new and file_free 2010-09-28 07:36:15 +02:00
Volker Lendecke
5276608151 s3: Lift smbd_server_conn from file_fnum 2010-09-28 07:36:15 +02:00
Volker Lendecke
5e26e4d30f s3: Move "Files" to smbd_server_connection 2010-09-28 07:36:15 +02:00
Volker Lendecke
3235f44ac4 s3: Make file_fnum static 2010-09-27 18:14:47 +02:00
Volker Lendecke
f1c1959f13 s3: Remove some unused code 2010-09-27 18:14:47 +02:00
Volker Lendecke
6319e0da10 s3: Fix some comments 2010-09-27 18:14:47 +02:00
Andreas Schneider
9ab62b774f s3-smbd: Fixed indent.
Signed-off-by: Simo Sorce <idra@samba.org>
2010-08-13 12:20:10 -04:00
Jeremy Allison
34a8324409 Fix a valgrind error found by SMB2-COMPOUND test.
If a file is closed we must also NULL out all chained_fsp
pointers when the fsp is freed to prevent invalid pointer
access.

Jeremy.
2010-06-08 21:20:07 -07:00
Simo Sorce
168b86c384 s3-smbd: group print relate data in own structure 2010-04-23 14:26:33 -07:00
Volker Lendecke
30c708b902 s3: Use bitmap_talloc in files.c 2010-03-28 15:25:17 +02:00
Volker Lendecke
8195832c6c s3: file_walk_table -> files_forall
This is more in line with the rest of the Samba code, like connections_forall
etc.
2010-03-22 09:30:51 +01:00
Volker Lendecke
678815081d s3: Fix some nonempty blank lines 2010-03-22 09:30:51 +01:00
Jeremy Allison
b6fdecd112 Fix bug #6837 - "Too many open files" when trying to access large number of files
from Windows 7. Original patch by me fixed up with the correct open files number
by jmaggard10@hotmail.com.
Jeremy.
2009-12-02 10:01:14 -08:00
Jeremy Allison
14dc32a4f5 Oops. Don't break the build..
Jeremy.
2009-10-07 15:43:43 -07:00
Jeremy Allison
94ce06f01d Make the logic a lot clearer and fix the comment to match.
Jeremy
2009-10-07 15:39:38 -07:00
Jeremy Allison
746fb5aa4f Correct fix for bug 6781 - Cannot rename subfolders in Explorer view with recent versions of Samba.
Without this fix, renaming a directory ./a to ./b, whilst a directory ./aa was already open
would fail.
Jeremy.
2009-10-07 15:14:50 -07:00
Tim Prouty
457191e9f3 s3: Fix a bug in renames of directories
Recently code was added to match windows semantics of denying the
rename of a directory if there are open files underneath it.  This
does partly match windows semantics, but it turns out the rename
should be allowed if the open file handle is for the directory being
renamed, or for a stream on the directory being renamed.  This patch
refines the check to better follow these rename semantics.
2009-08-06 17:07:50 -07:00
Tim Prouty
841efce8b5 s3: Separate out a new file: filename_utils.c
This is to ease the linking pain of everything that links LOCKING_OBJ
2009-07-20 17:26:57 -07:00
Tim Prouty
5a8d70d465 s3: Change fsp->fsp_name to be an smb_filename struct! 2009-07-20 17:26:56 -07:00
Tim Prouty
12a5db45e2 s3: Change file_structs to be allocated with talloc instead of malloc 2009-07-20 17:26:56 -07:00
Volker Lendecke
22085c59cb Add "file_walk_table" to do stuff with all open files 2009-05-18 10:42:22 +02:00
Volker Lendecke
32a36e4703 Add notify_onelevel.tdb
This optimizes non-recursive notifys. For non-recursive notifies we can use a
per-directory file-id indexed notify record. This matters for the Windows
Explorer and IIS cases which do not use recursive notifies. In these cases, we
do not have to shuffle around the whole notify record on every change.

For the cluster case, this improves correctness of the notifies, ctdb only
distributes the tdb seqnum once a second, so we can lose notifies.
2009-04-16 15:07:06 +02:00
Jeremy Allison
3121249243 Make us pass the RAW-RENAME torture test I just added.
Inside a directory, keep a file open and then renaming
the directory should fail with ACCESS_DENIED.

Jeremy.
2009-02-26 11:42:23 -08:00
Stefan Metzmacher
3dde0cbb76 s3:smbd: move all globals and static variables in globals.[ch]
The goal is to move all this variables into a big context structure.

metze
2009-01-08 12:22:21 +01:00
Jeremy Allison
97fb05c2c0 First part of fix for bug #5903 - vfs_streams_xattr breaks contents of the file.
Restructures parts of open code so that fsp must be allocated before calling
open_file_ntcreate(_internal). Also fix up file ref-counting inside files.c.
Jeremy.
2008-11-21 12:14:53 -08:00
Volker Lendecke
ff211be696 Remove "pipe_handle_offset" -- pipes now use "struct files_struct" 2008-10-25 12:09:58 +02:00
Volker Lendecke
d65afbe55f Remove the chain_fsp global 2008-10-13 19:32:39 +02:00
Volker Lendecke
c530009401 Pass struct smb_request to file_free
on the way to get rid of chain_fsp
2008-10-13 19:32:38 +02:00
Volker Lendecke
c3fedcddd5 Pass struct smb_request to file_new
Goal is to remove the chain_fsp global variable
2008-10-13 19:32:38 +02:00
Volker Lendecke
3bbe5e88e5 Pass struct smb_request to file_fsp
The goal is to get rid of the chain_fsp global variable
2008-10-13 19:32:37 +02:00
Volker Lendecke
1d83fbffae Remove a pointless level of indirection 2008-10-09 12:06:39 +02:00
Jeremy Allison
3b02b9e40e Second part of the fix for bug #5790 - samba returns STATUS_OBJECT_NAME_NOT_FOUND on set file disposition call.
This was my fault. I use a singleton cache (positive and negative) to speed up pathname based qfileinfo/setfileinfo lookups for alternate fsp's open on the same path. I only invalidated the negative cache on adding a new file fsp, as I incorrectly imagined the new fsp was put at the *end* of the open files list. DLIST_ADD puts it at the start, meaning any subsequent open wasn't seen once the cache was set. Doh !
Jeremy.
2008-09-26 18:39:03 -07:00
Jeremy Allison
31e10643c9 Fix bug #5790 samba returns STATUS_OBJECT_NAME_NOT_FOUND on set file disposition.
We were checking that fd != -1 in file_find_di_XXX calls which is no longer
needed due to a change in internal semantics.
Jeremy.
2008-09-24 14:28:18 -07:00
Jeremy Allison
b430b38220 Remove the "stat_open()" function, flag, and all associated code. It was only
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 6bfb06ad95)
2008-05-02 17:22:10 -07:00
Stefan Metzmacher
d03453864a smbd: implement the strange write time update logic
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 2eab212ea2)
2008-04-07 12:29:26 +02:00
James Peach
d2a9630a8b Release per-fsp data on file closure.
(This used to be commit 9fead46b54)
2007-12-19 22:19:55 -08:00
Gerald (Jerry) Carter
e5a951325a [GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch.
(This used to be commit 5c6c8e1fe9)
2007-10-10 15:34:30 -05:00
Volker Lendecke
4ee8b2937d r25055: Add file_id_string_tos
This removes file_id_string_static and file_id_string_static2
(This used to be commit 638c848c9a)
2007-10-10 12:30:36 -05:00
Volker Lendecke
a2d6aa829f r24102: Pass the fid instead of inbuf and an offset to file_fsp.
This removes the buf==NULL condition in file_fsp(), but wherever it is called
we do have a buffer anyway.

Volker
(This used to be commit d70a1f82fe)
2007-10-10 12:29:07 -05:00
Volker Lendecke
041204d1a4 r23996: One more const
(This used to be commit a54fa551a4)
2007-10-10 12:28:53 -05:00
Andrew Tridgell
5e54558c6d r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text
(This used to be commit b0132e94fc)
2007-10-10 12:28:22 -05:00
Jeremy Allison
d824b98f80 r23779: Change from v2 or later to v3 or later.
Jeremy.
(This used to be commit 407e6e695b)
2007-10-10 12:28:20 -05:00
Jeremy Allison
08a9de8927 r23589: Ensure we will always release any timeout handler
on fsp close or removal of oplock. Mulitple removals
are safe.
Jeremy.
(This used to be commit 6de0970704)
2007-10-10 12:23:33 -05:00
James Peach
b1ce226af8 r23510: Tidy calls to smb_panic by removing trailing newlines. Print the
failed expression in SMB_ASSERT.
(This used to be commit 171dc060e2)
2007-10-10 12:23:23 -05:00
Volker Lendecke
e8156439f2 r23183: Check in a change made by Tridge:
This replaces the internal explicit dev/ino file id representation by a
"struct file_id". This is necessary as cluster file systems and NFS
don't necessarily assign the same device number to the shared file
system. With this structure in place we can now easily add different
schemes to map a file to a unique 64-bit device node.

Jeremy, you might note that I did not change the external interface of
smb_share_modes.c.

Volker
(This used to be commit 9b10dbbd5d)
2007-10-10 12:22:52 -05:00
Jeremy Allison
4952fe368a r21714: Change the VFS interface to use struct timespec
for utimes - change the call to ntimes. This preserves
nsec timestamps we get from stat (if the system supports
it) and only maps back down to usec or sec resolution
on time set. Looks bigger than it is as I had to move
lots of internal code from using time_t and struct utimebuf
to struct timespec.
Jeremy.
(This used to be commit 8f3d530c5a)
2007-10-10 12:18:24 -05:00
Volker Lendecke
a2f2653d9a r21319: Remove functions not needed anymore
(This used to be commit 0c8a364aec)
2007-10-10 12:17:56 -05:00
Volker Lendecke
d9a29aade0 r21279: Get rid of 'aio write behind', this is broken.
It should probably better be integrated with our write cache.

Volker
(This used to be commit 58bfd168b0)
2007-10-10 12:17:53 -05:00
Volker Lendecke
2852ecc67e r21092: Ok, that's the one that activates the Samba4 notify backend.
Now to clean up / fix lots of stuff.

Volker
(This used to be commit 9e7443fa14)
2007-10-10 12:17:36 -05:00
Volker Lendecke
940192ddcc r20854: Ok, now I think we're at a point where looking at notify starts to make sense
again :-)

Volker
(This used to be commit 5533cdeec1)
2007-10-10 12:17:13 -05:00
Volker Lendecke
46fdae1b6b r20634: A *LOT* more work is necessary before touching notify remotely starts to make
sense. Until then, remove it from the tree to keep the diff between 3_0_24 and
3_0 small.

Volker
(This used to be commit f146a85e74)
2007-10-10 12:17:00 -05:00
Volker Lendecke
200bd10b32 r20442: Slight rewrite of the change notify infrastructure. This now survives the
first of the raw-notify subtests, the one-level test_notify_dir without any
flags around yet.

The tricky part was getting the data structures right, I hope the next tests
don't let that fall over.

fsp->notify is now by default NULL, meaning that nobody has issued a
changenotify call. This means nobody is interested in changes for this
directory.

If that has happened, notify_change_buf collects the changes if no current
request is outstanding, and it collects the requests if no change has happened
since the last request.

Happy New Year, somewhere on this planet it's already 2007 :-)

Volker

P.S: Jeremy, there's a question for you in smbd/files.c line 367.
(This used to be commit ce0ad24988)
2007-10-10 12:16:50 -05:00
Volker Lendecke
98c082489b r20394: This is a *VERY* early start of my work on notify.
Checking in because Jeremy was bugging me. Potentially this becomes quite
intrusive, I'm not sure if I should open a temporary branch for this.

Jeremy, Jerry, do you think 3_0 is the right place for this?

Volker
(This used to be commit bcf5c751cb)
2007-10-10 12:16:46 -05:00
Jeremy Allison
fbdcf2663b r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need
to do the upper layer directories but this is what
everyone is waiting for....

Jeremy.
(This used to be commit 9dafb7f48c)
2007-10-10 11:19:14 -05:00
Volker Lendecke
e2a90398ec r15817: Remove some unused code
(This used to be commit 72f103708d)
2007-10-10 11:17:10 -05:00
Jeremy Allison
cc9ea93456 r15668: DOS or FCB opens share one share mode entry from different
fsp pointers. Ensure we cope with this to pass Samba4
DENY tests (we used to pass these, there must have been
a regression with newer code). We now pass them.
Jeremy
(This used to be commit fd6fa1d4ea)
2007-10-10 11:17:06 -05:00
Jeremy Allison
f04d5530cc r14460: SMBexit closes by pid and vuid. Tested with smbtorture.
Jeremy.
(This used to be commit 71e8158042)
2007-10-10 11:15:31 -05:00
Jeremy Allison
d14af63e6a r13293: Rather a big patch I'm afraid, but this should fix bug #3347
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 23f16cbc2e)
2007-10-10 11:06:21 -05:00
Gerald Carter
54abd2aa66 r10656: BIG merge from trunk. Features not copied over
* \PIPE\unixinfo
* winbindd's {group,alias}membership new functions
* winbindd's lookupsids() functionality
* swat (trunk changes to be reverted as per discussion with Deryck)
(This used to be commit 939c3cb5d7)
2007-10-10 11:04:48 -05:00
James Peach
93954d6390 r9985: Move the all the strict sync logic into file_sync().
(This used to be commit cc680bbe22)
2007-10-10 11:03:30 -05:00
Jeremy Allison
e24397f084 r8292: Tidy up function comments.
Jeremy.
(This used to be commit 8de6b1592a)
2007-10-10 10:58:19 -05:00
Jeremy Allison
af8a691db1 r8219: Merge the new open code from HEAD to 3.0. Haven't yet run the torture
tests on this as it's very late NY time (just wanted to get this work
into the tree). I'll test this over the weekend....
Jerry - in looking at the difference between the two trees there
seem to be some printing/ntprinting.c and registry changes we might
want to examine to try keep in sync.
Jeremy.
(This used to be commit c7fe18761e)
2007-10-10 10:58:18 -05:00
Jeremy Allison
0557c6cba2 r6172: Tidy up error processing significantly. Remove unix_ERR_XXX global nastyness.
Jeremy.
(This used to be commit d3379fe61b)
2007-10-10 10:56:27 -05:00
Jeremy Allison
95e68fa7f8 r5731: Get delayed write semantics closer to W2K3. We need to store 2 times.
This may fix bug #2382.
Jeremy.
(This used to be commit a27c351e6b)
2007-10-10 10:55:58 -05:00
Jeremy Allison
eb546db88d r5720: Attempt to fix bug #2382 (Excel shared workbook stops working). Also
incorporates part of the fix created by ke_miyata@itg.hitachi.co.jp
for bug #2045 (MS-Office behavior of timestamp).
Jeremy.
(This used to be commit 4f3b12ac73)
2007-10-10 10:55:57 -05:00
Jeremy Allison
acf9d61421 r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation
functions so we can funnel through some well known functions. Should help greatly with
malloc checking.
HEAD patch to follow.
Jeremy.
(This used to be commit 620f2e608f)
2007-10-10 10:53:32 -05:00
Jeremy Allison
8c1c918c94 r3050: Steal from Samba4 :-). Make us pass most of the new lock tests (except for
the cancel lock which I have to add).
Jeremy.
(This used to be commit cf7f89999e)
2007-10-10 10:52:59 -05:00
Jeremy Allison
273479391f Fix coredump from Samba4 torture suite.
Jeremy.
(This used to be commit 9c1bab9445)
2003-09-17 19:36:38 +00:00
Jeremy Allison
6d6401a67a Implement SMBexit properly. Found by Samba4 tester. You must do a make
clean proto all; after this commit.
Jeremy.
(This used to be commit 27af1f9fea)
2003-08-19 01:53:45 +00:00
Jeremy Allison
3a052c9e0a Implemented the level 1010 NT rename level. Many fixes for Samba4 test
correctness.
Jeremy.
(This used to be commit f57429befa)
2003-08-16 02:34:03 +00:00
Jeremy Allison
f161839a74 Stat opens can have fsp->fd == -1 and will have a share entry. Ensure
that file_find_dif will find them. Fixes a core dump in smbd/open.c.
Jeremy.
(This used to be commit 0e2165630d)
2003-05-22 20:31:35 +00:00
Alexander Bokovoy
e8573c8fa9 Add NT quota support. Patch from Stefan (metze) Metzemacher
1. Allows to change quota settings for shared mount points from Win2K and WinXP from Explorer properties tab
2. Disabled by default and when requested, will be probed and enabled only on Linux where it works
3. Was tested for approx. two weeks now on Linux by two independent QA teams, have not found any bugs so far
Documentation to follow
(This used to be commit 4bf022ce9e)
2003-05-12 01:20:17 +00:00
Jeremy Allison
83219da302 Fix for systems that allow more than 65536 open files per process.
Jeremy.
(This used to be commit 947a56ce00)
2002-10-22 22:17:29 +00:00
Tim Potter
cd68afe312 Removed version number from file header.
Changed "SMB/Netbios" to "SMB/CIFS" in file header.
(This used to be commit 6a58c9bd06)
2002-01-30 06:08:46 +00:00
Jeremy Allison
88b55f47b4 Move from timestamp to gen count file id's for finding oplocked files
in a tdb.
Jeremy.
(This used to be commit 058ae6b58f)
2001-10-20 21:59:34 +00:00
Tim Potter
dc1fc3ee8e Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header.
(This used to be commit 2d0922b0ea)
2001-10-02 04:29:50 +00:00
Simo Sorce
61b2794968 move to SAFE_FREE()
(This used to be commit a95943fde0)
2001-09-17 11:25:41 +00:00
Jeremy Allison
53850c51ca configure:
configure.in:
include/config.h.in:
include/profile.h:
smbd/vfs-wrap.c:
smbd/vfs.c:
Added fchmod and fchown to VFS (sorry Gerald - but we needed them anyway).
smbd/dosmode.c:
smbd/files.c:
printing/printfsp.c:
smbd/close.c:
smbd/open.c:
Fixed "dos filemode" correctly so there are no race conditions. Forces test
of open of file O_WRONLY before allowing fchmod as root. Afterwards, calls
standard close function that preserves POSIX locks due to POSIX-me-harder
braindamage. :-). Andrew please review this code.
Also - in removing the tmpdir param in smbrun an extra NULL parameter
was missed in each print_run_command() call (which is a varargs fn.).
Now fixed.
Jeremy.
(This used to be commit 32397e5bc6)
2001-04-14 00:19:12 +00:00
Jeremy Allison
3c2c047e82 Added fix from "Eric Boehm" <boehm@nortelnetworks.com> to try and set hard
limit before setting soft limit.
Jeremy.
(This used to be commit a1eb2752a8)
2001-04-13 19:33:26 +00:00
Jeremy Allison
da3053048c Merge of new 2.2 code into HEAD (Gerald I hate you :-) :-). Allows new SAMR
RPC code to merge with new passdb code.
Currently rpcclient doesn't compile. I'm working on it...
Jeremy.
(This used to be commit 0be41d5158)
2001-03-11 00:32:10 +00:00
Andrew Tridgell
49a0e6d598 more merging voodoo
this adds "#define OLD_NTDOMAIN 1" in lots of places. Don't panic -
this isn't permanent, it should go after another few merge steps have
been done
(This used to be commit 92109d7b3c)
2000-05-10 10:41:59 +00:00
Herb Lewis
c88222da0c Fix for misunderstanding of fsync added when vfs layer
was done. Samba was doing fsync's (bleagh).
Jeremy.
(This used to be commit f9a52cadbf)
2000-05-10 01:31:46 +00:00
Jeremy Allison
693ffb8466 Added sys_fork() and sys_getpid() functions to stop the overhead
of doing a system call every time we want to just get our pid.
Jeremy.
(This used to be commit 148628b616)
2000-05-02 02:23:41 +00:00
Jeremy Allison
e82dbfcbe9 Now that fsp's are created on successful file open, the structure member
fsp->open is no longer needed (if an fsp pointer is valid, then it's open :-).

NB for Luke, this patch also did not apply to TNG. TNG is not yet
identical w.r.t file serving with HEAD. This makes it impossible for
me to help maintain TNG. Please fix asap.

lib/substitute.c: Removed unused variable (pidstr).

Jeremy.
(This used to be commit 389b700a26)
2000-04-24 19:23:51 +00:00
Jeremy Allison
6259f51dd9 This is a *big* checkin that may break some things, but implements the
new open mechanism Andrew & I discussed.

config.sub:
configure: Included the QNX patch.

include/vfs.h:
smbd/vfs-wrap.c:
smbd/vfs.c: Added ftruncate vfs call (needed).

Note that we will also need locking calls in the vfs (to be added).

lib/util_unistr.c:
nmbd/nmbd_processlogon.c: Fix for NT domain logons causing nmbd to core dump.
                          Also fix for sidsize DOS bug.

locking/locking.c: Check value of ret before using it for memdup.

printing/printing.c: Convert print_fsp_open to return an allocated fsp.

rpc_server/srv_lsa.c: Fix for NT domain logons.

I have removed all use of lp_share_modes() from the code (although I
left the parameter in the table for backwards compatibility). It no longer makes
sense for this to exist.

smbd/close.c: Removed lp_share_modes().
smbd/fileio.c: Fixed parameters to unlock_share_entry call in panic code.
smbd/files.c: Correctly set the unix_ERR_code to ERRnofids on fsp allocation fail.

smbd/nttrans.c:
smbd/reply.c:
smbd/trans2.c: Changed all occurrences of open_file_shared/open_directory/
               open_file_stat to return an fsp from the call.

smbd/open.c: Changed all occurrences of open_file_shared/open_directory/
             open_file_stat to return an fsp from the call.

In addition I have fixed a long standing race condition in the deny mode
processing w.r.t. two smbd's creating a file. Andrew, please note that
your original idea of using open with O_EXCL in this case would not work
(I went over the races very carefully) and so we must re-check deny modes
*after* the open() call returns. This is because there is a race between
the open with O_EXCL and the lock of the share mode entry. Imagine the
case where the first smbd does the open with O_EXCL and a deny mode of DENY_ALL,
but is pre-empted before it locks the share modes and creates the deny
mode entry for DENY_ALL. A second smbd could then come in with O_RDONLY
and a deny mode of DENY_NONE and the two opens would be allowed.

The *only* way to fix this race is to lock the share modes after the
open and then do the deny mode checks *after* this lock in the case
where the file did not originally exist.

This code will need extensive testing but seems to initially work.

Jeremy.
(This used to be commit ab0ecc39d6)
2000-04-22 00:33:16 +00:00
Andrew Tridgell
2733f5352a initialise fsp->fd to -1
(This used to be commit 5257ff5d67)
2000-04-10 13:12:04 +00:00
Andrew Tridgell
689ec46450 the bulk of the changes to get rid of fd_ptr and move print open
handling to printing/printing.c

most of this was just replacing things like fsp->fd_ptr->fd with fsp->fd

the changes in open.c are quite dramatic. Most of it is removing all
the functions that handled the fd multiplexing
(This used to be commit d1827a3648)
2000-04-10 13:05:23 +00:00
Tim Potter
16bb009dbb Mega-VFS merge. Yeah baby!
Synopsis: change every disk access function to work through a vfs_ops
structure contained in the connection_struct.
(This used to be commit 3aad500c0f)
2000-02-03 05:17:25 +00:00
Andrew Tridgell
b3b634ff42 use string_set() instead of string_init()
bug pointed out by Richard
(This used to be commit 070f49397f)
2000-01-16 11:18:04 +00:00
Andrew Tridgell
3db52feb1f first pass at updating head branch to be to be the same as the SAMBA_2_0 branch
(This used to be commit 453a822a76)
1999-12-13 13:27:58 +00:00
Luke Leighton
ad000ee7dc spelling mistake.
(This used to be commit b8ac96cd9c)
1999-08-13 21:11:38 +00:00
Tim Potter
1e1a52bb5f Changed arguments to fsync() function to break dependency on
connection_struct.
(This used to be commit ee6f826ccc)
1999-04-20 03:29:05 +00:00
Tim Potter
6d5ef2e929 Use VFS operations for file I/O.
(This used to be commit cfddbdb624)
1999-04-04 06:25:13 +00:00
Jeremy Allison
bb9622bfa6 Fixed crash bug which was assuming that fd_ptr was always non-null
(which is not the case with open directories).
Jeremy.
(This used to be commit c154b1601f)
1998-11-18 19:06:51 +00:00
Jeremy Allison
9bb7ac81b6 Reasonably large change to give us *exactly* correct NT delete on close semantics.
This was trickier than it looks :-). Check out the new DELETE_ON_CLOSE
flag in the share modes and the new code that iterates through all open
files on the same device and inode in files.c and trans2.c

Also changed the code that modifies share mode entries to take
generic function pointers rather than doing a specific thing so
this sort of change should be easier in the future.

Jeremy.
(This used to be commit 5e6a7cd99d)
1998-10-23 03:34:50 +00:00
Jeremy Allison
f3793be165 Re-added code to tell the user how many open files they
have. Needed for server diagnosis purposes...
Jeremy.
(This used to be commit 04d79a9ae5)
1998-10-16 06:16:10 +00:00
Andrew Tridgell
788263ba2f - fixed a bunch of warnings and minor errors
- got smbtorture to compile
- removed %D from some of lukes code - Luke, what is %D? it ain't
  portable anyway
(This used to be commit 91597c12fb)
1998-10-08 06:21:33 +00:00
Andrew Tridgell
93bbfce02b added a function set_maxfiles() to set our file rlimit to the max
possible and return the max.
(This used to be commit 7a7b5ee168)
1998-10-05 01:57:03 +00:00
Andrew Tridgell
eb7f62f911 got rid of USE_FILES_ARRAY code (it was unused)
(This used to be commit f15ece5316)
1998-10-01 03:07:09 +00:00
Jeremy Allison
5b4d94e20f (Finally) implemented "max open files" as a global smb.conf parameter.
Sets up the files array correctly - limited by the smb.conf parameter
and by the max fd's per process as found by getrlimit().
Jeremy.
(This used to be commit eca24bd243)
1998-09-30 01:49:24 +00:00
Jeremy Allison
aab2fe0216 First cut at kernel oplocks. This should have no effect unless runnin
on a machine that supports them in autoconf.

Move various functions out of lib/util.c into smbd/process.c
and smbd/oplock.c where they belong.

Jeremy.
(This used to be commit c3c5e13f85)
1998-09-23 01:48:45 +00:00
Jeremy Allison
ede44ebdf0 smb.h: Removed fdnum from file_fd_struct. Not needed.
files.c: Removed fd bitmap - not needed. Added code to do use arrays rather
         than linked list - disabled by default but can be enabled to check
         performance.
Jeremy.
(This used to be commit 069efc0454)
1998-09-10 18:57:06 +00:00
Andrew Tridgell
f6044c87c0 some cleanups to use ZERO_STRUCT() and friends
(This used to be commit 7b154dc431)
1998-09-05 13:24:20 +00:00
Andrew Tridgell
e9ea36e4d2 tridge the destroyer returns!
prompted by the interpret_security() dead code that Jean-Francois
pointed out I added a make target "finddead" that finds potentially
dead (ie. unused) code. It spat out 304 function names ...

I went through these are deleted many of them, making others static
(finddead also reports functions that are used only in the local
file).

in doing this I have almost certainly deleted some useful code. I may
have even prevented compilation with some compile options. I
apologise. I decided it was better to get rid of this code now and add
back the one or two functions that are needed than to keep all this
baggage.

So, if I have done a bit too much "destroying" then let me know. Keep
the swearing to a minimum :)

One bit I didn't do is the ubibt code. Chris, can you look at that?
Heaps of unused functions there. Can they be made static?
(This used to be commit 2204475c87)
1998-09-05 05:07:05 +00:00
Jeremy Allison
98f524bde4 Bugfix for leak in reference counted file struct.
Added "nt smb support" parameter to allow NT SMB's to be turned off.
Jeremy.
(This used to be commit 63f65f5027)
1998-09-05 03:14:40 +00:00
Jeremy Allison
83900f2b68 Modified dev_t and ino_t code to be 64 bit clean (including changes
to oplock break message passing). I think that smbd/nmbd are now
inode and offset size independent (at least for 32 bit and 64 bit
systems).

Now to expose all this new functionality to NT clients.....

Jeremy.
(This used to be commit 5910d07bbf)
1998-09-04 20:53:58 +00:00
Jeremy Allison
1855627413 More abstraction of file system data types, to move to a 64
bit file interface for the NT SMB's.

Created a new define, SMB_STRUCT_STAT that currently is
defined to be struct stat - this wil change to a user
defined type containing 64 bit info when the correct
wrappers are written for 64 bit stat(), fstat() and lstat()
calls.

Also changed all sys_xxxx() calls that were previously just
wrappers to the same call prefixed by a dos_to_unix() call
into dos_xxxx() calls. This makes it explicit when a pathname
translation is being done, and when it is not.

Now, all sys_xxx() calls are meant to be wrappers to mask
OS differences, and not silently converting filenames on
the fly.

Jeremy.
(This used to be commit 28aa182dbf)
1998-09-01 20:11:54 +00:00
Jeremy Allison
693480af8b configure.in, configure: include/config.h.in: Added stropts and poll.
include/smb.h: Moved old typedefs of uint8 etc. into include/includes.h where
               all the other defines live (changed them from typedefs to
               defines).
Other changes : changed from using uint32 to SMB_DEV_T and SMB_INO_T
in preparation for moving to size independed (ie. 64 bit clean) device
and inode access. Stat call wrapper comes next :-).

Jeremy.
(This used to be commit 3d9ec96de5)
1998-08-31 20:20:54 +00:00
Jeremy Allison
dc76502cd8 Turning on blocking locking code. NB. Blocking lock requests that are not
the head of an SMB request (ie. are part of a chain) will not be queued -
this will be fixed when we move to the new chain code. In practice, this
doesn't seem to cause much of a problem (in my admittedly limited testing)
bug a debug level zero message will be placed in the log when this
happens to help determine how real the problem is.

smbd/locking.c: New debug messages.
smbd/blocking.c: New blocking code - handles SMBlock, SMBlockread and SMBlockingX
smbd/chgpasswd.c: Fix for master fd leak.
smbd/files.c: Tidyup comment.
smbd/nttrans.c: Added fnum to debug message.
smbd/process.c: Made chain_reply() use construct_reply_common(). Added blocking
                lock queue processing into idle loop.
smbd/reply.c: Added queue pushes for SMBlock, SMBlockread and SMBlockingX.
Jeremy.
(This used to be commit e1dd03ecda)
1998-08-20 19:28:37 +00:00
Jeremy Allison
b935fc0862 Fixed bug introduced by the recent changes where the chain_fnum
could be overwritten in oplock processing code.
Jeremy.
(This used to be commit 908a583b48)
1998-08-17 22:59:53 +00:00
Andrew Tridgell
72ed7049d8 added some optimisation for the case where the number of open files is
very large. files.c now promotes a files_struct to the top of the list
if it is used when it is more than 10 elements from the top.

also moved common linked list code for the 5 sets of linked lists that
I've created over the past few days into dlinklist.h (I've explained
to Chris why I didn't use the ubiqx code)
(This used to be commit 1eb9ae2996)
1998-08-17 06:47:53 +00:00
Andrew Tridgell
983dc71c98 moved connection_struct handling code into smbd/conn.c and changed it
to a linked list with bitmap format.
(This used to be commit b7aaab1b6b)
1998-08-17 06:13:32 +00:00
Andrew Tridgell
8978aae696 much cleaner chain pointer handling for both files and pipes.
the chain pointer is now stored as a static and is set whenever a
handle is created or extracted. This also makes the code less error
prone.
(This used to be commit 068a862982)
1998-08-17 03:52:05 +00:00
Andrew Tridgell
f2d538a105 some cleanups from the conversion of Pipes[] to a linked list. I also
removed most cases where a pnum is used and substituted a pipes_struct*.

in files.c I added a offset of 0x1000 to all file handles on the
wire. This makes it much less likely that bad parsing will give us the
wrong field.
(This used to be commit 8bc2627ff2)
1998-08-17 03:06:20 +00:00
Andrew Tridgell
b590b27b45 - some tidying up in files.c
- handle null fsp in DEBUG() at end of reply_ntcreate_and_X(). Jeremy,
  can you fix this properly?

- get snum right in print queue code in ipc.c (it was broken by my
  connections_struct changes).
(This used to be commit b3dd378575)
1998-08-16 06:20:18 +00:00
Andrew Tridgell
739d0b1ddc got rid of the Files[] array completely (previously I'd just made it
private to files.c)

It now is a doubly linked list with a bitmap for allocated file
numbers. Similarly for the fd_ptr code. I also changed the default
maximum number of open files to 4096. The static cost is 1 bit per
file.

It all seems to work, and it passes the "does Sue scream" test, but if
you see weird behaviour then please investigate. With the volume of
new code that has gone in there are bound to be one or two bugs
lurking.

note that you must do a "make clean" before building this as many data
structures have changed in size.
(This used to be commit 79755ce970)
1998-08-16 04:08:47 +00:00
Andrew Tridgell
6a6e8958ad changed find_free_file() to file_new().
(This used to be commit 3daee29636)
1998-08-16 02:32:55 +00:00
Andrew Tridgell
127655cc88 this checkin gets rid of the global Files[] array and makes it local
in files.c

it should now be faily easy to expand the default MAX_OPEN_FILES to
many thousands.
(This used to be commit b088c804f9)
1998-08-15 07:27:34 +00:00