2 Unix SMB/Netbios implementation.
4 SMB wrapper stat functions
5 Copyright (C) Andrew Tridgell 1998
6 Copyright (C) Derrell Lipman 2003-2005
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 3 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, see <http://www.gnu.org/licenses/>.
24 static void copy_stat(struct SMBW_stat *external, struct stat *internal)
26 external->s_dev = internal->st_dev;
27 external->s_ino = internal->st_ino;
28 external->s_mode = internal->st_mode;
29 external->s_nlink = internal->st_nlink;
30 external->s_uid = internal->st_uid;
31 external->s_gid = internal->st_gid;
32 external->s_rdev = internal->st_rdev;
33 external->s_size = internal->st_size;
34 external->s_blksize = internal->st_blksize;
35 external->s_blocks = internal->st_blocks;
36 external->s_atime = internal->st_atime;
37 external->s_mtime = internal->st_mtime;
38 external->s_ctime = internal->st_ctime;
42 /*****************************************************
44 *******************************************************/
45 int smbw_fstat(int fd_smbw, struct SMBW_stat *st)
47 int fd_client = smbw_fd_map[fd_smbw];
50 if (smbc_fstat(fd_client, &statbuf) < 0) {
54 copy_stat(st, &statbuf);
60 /*****************************************************
62 *******************************************************/
63 int smbw_stat(const char *fname, struct SMBW_stat *st)
72 smbw_fix_path(fname, path);
74 p = path + 6; /* look just past smb:// */
75 simulate = (strchr(p, '/') == NULL);
77 /* special case for full-network scan, workgroups, and servers */
81 statbuf.st_mode = 0040777;
87 statbuf.st_blksize = 1024;
88 statbuf.st_blocks = 1;
89 statbuf.st_atime = 0; /* beginning of epoch */
90 statbuf.st_mtime = 0; /* beginning of epoch */
91 statbuf.st_ctime = 0; /* beginning of epoch */
93 } else if (smbc_stat(path, &statbuf) < 0) {
97 copy_stat(st, &statbuf);