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

7119 Commits

Author SHA1 Message Date
Jeremy Allison
0d24370c76 Make the s3 pidfile use the common code inside lib/util/pidfile.c 2012-07-19 16:08:49 -07:00
Jeremy Allison
2922fdaaf0 Move source4/smbd/pidfile into lib/util in preparation for making it in common. 2012-07-19 15:41:52 -07:00
Andrew Bartlett
0f57da57e3 lib/param: bring lp_smb_ports() into common by making it a list everywhere 2012-07-19 08:02:32 +02:00
Volker Lendecke
8ef968a23d s3-aio: Panic if we try to close a fsp with outstanding aio requests
The core smbd must have taken care of this. If we don't do this properly,
we have a race of the close(2) against a pwrite(2). We might end up
writing to the wrong file.

Signed-off-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jul 19 03:40:17 CEST 2012 on sn-devel-104
2012-07-19 03:40:17 +02:00
Volker Lendecke
a6b5836741 s3-smb2: Postpone close_file until all aio is handled
Thanks to Jeremy for this simple idea

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:58:43 -07:00
Volker Lendecke
3e9f58be7e s3-smb1: Postpone close_file until all aio is handled
Thanks to Jeremy for this simple idea

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:57:53 -07:00
Volker Lendecke
f79fb4429c s3: Slightly simplify reply_close()
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:54:04 -07:00
Volker Lendecke
ed31e20115 s3-aio: Make the strict sync after write async
This restores cb405947ca, which was
lost during the refactoring of aio.c and vfs_aio_pthread.c.

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:51:11 -07:00
Volker Lendecke
56aae9f754 s3: Add a _nosync version of smb2_write_complete
This will be used in aio.c to avoid a second fsync after write

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:48:27 -07:00
Volker Lendecke
5d09cec6fe s3-vfs: async fsync
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:48:04 -07:00
Volker Lendecke
3882113e6f s3: Fix the build
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:47:27 -07:00
Volker Lendecke
fd351b6ebb s3: Make us survive base-delaywrite with aio enabled
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:46:54 -07:00
Volker Lendecke
c4efaabbd9 s3: Move the aio_pthread read/write functionality to vfs_default
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:46:29 -07:00
Volker Lendecke
9dc78c90f3 s3-aio: Remove unused VFS functions and more
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:45:58 -07:00
Volker Lendecke
ff701ceae2 s3: Add vfs_aio_posix
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:41:36 -07:00
Volker Lendecke
f9df073a31 s3: Make smbd/aio.c not depend on aio.h anymore
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:40:35 -07:00
Volker Lendecke
66eb7bc6ec s3: Remove the unused completion handling from aio.c
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:38:15 -07:00
Volker Lendecke
f5dc8837d9 s3: Properly handle shutdown with the _send/_recv based aio
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:37:28 -07:00
Volker Lendecke
aff6956d35 s3: Use SMB_VFS_PWRITE_SEND in schedule_smb2_aio_write
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:35:32 -07:00
Volker Lendecke
6df7ba3af9 s3: Use SMB_VFS_PREAD_SEND in schedule_smb2_aio_read
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:34:27 -07:00
Volker Lendecke
2bad405a4e s3: Use SMB_VFS_PWRITE_SEND in schedule_aio_write_and_X
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:33:22 -07:00
Volker Lendecke
7c32017064 s3: Use SMB_VFS_PREAD_SEND in schedule_aio_read_and_X
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:13:04 -07:00
Volker Lendecke
e24aed15fa s3-vfs: async pread
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:11:56 -07:00
Volker Lendecke
c6e456d9c0 s3-vfs: async pwrite
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 13:49:21 -07:00
Rusty Russell
fe72740e82 loadparm: make the source3/ lp_ functions take an explicit TALLOC_CTX *.
They use talloc_tos() internally: hoist that up to the callers, some
of whom don't want to us talloc_tos().

