5 #include <libsmbclient.h>
6 #include "get_auth_data_fn.h"
9 int main(int argc, char * argv[])
17 char * pSmbPath = NULL;
18 time_t t = time(NULL);
21 struct utimbuf utimbuf;
25 pSmbPath = "smb://RANDOM/Public/small";
34 t = (time_t) strtol(argv[2], NULL, 10);
39 "%s [ smb://path/to/file [ mtime ] ]\n",
44 smbc_init(get_auth_data_fn, debug);
46 if (smbc_stat(pSmbPath, &st) < 0)
52 printf("Before\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
53 st.st_mtime, ctime_r(&st.st_mtime, mtime),
54 st.st_ctime, ctime_r(&st.st_ctime, ctime),
55 st.st_atime, ctime_r(&st.st_atime, atime));
57 utimbuf.actime = t; /* unchangable (wont change) */
58 utimbuf.modtime = t; /* this one should succeed */
59 if (smbc_utime(pSmbPath, &utimbuf) < 0)
65 if (smbc_stat(pSmbPath, &st) < 0)
71 printf("After\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
72 st.st_mtime, ctime_r(&st.st_mtime, mtime),
73 st.st_ctime, ctime_r(&st.st_ctime, ctime),
74 st.st_atime, ctime_r(&st.st_atime, atime));