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

6993 Commits

Author SHA1 Message Date
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