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, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 static void copy_stat(struct SMBW_stat *external, struct stat *internal)
27 external->s_dev = internal->st_dev;
28 external->s_ino = internal->st_ino;
29 external->s_mode = internal->st_mode;
30 external->s_nlink = internal->st_nlink;
31 external->s_uid = internal->st_uid;
32 external->s_gid = internal->st_gid;
33 external->s_rdev = internal->st_rdev;
34 external->s_size = internal->st_size;
35 external->s_blksize = internal->st_blksize;
36 external->s_blocks = internal->st_blocks;
37 external->s_atime = internal->st_atime;
38 external->s_mtime = internal->st_mtime;
39 external->s_ctime = internal->st_ctime;
43 /*****************************************************
45 *******************************************************/
46 int smbw_fstat(int fd_smbw, struct SMBW_stat *st)
48 int fd_client = smbw_fd_map[fd_smbw];
51 if (smbc_fstat(fd_client, &statbuf) < 0) {
55 copy_stat(st, &statbuf);
61 /*****************************************************
63 *******************************************************/
64 int smbw_stat(const char *fname, struct SMBW_stat *st)
73 smbw_fix_path(fname, path);
75 p = path + 6; /* look just past smb:// */
76 simulate = (strchr(p, '/') == NULL);
78 /* special case for full-network scan, workgroups, and servers */
82 statbuf.st_mode = 0040777;
88 statbuf.st_blksize = 1024;
89 statbuf.st_blocks = 1;
90 statbuf.st_atime = 0; /* beginning of epoch */
91 statbuf.st_mtime = 0; /* beginning of epoch */
92 statbuf.st_ctime = 0; /* beginning of epoch */
94 } else if (smbc_stat(path, &statbuf) < 0) {
98 copy_stat(st, &statbuf);