A simple patch, but hits a lot of files.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-07-18 15:07:23 +09:30
Volker Lendecke
27e20d5d60 s3: Make us survive smb2.lock.rw-shared with aio enabled
schedule_aio_smb2_write can return NT_STATUS_FILE_LOCK_CONFLICT.
This is a valid error code that smb2.lock.rw-shared expects and
checks for. The code before this patch maps this to NT_STATUS_FILE_CLOSED,
masking the real, correct error message.

Signed-off-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jul 13 21:53:51 CEST 2012 on sn-devel-104
2012-07-13 21:53:51 +02:00
Andrew Bartlett
15fedb3c68 s3-auth Remove unused global_machine_account_needs_changing
This boolean was only set if the old machine account store (with an
MD4 hash in it) was returned.  We have not set that password type for
years.  If this call ever worked, it would store a plaintext password,
so we could only ever be here if we had set a password using a version
of Samba so old as not to store plaintext, and then never honered the
flag anyway.

Andrew Bartlett

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Jul 13 07:52:40 CEST 2012 on sn-devel-104
2012-07-13 07:52:40 +02:00
Jeremy Allison
a7c63ac1b7 Set fsp->initial_allocation_size before calling open_file_ntcreate().
Allows an SMB_VFS_OPEN() vfs module to do something interesting with
the request.
2012-07-12 22:46:07 +02:00
Jeremy Allison
775014bd9c Make sure we reset fsp->initial_allocation_size to zero if we didn't create the file.
This will become important as we set fsp->initial_allocation_size before
create.
2012-07-12 22:46:07 +02:00
Jeremy Allison
cb405947ca Add an optimization to pthread aio writes to also do fsync if requested.
Should help by ensuring complete writes done in sub-thread, not in
the main thread.
2012-07-12 22:46:07 +02:00
Volker Lendecke
622eb59eb4 s3: Make us survive base-delaywrite with aio enabled
Signed-off-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jul 12 21:28:19 CEST 2012 on sn-devel-104
2012-07-12 21:28:19 +02:00
Volker Lendecke
67e7e14e62 s3: Factor out "mark_file_modified"
This is in preparation of making us survive base-delaywrite with async I/O activated

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-12 10:13:12 -07:00
Jeremy Allison
6d903bf189 Cope with a (non-security) open race we've had for ever as NTCreateX isn't atomic on POSIX.
On open without create, the file did exist, but some
other (local or NFS) process either renamed/unlinked
and re-created the file with different dev/ino after
we walked the path, but before we did the open. We
could retry the open but it's a rare enough case it's
easier to just fail the open to prevent creating any
problems in the open file db having the wrong dev/ino
key.

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jul 10 21:57:33 CEST 2012 on sn-devel-104
2012-07-10 21:57:33 +02:00
Jeremy Allison
69a3e947b6 Now we have a guaranteed indication of a file being created, use it to set the create disposition correctly. 2012-07-10 09:39:36 -07:00
Jeremy Allison
02d42be258 Add function fd_open_atomic() which uses O_CREAT|O_EXCL to return a guaranteed indication of creation of a new file. 2012-07-10 09:39:29 -07:00
Jeremy Allison
3aa186f1d4 Simplify the logic in open_file() some more.
Move the inheritance work into the if block
where we created the file. We can never have
created the file (and thus need no inheritance)
for a stat-open.

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jul 10 03:30:22 CEST 2012 on sn-devel-104
2012-07-10 03:30:22 +02:00
Jeremy Allison
3a705e5f3d Simplify the logic in open_file().
Move the fstat call into the block which opens a file descriptor.
Remove the stat() call in the stat-open case. We already failed
the open if !file_existed.
2012-07-09 16:20:45 -07:00
Jeremy Allison
9d5e026bde Make check_same_stat() and check_same_dev_ino() common functions. 2012-07-09 12:26:56 -07:00
Jeremy Allison
1f37ed7a52 Factor out check_same_dev_ino() from check_same_stat() so it can be called separately. 2012-07-09 11:35:20 -07:00
Björn Jacke
f9fb1ef85c s3: evaluate MNT_QUOTA and MNT_RDONLY in statvfs also on darwin 2012-07-05 22:00:52 +02:00
Björn Jacke
b40fb6eec5 s3: if we know a file is immutable, report it to be readonly
on *BSD we get the immutable flag via st_flags, we should use that if possible.
2012-07-04 12:01:20 +02:00
Andreas Schneider
d0878b3b81 s3-smbd: Remove deprecated 'share modes' option. 2012-07-03 21:56:49 +02:00
Volker Lendecke
abda9d3347 s3: Fix Coverity ID 709217 Dereference after null check
A few lines before we did check for x != NULL. I think this might
fix a potential remote crash.

