summaryrefslogtreecommitdiff
path: root/source3/smbd/open.c
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-12-31 10:16:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:49 -0500
commit165f5f3f40317c1e75d60a977270f903f7475f69 (patch)
tree150798e7f68903db1201c2465f77c863dcd03c30 /source3/smbd/open.c
parentab7fc62edfb32422bf95dbf358f6ee5d94e27a34 (diff)
downloadsamba-165f5f3f40317c1e75d60a977270f903f7475f69.tar.gz
samba-165f5f3f40317c1e75d60a977270f903f7475f69.tar.bz2
samba-165f5f3f40317c1e75d60a977270f903f7475f69.zip
r20433: Work in progress: Survive more of RAW-NOTIFY.
call_nt_transact_notify_change() is now sync if there are changes around. A notify_message does a direct reply from within the message, so process_pending_change_notify_queue is not needed anymore for samba-generated events. Next step is to restructure the kernel-mechanisms to generate messages. Volker (This used to be commit c813f71d0036ec52c99a97e60fe33ee47d0635fa)
Diffstat (limited to 'source3/smbd/open.c')
-rw-r--r--source3/smbd/open.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 040b0543aa..895dd48221 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -198,7 +198,8 @@ static void change_dir_owner_to_parent(connection_struct *conn,
static NTSTATUS open_file(files_struct *fsp,
connection_struct *conn,
const char *parent_dir,
- const char *fname,
+ const char *name,
+ const char *path,
SMB_STRUCT_STAT *psbuf,
int flags,
mode_t unx_mode,
@@ -227,7 +228,7 @@ static NTSTATUS open_file(files_struct *fsp,
if (!CAN_WRITE(conn)) {
/* It's a read-only share - fail if we wanted to write. */
if(accmode != O_RDONLY) {
- DEBUG(3,("Permission denied opening %s\n",fname));
+ DEBUG(3,("Permission denied opening %s\n", path));
return NT_STATUS_ACCESS_DENIED;
} else if(flags & O_CREAT) {
/* We don't want to write - but we must make sure that
@@ -253,7 +254,7 @@ static NTSTATUS open_file(files_struct *fsp,
if ((accmode == O_RDONLY) && ((flags & O_TRUNC) == O_TRUNC)) {
DEBUG(10,("open_file: truncate requested on read-only open "
- "for file %s\n",fname ));
+ "for file %s\n", path));
local_flags = (flags & ~O_ACCMODE)|O_RDWR;
}
@@ -282,15 +283,15 @@ static NTSTATUS open_file(files_struct *fsp,
/* Don't create files with Microsoft wildcard characters. */
if ((local_flags & O_CREAT) && !file_existed &&
- ms_has_wild(fname)) {
+ ms_has_wild(path)) {
return NT_STATUS_OBJECT_NAME_INVALID;
}
/* Actually do the open */
- if (!fd_open(conn, fname, fsp, local_flags, unx_mode)) {
+ if (!fd_open(conn, path, fsp, local_flags, unx_mode)) {
DEBUG(3,("Error opening file %s (%s) (local_flags=%d) "
"(flags=%d)\n",
- fname,strerror(errno),local_flags,flags));
+ path,strerror(errno),local_flags,flags));
return map_nt_error_from_unix(errno);
}
@@ -298,7 +299,7 @@ static NTSTATUS open_file(files_struct *fsp,
/* Inherit the ACL if required */
if (lp_inherit_perms(SNUM(conn))) {
- inherit_access_acl(conn, parent_dir, fname,
+ inherit_access_acl(conn, parent_dir, path,
unx_mode);
}
@@ -307,6 +308,9 @@ static NTSTATUS open_file(files_struct *fsp,
change_file_owner_to_parent(conn, parent_dir,
fsp);
}
+
+ notify_action(conn, parent_dir, name,
+ NOTIFY_ACTION_ADDED);
}
} else {
@@ -317,13 +321,13 @@ static NTSTATUS open_file(files_struct *fsp,
int ret;
if (fsp->fh->fd == -1) {
- ret = SMB_VFS_STAT(conn, fname, psbuf);
+ ret = SMB_VFS_STAT(conn, path, psbuf);
} else {
ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,psbuf);
/* If we have an fd, this stat should succeed. */
if (ret == -1) {
DEBUG(0,("Error doing fstat on open file %s "
- "(%s)\n", fname,strerror(errno) ));
+ "(%s)\n", path,strerror(errno) ));
}
}
@@ -365,12 +369,13 @@ static NTSTATUS open_file(files_struct *fsp,
fsp->sent_oplock_break = NO_BREAK_SENT;
fsp->is_directory = False;
fsp->is_stat = False;
- if (conn->aio_write_behind_list &&
- is_in_path(fname, conn->aio_write_behind_list, conn->case_sensitive)) {
+ if (conn->aio_write_behind_list
+ && is_in_path(path, conn->aio_write_behind_list,
+ conn->case_sensitive)) {
fsp->aio_write_behind = True;
}
- string_set(&fsp->fsp_name,fname);
+ string_set(&fsp->fsp_name, path);
fsp->wcp = NULL; /* Write cache pointer. */
DEBUG(2,("%s opened file %s read=%s write=%s (numopen=%d)\n",
@@ -1579,8 +1584,9 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
* open_file strips any O_TRUNC flags itself.
*/
- fsp_open = open_file(fsp, conn, parent_dir, fname, psbuf, flags|flags2,
- unx_mode, access_mask, open_access_mask);
+ fsp_open = open_file(fsp, conn, parent_dir, newname, fname, psbuf,
+ flags|flags2, unx_mode, access_mask,
+ open_access_mask);
if (!NT_STATUS_IS_OK(fsp_open)) {
if (lck != NULL) {
@@ -1845,7 +1851,7 @@ NTSTATUS open_file_fchmod(connection_struct *conn, const char *fname,
/* note! we must use a non-zero desired access or we don't get
a real file descriptor. Oh what a twisted web we weave. */
- status = open_file(fsp, conn, NULL, fname, psbuf, O_WRONLY, 0,
+ status = open_file(fsp, conn, NULL, NULL, fname, psbuf, O_WRONLY, 0,
FILE_WRITE_DATA, FILE_WRITE_DATA);
/*