diff options
author | bubulle <bubulle@alioth.debian.org> | 2009-02-26 22:15:00 +0000 |
---|---|---|
committer | bubulle <bubulle@alioth.debian.org> | 2009-02-26 22:15:00 +0000 |
commit | 7a15735eaa209f8dba887ffa180eb770389694de (patch) | |
tree | aeb269dc0a1a8785a2c492b301110199c9cd1c67 /source/smbd/reply.c | |
parent | ca16c95b70df7e455b620a5d6eb9f224c725ae44 (diff) | |
download | samba-7a15735eaa209f8dba887ffa180eb770389694de.tar.gz |
Load samba-3.3.1 into branches/samba/upstream.upstream/3.3.1
git-svn-id: svn://svn.debian.org/svn/pkg-samba/branches/samba/upstream@2611 fc4039ab-9d04-0410-8cac-899223bdd6b0
Diffstat (limited to 'source/smbd/reply.c')
-rw-r--r-- | source/smbd/reply.c | 76 |
1 files changed, 56 insertions, 20 deletions
diff --git a/source/smbd/reply.c b/source/smbd/reply.c index c192d4a138..8e757da706 100644 --- a/source/smbd/reply.c +++ b/source/smbd/reply.c @@ -5614,7 +5614,13 @@ NTSTATUS rename_internals_fsp(connection_struct *conn, return map_nt_error_from_unix(errno); } } else { - if (SMB_VFS_STAT(conn,fsp->fsp_name,&sbuf) == -1) { + int ret = -1; + if (fsp->posix_open) { + ret = SMB_VFS_LSTAT(conn,fsp->fsp_name,&sbuf); + } else { + ret = SMB_VFS_STAT(conn,fsp->fsp_name,&sbuf); + } + if (ret == -1) { return map_nt_error_from_unix(errno); } } @@ -5718,6 +5724,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx, struct smb_Dir *dir_hnd = NULL; const char *dname; long offset = 0; + bool posix_pathnames = lp_posix_pathnames(); ZERO_STRUCT(sbuf1); ZERO_STRUCT(sbuf2); @@ -5829,19 +5836,30 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx, } ZERO_STRUCT(sbuf1); - SMB_VFS_STAT(conn, directory, &sbuf1); + if (posix_pathnames) { + SMB_VFS_LSTAT(conn, directory, &sbuf1); + } else { + SMB_VFS_STAT(conn, directory, &sbuf1); + } status = S_ISDIR(sbuf1.st_mode) ? open_directory(conn, req, directory, &sbuf1, - access_mask, - FILE_SHARE_READ|FILE_SHARE_WRITE, - FILE_OPEN, 0, 0, NULL, - &fsp) + access_mask, + FILE_SHARE_READ|FILE_SHARE_WRITE, + FILE_OPEN, + 0, + posix_pathnames ? FILE_FLAG_POSIX_SEMANTICS|0777 : 0, + NULL, + &fsp) : open_file_ntcreate(conn, req, directory, &sbuf1, - access_mask, - FILE_SHARE_READ|FILE_SHARE_WRITE, - FILE_OPEN, 0, 0, 0, NULL, - &fsp); + access_mask, + FILE_SHARE_READ|FILE_SHARE_WRITE, + FILE_OPEN, + 0, + posix_pathnames ? FILE_FLAG_POSIX_SEMANTICS|0777 : 0, + 0, + NULL, + &fsp); if (!NT_STATUS_IS_OK(status)) { DEBUG(3, ("Could not open rename source %s: %s\n", @@ -5933,19 +5951,30 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx, } ZERO_STRUCT(sbuf1); - SMB_VFS_STAT(conn, fname, &sbuf1); + if (posix_pathnames) { + SMB_VFS_LSTAT(conn, fname, &sbuf1); + } else { + SMB_VFS_STAT(conn, fname, &sbuf1); + } status = S_ISDIR(sbuf1.st_mode) ? open_directory(conn, req, fname, &sbuf1, - access_mask, - FILE_SHARE_READ|FILE_SHARE_WRITE, - FILE_OPEN, 0, 0, NULL, - &fsp) + access_mask, + FILE_SHARE_READ|FILE_SHARE_WRITE, + FILE_OPEN, + 0, + posix_pathnames ? FILE_FLAG_POSIX_SEMANTICS|0777 : 0, + NULL, + &fsp) : open_file_ntcreate(conn, req, fname, &sbuf1, - access_mask, - FILE_SHARE_READ|FILE_SHARE_WRITE, - FILE_OPEN, 0, 0, 0, NULL, - &fsp); + access_mask, + FILE_SHARE_READ|FILE_SHARE_WRITE, + FILE_OPEN, + 0, + posix_pathnames ? FILE_FLAG_POSIX_SEMANTICS|0777 : 0, + 0, + NULL, + &fsp); if (!NT_STATUS_IS_OK(status)) { DEBUG(3,("rename_internals: open_file_ntcreate " @@ -7123,7 +7152,14 @@ void reply_setattrE(struct smb_request *req) return; } } else { - if (SMB_VFS_STAT(conn, fsp->fsp_name, &sbuf) == -1) { + int ret = -1; + + if (fsp->posix_open) { + ret = SMB_VFS_LSTAT(conn, fsp->fsp_name, &sbuf); + } else { + ret = SMB_VFS_STAT(conn, fsp->fsp_name, &sbuf); + } + if (ret == -1) { status = map_nt_error_from_unix(errno); reply_nterror(req, status); END_PROFILE(SMBsetattrE); |