Signed-off-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Tue Jul  3 15:30:17 CEST 2012 on sn-devel-104
2012-07-03 15:30:16 +02:00
Volker Lendecke
6710e4edc5 s3: Fix Coverity ID 709218 Uninitialized pointer read
Signed-off-by: Michael Adam <obnox@samba.org>
2012-07-03 13:39:42 +02:00
Michael Adam
e332bfaff5 s3:smbd: Include smbXsrv.h before vfs.h (in smbd.h) so that the smbXsrv structures are available
This is currently needed for files_struct and connection_struct
that contain backlinks to smbXsrv_open and smbXsrv_tcon, respectively.
Finally, these backlinks to the smb level structures should be removed.
2012-07-03 13:39:41 +02:00
Michael Adam
8a32d62abc s3:smbd:smb2: fix prototype of make_connection_smb2() to use smbXsrv_tcon
instead of internal smbXsrv_tcon0.
2012-07-03 13:39:40 +02:00
Michael Adam
98ccca8dca s3:smbd: include smbXsrv.h before smbd/proto.h to have the smbXsrv_ structs available 2012-07-03 13:39:40 +02:00
Michael Adam
bfc38d74cc s3:smbd:smb2: change smbXsrv_tcon0 to smbXsrv_tcon in smbd_smb2_request_check_tcon()
smbXsrv_tcon0 is the internal name for the (current) version0 of the
structure. Externally, only smbXsrv_tcon should be used.
2012-07-03 13:39:40 +02:00
Michael Adam
cca51e2f55 s3:smbd:smb2: change smbXsrv_session0 to smbXsrv_session in struct user_struct.
smbXsrv_session0 is the internal name of (current) version 0 of
the structure. Externally, only smbXsrv_session should be used.
2012-07-03 13:39:39 +02:00
Jeremy Allison
5679ba1018 Don't allow asynchronous creates to be canceled in SMB2.
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Jun 30 04:10:02 CEST 2012 on sn-devel-104
2012-06-30 04:10:02 +02:00
Jeremy Allison
6617c2c1f5 Make schedule_deferred_open_message_smb() return an indication of success. 2012-06-30 02:23:39 +02:00
Jeremy Allison
0d2f6cae41 Make schedule_deferred_open_message_smb2() return an indication of success. 2012-06-30 02:23:39 +02:00
Jeremy Allison
b004121d9b Allow for async opens.
If the SMB_VFS_OPEN() function returns -1, EINTR -> NT_STATUS_RETRY,
then queue the open up to be completed when the async open completes.
2012-06-30 02:23:39 +02:00
Jeremy Allison
d1e1aa552d Add new bool field async_open to struct deferred_open_record. Not used yet. 2012-06-30 02:23:39 +02:00
Jeremy Allison
0362dcbd09 Fix defer_open() fuction in the open code path to cope with a NULL lck parameter. 2012-06-30 02:23:39 +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
f7762e2730 s3:smbd: add smbXsrv_open* infrastructure
Pair-Programmed-With: Michael Adam <obnox@samba.org>

metze
2012-06-29 19:11:04 +02:00
Björn Jacke
143b711c23 s3: fix the logic in bsd_statvfs 2012-06-29 17:19:21 +02:00
Stefan Metzmacher
1a622fe641 s3:smb2_server: remove max_charge check in smbd_smb2_request_verify_creditcharge()
The client can send any credit charge value, it's ok to send more than needed.

