incorrect file times

Snyder, Mark MSnyder at chw.org
Wed Dec 8 20:15:08 GMT 2004


Using code linking to libsmbclient.a to connect to both Win9x and WinNT systems.  I have noticed that the file times on 9x can be interpreted directly using a C function like ctime, however the times that come from NT boxes appears to be a shifted for the time zone, and so I get the wrong time.  I added the following code to libsmbclient.c into smb_stat_ctx and smb_fstat_ctx to compensate when the server is an NT type.  I could compensate in my code rather than modifying libsmbclient.c, however I would need a way to get the time zone and server type, and I cannot see a way to do that outside of libsmbclient.  Any suggestions or is this a reasonable approach?
 
ADDED TO smbc_stat_ctx
smbc_setup_stat(context, st, path, size, mode);
 
/* added to adjust times for NT systems */
if (srv->cli.capabilities & CAP_NT_SMBS) {
 if (c_time > 0) c_time += srv->cli.serverzone;
 if (m_time > 0) m_time += srv->cli.serverzone;
 if (a_time > 0) a_time += srv->cli.serverzone;
}
 
st->st_atime = a_time;
 
ADDED TO smbc_fstat_ctx
smbc_setup_stat(context, st, path, size, mode);
 
/* added to adjust times for NT systems */
if (file->srv->cli.capabilities & CAP_NT_SMBS) {
 if (c_time > 0) c_time += file->srv->cli.serverzone;
 if (m_time > 0) m_time += file->srv->cli.serverzone;
 if (a_time > 0) a_time += file->srv->cli.serverzone;
}
 
st->st_atime = a_time;
 

**************************
Children's Hospital and Health System recognizes that unencrypted e-mail is insecure and does not guarantee confidentiality.  The confidentiality of replies to this message cannot be guaranteed unless the replies are encrypted.
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the smb-clients mailing list