5 #include <libsmbclient.h>
6 #include "get_auth_data_fn.h"
9 int main(int argc
, char * argv
[])
18 char * pSmbPath
= NULL
;
20 struct utimbuf utimbuf
;
24 pSmbPath
= "smb://RANDOM/Public/small";
33 mode
= (int) strtol(argv
[2], NULL
, 8);
38 "%s [ smb://path/to/file [ octal_mode ] ]\n",
43 smbc_init(get_auth_data_fn
, debug
);
45 if (smbc_stat(pSmbPath
, &st
) < 0)
51 printf("Before\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
52 st
.st_mtime
, ctime_r(&st
.st_mtime
, mtime
),
53 st
.st_ctime
, ctime_r(&st
.st_ctime
, ctime
),
54 st
.st_atime
, ctime_r(&st
.st_atime
, atime
));
56 utimbuf
.actime
= st
.st_atime
- 120; /* unchangable. this one wont change */
57 utimbuf
.modtime
= st
.st_mtime
- 120; /* this one should succeed */
58 if (smbc_utime(pSmbPath
, &utimbuf
) < 0)
64 if (smbc_stat(pSmbPath
, &st
) < 0)
70 printf("After\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
71 st
.st_mtime
, ctime_r(&st
.st_mtime
, mtime
),
72 st
.st_ctime
, ctime_r(&st
.st_ctime
, ctime
),
73 st
.st_atime
, ctime_r(&st
.st_atime
, atime
));