metze

Signed-off-by: Michael Adam <obnox@samba.org>
2012-06-29 15:21:08 +02:00
Björn Jacke
b526a0d673 s3: merge bsd_statvfs and darwin_statvfs 2012-06-29 12:47:23 +02:00
Jeremy Allison
821bd95156 Replace all uses of setXX[ug]id() and setgroups with samba_setXX[ug]id() calls.
Will allow thread-specific credentials to be added by modifying
the central definitions. Deliberately left the setXX[ug]id()
call in popt as this is not used in Samba.
2012-06-28 17:15:16 -07:00
Stefan Metzmacher
34a9892ec1 s3:smb2_server: make the logic in smbd_smb2_request_verify_creditcharge() simpler
We just need a max_charge variable to make the algorithm independent
of multi_credit support.

metze
2012-06-29 00:14:56 +02:00
Stefan Metzmacher
967f2c44b3 s3:smb2_server: simplify smbd_smb2_request_verify_creditcharge() a bit.
A credit charge of 0 is really not a special case, it just means the same
as 1.

metze
2012-06-29 00:14:56 +02:00
Stefan Metzmacher
5b7f5d02b5 s3:smb2_negprot: support SMB2_CAP_LARGE_MTU on everything but port 139
In future we'll have other transports like RDMA.
This makes NBT (tcp port 139) special instead of port 445.

metze
2012-06-29 00:14:56 +02:00
Stefan Metzmacher
1db83d2b37 s3:smb2_server: grant extra credits for multi-credit requests
metze
2012-06-29 00:14:55 +02:00
Stefan Metzmacher
648b959b13 s3:smb2_server: implement credit granting similar to windows
This makes it much easier to compare traces.

metze
2012-06-29 00:14:55 +02:00
Stefan Metzmacher
82dc0b33b9 s3:smb2_server: make sure sequence numbers don't wrap at UINT64_MAX
metze
2012-06-29 00:14:54 +02:00
Stefan Metzmacher
ee8ae459ae s3:smb2_server: make sure we don't grant more credits than we allow
If the client hasn't consumed the lowest seqnum, but the distance
between lowest and highest seqnum has reached max credits.

In that case we should stop granting credits.

metze
2012-06-29 00:14:54 +02:00
Stefan Metzmacher
4fe41c0bb1 s3:smb2_server: check the credit_charge against the already granted credits
metze
2012-06-29 00:14:54 +02:00
Stefan Metzmacher
984fdaf914 s3:smb2_server: split out a smb2_validate_sequence_number() function
metze
2012-06-29 00:14:53 +02:00
Stefan Metzmacher
d6e7a76461 s3:smb2_server: clear sequence window if we got the lowest sequence id
Otherwise we'll never consume sequence id '0'.

metze
2012-06-29 00:14:53 +02:00
Stefan Metzmacher
bd6d415cae s3:smb2_server: fix calculation of the next bitmap_offset
metze
2012-06-29 00:14:52 +02:00
Stefan Metzmacher
d1ee774ed0 s3:smb2_server: remove unused and confusing DEFAULT_SMB2_MAX_CREDIT_BITMAP_FACTOR
metze
2012-06-29 00:14:52 +02:00
Stefan Metzmacher
925994e42e s3:smb2_server: call smbd_smb2_request_validate() also in smbd_smb2_first_negprot()
We need to consume message_id 0, for SMB1 negprot starts.

metze
2012-06-29 00:14:51 +02:00
Stefan Metzmacher
0b8eac9b79 s3:smb2_server: start the connection with one credit granted to the client
metze
2012-06-29 00:14:51 +02:00
Björn Jacke
7560b1cea6 s3: fine tune and clean up statvfs tests
This should also fix the build on Tru64. Tru64 has a POSIX compliant statvfs()
function while most *BSD systems ignore POSIX.

Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Thu Jun 28 23:07:23 CEST 2012 on sn-devel-104
2012-06-28 23:07:23 +02:00
Stefan Metzmacher
d6939c39c0 s3:smbd: change nt_open_pipe() to uint16_t pnum/fnum
This is SMB1 code...

metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jun 28 14:47:45 CEST 2012 on sn-devel-104
2012-06-28 14:47:45 +02:00
Stefan Metzmacher
d7d1bb9444 s3:smb2_create: add usefull DEBUG() message
All calls which take an file handle have the same,
so we should also log it, when we create a handle.

metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jun 28 12:41:49 CEST 2012 on sn-devel-104
2012-06-28 12:41:48 +02:00
Stefan Metzmacher
66fa891d2d s3:smbd/files: fsp->fnum is uint64_t not int!
metze
2012-06-28 10:08:03 +02:00
Andrew Bartlett
666dba3353 s3-param: Rename loadparm_s3_context -> loadparm_s3_helpers
This helps clarify the role of this structure and wrapper function.

The purpose here is to provide helper functions to the lib/param
loadparm_context that point back at the s3 lp_ functions.  This allows
a struct loadparm_context to be passed to any point in the code, and
always refer to the correct loadparm system.  If this has not been
set, the variables loaded in the lib/param code will be returned.

As requested by Michael Adam.

Andrew Bartlett

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jun 27 17:11:16 CEST 2012 on sn-devel-104
2012-06-27 17:11:16 +02:00
Volker Lendecke
5df1fda0f5 s3: Restore async i/o with the "native" AIO interface
eff3609 moved the async signal handler initialization to later in the process
to enable aio_fork and aio_pthread on platforms without realtime signals. This
commit broke the use of the native aio interface. aio_pending_size is
initialized to 0, so aio.c will not allow async i/0 at all if modules do not
set that variable correctly. Initialize to 100 right from the start.

Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Jun 26 14:08:22 CEST 2012 on sn-devel-104
2012-06-26 14:08:22 +02:00
Stefan Metzmacher
93399c1ec3 s3:smbXsrv_tcon: pass max_tcons explicitly for smbXsrv_tcon_table_init()
metze
2012-06-26 12:18:03 +02:00
Stefan Metzmacher
9c36781580 s3:smbXsrv_session: pass max_sessions explicitly for smbXsrv_session_table_init()
metze
2012-06-26 12:17:33 +02:00
Stefan Metzmacher
45cd2bc2b3 s3:smb2_sesssetup: make use of smb2srv_session_close_previous_send/recv
metze
2012-06-25 20:55:07 +02:00
Stefan Metzmacher
299b63f875 s3:smbXsrv_session: react on MSG_SMBXSRV_SESSION_CLOSE
metze
2012-06-25 20:55:07 +02:00
Stefan Metzmacher
8acf6c90bd s3:smbXsrv_session: add smb2srv_session_close_previous_send/recv
metze
2012-06-25 20:55:07 +02:00
Stefan Metzmacher
ed75069460 s3:smb2_sesssetup: inline gensec_session_info() call
metze
2012-06-25 20:55:07 +02:00
Stefan Metzmacher
1b8bcaeda3 s3:smb2_sesssetup: make use of gensec_update_send/recv
metze
2012-06-25 20:55:07 +02:00
Stefan Metzmacher
f32e99a0fc s3:smb2_sesssetup: inline most of smbd_smb2_session_setup()
metze
2012-06-25 20:55:07 +02:00
Stefan Metzmacher
e77000259c s3:smbd/sesssetup: implement dynamic re-authentication and expire session if client supports it
metze
2012-06-25 20:55:06 +02:00
Stefan Metzmacher
d2e1058f42 s3:smb2_sesssetup: implement dynamic re-authentication and expire sessions
metze
2012-06-25 20:55:06 +02:00
Stefan Metzmacher
9854ed6d01 s3:smbd: remove now unused invalidate_all_vuids()
Pair-Programmed-With: Michael Adam <obnox@samba.org>

