Bug 1885 - smbc_stat returns file times shifted by 2 hours
Summary: smbc_stat returns file times shifted by 2 hours
Status: CLOSED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 3.0.6
Hardware: x86 Linux
: P3 normal
Target Milestone: none
Assignee: Derrell Lipman
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-07 11:03 UTC by Martin Koller
Modified: 2005-08-24 10:16 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Koller 2004-10-07 11:03:52 UTC
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; 
}
Comment 1 Martin Koller 2004-10-08 05:33:27 UTC
When I look at the same file (via my Samba Server) from a Windows XP machine, 
the timestamp looks correct. 
Comment 2 Derrell Lipman 2005-03-29 19:44:08 UTC
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.
Comment 3 Gerald (Jerry) Carter (dead mail address) 2005-08-24 10:16:32 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.