6 #include <libsmbclient.h>
7 #include "get_auth_data_fn.h"
10 int main(int argc, char * argv[])
18 char * pSmbPath = NULL;
19 time_t t = time(NULL);
22 struct utimbuf utimbuf;
26 pSmbPath = "smb://RANDOM/Public/small";
35 t = (time_t) strtol(argv[2], NULL, 10);
40 "%s [ smb://path/to/file [ mtime ] ]\n",
45 smbc_init(get_auth_data_fn, debug);
47 if (smbc_stat(pSmbPath, &st) < 0)
53 printf("Before\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
54 st.st_mtime, ctime_r(&st.st_mtime, mtime),
55 st.st_ctime, ctime_r(&st.st_ctime, ctime),
56 st.st_atime, ctime_r(&st.st_atime, atime));
58 utimbuf.actime = t; /* unchangable (wont change) */
59 utimbuf.modtime = t; /* this one should succeed */
60 if (smbc_utime(pSmbPath, &utimbuf) < 0)
66 if (smbc_stat(pSmbPath, &st) < 0)
72 printf("After\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
73 st.st_mtime, ctime_r(&st.st_mtime, mtime),
74 st.st_ctime, ctime_r(&st.st_ctime, ctime),
75 st.st_atime, ctime_r(&st.st_atime, atime));