metze
2012-06-25 20:55:06 +02:00
Michael Adam
77d1173aa2 s3:smbd: remove now unused conn_close_all()
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
2012-06-25 20:55:06 +02:00
Michael Adam
d693ff54db s3:smbd: use smbXsrv_session_logoff_all() and smb1srv_tcon_disconnect_all() in exit_server_common()
This removes the use of conn_close_all() and invalidate_all_vuids()

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
2012-06-25 20:55:06 +02:00
Stefan Metzmacher
a129e271b5 s3:smbd: make use of smbXsrv_session for smb1
Pair-Programmed-With: Michael Adam <obnox@samba.org>

metze
2012-06-25 20:55:06 +02:00
Stefan Metzmacher
faa8edccef s3:smbd: make use of smbXsrv_tcon for smb1
Pair-Programmed-With: Michael Adam <obnox@samba.org>

metze
2012-06-25 20:55:06 +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
Stefan Metzmacher
ef408e5068 s3:smb2_sesssetup: add support for SMB 2.24/3.00 signing
metze
2012-06-25 20:55:06 +02:00
Stefan Metzmacher
02d206ee64 s3:smb2_sesssetup: make use of the smbXsrv_session infrastructure
We still have smbd_smb2_session as primary structure,
but that will went away once we got rid of smbd_smb2_tcon.

metze
2012-06-25 20:55:06 +02:00
Stefan Metzmacher
1fffd35692 s3:smbXsrv_session: init and disconnect smbXsrv_tcon for SMB2/3
metze
2012-06-25 20:55:06 +02:00
Stefan Metzmacher
c36bd677f3 s3:smbd: add smbXsrv_tcon infrastructure
Pair-Programmed-With: Michael Adam <obnox@samba.org>

metze
2012-06-25 20:55:06 +02:00
Stefan Metzmacher
f3dce4cc95 sq smbXsrv_session_global_store no connection 2012-06-25 20:55:06 +02:00
Stefan Metzmacher
85f8c14f30 s3:smbd: add smbXsrv_session infrastructure
Pair-Programmed-With: Michael Adam <obnox@samba.org>

