return NT_STATUS_OK;
}
+ if (access_mask == DELETE_ACCESS && S_ISLNK(smb_fname->st.st_ex_mode)) {
+ /* We can always delete a symlink. */
+ DEBUG(10,("smbd_check_access_rights: not checking ACL "
+ "on DELETE_ACCESS on symlink %s.\n",
+ smb_fname_str_dbg(smb_fname) ));
+ return NT_STATUS_OK;
+ }
+
status = SMB_VFS_GET_NT_ACL(conn, smb_fname->base_name,
(SECINFO_OWNER |
SECINFO_GROUP |
"share entry with an open file\n");
}
- if (is_deferred_open_entry(share_entry) ||
- is_unused_share_mode_entry(share_entry)) {
+ if (is_deferred_open_entry(share_entry)) {
goto panic;
}
static void find_oplock_types(files_struct *fsp,
int oplock_request,
- struct share_mode_lock *lck,
+ const struct share_mode_lock *lck,
struct share_mode_entry **pp_batch,
struct share_mode_entry **pp_ex_or_batch,
bool *got_level2,
if ((oplock_request & INTERNAL_OPEN_ONLY) || is_stat_open(fsp->access_mask)) {
return false;
}
-
- if (batch_entry != NULL) {
- /* Found a batch oplock */
- send_break_message(fsp, batch_entry, mid, oplock_request);
- return true;
+ if (batch_entry == NULL) {
+ return false;
}
- return false;
+
+ /* Found a batch oplock */
+ send_break_message(fsp, batch_entry, mid, oplock_request);
+ return true;
}
static bool delay_for_exclusive_oplocks(files_struct *fsp,
int oplock_request,
struct share_mode_entry *ex_entry)
{
+ bool delay_it;
+
if ((oplock_request & INTERNAL_OPEN_ONLY) || is_stat_open(fsp->access_mask)) {
return false;
}
+ if (ex_entry == NULL) {
+ return false;
+ }
- if (ex_entry != NULL) {
- /* Found an exclusive or batch oplock */
- bool delay_it = is_delete_request(fsp) ?
- BATCH_OPLOCK_TYPE(ex_entry->op_type) : true;
- if (delay_it) {
- send_break_message(fsp, ex_entry, mid, oplock_request);
- return true;
- }
+ /* Found an exclusive or batch oplock */
+
+ delay_it = is_delete_request(fsp) ?
+ BATCH_OPLOCK_TYPE(ex_entry->op_type) : true;
+
+ if (!delay_it) {
+ return false;
}
- return false;
+
+ send_break_message(fsp, ex_entry, mid, oplock_request);
+ return true;
}
static void grant_fsp_oplock_type(files_struct *fsp,
for (i=0; i<lck->num_share_modes; i++) {
struct share_mode_entry *e = &lck->share_modes[i];
- if (!is_deferred_open_entry(e)) {
- continue;
- }
-
- if (procid_is_me(&e->pid) && (e->op_mid == req->mid)) {
+ if (is_deferred_open_entry(e) &&
+ procid_is_me(&e->pid) &&
+ (e->op_mid == req->mid)) {
DEBUG(0, ("Trying to defer an already deferred "
"request: mid=%llu, exiting\n",
(unsigned long long)req->mid));
bool posix_open = False;
bool new_file_created = False;
bool clear_ads = false;
- struct file_id id;
NTSTATUS fsp_open = NT_STATUS_ACCESS_DENIED;
mode_t new_unx_mode = (mode_t)0;
mode_t unx_mode = (mode_t)0;
NTSTATUS status;
char *parent_dir;
- ZERO_STRUCT(id);
-
if (conn->printer) {
/*
* Printers are handled completely differently.
}
}
- status = check_name(conn, smb_fname->base_name);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
-
if (!posix_open) {
new_dos_attributes &= SAMBA_ATTRIBUTES_MASK;
if (file_existed) {
struct share_mode_entry *exclusive_entry = NULL;
bool got_level2_oplock = false;
bool got_a_none_oplock = false;
+ struct file_id id;
struct timespec old_write_time = smb_fname->st.st_ex_mtime;
id = vfs_file_id_from_sbuf(conn, &smb_fname->st);
bool got_level2_oplock = false;
bool got_a_none_oplock = false;
struct timespec old_write_time = smb_fname->st.st_ex_mtime;
+ struct file_id id;
/*
* Deal with the race condition where two smbd's detect the
* file doesn't exist and do the create at the same time. One
fsp->oplock_type = NO_OPLOCK;
}
- if (!(flags2 & O_TRUNC)) {
- info = FILE_WAS_OPENED;
- } else {
+ if (flags2 & O_TRUNC) {
info = FILE_WAS_OVERWRITTEN;
+ } else {
+ info = FILE_WAS_OPENED;
}
} else {
info = FILE_WAS_CREATED;
fsp->oplock_type = NO_OPLOCK;
}
- if (info == FILE_WAS_OVERWRITTEN || info == FILE_WAS_CREATED || info == FILE_WAS_SUPERSEDED) {
- new_file_created = True;
- }
-
set_share_mode(lck, fsp, get_current_uid(conn),
req ? req->mid : 0,
fsp->oplock_type);
fsp->initial_delete_on_close = True;
}
+ if (info == FILE_WAS_OVERWRITTEN
+ || info == FILE_WAS_CREATED
+ || info == FILE_WAS_SUPERSEDED) {
+ new_file_created = True;
+ }
+
if (new_file_created) {
/* Files should be initially set as archive */
if (lp_map_archive(SNUM(conn)) ||
size_t sp_len, bn_len;
NTSTATUS status;
struct smbd_server_connection *sconn =
- talloc_get_type(private_data,
+ talloc_get_type_abort(private_data,
struct smbd_server_connection);
- if (sconn == NULL) {
- return;
- }
-
if (data->data == NULL
|| data->length < MSG_FILE_RENAMED_MIN_SIZE + 2) {
DEBUG(0, ("msg_file_was_renamed: Got invalid msg len %d\n",
}
}
- /* All file access must go through check_name() */
-
- status = check_name(conn, smb_fname->base_name);
- if (!NT_STATUS_IS_OK(status)) {
- goto fail;
- }
-
if (stream_name && is_ntfs_default_stream_smb_fname(smb_fname)) {
int ret;
smb_fname->stream_name = NULL;