6 #include <libsmbclient.h>
7 #include "get_auth_data_fn.h"
10 int main(int argc
, char * argv
[])
16 const char * pSmbPath
= NULL
;
17 time_t t
= time(NULL
);
19 struct utimbuf utimbuf
;
23 pSmbPath
= "smb://RANDOM/Public/small";
32 t
= (time_t) strtol(argv
[2], NULL
, 10);
37 "%s [ smb://path/to/file [ mtime ] ]\n",
42 smbc_init(get_auth_data_fn
, debug
);
44 if (smbc_stat(pSmbPath
, &st
) < 0)
50 printf("Before\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
51 st
.st_mtime
, ctime_r(&st
.st_mtime
, m_time
),
52 st
.st_ctime
, ctime_r(&st
.st_ctime
, c_time
),
53 st
.st_atime
, ctime_r(&st
.st_atime
, a_time
));
55 utimbuf
.actime
= t
; /* unchangable (wont change) */
56 utimbuf
.modtime
= t
; /* this one should succeed */
57 if (smbc_utime(pSmbPath
, &utimbuf
) < 0)
63 if (smbc_stat(pSmbPath
, &st
) < 0)
69 printf("After\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
70 st
.st_mtime
, ctime_r(&st
.st_mtime
, m_time
),
71 st
.st_ctime
, ctime_r(&st
.st_ctime
, c_time
),
72 st
.st_atime
, ctime_r(&st
.st_atime
, a_time
));