2 Unix SMB/CIFS implementation.
4 POSIX NTVFS backend - setfileinfo
6 Copyright (C) Andrew Tridgell 2004
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "include/includes.h"
24 #include "vfs_posix.h"
27 set info on a open file
29 NTSTATUS pvfs_setfileinfo(struct smbsrv_request *req,
30 union smb_setfileinfo *info)
32 struct pvfs_private *pvfs = req->tcon->ntvfs_private;
33 struct utimbuf unix_times;
36 f = pvfs_find_fd(pvfs, info->generic.file.fnum);
38 return NT_STATUS_INVALID_HANDLE;
41 switch (info->generic.level) {
42 case RAW_SFILEINFO_END_OF_FILE_INFO:
43 case RAW_SFILEINFO_END_OF_FILE_INFORMATION:
45 info->end_of_file_info.in.size) != 0) {
46 return pvfs_map_errno(pvfs, errno);
49 case RAW_SFILEINFO_SETATTRE:
50 unix_times.actime = info->setattre.in.access_time;
51 unix_times.modtime = info->setattre.in.write_time;
53 if (unix_times.actime == 0 && unix_times.modtime == 0) {
57 /* set modify time = to access time if modify time was 0 */
58 if (unix_times.actime != 0 && unix_times.modtime == 0) {
59 unix_times.modtime = unix_times.actime;
62 /* Set the date on this file */
63 if (utime(f->name->full_name, &unix_times) == -1) {
64 return NT_STATUS_ACCESS_DENIED;