1 #include <libsmbclient.h>
6 #include "get_auth_data_fn.h"
9 * This test is intended to ensure that the timestamps returned by
10 * libsmbclient are the same as timestamps returned by the local system. To
11 * test this, we assume a working Samba environment, and access the same
12 * file via SMB and locally (or NFS).
17 static int gettime(const char * pUrl
,
18 const char * pLocalPath
);
21 int main(int argc
, char* argv
[])
25 printf("usage: %s <file_url> <file_localpath>\n", argv
[0]);
29 gettime(argv
[1], argv
[2]);
34 static int gettime(const char * pUrl
,
35 const char * pLocalPath
)
42 smbc_init(get_auth_data_fn
, 0);
44 if (smbc_stat(pUrl
, &st
) < 0)
50 printf("SAMBA\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
));
56 /* check the stat on this file */
57 if (stat(pLocalPath
, &st
) < 0)
63 printf("LOCAL\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
64 st
.st_mtime
, ctime_r(&st
.st_mtime
, m_time
),
65 st
.st_ctime
, ctime_r(&st
.st_ctime
, c_time
),
66 st
.st_atime
, ctime_r(&st
.st_atime
, a_time
));