summaryrefslogtreecommitdiff
path: root/source3/smbd/open.c
AgeCommit message (Collapse)AuthorFilesLines
2011-05-16Fix the SMB2 showstopper, found by an extended torture test from Volker.Jeremy Allison1-3/+25
In the oplock refactoring, the algorithm underwent an unnoticed change. In 3.5.x stat_opens were silently (i.e. no explicit code had comments explaining this) ignored when looking for oplock breaks and share mode violations. After the refactoring, the function find_oplock_types() no longer ignored stat_open entries in the share mode table when looking for batch and exclusive oplocks. This patch adds two changes to find_oplock_types() to ignore the case where the incoming open request is a stat open being tested against existing opens, and also when the incoming open request is a non-stat open being tested against existing stat opens. Neither of these cause an oplock break or share mode violation. Thanks a *lot* to Volker, who persevered in reproducing this problem. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Mon May 16 22:38:20 CEST 2011 on sn-devel-104
2011-05-16Ensure we always write the correct incoming mid into the share modeJeremy Allison1-2/+4
table entries.
2011-04-29s3-smb Use FILE_ATTRIBUTE_ARCHIVE intead of aARCHAndrew Bartlett1-3/+3
This means we use just one constant for this file attribute. Andrew Bartlett
2011-04-29s3-smb Use FILE_ATTRIBUTE_DIRECTORY intead of aDIRAndrew Bartlett1-2/+2
This means we use just one constant for this file attribute. Andrew Bartlett
2011-04-15Ensure vfs_chown_fsp() is safe against races.Jeremy Allison1-1/+1
2011-04-14Ensure change_dir_owner_to_parent() can't be raced.Jeremy Allison1-1/+1
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu Apr 14 23:39:55 CEST 2011 on sn-devel-104
2011-04-14Optimization for change_file_owner_to_parent() and change_dir_owner_to_parent()Jeremy Allison1-0/+21
Don't do the chown if the owner is already correct.
2011-04-13Don't print "success" message after error message in ↵Jeremy Allison1-9/+8
change_file_owner_to_parent(). Remove "goto" in change_dir_owner_to_parent().
2011-04-08Subtle change. Microsoft SMB2 tests return different access mask than for ↵Jeremy Allison1-1/+12
SMB1 with raw.acls.
2011-03-30s3-messages: make ndr_messaging.h part of messages.h.Günther Deschner1-1/+0
Guenther
2011-03-30s3-messages: only include messages.h where needed.Günther Deschner1-0/+1
Guenther
2011-03-30s3-auth: smbd needs auth.hGünther Deschner1-0/+1
Guenther
2011-03-30s3: include smbd/smbd.h where needed.Günther Deschner1-0/+1
Guenther
2011-03-30s3-includes: only include system/filesys.h when needed.Günther Deschner1-0/+1
Guenther
2011-03-21s3:smbd: access checks should not depend on share mode flagsStefan Metzmacher1-1/+0
metze
2011-02-27s3: Fix some nonempty blank linesVolker Lendecke1-10/+9
2011-02-25Ensure we don't return an incorrect access mask.Jeremy Allison1-1/+2
From the Microsoft test suite @ Connectathon: Test Case: TestSuite_ScenarioNo009GrantedAccessTestS0 File created with access = 0x7 (Read, Write, Delete) Query Info on file returns 0x87 (Read, Write, Delete, Read Attributes) Jeremy.
2011-02-24Batch oplocks conflict with exclusive as well as themselves.Jeremy Allison1-1/+1
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu Feb 24 21:44:50 CET 2011 on sn-devel-104
2011-02-24Remember to free the second temporary string.Jeremy Allison1-0/+1
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu Feb 24 04:17:49 CET 2011 on sn-devel-104
2011-02-23Fix bug 7950 - Samba 3.5.x fails BASE-CREATEX_SHAREMODES_DIR smbtorture4 testJeremy Allison1-6/+16
We need to revalidate the pathname once re-constructed from a root fsp. Jeremy.
2011-02-22s3-auth Rename auth_serversupplied_info varaiables: server_info -> session_infoAndrew Bartlett1-1/+1
These variables, of type struct auth_serversupplied_info were poorly named when added into 2001, and in good consistant practice, this has extended all over the codebase in the years since. The structure is also not ideal for it's current purpose. Originally intended to convey the results of the authentication modules, it really describes all the essential attributes of a session. This rename will reduce the volume of a future patch to replaced these with a struct auth_session_info, with auth_serversupplied_info confined to the lower levels of the auth subsystem, and then eliminated. (The new structure will be the output of create_local_token(), and the change in struct definition will ensure that this is always run, populating local groups and privileges). Andrew Bartlett Signed-off-by: Stefan Metzmacher <metze@samba.org>
2011-02-09Oops. Need to test for if(!NT_STATUS_IS_OK(..)) for error.Jeremy Allison1-1/+1
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Feb 9 22:06:05 CET 2011 on sn-devel-104
2011-02-09Move to opening an fd on directory opens. Get more careful about symlink races.Jeremy Allison1-1/+37
2011-02-09Remove unneeded stat call.Jeremy Allison1-9/+4
2011-02-08Pass fsp to dptr_CloseDir(). Cope with setting the fd if we're closing an fd ↵Jeremy Allison1-0/+3
that opendir knows about.
2011-02-08If possible (O_DIRECTORY exists) open an fd for a directory open.Jeremy Allison1-0/+15
Start of the move towards handle-based code for directory access. Currently makes fstat/fchown code work for directories rather than falling back to pathnames. Jeremy. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Tue Feb 8 06:34:41 CET 2011 on sn-devel-104
2011-02-07Fix leak in error path.Jeremy Allison1-0/+1
2011-02-05Move the "oplock file with byte range locks" check to the correct place, ↵Jeremy Allison1-0/+15
where we're making oplock decisions. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Sat Feb 5 01:18:14 CET 2011 on sn-devel-104
2011-02-02Based on a conversation with Volker, refactor some of the oplock code to ↵Jeremy Allison1-71/+160
make it comprehensible. delay_for_oplocks() did 4 things. 1). Validation of existing oplock types. 2). Check for compatibility with batch oplocks (pass 1). 3). Check for compatibility with exclusive oplocks (pass 2). 4). Set the correct oplock type from the requested value. Refactor into 4 separate functions: 1). find_oplock_types() - does validation of oplock types and returns pointers to specific values. 2). delay_for_batch_oplocks() - the pass 1 phase above. 3). delay_for_exclusive_oplocks() - the pass 2 phase above 4). grant_fsp_oplock_type() - Set the correct oplock type from the requested value. Now separated out this code should be much easier to understand and modify. This also fixes an erroneous SMB_ASSERT which was hidden by the previous complexity of the single delay_for_oplocks() code. Jeremy. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Feb 2 01:52:21 CET 2011 on sn-devel-104
2011-01-31Fix bug #7928 - Samba problems with kernel oplocks option set to "no"Pavel Shilovsky1-1/+4
We should not grant levelII oplocks on a file with existing byte range locks.
2011-01-25Fix bug #7863 - Unlink may unlink wrong file when hardlinks are involved.Jeremy Allison1-4/+8
Do this by keeping a linked list of delete on close tokens, one for each filename that identifies a path to the dev/inode. Use the jenkins hash of the pathname to identify the correct token.
2010-12-29Fix bug #7892 - open_file_fchmod() leaves a stale lock.Jeremy Allison1-36/+4
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Dec 29 02:15:23 CET 2010 on sn-devel-104
2010-12-21Keep track of the sparse status of an open file handle. Allows bypass ofJeremy Allison1-0/+9
strict allocation on sparse files. Files opened as POSIX opens are always sparse. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Tue Dec 21 04:12:22 CET 2010 on sn-devel-104
2010-12-01Fix a typo - should be '&&' not '&' when checking for privileges.Jeremy Allison1-1/+1
Jeremy.
2010-11-04s3: Remove an unused prototypeVolker Lendecke1-17/+0
Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Thu Nov 4 17:44:09 UTC 2010 on sn-devel-104
2010-10-22Revert "Wrap security_token_has_privilege() with a check for ↵Jeremy Allison1-2/+2
lp_enable_privileges(). Needed" Not needed - privileges code prevents "enable privileges = no" from adding privileges anyway. This reverts commit a8b95686a7bde3f96f141b6938e24e101567ef54. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Fri Oct 22 23:41:36 UTC 2010 on sn-devel-104
2010-10-22Wrap security_token_has_privilege() with a check for lp_enable_privileges(). ↵Jeremy Allison1-2/+2
Needed to maintain compatibility with smb.conf manpage. Jeremy. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Fri Oct 22 18:15:48 UTC 2010 on sn-devel-104
2010-10-21Add code to implement SeSecurityPrivilege in net rpc rights, and in theJeremy Allison1-21/+8
open and get/set NT security descriptor code. Jeremy. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu Oct 21 00:15:57 UTC 2010 on sn-devel-104
2010-10-15Fix bug #7734 - When creating files with "inherit ACLs" set to true, we ↵Jeremy Allison1-1/+1
neglect to apply appropriate create masks. Jeremy.
2010-10-15Fix bug #7733 - Invalid client DOS attributes on create can cause incorrect ↵Jeremy Allison1-0/+9
unix mode_t to be generated. It turns out a client can send an NTCreateX call for a new file, but specify FILE_ATTRIBUTE_DIRECTORY in the attribute list. Windows silently strips this, but we don't - causing the unix_mode() function to go through the "mode bits for new directory" codepath, instead of the "mode bits for new file" codepath. Jeremy.
2010-10-12libcli/security Provide a common, top level libcli/security/security.hAndrew Bartlett1-0/+1
This will reduce the noise from merges of the rest of the libcli/security code, without this commit changing what code is actually used. This includes (along with other security headers) dom_sid.h and security_token.h Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Tue Oct 12 05:54:10 UTC 2010 on sn-devel-104
2010-10-03s3: Remove smbd_server_conn from msg_file_was_renamedVolker Lendecke1-1/+8
2010-10-03s3: Remove smbd_server_conn from validate_my_share_entriesVolker Lendecke1-3/+5
2010-09-28s3: Lift smbd_server_conn from file_find_di_firstVolker Lendecke1-2/+3
2010-09-28s3: Lift smbd_server_conn from file_find_difVolker Lendecke1-1/+1
2010-09-11s3:auth Remove NT_USER_TOKENAndrew Bartlett1-1/+1
The all UPPER case typedef is no longer the preferred Samba style and this makes it easier to see that this is the IDL-derivied structure Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
2010-08-26s3-build: only include "fake_file.h" where needed.Günther Deschner1-0/+1
Guenther
2010-07-29s3: Avoid an unnecessary ftruncate callVolker Lendecke1-1/+1
If we just created the file, it has length 0 by definition. This is still done while holding the share mode lock, so no race around wrt other cifs clients.
2010-07-27s3-smbd: Migrated to new spoolss functions for printing.Simo Sorce1-2/+3
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-05s3: Remove procid_self() from fill_deferred_open_entry()Volker Lendecke1-5/+10