I have one computer on which I have a local file in /tmp/shared. This folder is set up to be a share ("temp") for the local running Samba server. When using smbclient //localhost/temp and doing dir I get test 0 Thu Oct 7 19:54:07 2004 When looking at the file with ls -l I get -rw-r--r-- 1 root root 0 2004-10-07 19:54 /tmp/shared/test up till now this is correct. But when using smbc_stat() on that file, I get a wrong date. The attached test program shows this output: SAMBA ret=0, mtime:Thu Oct 7 21:54:07 2004 ctime:Thu Oct 7 21:54:07 2004 atime:Thu Oct 7 21:54:07 2004 LOCAL ret=0, mtime:Thu Oct 7 19:54:07 2004 ctime:Thu Oct 7 19:54:07 2004 atime:Thu Oct 7 19:54:07 2004 source: #include <stdio.h> #include <string.h> #include <time.h> #include <libsmbclient.h> void auth_smbc_get_data(const char *server,const char *share, char *workgroup, int wgmaxlen, char *username, int unmaxlen, char *password, int pwmaxlen) { strcpy(username, "root"); strcpy(password, ""); } int main() { char buffer[16384]; smbc_init(auth_smbc_get_data, 0); struct stat st; int ret = smbc_stat("smb://localhost/temp/test", &st); printf("SAMBA\nret=%d,\n mtime:%s ctime:%s atime:%s\n", ret, ctime(&st.st_mtime), ctime(&st.st_ctime), ctime(&st.st_atime)); ret = stat("/tmp/shared/test", &st); printf("LOCAL\nret=%d,\n mtime:%s ctime:%s atime:%s\n", ret, ctime(&st.st_mtime), ctime(&st.st_ctime), ctime(&st.st_atime)); return 0; }
When I look at the same file (via my Samba Server) from a Windows XP machine, the timestamp looks correct.
When smbc_stat() was talking with a Win98 server, the times returned were correct. However, when talking with a Win2k or similar protocol server, it would erroneously subtract the timezone offset from the timestamp values.
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.