metze
2012-06-25 20:55:06 +02:00
Stefan Metzmacher
130436f2fc s3:smbd: add smbXsrv_version_* infrastructure
metze
2012-06-25 20:55:05 +02:00
Volker Lendecke
754b925ccd s3: Fix a typo
Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Jun 25 17:13:59 CEST 2012 on sn-devel-104
2012-06-25 17:13:59 +02:00
Stefan Metzmacher
b40fa94360 s3:smbd: fix warning in smbd_tevent_trace_callback() without profile support
metze
2012-06-22 12:56:47 +02:00
Jeremy Allison
dd763d6d8e Fix bug #8974 - Kernel oplocks are broken when uid(file) != uid(process).
Based on a fix from "Etienne Dechamps " <e-t172@akegroup.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jun 21 21:53:58 CEST 2012 on sn-devel-104
2012-06-21 21:53:58 +02:00
Andrew Bartlett
33ff033204 s4-provision: Give better clues on what Samba needs for s3fs ACL support
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Jun 21 14:07:55 CEST 2012 on sn-devel-104
2012-06-21 14:07:55 +02:00
Michael Adam
73b200064f s3:util: rename procid_equal() to serverid_equal()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-21 08:27:32 +02:00
Volker Lendecke
53cfde7204 s3: Remove a user of procid_is_me
Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-21 08:27:30 +02:00
Stefan Metzmacher
cd260391fa s3:smbd: fix the build with the --with-profiling-data option
metze
2012-06-20 12:58:58 +02:00
Jeremy Allison
818fd7e917 Remove unused code now we set the correct command codes. 2012-06-19 10:27:24 -07:00
Jeremy Allison
6cef2a613c Fix warning: variable ‘in_start_time’ set but not used. 2012-06-19 10:27:23 -07:00
Rusty Russell
6244f668a3 TDB2: make SAMBA use tdb1 again for the moment.
Otherwise the following surgery will break the SAMBA build and testsuite.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19 05:38:05 +02:00
Jeremy Allison
bbb7cbfb7c Same fix as bug 8989 - Samba 3.5.x (and probably all other versions of Samba) does not send correct responses to NT Transact Secondary when no data and no params
for the Trans2 calls. See MS-CIFS 2.2.4.47.2 for details.

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Jun 16 07:59:19 CEST 2012 on sn-devel-104
2012-06-16 07:59:19 +02:00
Jeremy Allison
816c40cb0d Fix Bug 8989 - Samba 3.5.x (and probably all other versions of Samba) does not send correct responses to NT Transact Secondary when no data and no params
Found by Richard Sharpe <realrichardsharpe@gmail.com>. The correct
command code in a reply to NT Transact Secondary (0xa1) is
NT Transact (0xa0).
2012-06-15 21:10:37 -07:00
Volker Lendecke
985dbedf27 s3: Slightly simplify grant_fsp_oplock_type
The "else" is not necessary, we did a return in the if-branch

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-06-15 21:07:55 -07:00
Stefan Metzmacher
8cca7b09ad s3:smb2_server: remember the request_time on an incoming request
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jun 15 09:17:33 CEST 2012 on sn-devel-104
2012-06-15 09:17:32 +02:00
Stefan Metzmacher
d8b3687fcb s3:smbd: remember the request_time on an incoming request
metze
2012-06-15 07:18:00 +02:00
Michael Adam
b27f88898a s3:vfs: change files_struct.fnum from int to uint64_t
Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jun 15 05:22:41 CEST 2012 on sn-devel-104
2012-06-15 05:22:41 +02:00
Michael Adam
67108c8e7e s3:smbd: change trans2.c to use fsp_fnum_dbg() for fsp->fnum logging.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:15 +02:00
Michael Adam
d056fd14c8 s3:smbd: change smb2_write.c to use fsp_fnum_dbg() for fsp->fnum logging.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:15 +02:00
Michael Adam
bde02985e6 s3:smbd: change smb2_setinfo.c to use fsp_fnum_dbg() for fsp->fnum logging.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:15 +02:00
Michael Adam
1e0eb24270 s3:smbd: change smb2_read.c to use fsp_fnum_dbg() for fsp->fnum logging.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:15 +02:00
Michael Adam
632560b4d8 s3:smbd: change smb2_notify.c to use fsp_fnum_dbg() for fsp->fnum logging.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:15 +02:00
Michael Adam
ec111bd050 s3:smbd: change smb2_lock.c to use fsp_fnum_dbg() for fsp->fnum logging.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:15 +02:00
Michael Adam
7738b574c2 s3:smbd: change smb2_ioctl.c to use fsp_fnum_dbg() for fsp->fnum logging.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:15 +02:00
Michael Adam
cf380e168d s3:smbd: change smb2_getinfo.c to use fsp_fnum_dbg() for fsp->fnum logging.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:15 +02:00
Michael Adam
66117c3312 s3:smbd: change smb2_flush.c to use fsp_fnum_dbg() for fsp->fnum logging.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:15 +02:00
Michael Adam
d82f1fada2 s3:smbd: change smb2_find.c to use fsp_fnum_dbg() for fsp->fnum logging.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:15 +02:00
Michael Adam
59225808fa s3:smbd: change smb2_close.c to use fsp_fnum_dbg() for fsp->fnum logging.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:15 +02:00
Michael Adam
78b9e1afef s3:smbd: change smb2_break.c to use fsp_fnum_dbg() for fsp->fnum logging.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:15 +02:00
Michael Adam
65ea1e427d s3:smbd: change reply.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
3d7befa8f0 s3:smbd: change pipes.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
cd37c68fad s3:smbd: change oplock.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
cdfc301da9 s3:smbd: change open.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
b4f6ef4e95 s3:smbd: change nttrans.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
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
cb1c18516c s3:smbd: change fake_file.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
ee6580c67f s3:smbd: change blocking.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
4d66d9f6dd s3:smbd: change aio.c to use fsp_fnum_dbg() for logging fsp->fnum.
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